Skip to content

Commit 633337a

Browse files
ENGCOM-7312: fixed condition when can show password input. Fixed logic for pulling… #27691
2 parents 935d6e1 + 0dc8b99 commit 633337a

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed
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="AssertStorefrontVisiblePasswordFieldForUnregisteredEmailOnCheckoutActionGroup">
12+
<annotations>
13+
<description>Checks if visible password field for unregistered email on checkout page</description>
14+
</annotations>
15+
16+
<waitForPageLoad stepKey="waitForCheckoutPageLoaded"/>
17+
<dontSeeElement selector="{{StorefrontCheckoutCheckoutCustomerLoginSection.password}}" stepKey="checkIfPasswordVisible"/>
18+
</actionGroup>
19+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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="StorefrontVisiblePasswordFieldForUnregisteredEmailOnCheckoutTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<stories value="Visible password field for unregistered e-mail on Checkout"/>
15+
<title value="Visibility password field for unregistered e-mail on Checkout process"/>
16+
<description value="Guest should not be able to see password field if entered unregistered email"/>
17+
<severity value="MINOR"/>
18+
<group value="checkout"/>
19+
</annotations>
20+
<before>
21+
<createData entity="SimpleTwo" stepKey="simpleProduct"/>
22+
</before>
23+
<after>
24+
<deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/>
25+
</after>
26+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductStorefront">
27+
<argument name="productUrl" value="$$simpleProduct.custom_attributes[url_key]$$"/>
28+
</actionGroup>
29+
<actionGroup ref="StorefrontClickAddToCartOnProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"/>
30+
<actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="openCheckoutPage"/>
31+
<actionGroup ref="AssertStorefrontEmailTooltipContentOnCheckoutActionGroup" stepKey="assertEmailTooltipContent"/>
32+
<actionGroup ref="AssertStorefrontEmailNoteMessageOnCheckoutActionGroup" stepKey="assertEmailNoteMessage"/>
33+
<actionGroup ref="StorefrontFillEmailFieldOnCheckoutActionGroup" stepKey="fillUnregisteredEmailFirstAttempt">
34+
<argument name="email" value="unregistered@email.test"/>
35+
</actionGroup>
36+
<actionGroup ref="AssertStorefrontVisiblePasswordFieldForUnregisteredEmailOnCheckoutActionGroup" stepKey="checkIfPasswordVisibleAfterFieldFilling"/>
37+
<actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="reloadCheckoutPage" />
38+
<actionGroup ref="AssertStorefrontVisiblePasswordFieldForUnregisteredEmailOnCheckoutActionGroup"
39+
stepKey="checkIfPasswordVisibleAfterPageReload"/>
40+
</test>
41+
</tests>

app/code/Magento/Checkout/view/frontend/web/js/view/form/element/email.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ define([
113113

114114
$.when(this.isEmailCheckComplete).done(function () {
115115
this.isPasswordVisible(false);
116+
checkoutData.setCheckedEmailValue('');
116117
}.bind(this)).fail(function () {
117118
this.isPasswordVisible(true);
118119
checkoutData.setCheckedEmailValue(this.email());
@@ -192,6 +193,10 @@ define([
192193
* @returns {Boolean} - initial visibility state.
193194
*/
194195
resolveInitialPasswordVisibility: function () {
196+
if (checkoutData.getInputFieldEmailValue() !== '' && checkoutData.getCheckedEmailValue() !== '') {
197+
return true;
198+
}
199+
195200
if (checkoutData.getInputFieldEmailValue() !== '') {
196201
return checkoutData.getInputFieldEmailValue() === checkoutData.getCheckedEmailValue();
197202
}

0 commit comments

Comments
 (0)