Skip to content

Commit b35e1d8

Browse files
MTO-102: [Test] Captcha on register customer
- Defects fixed
1 parent 92a2456 commit b35e1d8

File tree

3 files changed

+10
-22
lines changed

3 files changed

+10
-22
lines changed

dev/tests/functional/tests/app/Magento/Captcha/Test/Block/Form/RegisterFormWithCaptcha.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
use Magento\Mtf\Client\Locator;
1010
use Magento\Customer\Test\Block\Form\Register;
11-
use Magento\Mtf\Client\ElementInterface;
1211

1312
/**
1413
* Form for storefront register customer with captcha.
@@ -50,12 +49,12 @@ public function isVisibleCaptchaReloadButton()
5049
}
5150

5251
/**
53-
* Get captcha reload button element.
52+
* Click on captcha reload button.
5453
*
55-
* @return ElementInterface
54+
* @return void
5655
*/
57-
public function getCaptchaReloadButton()
56+
public function reloadCaptcha()
5857
{
59-
return $this->_rootElement->find($this->captchaReload, Locator::SELECTOR_CSS);
58+
$this->_rootElement->find($this->captchaReload, Locator::SELECTOR_CSS)->click();
6059
}
6160
}

dev/tests/functional/tests/app/Magento/Captcha/Test/Page/CustomerAccountCreate.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/pages.xsd">
9-
<page name="CustomerAccountCreate">
9+
<page name="CustomerAccountCreate" mca="customer/account/create">
1010
<block name="registerFormWithCaptcha" class="Magento\Captcha\Test\Block\Form\RegisterFormWithCaptcha" locator="#form-validate[novalidate='novalidate']" strategy="css selector"/>
1111
</page>
1212
</config>

dev/tests/functional/tests/app/Magento/Captcha/Test/TestCase/CaptchaOnStoreFrontRegisterTest.php

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@
1111
use Magento\Captcha\Test\Constraint\AssertCaptchaFieldOnRegisterForm;
1212
use Magento\Customer\Test\Fixture\Customer;
1313
use Magento\Customer\Test\Page\CustomerAccountCreate;
14-
use Magento\Mtf\Fixture\FixtureFactory;
1514

1615
/**
1716
* Preconditions:
18-
* 1. Enable CAPTCHA for customer.
17+
* 1. Enable captcha for customer.
1918
*
2019
* Test Flow:
2120
* 1. Open storefront account register form.
@@ -34,7 +33,7 @@ class CaptchaOnStoreFrontRegisterTest extends Injectable
3433
private $stepFactory;
3534

3635
/**
37-
* Assert Captcha.
36+
* Assert captcha on storefront account register page.
3837
*
3938
* @var AssertCaptchaFieldOnRegisterForm
4039
*/
@@ -47,13 +46,6 @@ class CaptchaOnStoreFrontRegisterTest extends Injectable
4746
*/
4847
private $customerAccountCreate;
4948

50-
/**
51-
* Fixture factory.
52-
*
53-
* @var FixtureFactory
54-
*/
55-
private $fixtureFactory;
56-
5749
/**
5850
* Configuration setting.
5951
*
@@ -67,26 +59,23 @@ class CaptchaOnStoreFrontRegisterTest extends Injectable
6759
* @param TestStepFactory $stepFactory
6860
* @param AssertCaptchaFieldOnRegisterForm $assertCaptcha
6961
* @param CustomerAccountCreate $customerAccount
70-
* @param FixtureFactory $fixtureFactory
7162
* @return void
7263
*/
7364
public function __inject(
7465
TestStepFactory $stepFactory,
7566
AssertCaptchaFieldOnRegisterForm $assertCaptcha,
76-
CustomerAccountCreate $customerAccount,
77-
FixtureFactory $fixtureFactory
67+
CustomerAccountCreate $customerAccount
7868
) {
7969
$this->stepFactory = $stepFactory;
8070
$this->assertCaptcha = $assertCaptcha;
8171
$this->customerAccountCreate = $customerAccount;
82-
$this->fixtureFactory = $fixtureFactory;
8372
}
8473

8574
/**
8675
* Test creation for customer register with captcha on storefront.
8776
*
8877
* @param Customer $customer
89-
* @param null|string $configData
78+
* @param string $configData
9079
* @return void
9180
*/
9281
public function test(
@@ -103,7 +92,7 @@ public function test(
10392

10493
$this->customerAccountCreate->open();
10594
$this->assertCaptcha->processAssertRegisterForm($this->customerAccountCreate);
106-
$this->customerAccountCreate->getRegisterFormWithCaptcha()->getCaptchaReloadButton()->click();
95+
$this->customerAccountCreate->getRegisterFormWithCaptcha()->reloadCaptcha();
10796
$this->customerAccountCreate->getRegisterFormWithCaptcha()->registerCustomer($customer);
10897
}
10998

0 commit comments

Comments
 (0)