-
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 pull request #903 from magento-epam/pr3
[Epam] Extend functional test sprint 3 - MTO-102: [Test] Captcha on register customer - MTO-136: [Test] [Test] Captcha on Contact Us form - MTO-144: [Test] Captcha and lockout for Storefront login page - MTO-121: [Variation] Move Anchored Category with Products (cron is ON, "Update on Save") - MTO-134: [Variation] Add Simple Product with required Custom Options to Cart
- Loading branch information
Showing
43 changed files
with
1,800 additions
and
36 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
dev/tests/functional/tests/app/Magento/Captcha/Test/Block/Form/ContactUs.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,60 @@ | ||
<?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\Contact\Test\Block\Form\ContactUs as ContactForm; | ||
|
||
/** | ||
* Form for "Contact Us" page with captcha. | ||
*/ | ||
class ContactUs extends ContactForm | ||
{ | ||
/** | ||
* 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 captcha reload button element. | ||
* | ||
* @return void | ||
*/ | ||
public function reloadCaptcha() | ||
{ | ||
$this->_rootElement->find($this->captchaReload, Locator::SELECTOR_CSS)->click(); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
dev/tests/functional/tests/app/Magento/Captcha/Test/Block/Form/ContactUs.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,14 @@ | ||
<?xml version="1.0" ?> | ||
<!-- | ||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<mapping strict="0"> | ||
<fields> | ||
<captcha> | ||
<selector>[name='captcha[contact_us]']</selector> | ||
</captcha> | ||
</fields> | ||
</mapping> |
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
60 changes: 60 additions & 0 deletions
60
dev/tests/functional/tests/app/Magento/Captcha/Test/Block/Form/Register.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,60 @@ | ||
<?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\Register as CustomerRegister; | ||
|
||
/** | ||
* Form for storefront register customer with captcha. | ||
*/ | ||
class Register extends CustomerRegister | ||
{ | ||
/** | ||
* 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 captcha reload button. | ||
* | ||
* @return void | ||
*/ | ||
public function reloadCaptcha() | ||
{ | ||
$this->_rootElement->find($this->captchaReload, Locator::SELECTOR_CSS)->click(); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
dev/tests/functional/tests/app/Magento/Captcha/Test/Block/Form/Register.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,14 @@ | ||
<?xml version="1.0" ?> | ||
<!-- | ||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<mapping strict="0"> | ||
<fields> | ||
<captcha> | ||
<selector>[name='captcha[user_create]']</selector> | ||
</captcha> | ||
</fields> | ||
</mapping> |
45 changes: 45 additions & 0 deletions
45
...unctional/tests/app/Magento/Captcha/Test/Constraint/AssertCaptchaFieldOnContactUsForm.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\Contact\Test\Page\ContactIndex; | ||
use Magento\Mtf\Constraint\AbstractConstraint; | ||
|
||
/** | ||
* Assert captcha on the Contact Us page. | ||
*/ | ||
class AssertCaptchaFieldOnContactUsForm extends AbstractConstraint | ||
{ | ||
/** | ||
* Assert captcha on the Contact Us page. | ||
* | ||
* @param ContactIndex $contactIndex | ||
* @return void | ||
*/ | ||
public function processAssertRegisterForm(ContactIndex $contactIndex) | ||
{ | ||
\PHPUnit_Framework_Assert::assertTrue( | ||
$contactIndex->getContactUs()->isVisibleCaptcha(), | ||
'Captcha image is not displayed on the Contact Us page.' | ||
); | ||
|
||
\PHPUnit_Framework_Assert::assertTrue( | ||
$contactIndex->getContactUs()->isVisibleCaptchaReloadButton(), | ||
'Captcha reload button is not displayed on the Contact Us page.' | ||
); | ||
} | ||
|
||
/** | ||
* Returns a string representation of the object. | ||
* | ||
* @return string | ||
*/ | ||
public function toString() | ||
{ | ||
return 'Captcha and reload button are present on the Contact Us page.'; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...functional/tests/app/Magento/Captcha/Test/Constraint/AssertCaptchaFieldOnRegisterForm.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\CustomerAccountCreate; | ||
use Magento\Mtf\Constraint\AbstractConstraint; | ||
|
||
/** | ||
* Assert captcha on storefront account register page. | ||
*/ | ||
class AssertCaptchaFieldOnRegisterForm extends AbstractConstraint | ||
{ | ||
/** | ||
* Assert captcha and reload button are visible on storefront account register page. | ||
* | ||
* @param CustomerAccountCreate $createAccountPage | ||
* @return void | ||
*/ | ||
public function processAssertRegisterForm(CustomerAccountCreate $createAccountPage) | ||
{ | ||
\PHPUnit_Framework_Assert::assertTrue( | ||
$createAccountPage->getRegisterForm()->isVisibleCaptcha(), | ||
'Captcha image is not displayed on the storefront account register page.' | ||
); | ||
|
||
\PHPUnit_Framework_Assert::assertTrue( | ||
$createAccountPage->getRegisterForm()->isVisibleCaptchaReloadButton(), | ||
'Captcha reload button is not displayed on the storefront account register page.' | ||
); | ||
} | ||
|
||
/** | ||
* Returns a string representation of the object. | ||
* | ||
* @return string | ||
*/ | ||
public function toString() | ||
{ | ||
return 'Captcha and reload button are displayed on the storefront account register page.'; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
dev/tests/functional/tests/app/Magento/Captcha/Test/Fixture/Comment.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="comment"> | ||
<field name="captcha" is_required="0" /> | ||
</fixture> | ||
</config> |
12 changes: 12 additions & 0 deletions
12
dev/tests/functional/tests/app/Magento/Captcha/Test/Page/ContactIndex.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="ContactIndex" mca="contact/index/index" module="Magento_Contact"> | ||
<block name="contactUs" class="Magento\Captcha\Test\Block\Form\ContactUs" locator="#contact-form" strategy="css selector" /> | ||
</page> | ||
</config> |
12 changes: 12 additions & 0 deletions
12
dev/tests/functional/tests/app/Magento/Captcha/Test/Page/CustomerAccountCreate.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="CustomerAccountCreate" mca="customer/account/create"> | ||
<block name="registerForm" class="Magento\Captcha\Test\Block\Form\Register" locator="#form-validate[novalidate='novalidate']" strategy="css selector" /> | ||
</page> | ||
</config> |
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
Oops, something went wrong.