Skip to content

Initialize authentication popup modal only when needed #30647

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a5a9c4c
Initialize authentication popup modal only when needed
Oct 25, 2020
cad2c25
Fix static and functional tests
Oct 28, 2020
6378178
Merge branch '2.4-develop' into optimize-authentication-popup
engcom-Charlie Nov 20, 2020
9901e85
fix all selectors
engcom-Charlie Nov 24, 2020
0b92d6d
Merge branch '2.4-develop' into optimize-authentication-popup
engcom-Charlie Nov 24, 2020
bd78d3c
fix selector
engcom-Charlie Nov 25, 2020
fbeac2b
Merge branch '2.4-develop' into optimize-authentication-popup
engcom-Charlie Nov 27, 2020
ec01b95
Merge branch '2.4-develop' into optimize-authentication-popup
Dec 21, 2020
0e97ea3
Merge branch '2.4-develop' into optimize-authentication-popup
Jan 8, 2021
c559a2e
fixed a bunch of selectors
engcom-Charlie Jan 8, 2021
3ef8b09
fix email selector
engcom-Charlie Jan 8, 2021
20d7b75
fix email selector
engcom-Charlie Jan 11, 2021
c3f47b3
fixed email selector for test
engcom-Charlie Jan 11, 2021
1620e73
Merge branch '2.4-develop' into optimize-authentication-popup
engcom-Charlie Jan 11, 2021
c005370
Merge branch '2.4-develop' into optimize-authentication-popup
Feb 22, 2021
eb6e88c
Merge branch '2.4-develop' into optimize-authentication-popup
Mar 2, 2021
62642a6
Merge branch '2.4-develop-mainline' into optimize-authentication-popup
engcom-Foxtrot Apr 21, 2021
934cd11
magento/magento2#30672: Initialize authentication popup modal only wh…
engcom-Foxtrot Apr 23, 2021
febfe67
Merge branch '2.4-develop' into optimize-authentication-popup
engcom-Foxtrot Apr 23, 2021
bfc6e76
Merge branch '2.4-develop' into optimize-authentication-popup
engcom-Foxtrot Apr 26, 2021
78f4694
magento#30672: Initialize authentication popup modal only when neede…
engcom-Foxtrot May 13, 2021
d5a5254
magento#30672: Initialize authentication popup modal only when neede…
engcom-Foxtrot May 14, 2021
d936055
Merge remote-tracking branch 'magento2/2.4-develop' into optimize-aut…
Sep 2, 2021
711560d
Merge branch '2.4-develop' into optimize-authentication-popup
Den4ik Sep 7, 2021
a805618
Merge branch '2.4-develop' into optimize-authentication-popup
engcom-Alfa Sep 14, 2021
8d8f1af
merge with 2.4-develop and Fixed conflicts
engcom-Echo Oct 31, 2022
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
Expand Up @@ -9,8 +9,8 @@
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="StorefrontCustomerSignInFormSection">
<element name="captchaField" type="input" selector="#captcha_user_login"/>
<element name="captchaImg" type="block" selector=".captcha-img"/>
<element name="captchaReload" type="block" selector=".captcha-reload"/>
<element name="captchaField" type="input" selector="fieldset #captcha_user_login"/>
<element name="captchaImg" type="block" selector="fieldset .captcha-img"/>
<element name="captchaReload" type="block" selector="fieldset .captcha-reload"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<argument name="address" defaultValue="US_Address_TX" type="entity"/>
</arguments>

<grabValueFrom selector="{{CheckoutShippingSection.email}}" stepKey="email"/>
<grabValueFrom selector="{{CheckoutShippingSection.emailAddress}}" stepKey="email"/>
<grabValueFrom selector="{{CheckoutShippingSection.firstName}}" stepKey="firstname"/>
<grabValueFrom selector="{{CheckoutShippingSection.lastName}}" stepKey="lastname"/>
<grabValueFrom selector="{{CheckoutShippingSection.street}}" stepKey="street"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<argument name="customerAddressVar"/>
</arguments>

<fillField selector="{{CheckoutShippingSection.email}}" userInput="{{customerVar.email}}" stepKey="enterEmail"/>
<fillField selector="{{CheckoutShippingSection.emailAddress}}" userInput="{{customerVar.email}}" stepKey="enterEmail"/>
<waitForPageLoad stepKey="waitForLoading3"/>
<fillField selector="{{CheckoutPaymentSection.guestFirstName}}" userInput="{{customerVar.firstname}}" stepKey="enterFirstName"/>
<fillField selector="{{CheckoutPaymentSection.guestLastName}}" userInput="{{customerVar.lastname}}" stepKey="enterLastName"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<argument name="address" type="entity"/>
</arguments>

