Skip to content

Commit 92b8ca6

Browse files
committed
magento/partners-magento2b2b#459: Automate MC-37569 Custom Customer Address Attribute
1 parent 26acabe commit 92b8ca6

6 files changed

+200
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
<!-- Check selected Billing address information on Review Section step -->
12+
<actionGroup name="StorefrontCheckSelectedBillingAddressInCheckoutWithSearchActionGroup">
13+
<annotations>
14+
<description value="Verify customer billing address values on storefront checkout."/>
15+
</annotations>
16+
<arguments>
17+
<argument name="customerVar"/>
18+
<argument name="customerAddressVar"/>
19+
</arguments>
20+
<waitForElement selector="{{CheckoutBillingAddressSection.selectedBillingAddress}}" time="30" stepKey="waitForBillingSectionLoaded"/>
21+
<see stepKey="VerifyFirstNameInSelectedAddress" selector="{{CheckoutBillingAddressSection.selectedBillingAddress}}" userInput="{{customerVar.firstname}}" />
22+
<see stepKey="VerifyLastNameInSelectedAddress" selector="{{CheckoutBillingAddressSection.selectedBillingAddress}}" userInput="{{customerVar.lastname}}" />
23+
<see stepKey="VerifyStreetInSelectedAddress" selector="{{CheckoutBillingAddressSection.selectedBillingAddress}}" userInput="{{customerAddressVar.street[0]}}" />
24+
<see stepKey="VerifyCityInSelectedAddress" selector="{{CheckoutBillingAddressSection.selectedBillingAddress}}" userInput="{{customerAddressVar.city}}" />
25+
<see stepKey="VerifyZipInSelectedAddress" selector="{{CheckoutBillingAddressSection.selectedBillingAddress}}" userInput="{{customerAddressVar.postcode}}" />
26+
<see stepKey="VerifyPhoneInSelectedAddress" selector="{{CheckoutBillingAddressSection.selectedBillingAddress}}" userInput="{{customerAddressVar.telephone}}" />
27+
</actionGroup>
28+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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="StorefrontClickAddNewAddressButtonFromCheckoutShippingActionGroup">
12+
<annotations>
13+
<description>Clicks the New Address button on the storefront Checkout Shipping page</description>
14+
</annotations>
15+
<click selector="{{CheckoutShippingSection.newAddressButton}}" stepKey="ClickOnAddNewAddressButton"/>
16+
<waitForPageLoad stepKey="waitForPageToLoad"/>
17+
</actionGroup>
18+
</actionGroups>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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="StorefrontClickSaveOnNewAddressFormActionGroup">
12+
<annotations>
13+
<description>Clicks the save button on the storefront new address form</description>
14+
</annotations>
15+
<click selector="{{CheckoutShippingSection.saveAddress}}" stepKey="saveNewAddress"/>
16+
<waitForPageLoad stepKey="waitForPageLoad"/>
17+
</actionGroup>
18+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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="StorefrontSelectDropdownCustomerAddressAttributeValueActionGroup">
12+
<annotations>
13+
<description>Selects the provided Option in the provided Customer Address Attribute drop down menu on store front.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="customerAddressAttribute"/>
17+
<argument name="optionValue" type="string"/>
18+
</arguments>
19+
20+
<selectOption selector="{{StorefrontCustomerAddressFormSection.dropDownAttribute(customerAddressAttribute.code)}}" userInput="{{optionValue}}" stepKey="selectOptionValue"/>
21+
</actionGroup>
22+
</actionGroups>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<element name="country" type="select" selector="//form[@class='form-address-edit']//select[contains(@name, 'country_id')]"/>
2121
<element name="useAsDefaultBillingAddressCheckBox" type="input" selector="//form[@class='form-address-edit']//input[@name='default_billing']"/>
2222
<element name="useAsDefaultShippingAddressCheckBox" type="input" selector="//form[@class='form-address-edit']//input[@name='default_shipping']"/>
23+
<element name="dropDownAttribute" type="select" selector="//select[@name='custom_attributes[{{var1}}]']" parameterized="true"/>
2324
<element name="saveAddress" type="button" selector="//button[@title='Save Address']" timeout="30"/>
2425
</section>
2526
</sections>
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
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="StorefrontVerifyCustomCustomerAddressAttributeTest">
12+
<annotations>
13+
<features value="Customer"/>
14+
<stories value="Storefront Custom Customer Address Attribute"/>
15+
<title value="Verify Custom Customer Address Attribute Value Shows On Storefront Customer Checkout"/>
16+
<description value="Verify that custom customer address attribute value shows at checkout on storefront for second address"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-37569"/>
19+
<group value="customer"/>
20+
</annotations>
21+
<before>
22+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
23+
<createData entity="SimpleProduct2" stepKey="simpleProduct"/>
24+
<createData entity="Simple_US_Customer" stepKey="simpleCustomer"/>
25+
</before>
26+
<after>
27+
<deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/>
28+
<deleteData createDataKey="simpleCustomer" stepKey="deleteCustomer"/>
29+
<!--Remove Custom Customer Address Attribute-->
30+
<actionGroup ref="AdminDeleteCustomerAttribute" stepKey="adminDeleteFirstCustomerAttribute">
31+
<argument name="defaultLabel" value="{{AttributeDropdownData.label}}"/>
32+
</actionGroup>
33+
</after>
34+
35+
<!--Create new custom customer address attribute-->
36+
<actionGroup ref="AdminNavigateToCustomerAddressAttributesPageActionGroup"/>
37+
<actionGroup ref="AdminAddOptionsCustomerAttribute" stepKey="adminCreateCustomerFirstAttribute">
38+
<argument name="defaultLabel" value="{{AttributeDropdownData.label}}"/>
39+
<argument name="attributeCode" value="{{AttributeDropdownData.code}}"/>
40+
<argument name="inputType" value="{{AttributeDropdownData.inputType}}"/>
41+
<argument name="sortOrder" value="{{AttributeDropdownData.sortOrder}}"/>
42+
<argument name="firstOption" value="{{AttributeDropdownData.firstOption}}"/>
43+
<argument name="secondOption" value="{{AttributeDropdownData.secondOption}}"/>
44+
</actionGroup>
45+
46+
<!--Add address to B2C Customer-->
47+
<actionGroup ref="AdminOpenCustomerEditPageActionGroup" stepKey="openCustomerEditPage">
48+
<argument name="customerId" value="$$simpleCustomer.id$"/>
49+
</actionGroup>
50+
<click selector="{{AdminEditCustomerAddressesSection.addresses}}" stepKey="proceedToAddresses"/>
51+
<waitForPageLoad stepKey="waitForPageToLoad"/>
52+
<click selector="{{AdminCustomerAddressesGridSection.firstRowEditLink}}" stepKey="editFirstAddress"/>
53+
<waitForPageLoad time="60" stepKey="waitForAddressForm"/>
54+
55+
<actionGroup ref="SelectDropdownCustomerAddressAttributeValueActionGroup" stepKey="selectOptionValue">
56+
<argument name="customerAddressAttribute" value="AttributeDropdownData"/>
57+
<argument name="optionValue" value="{{AttributeDropdownData.firstOption}}"/>
58+
</actionGroup>
59+
60+
<!--Login To Store Front By B2C Customer-->
61+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsStoreFront">
62+
<argument name="Customer" value="$$simpleCustomer$$"/>
63+
</actionGroup>
64+
<!-- Add Product To Cart From Product Detail Page-->
65+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductPageOnStorefront">
66+
<argument name="product" value="$$simpleProduct$$"/>
67+
</actionGroup>
68+
<actionGroup ref="StorefrontAddToTheCartActionGroup" stepKey="addToCartFromStorefrontProductPage"/>
69+
70+
<!--Go To Checkout and Verify Default Address-->
71+
<actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="goToCheckoutPage"/>
72+
<!-- Ensure that the selected shipping address is similar to first address -->
73+
<actionGroup ref="CheckSelectedShippingAddressInCheckoutWithSearchActionGroup" stepKey="assertShippingAddress">
74+
<argument name="customerVar" value="$$simpleCustomer$$"/>
75+
<argument name="customerAddressVar" value="CustomerAddressSimple"/>
76+
</actionGroup>
77+
<!--Verify that selected "Test Dropdown" options appears on the page-->
78+
<see selector="{{CheckoutShippingAddressSection.selectedShippingAddress}}" userInput="{{AttributeDropdownData.firstOption}}" stepKey="seeShippingAddressCustomAttribute"/>
79+
80+
<!--Add Second Shipping Address-->
81+
<actionGroup ref="StorefrontClickAddNewAddressButtonFromCheckoutShippingActionGroup" stepKey="clickAddNewAddressButton"
82+
83+
<!--Fill in Shipping Address required fields and Custom Customer Address Attribute and click *Ship Here* button-->
84+
<actionGroup ref="FillNewShippingAddressModalActionGroup" stepKey="changeAddress">
85+
<argument name="address" value="US_Address_NY"/>
86+
</actionGroup>
87+
<actionGroup ref="StorefrontSelectDropdownCustomerAddressAttributeValueActionGroup" stepKey="selectOptionValue1">
88+
<argument name="customerAddressAttribute" value="AttributeDropdownData"/>
89+
<argument name="optionValue" value="{{AttributeDropdownData.firstOption}}"/>
90+
</actionGroup>
91+
<actionGroup ref="StorefrontClickSaveOnNewAddressFormActionGroup" stepKey="clickOnSaveNewAddress"/>
92+
93+
<!-- Ensure that the selected shipping address is similar to second address -->
94+
<actionGroup ref="CheckSelectedShippingAddressInCheckoutWithSearchActionGroup" stepKey="assertShippingAddress1">
95+
<argument name="customerVar" value="$$simpleCustomer$$"/>
96+
<argument name="customerAddressVar" value="US_Address_NY"/>
97+
</actionGroup>
98+
<!--Verify that selected "Test Dropdown" options appears on the page-->
99+
<see selector="{{CheckoutShippingAddressSection.selectedShippingAddress}}" userInput="{{AttributeDropdownData.firstOption}}" stepKey="seeShippingAddressCustomAttribute1"/>
100+
101+
<!-- Select First Shipping Method and Go To Billing Section -->
102+
<click selector="{{CheckoutShippingSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/>
103+
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNextOnShippingStep"/>
104+
105+
<!-- Ensure that the Billing address is similar to first address -->
106+
<actionGroup ref="StorefrontCheckSelectedBillingAddressInCheckoutWithSearchActionGroup" stepKey="assertBillingAddress">
107+
<argument name="customerVar" value="$$simpleCustomer$$"/>
108+
<argument name="customerAddressVar" value="CustomerAddressSimple"/>
109+
</actionGroup>
110+
<!--Verify that selected "Test Dropdown" options appears on the page-->
111+
<see selector="{{CheckoutBillingAddressSection.selectedBillingAddress}}" userInput="{{AttributeDropdownData.firstOption}}" stepKey="seeBillingAddressCustomAttribute"/>
112+
</test>
113+
</tests>

0 commit comments

Comments
 (0)