Skip to content

Commit 9820686

Browse files
authored
ENGCOM-9264: MFTF: Login On Checkout With Enabled Captcha #32997
2 parents 5fdf987 + 1d51861 commit 9820686

10 files changed

+219
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertCaptchaVisibleOnSignInModalOnCheckoutActionGroup">
12+
13+
<waitForElementVisible selector="{{StorefrontCheckoutSignInModalSection.captchaField}}" stepKey="waitToSeeCaptchaField"/>
14+
<waitForElementVisible selector="{{StorefrontCheckoutSignInModalSection.captchaImg}}" stepKey="waitToSeeCaptchaImage"/>
15+
<waitForElementVisible selector="{{StorefrontCheckoutSignInModalSection.captchaReload}}" stepKey="waitToSeeCaptchaReloadButton"/>
16+
<reloadPage stepKey="refreshPage"/>
17+
<waitForPageLoad stepKey="waitForPageReloaded"/>
18+
<click selector="{{StorefrontCustomerSignInLinkSection.signInLink}}" stepKey="clickOnSignInLink"/>
19+
<waitForElementVisible selector="{{StorefrontCheckoutSignInModalSection.captchaField}}" stepKey="waitToSeeCaptchaFieldAfterPageReload"/>
20+
<waitForElementVisible selector="{{StorefrontCheckoutSignInModalSection.captchaImg}}" stepKey="waitToSeeCaptchaImageAfterPageReload"/>
21+
<waitForElementVisible selector="{{StorefrontCheckoutSignInModalSection.captchaReload}}" stepKey="waitToSeeCaptchaReloadButtonAfterPageReload"/>
22+
</actionGroup>
23+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontCheckoutFillCaptchaFieldOnSignInPopupActionGroup" extends="StorefrontCheckoutFillCustomerCredentialsOnSignInPopupActionGroup">
12+
<annotations>
13+
<description>EXTENDS: LoginAsCustomerUsingSignInLinkActionGroup. Fills in the Captcha field on the Sign In modal on checkout page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="captcha" type="string"/>
17+
</arguments>
18+
19+
<fillField selector="{{StorefrontCheckoutSignInModalSection.captchaField}}" userInput="{{captcha}}" stepKey="fillCaptchaField" after="fillPassword"/>
20+
</actionGroup>
21+
</actionGroups>