<fillField selector="{{CheckoutShippingSection.email}}" userInput="{{customer.email}}" stepKey="fillEmailField"/>
<fillField selector="{{CheckoutShippingSection.emailAddress}}" userInput="{{customer.email}}" stepKey="fillEmailField"/>
<fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{customer.firstName}}" stepKey="fillFirstName"/>
<fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{customer.lastName}}" stepKey="fillLastName"/>
<fillField selector="{{CheckoutShippingSection.street}}" userInput="{{address.street}}" stepKey="fillStreet"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<argument name="shippingMethod" defaultValue="" type="string"/>
</arguments>

<waitForElementVisible selector="{{CheckoutShippingSection.email}}" stepKey="waitForEmailField"/>
<fillField selector="{{CheckoutShippingSection.email}}" userInput="{{customerVar.email}}" stepKey="enterEmail"/>
<waitForElementVisible selector="{{CheckoutShippingSection.emailAddress}}" stepKey="waitForEmailField"/>
<fillField selector="{{CheckoutShippingSection.emailAddress}}" userInput="{{customerVar.email}}" stepKey="enterEmail"/>
<fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{customerVar.firstname}}" stepKey="enterFirstName"/>
<fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{customerVar.lastname}}" stepKey="enterLastName"/>
<fillField selector="{{CheckoutShippingSection.street}}" userInput="{{customerAddressVar.street[0]}}" stepKey="enterStreet"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<argument name="customerAddressVar"/>
</arguments>

<fillField selector="{{CheckoutShippingSection.email}}" userInput="{{customerVar.email}}" stepKey="enterEmail"/>
<fillField selector="{{CheckoutShippingSection.emailAddress}}" userInput="{{customerVar.email}}" stepKey="enterEmail"/>
<fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{customerVar.firstname}}" stepKey="enterFirstName"/>
<fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{customerVar.lastname}}" stepKey="enterLastName"/>
<fillField selector="{{CheckoutShippingSection.street}}" userInput="{{customerAddressVar.street[0]}}" stepKey="enterStreet"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<argument name="customerAddressVar"/>
</arguments>

<fillField selector="{{CheckoutShippingSection.email}}" userInput="{{customerVar.email}}" stepKey="enterEmail"/>
<fillField selector="{{CheckoutShippingSection.emailAddress}}" userInput="{{customerVar.email}}" stepKey="enterEmail"/>
<fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{customerVar.firstname}}" stepKey="enterFirstName"/>
<fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{customerVar.lastname}}" stepKey="enterLastName"/>
<fillField selector="{{CheckoutShippingSection.street}}" userInput="{{customerAddressVar.street[0]}}" stepKey="enterStreet"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</arguments>

<waitForPageLoad stepKey="waitForCheckoutShippingSectionToLoad"/>
<fillField selector="{{CheckoutShippingSection.email}}" userInput="{{customer.email}}" stepKey="fillEmailField"/>
<fillField selector="{{CheckoutShippingSection.emailAddress}}" userInput="{{customer.email}}" stepKey="fillEmailField"/>
<waitForPageLoad stepKey="waitForLoadingMaskToDisappear"/>
<waitForElementVisible selector="{{CheckoutShippingSection.password}}" stepKey="waitForElementVisible"/>
<fillField selector="{{CheckoutShippingSection.password}}" userInput="{{customer.password}}" stepKey="fillPasswordField"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<description>Fills in the Customer details for the 'Shipping Address' section of the Storefront Checkout page. Selects 'Free Shipping'. Clicks on Next. Validates that the URL is present and correct.</description>
</annotations>

