Skip to content

Commit 1d4b482

Browse files
committed
MC-4891: Convert UpdateTaxRuleEntityTest to MFTF
1 parent b6ce8da commit 1d4b482

File tree

10 files changed

+382
-2
lines changed

10 files changed

+382
-2
lines changed

app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductPageSection.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="StorefrontProductPageSection">
12-
<element name="qtyInput" type="button" selector="input.input-text.qty"/>
12+
<element name="qtyInput" type="button" selector="input.input-text.qty" timeout="30"/>
1313
<element name="addToCartBtn" type="button" selector="button.action.tocart.primary" timeout="30"/>
1414
<element name="successMsg" type="button" selector="div.message-success"/>
15-
<element name="errorMsg" type="button" selector="div.message-error"/>
15+
<element name="errorMsg" type="button" selector="div.message-error" timeout="30"/>
1616
<element name="alertMessage" type="text" selector=".page.messages [role=alert]"/>
1717
<element name="messagesBlock" type="text" selector=".page.messages"/>
1818
<element name="addToWishlist" type="button" selector="//a[@class='action towishlist']" timeout="30"/>
1919
<element name="customTextOptionInput" type="input" selector=".input-text.product-custom-option"/>
2020
<element name="charCounter" type="text" selector=".character-counter"/>
21+
<element name="tax" type="input" selector=".totals-tax .amount .price"/>
22+
<element name="orderTotal" type="input" selector=".grand.totals .amount .price"/>
2123
</section>
2224
</sections>
Lines changed: 21 additions & 0 deletions
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="FillShippingZipForm">
12+
<arguments>
13+
<argument name="address"/>
14+
</arguments>
15+
<conditionalClick stepKey="openShippingDetails" selector="{{CheckoutCartSummarySection.shippingHeading}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false"/>
16+
<selectOption stepKey="selectCountry" selector="{{CheckoutCartSummarySection.country}}" userInput="{{address.country}}"/>
17+
<selectOption stepKey="selectStateProvince" selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="{{address.state}}"/>
18+
<fillField stepKey="fillPostCode" selector="{{CheckoutCartSummarySection.postcode}}" userInput="{{address.postcode}}"/>
19+
<waitForPageLoad stepKey="waitForFormUpdate"/>
20+
</actionGroup>
21+
</actionGroups>

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,21 @@
108108
<data key="country_id">GB</data>
109109
<data key="telephone">444-44-444-44</data>
110110
</entity>
111+
<entity name="US_Address_Utah" type="address">
112+
<data key="firstname">John</data>
113+
<data key="lastname">Doe</data>
114+
<data key="company">Magento</data>
115+
<array key="street">
116+
<item>1234 Some Utah address</item>
117+
</array>
118+
<data key="city">Provo</data>
119+
<data key="state">Utah</data>
120+
<data key="country_id">US</data>
121+
<data key="country">United States</data>
122+
<data key="postcode">84001</data>
123+
<data key="telephone">512-345-6789</data>
124+
<data key="default_billing">Yes</data>
125+
<data key="default_shipping">Yes</data>
126+
<requiredEntity type="region">RegionUT</requiredEntity>
127+
</entity>
111128
</entities>

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,17 @@
102102
<data key="website_id">0</data>
103103
<requiredEntity type="address">US_Address_CA</requiredEntity>
104104
</entity>
105+
<entity name="Simple_US_Utah_Customer" type="customer">
106+
<data key="group_id">1</data>
107+
<data key="default_billing">true</data>
108+
<data key="default_shipping">true</data>
109+
<data key="email" unique="prefix">John.Doe@example.com</data>
110+
<data key="firstname">John</data>
111+
<data key="lastname">Doe</data>
112+
<data key="fullname">John Doe</data>
113+
<data key="password">pwdTest123!</data>
114+
<data key="store_id">0</data>
115+
<data key="website_id">0</data>
116+
<requiredEntity type="address">US_Address_Utah</requiredEntity>
117+
</entity>
105118
</entities>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,9 @@
2727
<data key="region_code">NY</data>
2828
<data key="region_id">43</data>
2929
</entity>
30+
<entity name="RegionUT" type="region">
31+
<data key="region">Utah</data>
32+
<data key="region_code">UT</data>
33+
<data key="region_id">58</data>
34+
</entity>
3035
</entities>

