-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'mainline/develop' into MAGETWO-64796
- Loading branch information
Showing
41 changed files
with
2,096 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
dev/tests/functional/tests/app/Magento/Captcha/Test/Block/Adminhtml/LoginWithCaptcha.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Captcha\Test\Block\Adminhtml; | ||
|
||
use Magento\Mtf\Client\Locator; | ||
use Magento\Backend\Test\Block\Admin\Login; | ||
|
||
/** | ||
* Login form for backend user. | ||
*/ | ||
class LoginWithCaptcha extends Login | ||
{ | ||
/** | ||
* Captcha image selector. | ||
* | ||
* @var string | ||
*/ | ||
private $captchaImage = '#backend_login'; | ||
|
||
/** | ||
* Captcha reload button selector. | ||
* | ||
* @var string | ||
*/ | ||
private $captchaReload = '#captcha-reload'; | ||
|
||
/** | ||
* Return captcha element visibility. | ||
* | ||
* @return bool | ||
*/ | ||
public function isVisibleCaptcha() | ||
{ | ||
return $this->_rootElement->find($this->captchaImage, Locator::SELECTOR_CSS)->isVisible(); | ||
} | ||
|
||
/** | ||
* Return captcha reload button element visibility. | ||
* | ||
* @return bool | ||
*/ | ||
public function isVisibleCaptchaReloadButton() | ||
{ | ||
return $this->_rootElement->find($this->captchaReload, Locator::SELECTOR_CSS)->isVisible(); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
dev/tests/functional/tests/app/Magento/Captcha/Test/Block/Adminhtml/LoginWithCaptcha.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" ?> | ||
<!-- | ||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<mapping strict="1"> | ||
<wrapper>login</wrapper> | ||
<fields> | ||
<username> | ||
<selector>#username</selector> | ||
</username> | ||
<password> | ||
<selector>#login</selector> | ||
</password> | ||
<captcha> | ||
<selector>#captcha</selector> | ||
</captcha> | ||
</fields> | ||
</mapping> |
61 changes: 61 additions & 0 deletions
61
dev/tests/functional/tests/app/Magento/Captcha/Test/Block/Form/LoginWithCaptcha.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Captcha\Test\Block\Form; | ||
|
||
use Magento\Mtf\Client\Locator; | ||
use Magento\Customer\Test\Block\Form\Login; | ||
use Magento\Mtf\Client\ElementInterface; | ||
|
||
/** | ||
* Form for storefront login with captcha. | ||
*/ | ||
class LoginWithCaptcha extends Login | ||
{ | ||
/** | ||
* Captcha image selector. | ||
* | ||
* @var string | ||
*/ | ||
private $captchaImage = '.captcha-img'; | ||
|
||
/** | ||
* Captcha reload button selector. | ||
* | ||
* @var string | ||
*/ | ||
private $captchaReload = '.captcha-reload'; | ||
|
||
/** | ||
* Get captcha element visibility. | ||
* | ||
* @return bool | ||
*/ | ||
public function isVisibleCaptcha() | ||
{ | ||
return $this->_rootElement->find($this->captchaImage, Locator::SELECTOR_CSS)->isVisible(); | ||
} | ||
|
||
/** | ||
* Get captcha reload button element visibility. | ||
* | ||
* @return bool | ||
*/ | ||
public function isVisibleCaptchaReloadButton() | ||
{ | ||
return $this->_rootElement->find($this->captchaReload, Locator::SELECTOR_CSS)->isVisible(); | ||
} | ||
|
||
/** | ||
* Click on reload captcha button. | ||
* | ||
* @return void | ||
*/ | ||
public function clickReloadCaptchaButton() | ||
{ | ||
$this->_rootElement->find($this->captchaReload, Locator::SELECTOR_CSS)->click(); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
dev/tests/functional/tests/app/Magento/Captcha/Test/Block/Form/LoginWithCaptcha.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" ?> | ||
<!-- | ||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<mapping strict="1"> | ||
<wrapper>login</wrapper> | ||
<fields> | ||
<email> | ||
<selector>[name='login[username]']</selector> | ||
</email> | ||
<password /> | ||
<captcha> | ||
<selector>[name='captcha[user_login]']</selector> | ||
</captcha> | ||
</fields> | ||
</mapping> |
45 changes: 45 additions & 0 deletions
45
...ests/functional/tests/app/Magento/Captcha/Test/Constraint/AssertCaptchaFieldOnBackend.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Captcha\Test\Constraint; | ||
|
||
use Magento\Captcha\Test\Page\Captcha\AdminAuthLoginWithCaptcha; | ||
use Magento\Mtf\Constraint\AbstractConstraint; | ||
|
||
/** | ||
* Assert captcha on backend login page. | ||
*/ | ||
class AssertCaptchaFieldOnBackend extends AbstractConstraint | ||
{ | ||
/** | ||
* Assert captcha and reload button are visible on backend login page. | ||
* | ||
* @param AdminAuthLoginWithCaptcha $adminAuthLogin | ||
* @return void | ||
*/ | ||
public function processAssert(AdminAuthLoginWithCaptcha $adminAuthLogin) | ||
{ | ||
\PHPUnit_Framework_Assert::assertTrue( | ||
$adminAuthLogin->getLoginBlockWithCaptcha()->isVisibleCaptcha(), | ||
'Captcha image is not present on backend login page.' | ||
); | ||
|
||
\PHPUnit_Framework_Assert::assertTrue( | ||
$adminAuthLogin->getLoginBlockWithCaptcha()->isVisibleCaptchaReloadButton(), | ||
'Captcha reload button is not present on backend login page.' | ||
); | ||
} | ||
|
||
/** | ||
* Returns a string representation of the object. | ||
* | ||
* @return string | ||
*/ | ||
public function toString() | ||
{ | ||
return 'Captcha and reload button are presents on backend login page.'; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...s/functional/tests/app/Magento/Captcha/Test/Constraint/AssertCaptchaFieldOnStorefront.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Captcha\Test\Constraint; | ||
|
||
use Magento\Customer\Test\Page\CustomerAccountLogin; | ||
use Magento\Mtf\Constraint\AbstractConstraint; | ||
|
||
/** | ||
* Assert captcha on storefront login page. | ||
*/ | ||
class AssertCaptchaFieldOnStorefront extends AbstractConstraint | ||
{ | ||
/** | ||
* Assert captcha and reload button are visible on storefront login page. | ||
* | ||
* @param CustomerAccountLogin $loginPage | ||
* @return void | ||
*/ | ||
public function processAssert(CustomerAccountLogin $loginPage) | ||
{ | ||
\PHPUnit_Framework_Assert::assertTrue( | ||
$loginPage->getLoginBlockWithCaptcha()->isVisibleCaptcha(), | ||
'Captcha image is not present on storefront login page.' | ||
); | ||
|
||
\PHPUnit_Framework_Assert::assertTrue( | ||
$loginPage->getLoginBlockWithCaptcha()->isVisibleCaptchaReloadButton(), | ||
'Captcha reload button is not present on storefront login page.' | ||
); | ||
} | ||
|
||
/** | ||
* Returns a string representation of the object. | ||
* | ||
* @return string | ||
*/ | ||
public function toString() | ||
{ | ||
return 'Captcha and reload button are presents on storefront login page.'; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
dev/tests/functional/tests/app/Magento/Captcha/Test/Fixture/Customer.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> | ||
<fixture name="customer"> | ||
<field name="captcha" is_required="0" /> | ||
</fixture> | ||
</config> |
12 changes: 12 additions & 0 deletions
12
dev/tests/functional/tests/app/Magento/Captcha/Test/Fixture/User.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> | ||
<fixture name="user"> | ||
<field name="captcha" is_required="0" /> | ||
</fixture> | ||
</config> |
12 changes: 12 additions & 0 deletions
12
...ts/functional/tests/app/Magento/Captcha/Test/Page/Adminhtml/AdminAuthLoginWithCaptcha.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> | ||
<page name="AdminAuthLoginWithCaptcha" area="Captcha" mca="admin/auth/login" module="Magento_Captcha"> | ||
<block name="loginBlockWithCaptcha" class="Magento\Captcha\Test\Block\Adminhtml\LoginWithCaptcha" locator="#login-form" strategy="css selector"/> | ||
</page> | ||
</config> |
12 changes: 12 additions & 0 deletions
12
dev/tests/functional/tests/app/Magento/Captcha/Test/Page/CustomerAccountLogin.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/pages.xsd"> | ||
<page name="CustomerAccountLogin"> | ||
<block name="loginBlockWithCaptcha" class="Magento\Captcha\Test\Block\Form\LoginWithCaptcha" locator="#login-form" strategy="css selector"/> | ||
</page> | ||
</config> |
Oops, something went wrong.