<fillField selector="{{CheckoutShippingSection.email}}" userInput="{{CustomerEntityOne.email}}" stepKey="setCustomerEmail"/>
<fillField selector="{{CheckoutShippingSection.emailAddress}}" userInput="{{CustomerEntityOne.email}}" stepKey="setCustomerEmail"/>
<fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="SetCustomerFirstName"/>
<fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{CustomerEntityOne.lastname}}" stepKey="SetCustomerLastName"/>
<fillField selector="{{CheckoutShippingSection.street}}" userInput="{{CustomerAddressSimple.street}}" stepKey="SetCustomerStreetAddress"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="CheckoutShippingGuestInfoSection">
<element name="email" type="input" selector="#customer-email"/>
<element name="email" type="input" selector="fieldset input[type='email']"/>
<element name="firstName" type="input" selector="input[name=firstname]"/>
<element name="lastName" type="input" selector="input[name=lastname]"/>
<element name="company" type="input" selector="input[name=company]"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<element name="editActiveAddress" type="button" selector="//div[@class='shipping-address-item selected-item']//span[text()='Edit']" timeout="30"/>
<element name="loginButton" type="button" selector="//button[@data-action='checkout-method-login']" timeout="30"/>
<element name="editActiveAddressButton" type="button" selector="//div[contains(@class,'payment-method _active')]//button[contains(@class,'action action-edit-address')]" timeout="30"/>
<element name="emailAddress" type="input" selector="#customer-email"/>
<element name="emailAddress" type="input" selector="fieldset input[type='email']"/>
<element name="shipHereButton" type="button" selector="//div[text()='{{street}}']/button[@class='action action-select-shipping-item']" parameterized="true" timeout="30"/>
<element name="addressFieldValidationError" type="text" selector="div.address div.field .field-error"/>
<element name="textFieldAttrRequireMessage" type="text" selector="//input[@name='custom_attributes[{{attribute}}]']/ancestor::div[contains(@class, 'control')]/div/span" parameterized="true" timeout="30"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<element name="orderLinks" type="text" selector="a[href*=order_id]" timeout="30"/>
<element name="orderNumberText" type="text" selector=".checkout-success > p:nth-child(1)"/>
<element name="continueShoppingButton" type="button" selector=".action.primary.continue" timeout="30"/>
<element name="createAnAccount" type="button" selector="[data-bind*=&quot;i18n: 'Create an Account'&quot;]" timeout="30"/>
<element name="createAnAccount" type="button" selector="a[class='action primary'] [data-bind*=&quot;i18n: 'Create an Account'&quot;]" timeout="30"/>
<element name="printLink" type="button" selector=".print" timeout="30"/>
<element name="orderNumberWithoutLink" type="text" selector="//div[contains(@class, 'checkout-success')]//p/span"/>
<element name="orderLinkByOrderNumber" type="text" selector="//div[contains(@class,'success')]//a[contains(.,'{{orderNumber}}')]" parameterized="true" timeout="30"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<section name="CheckoutSuccessRegisterSection">
<element name="registerMessage" type="text" selector="#registration p:nth-child(1)"/>
<element name="customerEmail" type="text" selector="#registration p:nth-child(2)"/>
<element name="createAccountButton" type="button" selector="[data-bind*=&quot;i18n: 'Create an Account'&quot;]" timeout="30"/>
<element name="createAccountButton" type="button" selector="a[class='action primary'] [data-bind*=&quot;i18n: 'Create an Account'&quot;]" timeout="30"/>
<element name="orderNumber" type="text" selector="//p[text()='Your order # is: ']//span"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<argument name="productName" value="$createProduct.name$$"/>
</actionGroup>
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
<fillField selector="{{CheckoutShippingSection.email}}" userInput="{{CustomerEntityOne.email}}" stepKey="enterEmail"/>
<fillField selector="{{CheckoutShippingSection.emailAddress}}" userInput="{{CustomerEntityOne.email}}" stepKey="enterEmail"/>
<fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="enterFirstName"/>
<fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{CustomerEntityOne.lastname}}" stepKey="enterLastName"/>
<fillField selector="{{CheckoutShippingSection.street}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="enterStreet"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@

<!--Proceed to checkout and check product name in Order Summary area-->
<actionGroup ref="StorefrontClickProceedToCheckoutActionGroup" stepKey="proceedToCheckout"/>
<waitForElementVisible selector="{{CheckoutShippingSection.email}}" stepKey="waitForShippingPageLoad"/>
<waitForElementVisible selector="{{CheckoutShippingSection.emailAddress}}" stepKey="waitForShippingPageLoad"/>
<conditionalClick selector="{{CheckoutShippingGuestInfoSection.itemInCart}}" dependentSelector="{{CheckoutShippingGuestInfoSection.itemInCartActive}}" visible="false" stepKey="clickItemInCart"/>
<grabTextFrom selector="{{CheckoutShippingGuestInfoSection.productName}}" stepKey="grabProductNameShipping"/>
<assertStringContainsString stepKey="assertProductNameShipping">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/>