app/code/Magento/Tax/Test/Mftf/Data/TaxRateData.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@
6060
<data key="zip_to">96162</data>
6161
<data key="rate">15.05</data>
6262
</entity>
63+
<entity name="TaxRateWithFixedZipUtah" type="taxRate">
64+
<data key="code" unique="suffix">Tax Rate </data>
65+
<data key="tax_country_id">US</data>
66+
<data key="tax_country">United States</data>
67+
<data key="tax_region_id">58</data>
68+
<data key="tax_region">Utah</data>
69+
<data key="zip_is_range">0</data>
70+
<data key="tax_postcode">84001</data>
71+
<data key="rate">20</data>
72+
</entity>
6373
<entity name="defaultTaxRateWithLargeRate" type="taxRate">
6474
<data key="code" unique="suffix">TaxRate</data>
6575
<data key="tax_country_id">GB</data>

app/code/Magento/Tax/Test/Mftf/Data/TaxRuleData.xml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@
77
-->
88
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
10+
<entity name="defaultTaxRule" type="taxRule">
11+
<data key="code" unique="suffix">TaxIdentifier</data>
12+
<data key="position">1</data>
13+
<data key="priority">1</data>
14+
<array key="customer_tax_class_ids">
15+
<item>3</item>
16+
</array>
17+
<array key="product_tax_class_ids">
18+
<item>2</item>
19+
</array>
20+
<array key="tax_rate_ids">
21+
<item>1</item>
22+
</array>
23+
</entity>
1024
<entity name="SimpleTaxRule" type="taxRule">
1125
<data key="code" unique="suffix">TaxRule</data>
1226
<data key="position">0</data>
@@ -71,4 +85,36 @@
7185
</array>
7286
<data key="calculate_subtotal">true</data>
7387
</entity>
88+
<entity name="taxRuleWithUpdatePriorityPosition" type="taxRule">
89+
<data key="code" unique="suffix">TaxRule</data>
90+
<data key="position">2</data>
91+
<data key="priority">2</data>
92+
<array key="customer_tax_class_ids">
93+
<item>3</item>
94+
</array>
95+
<array key="product_tax_class_ids">
96+
<item>2</item>
97+
</array>
98+
<array key="tax_rate_ids">
99+
<item>1</item>
100+
<item>2</item>
101+
</array>
102+
<data key="calculate_subtotal">true</data>
103+
</entity>
104+
<entity name="taxRuleWithCustomTaxClasses" type="taxRule">
105+
<data key="code" unique="suffix">TaxRule</data>
106+
<data key="position">0</data>
107+
<data key="priority">0</data>
108+
<array key="customer_tax_class_ids">
109+
<item>3</item>
110+
</array>
111+
<array key="product_tax_class_ids">
112+
<item>2</item>
113+
</array>
114+
<array key="tax_rate_ids">
115+
<item>1</item>
116+
<item>2</item>
117+
</array>
118+
<data key="calculate_subtotal">true</data>
119+
</entity>
74120
</entities>
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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="AdminUpdateDefaultTaxRuleTest">
12+
<annotations>
13+
<stories value="Update tax rule"/>
14+
<title value="Update tax rule, tax rule default"/>
15+
<description value="Test log in to Update tax rule and Update default tax rule"/>
16+
<testCaseId value="MC-5819"/>
17+
<severity value="CRITICAL"/>
18+
<group value="tax"/>
19+
<group value="mtf_migrated"/>
20+
</annotations>
21+
<before>
22+
<createData entity="defaultTaxRule" stepKey="initialTaxRule"/>
23+
<createData entity="defaultTaxRate" stepKey="initialTaxRate"/>
24+
<createData entity="customerTaxClass" stepKey="createCustomerTaxClass"/>
25+
<createData entity="productTaxClass" stepKey="createProductTaxClass"/>
26+
<getData entity="customerTaxClass" stepKey="customerTaxClass">
27+
<requiredEntity createDataKey="createCustomerTaxClass"/>
28+
</getData>
29+
<getData entity="productTaxClass" stepKey="productTaxClass">
30+
<requiredEntity createDataKey="createProductTaxClass"/>
31+
</getData>
32+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
33+
</before>
34+
<after>
35+
<deleteData stepKey="deleteTaxRule" createDataKey="initialTaxRule" />
36+
<deleteData stepKey="deleteTaxRate" createDataKey="initialTaxRate" />
37+
<deleteData stepKey="deleteCustomerTaxClass" createDataKey="createCustomerTaxClass"/>
38+
<deleteData stepKey="deleteProductTaxClass" createDataKey="createProductTaxClass"/>
39+
</after>
40+
41+
<amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRuleIndex1"/>
42+
<waitForPageLoad stepKey="waitForTaxRuleIndex1"/>
43+
<click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters1"/>
44+
<fillField selector="{{AdminTaxRuleGridSection.code}}" userInput="$$initialTaxRule.code$$" stepKey="fillTaxCodeSearch"/>
45+
<click selector="{{AdminTaxRuleGridSection.search}}" stepKey="clickSearch1"/>
46+
<click selector="{{AdminTaxRuleGridSection.nthRow('1')}}" stepKey="clickFirstRow1"/>
47+
48+
<!-- Update tax rule with default -->
49+
<fillField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode1"/>
50+
<fillField selector="{{AdminTaxRuleFormSection.taxRateSearch}}" userInput="$$initialTaxRate.code$$" stepKey="fillTaxRateSearch"/>
51+
<wait stepKey="waitForSearch" time="5" />
52+
<click selector="{{AdminTaxRuleFormSection.taxRateOption($$initialTaxRate.code$$)}}" stepKey="clickSelectNeededItem"/>
53+
<click selector="{{AdminTaxRuleFormSection.additionalSettings}}" stepKey="clickAdditionalSettings"/>
54+
<scrollTo selector="{{AdminTaxRuleFormSection.additionalSettings}}" x="0" y="-80" stepKey="scrollToAdvancedSettings"/>
55+
<wait stepKey="waitForAdditionalSettings" time="5" />
56+
<conditionalClick selector="{{AdminTaxRuleFormSection.customerTaxClassOption(retailCustomerTaxClass.class_name)}}" dependentSelector="{{AdminTaxRuleFormSection.customerTaxClassSelected(retailCustomerTaxClass.class_name)}}" visible="false" stepKey="checkRetailCustomerTaxClass" />
57+
<conditionalClick selector="{{AdminTaxRuleFormSection.productTaxClassOption(taxableGoodsTaxClass.class_name)}}" dependentSelector="{{AdminTaxRuleFormSection.productTaxClassSelected(taxableGoodsTaxClass.class_name)}}" visible="false" stepKey="checkTaxableGoodsTaxClass" />
58+
<click selector="{{AdminTaxRuleFormSection.customerTaxClassOption($$customerTaxClass.class_name$$)}}" stepKey="clickSelectCustomerTaxClass"/>
59+
<click selector="{{AdminTaxRuleFormSection.productTaxClassOption($$productTaxClass.class_name$$)}}" stepKey="clickSelectProductTaxClass"/>
60+
<fillField selector="{{AdminTaxRuleFormSection.priority}}" userInput="{{taxRuleWithUpdatePriorityPosition.priority}}" stepKey="fillPriority"/>
61+
<fillField selector="{{AdminTaxRuleFormSection.sortOrder}}" userInput="{{taxRuleWithUpdatePriorityPosition.position}}" stepKey="fillPosition"/>
62+
<click selector="{{AdminTaxRuleFormSection.save}}" stepKey="clickSaveTaxRule"/>
63+
<waitForPageLoad stepKey="waitForTaxRuleSaved" />
64+
<!-- Verify we see success message -->
65+
<see selector="{{AdminTaxRuleGridSection.successMessage}}" userInput="You saved the tax rule." stepKey="seeAssertTaxRuleSuccessMessage"/>
66+
67+
<!-- Verify we see updated tax rule with default(from the above step) on the tax rule grid page -->
68+
<click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters2"/>
69+
<fillField selector="{{AdminTaxRuleGridSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode2"/>
70+
<click selector="{{AdminTaxRuleGridSection.search}}" stepKey="clickSearch2"/>
71+
<waitForPageLoad stepKey="waitForTaxRuleSearch"/>
72+
<click selector="{{AdminTaxRuleGridSection.nthRow('1')}}" stepKey="clickFirstRow2"/>
73+
74+
<!-- Verify we see updated tax rule with default on the tax rule form page -->
75+
<seeInField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="seeInTaxRuleCode"/>
76+
<seeElement selector="{{AdminTaxRuleFormSection.taxRateSelected($$initialTaxRate.code$$)}}" stepKey="seeTaxRateSelected"/>
77+
<click selector="{{AdminTaxRuleFormSection.additionalSettings}}" stepKey="clickAdditionalSettings1"/>
78+
<scrollTo selector="{{AdminTaxRuleFormSection.additionalSettings}}" x="0" y="-80" stepKey="scrollToAdvancedSettings1"/>
79+
<seeElement selector="{{AdminTaxRuleFormSection.customerTaxClassSelected($$customerTaxClass.class_name$$)}}" stepKey="seeCustomerTaxClass"/>
80+
<seeElement selector="{{AdminTaxRuleFormSection.productTaxClassSelected($$productTaxClass.class_name$$)}}" stepKey="seeProductTaxClass"/>
81+
<seeInField selector="{{AdminTaxRuleFormSection.priority}}" userInput="{{taxRuleWithUpdatePriorityPosition.priority}}" stepKey="seePriority"/>
82+
<seeInField selector="{{AdminTaxRuleFormSection.sortOrder}}" userInput="{{taxRuleWithUpdatePriorityPosition.position}}" stepKey="seePosition"/>
83+
</test>
84+
</tests>
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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="AdminUpdateTaxRuleWithCustomClassesTest">
12+
<annotations>
13+
<stories value="Update tax rule"/>
14+
<title value="Update tax rule, tax rule with custom classes"/>
15+
<description value="Test log in to Update tax rule and Update tax rule with custom classes"/>
16+
<testCaseId value="MC-5820"/>
17+
<severity value="CRITICAL"/>
18+
<group value="tax"/>
19+
<group value="mtf_migrated"/>
20+
</annotations>
21+
22+
<before>
23+
<createData entity="defaultTaxRule" stepKey="initialTaxRule"/>
24+
<createData entity="defaultTaxRateWithZipRange" stepKey="taxRateWithZipRange"/>
25+
<createData entity="customerTaxClass" stepKey="createCustomerTaxClass"/>
26+
<createData entity="productTaxClass" stepKey="createProductTaxClass"/>
27+
<getData entity="customerTaxClass" stepKey="customerTaxClass">
28+
<requiredEntity createDataKey="createCustomerTaxClass"/>
29+
</getData>
30+
<getData entity="productTaxClass" stepKey="productTaxClass">
31+
<requiredEntity createDataKey="createProductTaxClass"/>
32+
</getData>
33+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
34+
</before>
35+
<after>
36+
<deleteData stepKey="deleteTaxRule" createDataKey="initialTaxRule" />
37+
<deleteData stepKey="deleteTaxRate" createDataKey="taxRateWithZipRange" />
38+
<deleteData stepKey="deleteCustomerTaxClass" createDataKey="createCustomerTaxClass"/>
39+
<deleteData stepKey="deleteProductTaxClass" createDataKey="createProductTaxClass"/>
40+
</after>
41+
42+
<amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRuleIndex1"/>
43+
<waitForPageLoad stepKey="waitForTaxRuleIndex1"/>
44+
<click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters1"/>
45+
<fillField selector="{{AdminTaxRuleGridSection.code}}" userInput="$$initialTaxRule.code$$" stepKey="fillTaxCodeSearch"/>
46+
<click selector="{{AdminTaxRuleGridSection.search}}" stepKey="clickSearch1"/>
47+
<click selector="{{AdminTaxRuleGridSection.nthRow('1')}}" stepKey="clickFirstRow1"/>
48+
49+
<!-- Update tax rule with custom classes -->
50+
<fillField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode1"/>
51+
<fillField selector="{{AdminTaxRuleFormSection.taxRateSearch}}" userInput="$$taxRateWithZipRange.code$$" stepKey="fillTaxRateSearch"/>
52+
<wait stepKey="waitForSearch" time="5" />
53+
<click selector="{{AdminTaxRuleFormSection.taxRateOption($$taxRateWithZipRange.code$$)}}" stepKey="clickSelectNeededItem"/>
54+
<click selector="{{AdminTaxRuleFormSection.additionalSettings}}" stepKey="clickAdditionalSettings"/>
55+
<scrollTo selector="{{AdminTaxRuleFormSection.additionalSettings}}" x="0" y="-80" stepKey="scrollToAdvancedSettings"/>
56+
<wait stepKey="waitForAdditionalSettings" time="5" />
57+
<conditionalClick selector="{{AdminTaxRuleFormSection.customerTaxClassOption(retailCustomerTaxClass.class_name)}}" dependentSelector="{{AdminTaxRuleFormSection.customerTaxClassSelected(retailCustomerTaxClass.class_name)}}" visible="false" stepKey="checkRetailCustomerTaxClass" />
58+
<conditionalClick selector="{{AdminTaxRuleFormSection.productTaxClassOption(taxableGoodsTaxClass.class_name)}}" dependentSelector="{{AdminTaxRuleFormSection.productTaxClassSelected(taxableGoodsTaxClass.class_name)}}" visible="false" stepKey="checkTaxableGoodsTaxClass" />
59+
<click selector="{{AdminTaxRuleFormSection.productTaxClassOption($$productTaxClass.class_name$$)}}" stepKey="clickSelectProductTaxClass"/>
60+
<click selector="{{AdminTaxRuleFormSection.save}}" stepKey="clickSaveTaxRule"/>
61+
<waitForPageLoad stepKey="waitForTaxRuleSaved" />
62+
<!-- Verify we see success message -->
63+
<see selector="{{AdminTaxRuleGridSection.successMessage}}" userInput="You saved the tax rule." stepKey="seeAssertTaxRuleSuccessMessage"/>
64+
65+
<!-- Verify we see updated tax rule with default(from the above step) on the tax rule grid page -->
66+
<click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters2"/>
67+
<fillField selector="{{AdminTaxRuleGridSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode2"/>
68+
<click selector="{{AdminTaxRuleGridSection.search}}" stepKey="clickSearch2"/>
69+
<waitForPageLoad stepKey="waitForTaxRuleSearch"/>
70+
<click selector="{{AdminTaxRuleGridSection.nthRow('1')}}" stepKey="clickFirstRow2"/>
71+
72+
<!-- Verify we see updated tax rule with default on the tax rule form page -->
73+
<seeInField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="seeInTaxRuleCode"/>
74+
<seeElement selector="{{AdminTaxRuleFormSection.taxRateSelected($$taxRateWithZipRange.code$$)}}" stepKey="seeTaxRateSelected"/>
75+
<click selector="{{AdminTaxRuleFormSection.additionalSettings}}" stepKey="clickAdditionalSettings1"/>
76+
<scrollTo selector="{{AdminTaxRuleFormSection.additionalSettings}}" x="0" y="-80" stepKey="scrollToAdvancedSettings1"/>
77+
<seeElement selector="{{AdminTaxRuleFormSection.productTaxClassSelected($$productTaxClass.class_name$$)}}" stepKey="seeProductTaxClass"/>
78+
<seeElement selector="{{AdminTaxRuleFormSection.customerTaxClassSelected(retailCustomerTaxClass.class_name)}}" stepKey="seeRetailCustomerTaxClass" />
79+
<seeElement selector="{{AdminTaxRuleFormSection.productTaxClassSelected(taxableGoodsTaxClass.class_name)}}" stepKey="seeTaxableGoodsTaxClass" />
80+
</test>
81+
</tests>

0 commit comments

Comments
 (0)