Skip to content

MFTF: Reset Customer Password With Enabled Captcha #32876

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: 2.4-develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AssertStorefrontCaptchaVisibleOnCustomerResetPasswordPageActionGroup">
<waitForElementVisible selector="{{StorefrontResetCustomerPasswordFormSection.captchaField}}" stepKey="waitToSeeCaptchaField"/>
<waitForElementVisible selector="{{StorefrontResetCustomerPasswordFormSection.captchaImg}}" stepKey="waitToSeeCaptchaImage"/>
<waitForElementVisible selector="{{StorefrontResetCustomerPasswordFormSection.captchaReload}}" stepKey="waitToSeeCaptchaReloadButton"/>
<reloadPage stepKey="refreshPage"/>
<waitForPageLoad stepKey="waitForPageReloaded"/>
<waitForElementVisible selector="{{StorefrontResetCustomerPasswordFormSection.captchaField}}" stepKey="waitToSeeCaptchaFieldAfterPageReload"/>
<waitForElementVisible selector="{{StorefrontResetCustomerPasswordFormSection.captchaImg}}" stepKey="waitToSeeCaptchaImageAfterPageReload"/>
<waitForElementVisible selector="{{StorefrontResetCustomerPasswordFormSection.captchaReload}}" stepKey="waitToSeeCaptchaReloadButtonAfterPageReload"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="StorefrontFillCaptchaFieldOnResetCustomerPasswordFormActionGroup">
<arguments>
<argument name="captcha" type="string"/>
</arguments>
<fillField userInput="{{captcha}}" selector="{{StorefrontResetCustomerPasswordFormSection.captchaField}}" stepKey="fillCaptchaField"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="StorefrontResetCustomerPasswordFormSection">
<element name="captchaField" type="input" selector="#form-validate input[name='captcha[user_forgotpassword]']" />
<element name="captchaImg" type="block" selector="#form-validate img.captcha-img"/>
<element name="captchaReload" type="block" selector="#form-validate button.captcha-reload"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="StorefrontResetCustomerPasswordWithEnabledCaptchaTest">
<annotations>
<features value="Customer"/>
<stories value="Customer Login"/>
<title value="Forgot Password on Storefront with enabled captcha"/>
<description value="Submitting Forgot Password Form on Storefront with enabled captcha"/>
<severity value="MAJOR"/>
<group value="Customer"/>
</annotations>
<before>
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
<magentoCLI command="config:set {{StorefrontCustomerCaptchaLength3ConfigData.path}} {{StorefrontCustomerCaptchaLength3ConfigData.value}}" stepKey="setCaptchaLength"/>
<magentoCLI command="config:set {{StorefrontCustomerCaptchaSymbols1ConfigData.path}} {{StorefrontCustomerCaptchaSymbols1ConfigData.value}}" stepKey="setCaptchaSymbols"/>
<magentoCLI command="config:set {{StorefrontCaptchaOnCustomerForgotPasswordConfigData.path}} {{StorefrontCaptchaOnCustomerForgotPasswordConfigData.value}}" stepKey="enableResetPasswordCaptcha"/>
<magentoCLI command="config:set {{StorefrontCustomerCaptchaModeAlwaysConfigData.path}} {{StorefrontCustomerCaptchaModeAlwaysConfigData.value}}" stepKey="setCaptchaAlwaysVisible"/>
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanInvalidatedCaches">
<argument name="tags" value="config full_page"/>
</actionGroup>
</before>
<after>
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/>
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
<magentoCLI command="config:set {{StorefrontCustomerCaptchaDefaultLengthConfigData.path}} {{StorefrontCustomerCaptchaDefaultLengthConfigData.value}}" stepKey="setDefaultCaptchaLength"/>
<magentoCLI command="config:set {{StorefrontCustomerCaptchaDefaultSymbolsConfigData.path}} {{StorefrontCustomerCaptchaDefaultSymbolsConfigData.value}}" stepKey="setDefaultCaptchaSymbols"/>
<magentoCLI command="config:set {{StorefrontCustomerCaptchaModeAfterFailConfigData.path}} {{StorefrontCustomerCaptchaModeAfterFailConfigData.value}}" stepKey="setCaptchaDefaultVisibility"/>
<magentoCLI command="config:set {{StorefrontCaptchaOnCustomerLoginConfigData.path}} {{StorefrontCaptchaOnCustomerLoginConfigData.value}},{{StorefrontCaptchaOnCustomerForgotPasswordConfigData.value}}" stepKey="enableCaptchaOnDefaultForms"/>
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanInvalidatedCaches">
<argument name="tags" value="config full_page"/>
</actionGroup>
</after>

