Skip to content

Commit 8352846

Browse files
glo74186Manjusha
authored andcommitted
AC-4166 : Persistent data for Registered Customer with default addresses (virtual quote)
1 parent 300353b commit 8352846

File tree

4 files changed

+140
-0
lines changed

4 files changed

+140
-0
lines changed
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="CustomerLoggedInCheckoutFillNewBillingAddressActionGroup" extends="LoggedInCheckoutFillNewBillingAddressActionGroup">
12+
<annotations>
13+
<description>EXTENDS: LoggedInCheckoutFillNewBillingAddressActionGroup. Removes 'selectCountry' and 'selectState' to fill state after country.</description>
14+
</annotations>
15+
16+
<remove keyForRemoval="selectCountry"/>
17+
<remove keyForRemoval="selectState"/>
18+
<selectOption stepKey="selectCountry1" selector="{{classPrefix}} {{CheckoutShippingSection.country}}" userInput="{{Address.country_id}}"/>
19+
<selectOption stepKey="selectState2" selector="{{classPrefix}} {{CheckoutShippingSection.region}}" userInput="{{Address.state}}"/>
20+
</actionGroup>
21+
</actionGroups>

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,6 @@
5151
<element name="stateProvince" type="text" selector="//div[@name='shippingAddress.region_id']//span[contains(text(),'State/Province')]" timeout="30"/>
5252
<element name="stateProvinceWithoutAsterisk" type="text" selector="//div[@class='field' and @name='shippingAddress.region_id']" timeout="30"/>
5353
<element name="stateProvinceWithAsterisk" type="text" selector="//div[@class='field _required' and @name='shippingAddress.region_id']" timeout="30"/>
54+
<element name="selectCountry" type="select" selector="//div[@class='billing-address-form']//select[@name='country_id']"/>
5455
</section>
5556
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
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="StorefrontPersistentDataForRegisteredCustomerWithVirtualQuoteTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<stories value="Checkout via register customer"/>
15+
<title value="Persistent Data for register Customer with virtual quote"/>
16+
<description value="One can use Persistent Data for register Customer with virtual quote"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="AC-4166"/>
19+
<group value="checkout"/>
20+
</annotations>
21+
<before>
22+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
23+
<createData entity="VirtualProduct" stepKey="createVirtualProduct">
24+
<requiredEntity createDataKey="createCategory"/>
25+
</createData>
26+
<createData entity="Simple_US_CA_Customer" stepKey="createCustomer"/>
27+
<magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/>
28+
<magentoCLI command="config:set {{EnablePaymentCheckMOConfigData.path}} {{EnablePaymentCheckMOConfigData.value}}" stepKey="enableCheckMoneyOrderPayment"/>
29+
<magentoCLI command="cache:clean config" stepKey="flushCache"/>
30+
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="goToStorefront"/>
31+
<executeJS function="window.localStorage.clear();" stepKey="clearLocalStorage"/>
32+
</before>
33+
<after>
34+
<!-- delete created data -->
35+
<deleteData createDataKey="createVirtualProduct" stepKey="deleteProduct"/>
36+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
37+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
38+
<magentoCLI command="config:set {{DisableFlatRateConfigData.path}} {{DisableFlatRateConfigData.value}}" stepKey="disableFlatRate"/>
39+
<magentoCLI command="config:set {{DisableCheckMoneyOrderPaymentMethod.path}} {{DisableCheckMoneyOrderPaymentMethod.value}}" stepKey="disableCheckMoneyOrderPaymentMethod"/>
40+
</after>
41+
<!-- Login as Customer Login from Customer page -->
42+
<!--Login to Frontend-->
43+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin">
44+
<argument name="Customer" value="$$createCustomer$$" />
45+
</actionGroup>
46+
<!-- Add default address -->
47+
<actionGroup ref="StorefrontAddCustomerDefaultAddressActionGroup" stepKey="addNewDefaultAddress">
48+
<argument name="Address" value="US_Address_California"/>
49+
</actionGroup>
50+
<!--Add product to cart.-->
51+
<actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart">
52+
<argument name="product" value="$createVirtualProduct$"/>
53+
</actionGroup>
54+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToShoppingCart"/>
55+
<click selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" stepKey="openEstimateTaxSection"/>
56+
<seeInField selector="{{CheckoutCartSummarySection.country}}" userInput="United States" stepKey="assertCountryFieldInCartEstimateShippingAndTaxSection"/>
57+
<seeInField selector="{{CheckoutCartSummarySection.stateProvinceInput}}" userInput="California" stepKey="assertStateProvinceInCartEstimateShippingAndTaxSection"/>
58+
<seeInField selector="{{CheckoutCartSummarySection.postcode}}" userInput="90230" stepKey="assertZipPostalCodeInCartEstimateShippingAndTaxSection"/>
59+
<selectOption selector="{{CheckoutCartSummarySection.country}}" userInput="United Kingdom" stepKey="selectCountry"/>
60+
<waitForLoadingMaskToDisappear stepKey="waitForCountryLoadingMaskDisappear"/>
61+
<fillField selector="{{CheckoutShippingGuestInfoSection.regionInput}}" userInput="" stepKey="changeStateProvinceField"/>
62+
<fillField selector="{{CheckoutCartSummarySection.postcode}}" userInput="KW1 7NQ" stepKey="fillZipPostalCodeField"/>
63+
<waitForLoadingMaskToDisappear stepKey="waitForZipLoadingMaskDisappear"/>
64+
<dontSeeJsError stepKey="verifyThatThereIsNoJSErrors"/>
65+
<reloadPage stepKey="refreshPage"/>
66+
<waitForPageLoad stepKey="waitForpageload"/>
67+
<seeInField selector="{{CheckoutCartSummarySection.country}}" userInput="United Kingdom" stepKey="assertCountryFieldInCartEstimateShippingSection"/>
68+
<seeInField selector="{{CheckoutCartSummarySection.stateProvinceInput}}" userInput="" stepKey="assertStateProvinceInCartEstimateShippingSection"/>
69+
<seeInField selector="{{CheckoutCartSummarySection.postcode}}" userInput="KW1 7NQ" stepKey="assertZipPostalCodeInCartEstimateShippingSection"/>
70+
<actionGroup ref="StorefrontClickProceedToCheckoutActionGroup" stepKey="goToCheckout"/>
71+
<actionGroup ref="CheckBillingAddressInCheckoutActionGroup" stepKey="checkBillingAddressOnBillingPage">
72+
<argument name="customerVar" value="$$createCustomer$$" />
73+
<argument name="customerAddressVar" value="US_Address_California" />
74+
</actionGroup>
75+
<conditionalClick selector="{{CheckoutShippingSection.editActiveAddressButton}}" dependentSelector="{{CheckoutShippingSection.editActiveAddressButton}}" visible="true" stepKey="clickEditButton"/>
76+
<waitForPageLoad stepKey="waitForLoadingMask"/>
77+
<click selector="{{CheckoutPaymentSection.addressDropdown}}" stepKey="editAddress"/>
78+
<waitForElementVisible selector="{{CheckoutPaymentSection.addressDropdown}}" stepKey="waitForDropDownToBeVisible"/>
79+
<selectOption selector="{{CheckoutShippingSection.addressDropdown}}" userInput="New Address" stepKey="addAddress"/>
80+
<waitForPageLoad stepKey="waitForMaskLoading"/>
81+
<seeInField stepKey="fillFirstName" selector="{{CheckoutShippingSection.firstName}}" userInput="John"/>
82+
<seeInField stepKey="fillLastName" selector="{{CheckoutShippingSection.lastName}}" userInput="Doe"/>
83+
<wait time="10" stepKey="waitForSelectCountry"/>
84+
<seeOptionIsSelected selector="{{CheckoutShippingSection.selectCountry}}" userInput="{{UK_Address.country}}" stepKey="seeCountryIsUnitedKingdom"/>
85+
<seeInField stepKey="fillZip" selector="{{CheckoutShippingSection.postcode}}" userInput="KW1 7NQ"/>
86+
<actionGroup ref="CustomerLoggedInCheckoutFillNewBillingAddressActionGroup" stepKey="changeBillingAddress">
87+
<argument name="Address" value="Switzerland_Address"/>
88+
<argument name="classPrefix" value="[aria-hidden=false]"/>
89+
</actionGroup>
90+
<!-- Check order summary in checkout -->
91+
<actionGroup ref="StorefrontClickUpdateAddressInCheckoutActionGroup" stepKey="clickToUpdate"/>
92+
<comment userInput="BIC workaround" stepKey="waitForPageLoading"/>
93+
<reloadPage stepKey="againRefreshPage1"/>
94+
<wait time="10" stepKey="waitForPageLoad"/>
95+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="AgainGoToShoppingCart"/>
96+
<dontSeeJsError stepKey="againVerifyThatThereIsNoJSErrors"/>
97+
<conditionalClick selector="{{CheckoutShippingSection.editActiveAddressButton}}" dependentSelector="{{CheckoutShippingSection.editActiveAddressButton}}" visible="true" stepKey="againClickEditButton"/>
98+
<waitForPageLoad stepKey="againWaitForLoadingMask"/>
99+
<seeInField selector="{{CheckoutCartSummarySection.country}}" userInput="{{Switzerland_Address.country}}" stepKey="againAssertCountryFieldInCartEstimateShippingAndTaxSection"/>
100+
<seeInField selector="{{CheckoutCartSummarySection.stateProvinceInput}}" userInput="{{Switzerland_Address.state}}" stepKey="againAssertStateProvinceInCartEstimateShippingAndTaxSection"/>
101+
<seeInField selector="{{CheckoutCartSummarySection.postcode}}" userInput="{{Switzerland_Address.postcode}}" stepKey="againAssertZipPostalCodeInCartEstimateShippingAndTaxSection"/>
102+
</test>
103+
</tests>

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,4 +478,19 @@
478478
<data key="default_billing">true</data>
479479
<data key="telephone">613-582-4782</data>
480480
</entity>
481+
<entity name="Switzerland_Address">
482+
<data key="firstname">John</data>
483+
<data key="lastname">Doe</data>
484+
<data key="company">Magento</data>
485+
<array key="street">
486+
<item>Kapelle St.</item>
487+
<item>Niklaus 3</item>
488+
</array>
489+
<data key="city">Baden</data>
490+
<data key="country_id">CH</data>
491+
<data key="country">Switzerland</data>
492+
<data key="state">Aargau</data>
493+
<data key="postcode">5555</data>
494+
<data key="telephone">555-55-555-55</data>
495+
</entity>
481496
</entities>

0 commit comments

Comments
 (0)