app/code/Magento/Captcha/Test/Mftf/Data/CaptchaConfigData.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@
3333
<data key="label">Contact Us</data>
3434
<data key="value">contact_us</data>
3535
</entity>
36+
<entity name="StorefrontCaptchaOnCheckoutConfigData">
37+
<data key="path">customer/captcha/forms</data>
38+
<data key="scope_id">0</data>
39+
<data key="label">Checkout/Placing Order</data>
40+
<data key="value">payment_processing_request</data>
41+
</entity>
3642
<entity name="StorefrontCaptchaOnCustomerLoginConfigData">
3743
<!-- Magento default value -->
3844
<data key="path">customer/captcha/forms</data>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="StorefrontCheckoutSignInModalSection">
12+
<element name="captchaField" type="input" selector="#captcha_user_login"/>
13+
<element name="captchaImg" type="block" selector=".captcha-img"/>
14+
<element name="captchaReload" type="block" selector=".captcha-reload"/>
15+
</section>
16+
</sections>
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontCaptchaLoginOnCheckoutWithEnabledCaptchaTest">
12+
<annotations>
13+
<features value="Captcha"/>
14+
<stories value="Login on checkout With Enabled Captcha"/>
15+
<title value="Captcha on checkout page"/>
16+
<description value="Customer should be able to login using Sign In link on checkout with enabled captcha"/>
17+
<severity value="MAJOR"/>
18+
<group value="captcha"/>
19+
</annotations>
20+
<before>
21+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
22+
<createData entity="SimpleProduct" stepKey="createProduct">
23+
<requiredEntity createDataKey="createCategory"/>
24+
</createData>
25+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
26+
<magentoCLI command="config:set {{StorefrontCustomerCaptchaLength3ConfigData.path}} {{StorefrontCustomerCaptchaLength3ConfigData.value}}" stepKey="setCaptchaLength"/>
27+
<magentoCLI command="config:set {{StorefrontCustomerCaptchaSymbols1ConfigData.path}} {{StorefrontCustomerCaptchaSymbols1ConfigData.value}}" stepKey="setCaptchaSymbols"/>
28+
<magentoCLI command="config:set {{StorefrontCaptchaOnCustomerLoginConfigData.path}} {{StorefrontCaptchaOnCustomerLoginConfigData.value}}" stepKey="enableCaptchaOnSignIn"/>
29+
<magentoCLI command="config:set {{StorefrontCustomerCaptchaModeAlwaysConfigData.path}} {{StorefrontCustomerCaptchaModeAlwaysConfigData.value}}" stepKey="setCaptchaAlwaysVisible"/>
30+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanInvalidatedCaches">
31+
<argument name="tags" value="config full_page"/>
32+
</actionGroup>
33+
</before>
34+
<after>
35+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
36+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
37+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/>
38+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
39+
<magentoCLI command="config:set {{StorefrontCustomerCaptchaDefaultLengthConfigData.path}} {{StorefrontCustomerCaptchaDefaultLengthConfigData.value}}" stepKey="setDefaultCaptchaLength"/>
40+
<magentoCLI command="config:set {{StorefrontCustomerCaptchaDefaultSymbolsConfigData.path}} {{StorefrontCustomerCaptchaDefaultSymbolsConfigData.value}}" stepKey="setDefaultCaptchaSymbols"/>
41+
<magentoCLI command="config:set {{StorefrontCustomerCaptchaModeAfterFailConfigData.path}} {{StorefrontCustomerCaptchaModeAfterFailConfigData.value}}" stepKey="setCaptchaDefaultVisibility"/>
42+
<magentoCLI command="config:set {{StorefrontCaptchaOnCustomerLoginConfigData.path}} {{StorefrontCaptchaOnCustomerLoginConfigData.value}},{{StorefrontCaptchaOnCustomerForgotPasswordConfigData.value}}" stepKey="enableCaptchaOnDefaultForms"/>
43+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanInvalidatedCaches">
44+
<argument name="tags" value="config full_page"/>
45+
</actionGroup>
46+
</after>
47+
48+
<actionGroup ref="OpenProductFromCategoryPageActionGroup" stepKey="openProductFromCategory">
49+
<argument name="category" value="$createCategory$"/>
50+
<argument name="product" value="$createProduct$"/>
51+
</actionGroup>
52+
<actionGroup ref="StorefrontAddProductToCartWithQtyActionGroup" stepKey="addProductToTheCart">
53+
<argument name="productQty" value="1"/>
54+
</actionGroup>
55+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="navigateToCheckout"/>
56+
<actionGroup ref="StorefrontCheckoutClickSignInLinkActionGroup" stepKey="clickSignInLink"/>
57+
<actionGroup ref="AssertCaptchaVisibleOnSignInModalOnCheckoutActionGroup" stepKey="assertCaptchaVisible"/>
58+
<actionGroup ref="StorefrontCheckoutFillCaptchaFieldOnSignInPopupActionGroup" stepKey="loginWithIncorrectCaptcha">
59+
<argument name="customer" value="$$createCustomer$$"/>
60+
<argument name="captcha" value="{{WrongCaptcha.value}}"/>
61+
</actionGroup>
62+
<actionGroup ref="StorefrontCheckoutClickSignInButtonOnSignInPopupActionGroup" stepKey="clickSignInButton"/>
63+
<actionGroup ref="AssertStorefrontErrorMessageSignInPopupFormActionGroup" stepKey="seeErrorMessage">
64+
<argument name="message" value="Incorrect CAPTCHA"/>
65+
</actionGroup>
66+
<actionGroup ref="StorefrontCheckoutFillCaptchaFieldOnSignInPopupActionGroup" stepKey="loginWithCorrectCaptcha">
67+
<argument name="customer" value="$$createCustomer$$"/>
68+
<argument name="captcha" value="{{PreconfiguredCaptcha.value}}"/>
69+
</actionGroup>
70+
<actionGroup ref="StorefrontCheckoutClickSignInButtonOnSignInPopupActionGroup" stepKey="clickSignInBtn"/>
71+
<actionGroup ref="AssertStorefrontCheckoutCustomerLoggedInActionGroup" stepKey="assertCustomerLoggedIn"/>
72+
</test>
73+
</tests>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertStorefrontCheckoutCustomerLoggedInActionGroup">
12+
<dontSeeElement selector="{{StorefrontCustomerSignInLinkSection.signInLink}}" stepKey="dontSeeSignInLink"/>
13+
</actionGroup>
14+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertStorefrontErrorMessageSignInPopupFormActionGroup">
12+
<arguments>
13+
<argument name="message" type="string"/>
14+
</arguments>
15+
<waitForPageLoad time="30" stepKey="waitForPageLoaded"/>
16+
<waitForElementVisible selector="{{StorefrontCustomerSignInPopupFormSection.errorMessage}}" time="30" stepKey="waitForErrorMessage"/>
17+
<see selector="{{StorefrontCustomerSignInPopupFormSection.errorMessage}}" userInput="{{message}}" stepKey="seeErrorMessage"/>
18+
</actionGroup>
19+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontCheckoutClickSignInButtonOnSignInPopupActionGroup">
12+
<click selector="{{StorefrontCustomerSignInLinkSection.signInBtn}}" stepKey="clickSignInBtn"/>
13+
</actionGroup>
14+
</actionGroups>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontCheckoutClickSignInLinkActionGroup">
12+
<click selector="{{StorefrontCustomerSignInLinkSection.signInLink}}" stepKey="clickOnSignInLink"/>
13+
</actionGroup>
14+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontCheckoutFillCustomerCredentialsOnSignInPopupActionGroup">
12+
<arguments>
13+
<argument name="customer" type="entity"/>
14+
</arguments>
15+
16+
<fillField selector="{{StorefrontCustomerSignInLinkSection.email}}" userInput="{{customer.email}}" stepKey="fillEmail"/>
17+
<fillField selector="{{StorefrontCustomerSignInLinkSection.password}}" userInput="{{customer.password}}" stepKey="fillPassword"/>
18+
</actionGroup>
19+
</actionGroups>

0 commit comments

Comments
 (0)