Skip to content

Commit c4bbe24

Browse files
authored
Merge pull request #6296 from magento-tsg/MC-38680
[Arrows] MC-38680: [2.3] Submitting invalid create account form leaves the submit button disabled
2 parents b3db8b2 + b2e5f2f commit c4bbe24

File tree

5 files changed

+76
-0
lines changed

5 files changed

+76
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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="AssertMessageCustomerCreateAccountPasswordComplexityActionGroup">
12+
<annotations>
13+
<description>Assert is shown an error about their password during new user form filling.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="message" type="string"/>
17+
</arguments>
18+
<see userInput="{{message}}" selector="{{StorefrontCustomerCreateFormSection.passwordErrorMessages}}" stepKey="verifyMessage"/>
19+
</actionGroup>
20+
</actionGroups>

app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@
4747
<data key="group">General</data>
4848
<requiredEntity type="address">US_Address_TX</requiredEntity>
4949
</entity>
50+
<entity name="Simple_Customer_With_Password_Length_Is_Below_Eight_Characters" type="customer">
51+
<data key="group_id">1</data>
52+
<data key="email" unique="prefix">John.Doe@example.com</data>
53+
<data key="firstname">John</data>
54+
<data key="lastname">Doe</data>
55+
<data key="fullname">John Doe</data>
56+
<data key="password">123123</data>
57+
<data key="store_id">0</data>
58+
<data key="website_id">0</data>
59+
</entity>
5060
<entity name="Simple_US_Customer_Without_Default_Address" type="customer">
5161
<data key="group_id">1</data>
5262
<data key="default_billing">true</data>

app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerCreateFormSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<element name="passwordField" type="input" selector="#password"/>
1919
<element name="confirmPasswordField" type="input" selector="#password-confirmation"/>
2020
<element name="createAccountButton" type="button" selector="button.action.submit.primary" timeout="30"/>
21+
<element name="passwordErrorMessages" type="text" selector="#password-error"/>
2122
</section>
2223
<section name="StoreFrontCustomerAdvancedAttributesSection">
2324
<element name="textFieldAttribute" type="input" selector="//input[@id='{{var}}']" parameterized="true" />
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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="StorefrontCreateCustomerWithInvalidDataTest">
12+
<annotations>
13+
<stories value="Create a Customer via the Storefront"/>
14+
<features value="Customer"/>
15+
<title value="Register customer on storefront after customer form validation failed."/>
16+
<description value="Customer should be able to re-submit register form after correcting invalid form data on storefront."/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-38681"/>
19+
<useCaseId value="MC-38680"/>
20+
<group value="customer"/>
21+
</annotations>
22+
23+
<actionGroup ref="StorefrontOpenCustomerAccountCreatePageActionGroup" stepKey="openCreateAccountPage"/>
24+
<!--Try to submit register form with wrong password.-->
25+
<actionGroup ref="StorefrontFillCustomerAccountCreationFormActionGroup" stepKey="fillCreateAccountFormWithWrongData">
26+
<argument name="customer" value="Simple_Customer_With_Password_Length_Is_Below_Eight_Characters"/>
27+
</actionGroup>
28+
<actionGroup ref="StorefrontClickCreateAnAccountCustomerAccountCreationFormActionGroup" stepKey="tryToSubmitFormWithWrongPassword"/>
29+
<actionGroup ref="AssertMessageCustomerCreateAccountPasswordComplexityActionGroup" stepKey="seeTheErrorPasswordLength">
30+
<argument name="message" value="Minimum length of this field must be equal or greater than 8 symbols. Leading and trailing spaces will be ignored."/>
31+
</actionGroup>
32+
<!--Re-submit customer register form with correct data.-->
33+
<actionGroup ref="StorefrontFillCustomerAccountCreationFormActionGroup" stepKey="fillCreateAccountFormWithCorrectData">
34+
<argument name="customer" value="Simple_US_Customer"/>
35+
</actionGroup>
36+
<actionGroup ref="StorefrontClickCreateAnAccountCustomerAccountCreationFormActionGroup" stepKey="submitCreateAccountForm"/>
37+
<actionGroup ref="AssertMessageCustomerCreateAccountActionGroup" stepKey="seeSuccessMessage"/>
38+
</test>
39+
</tests>

app/code/Magento/Customer/view/frontend/web/js/block-submit-on-send.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,15 @@ define([
1414

1515
dataForm.submit(function () {
1616
$(this).find(':submit').attr('disabled', 'disabled');
17+
18+
if (this.isValid === false) {
19+
$(this).find(':submit').prop('disabled', false);
20+
}
21+
this.isValid = true;
1722
});
1823
dataForm.bind('invalid-form.validate', function () {
1924
$(this).find(':submit').prop('disabled', false);
25+
this.isValid = false;
2026
});
2127
};
2228
});

0 commit comments

Comments
 (0)