<actionGroup ref="StorefrontNavigateToResetCustomerPasswordPageActionGroup" stepKey="navigateToResetPasswordPage"/>
<actionGroup ref="AssertStorefrontCaptchaVisibleOnCustomerResetPasswordPageActionGroup" stepKey="assertCaptchaIsVisible"/>
<actionGroup ref="StorefrontFillCustomerResetPasswordFormActionGroup" stepKey="fillResetPasswordForm">
<argument name="email" value="$$createCustomer.email$$"/>
</actionGroup>
<actionGroup ref="StorefrontFillCaptchaFieldOnResetCustomerPasswordFormActionGroup" stepKey="fillCaptchaFieldWithIncorrectValues">
<argument name="captcha" value="{{WrongCaptcha.value}}"/>
</actionGroup>
<actionGroup ref="StorefrontClickResetMyPasswordButtonActionGroup" stepKey="clickResetPasswordButton"/>
<actionGroup ref="AssertMessageCustomerChangeAccountInfoActionGroup" stepKey="assertErrorMessage">
<argument name="message" value="Incorrect CAPTCHA"/>
<argument name="messageType" value="error"/>
</actionGroup>
<actionGroup ref="StorefrontFillCustomerResetPasswordFormActionGroup" stepKey="fillEmailFieldOnResetPasswordForm">
<argument name="email" value="$$createCustomer.email$$"/>
</actionGroup>
<actionGroup ref="StorefrontFillCaptchaFieldOnResetCustomerPasswordFormActionGroup" stepKey="fillCaptchaFieldWithCorrectValues">
<argument name="captcha" value="{{PreconfiguredCaptcha.value}}"/>
</actionGroup>
<actionGroup ref="StorefrontClickResetMyPasswordButtonActionGroup" stepKey="clickResetPasswordButtonOnForm"/>
<actionGroup ref="AssertCustomerResetPasswordActionGroup" stepKey="seePageWithSuccessMessage">
<argument name="url" value="{{StorefrontCustomerSignInPage.url}}"/>
<argument name="message" value="If there is an account associated with $$createCustomer.email$$ you will receive an email with a link to reset your password."/>
</actionGroup>
</test>
</tests>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="StorefrontClickResetMyPasswordButtonActionGroup">
<click stepKey="clickResetPassword" selector="{{StorefrontForgotPasswordSection.resetMyPasswordButton}}"/>
<waitForPageLoad stepKey="waitForPageLoaded"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="StorefrontFillCustomerResetPasswordFormActionGroup">
<arguments>
<argument name="email" type="string"/>
</arguments>
<fillField stepKey="fillEmailField" userInput="{{email}}" selector="{{StorefrontForgotPasswordSection.email}}"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="StorefrontNavigateToResetCustomerPasswordPageActionGroup">

<amOnPage stepKey="amOnSignInPage" url="{{StorefrontCustomerSignInPage.url}}"/>
<click stepKey="clickForgotPasswordLink" selector="{{StorefrontCustomerSignInFormSection.forgotPasswordLink}}"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
<see stepKey="seePageTitle" userInput="Forgot Your Password" selector="{{StorefrontForgotPasswordSection.pageTitle}}"/>
</actionGroup>
</actionGroups>