Skip to content

Commit b3497f5

Browse files
committed
Cover mftf test
1 parent 2fa4bee commit b3497f5

File tree

4 files changed

+84
-0
lines changed

4 files changed

+84
-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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="StorefrontAssertCheckoutPrefixNameSelectedActionGroup">
11+
<annotations>
12+
<description>Verify able selecting provided value for Prefix Name on the checkout page.</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="prefix" type="string" defaultValue=""/>
16+
</arguments>
17+
18+
<selectOption selector="{{CheckoutShippingGuestInfoSection.prefixName}}" userInput="{{prefix}}" stepKey="changeStateProvinceField"/>
19+
<seeInField selector="{{CheckoutShippingGuestInfoSection.prefixName}}" userInput="{{prefix}}" stepKey="prefixName"/>
20+
</actionGroup>
21+
</actionGroups>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="CheckoutShippingGuestInfoSection">
1212
<element name="email" type="input" selector="#customer-email"/>
13+
<element name="prefixName" type="select" selector="select[name=prefix]"/>
1314
<element name="firstName" type="input" selector="input[name=firstname]"/>
1415
<element name="lastName" type="input" selector="input[name=lastname]"/>
1516
<element name="company" type="input" selector="input[name=company]"/>

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,16 @@
6161
<data key="label">Global</data>
6262
<data key="value">0</data>
6363
</entity>
64+
<entity name="CustomerAccountAddressPrefixRequiredConfigData">
65+
<data key="path">customer/address/prefix_show</data>
66+
<data key="value">req</data>
67+
</entity>
68+
<entity name="CustomerAccountAddressPrefixNoConfigData">
69+
<data key="path">customer/address/prefix_show</data>
70+
<data key="value">0</data>
71+
</entity>
72+
<entity name="CustomerAccountAddressPrefixOptionsConfigData">
73+
<data key="path">customer/address/prefix_options</data>
74+
<data key="value">;Mr.;Mrs.</data>
75+
</entity>
6476
</entities>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="StorefrontCheckPrefixCustomerOnCheckoutTest">
11+
<annotations>
12+
<title value="Verify 'Prefix Name' when using an empty value for it."/>
13+
<description value="Empty value for 'Prefix Name' must be shown in the select field."/>
14+
</annotations>
15+
<before>
16+
<magentoCLI command="config:set {{CustomerAccountAddressPrefixRequiredConfigData.path}} {{CustomerAccountAddressPrefixRequiredConfigData.value}}" stepKey="requiredShowPrefix"/>
17+
<magentoCLI command="config:set {{CustomerAccountAddressPrefixOptionsConfigData.path}} {{CustomerAccountAddressPrefixOptionsConfigData.value}}" stepKey="setOptionsPrefix"/>
18+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
19+
<createData entity="_defaultCategory" stepKey="createCategory"/>
20+
<createData entity="_defaultProduct" stepKey="createProduct">
21+
<requiredEntity createDataKey="createCategory"/>
22+
</createData>
23+
</before>
24+
<after>
25+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
26+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
27+
<magentoCLI command="config:set {{CustomerAccountAddressPrefixNoConfigData.path}} {{CustomerAccountAddressPrefixNoConfigData.value}}" stepKey="disableShowPrefix"/>
28+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
29+
</after>
30+
31+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openStorefrontProductPage">
32+
<argument name="productUrl" value="$$createProduct.name$$"/>
33+
</actionGroup>
34+
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart">
35+
<argument name="product" value="$$createProduct$$"/>
36+
<argument name="productCount" value="1"/>
37+
</actionGroup>
38+
<actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="guestGoToCheckout"/>
39+
40+
<actionGroup ref="StorefrontAssertCheckoutPrefixNameSelectedActionGroup" stepKey="assertFirstPrefix">
41+
<argument name="prefix" value="Mr."/>
42+
</actionGroup>
43+
<actionGroup ref="StorefrontAssertCheckoutPrefixNameSelectedActionGroup" stepKey="assertSecondPrefix">
44+
<argument name="prefix" value="Mrs."/>
45+
</actionGroup>
46+
<actionGroup ref="StorefrontAssertCheckoutPrefixNameSelectedActionGroup" stepKey="assertEmptyPrefix">
47+
<argument name="prefix"/>
48+
</actionGroup>
49+
</test>
50+
</tests>

0 commit comments

Comments
 (0)