<!--Process steps-->
<fillField selector="{{CheckoutShippingSection.email}}" userInput="{{CustomerEntityOne.email}}" stepKey="enterEmail"/>
<fillField selector="{{CheckoutShippingSection.emailAddress}}" userInput="{{CustomerEntityOne.email}}" stepKey="enterEmail"/>
<fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="enterFirstName"/>
<fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{CustomerEntityOne.lastname}}" stepKey="enterLastName"/>
<fillField selector="{{CheckoutShippingSection.street}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="enterStreet"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
<page name="StorefrontCustomerSignInPage" url="/customer/account/login/" area="storefront" module="Magento_Customer">
<section name="StorefrontCustomerSignInFormSection" />
<section name="StorefrontCustomerLoginMessagesSection"/>
<section name="StorefrontCustomerLoginSignUpSection"/>
</page>
</pages>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?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="AdminCreateUserSection">
<element name="createAnAccountButton" type="button" selector="//div[contains(@class, 'block-new-customer')]//a/span[contains(.,'Create an Account')]"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="StorefrontCustomerSignInFormSection">
<element name="emailField" type="input" selector="#email"/>
<element name="passwordField" type="input" selector="#pass"/>
<element name="emailField" type="input" selector="input[name='login[username]']"/>
<element name="passwordField" type="input" selector="input[name='login[password]']"/>
<element name="showPasswordCheckbox" type="input" selector="#show-password"/>
<element name="signInAccountButton" type="button" selector="#send2" timeout="30"/>
<element name="signInAccountButton" type="button" selector="fieldset.login #send2" timeout="30"/>
<element name="forgotPasswordLink" type="button" selector=".action.remind" timeout="10"/>
<element name="customerLoginBlock" type="text" selector=".login-container .block.block-customer-login"/>
<element name="signInAccountLink" type="button" selector="//header[@class='page-header']//li/a[contains(.,'Sign In')]"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
<argument name="customer" value="$$customer$$"/>
</actionGroup>
<actionGroup ref="StorefrontLoginFormClickShowPasswordActionGroup" stepKey="clickShowPasswordCheckbox"/>
<actionGroup ref="AssertLoginFormPasswordFieldActionGroup" stepKey="AssertPasswordField"/>
<actionGroup ref="AssertLoginFormPasswordFieldActionGroup" stepKey="AssertPasswordField">
<argument name="passwordFieldType" value="password"/>
</actionGroup>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,27 @@ define([
});
},

/** Init popup login window */
/**
* Sets modal on given HTML element with on demand initialization.
*/
setModalElement: function (element) {
var cart = customerData.get('cart');

if (cart().isGuestCheckoutAllowed === false) {
this.createPopup(element);
} else {
cart.subscribe(function (cartData) {
if (cartData.isGuestCheckoutAllowed === false) {
this.createPopup(element);
}
}, this);
}
},

/**
* Initializes authentication modal on given HTML element.
*/
createPopup: function (element) {
if (authenticationPopup.modalWindow == null) {
authenticationPopup.createPopUp(element);
}
Copy link
Contributor

@mrtuvn mrtuvn Mar 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we compare with authenticationPopup.modalWindow === null (triple equal with type convert) instead ?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
<waitForElementVisible selector="{{MultishippingSection.shippingMultipleCheckout}}" stepKey="waitMultipleAddressShippingButton"/>
<click selector="{{MultishippingSection.shippingMultipleCheckout}}" stepKey="clickToMultipleAddressShippingButton"/>
<!--Create an account-->
<waitForElementVisible selector="{{StorefrontCustomerSignInPopupFormSection.createAnAccount}}" stepKey="waitCreateAnAccountButton"/>
<click selector="{{StorefrontCustomerSignInPopupFormSection.createAnAccount}}" stepKey="clickOnCreateAnAccountButton"/>
<waitForElementVisible selector="{{AdminCreateUserSection.createAnAccountButton}}" stepKey="waitCreateAnAccountButton"/>
<click selector="{{AdminCreateUserSection.createAnAccountButton}}" stepKey="clickOnCreateAnAccountButton"/>
<waitForPageLoad stepKey="waitForCreateAccountPageToLoad"/>
<!--Check the VAT Number field-->
<seeElement selector="{{StorefrontCustomerAddressSection.vatId}}" stepKey="assertVatIdField"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="StorefrontNewsletterManageSection">
<element name="subscriptionCheckbox" type="checkbox" selector="#subscription" />
<element name="saveButton" type="button" selector="div.primary>button"/>
<element name="saveButton" type="button" selector="div.primary>button.save"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

<!-- Fill in address for CA -->
<actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="goToCheckout"/>
<fillField selector="{{CheckoutShippingSection.email}}" userInput="{{Simple_US_Customer_CA.email}}" stepKey="enterEmail"/>
<fillField selector="{{CheckoutShippingSection.emailAddress}}" userInput="{{Simple_US_Customer_CA.email}}" stepKey="enterEmail"/>
<waitForLoadingMaskToDisappear stepKey="waitEmailLoad"/>
<actionGroup ref="LoggedInCheckoutFillNewBillingAddressActionGroup" stepKey="changeAddress">
<argument name="Address" value="US_Address_CA"/>
Expand Down
Loading