Skip to content

Commit ef721e9

Browse files
committed
MC-4890: Convert DeleteTaxRuleEntityTest to MFTF
1 parent b6ce8da commit ef721e9

File tree

8 files changed

+155
-4
lines changed

8 files changed

+155
-4
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@
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"/>
14-
<element name="successMsg" type="button" selector="div.message-success"/>
15-
<element name="errorMsg" type="button" selector="div.message-error"/>
14+
<element name="successMsg" type="button" selector="div.message-success" timeout="30"/>
15+
<element name="errorMsg" type="button" selector="div.message-error" timeout="30"/>
1616
<element name="alertMessage" type="text" selector=".page.messages [role=alert]"/>
17-
<element name="messagesBlock" type="text" selector=".page.messages"/>
17+
<element name="messagesBlock" type="text" selector=".page.messages" timeout="30"/>
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="subTotal" type="input" selector="span[data-th='Subtotal']"/>
22+
<element name="shipping" type="input" selector="span[data-th='Shipping']"/>
23+
<element name="tax" type="input" selector="totals-tax"/>
24+
<element name="orderTotal" type="input" selector=".grand.totals .amount .price"/>
2125
</section>
2226
</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 selector="{{CheckoutCartSummarySection.shippingHeading}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="openShippingDetails"/>
16+
<selectOption selector="{{CheckoutCartSummarySection.country}}" userInput="{{address.country}}" stepKey="selectCountry"/>
17+
<selectOption selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="{{address.state}}" stepKey="selectStateProvince"/>
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/TaxRuleData.xml

Lines changed: 14 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>

app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
<element name="taxRate" type="input" selector="#taxRuleGrid_filter_tax_rates_codes"/>
1616
<element name="nthRow" type="block" selector="tr[data-role='row']:nth-of-type({{var}})" parameterized="true" timeout="30"/>
1717
<element name="successMessage" type="text" selector="#messages"/>
18+
<element name="emptyText" type="text" selector="//*[@id='taxRuleGrid_table']/tbody/tr"/>
1819
</section>
1920
</sections>
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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="AdminDeleteTaxRuleTest">
12+
<annotations>
13+
<stories value="Delete tax rule"/>
14+
<title value="Delete tax rule"/>
15+
<description value="Test log in to tax rule and Delete tax rule"/>
16+
<testCaseId value="MC-5823"/>
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="ApiSimplePrice100Qty100v2" stepKey="simpleProduct"/>
25+
<createData entity="Simple_US_Utah_Customer" stepKey="customer" />
26+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
27+
</before>
28+
<after>
29+
<deleteData stepKey="deleteSimpleProduct" createDataKey="simpleProduct" />
30+
<deleteData stepKey="deleteCustomer" createDataKey="customer" />
31+
</after>
32+
33+
<amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRuleIndex1"/>
34+
<waitForPageLoad stepKey="waitForTaxRuleIndex1"/>
35+
<click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters1"/>
36+
<fillField selector="{{AdminTaxRuleGridSection.code}}" userInput="$$initialTaxRule.code$$" stepKey="fillTaxCodeSearch"/>
37+
<click selector="{{AdminTaxRuleGridSection.search}}" stepKey="clickSearch1"/>
38+
<click selector="{{AdminTaxRuleGridSection.nthRow('1')}}" stepKey="clickFirstRow1"/>
39+
40+
<!-- Delete values on the tax rule form page -->
41+
<click selector="{{AdminTaxRuleFormSection.deleteRule}}" stepKey="clickDeleteRule"/>
42+
<click selector="{{AdminTaxRuleFormSection.ok}}" stepKey="clickOk"/>
43+
<waitForPageLoad stepKey="waitForTaxRuleDeleted" />
44+
45+
<!-- Verify we see success message -->
46+
<see selector="{{AdminMessagesSection.success}}" userInput="The tax rule has been deleted." stepKey="seeAssertTaxRuleDeleteMessage"/>
47+
48+
<!-- Confirm Deleted Tax Rule(from the above step) on the tax rule grid page -->
49+
<amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRuleIndex2"/>
50+
<waitForPageLoad stepKey="waitForTaxRuleIndex2"/>
51+
<click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters2"/>
52+
<fillField selector="{{AdminTaxRuleGridSection.code}}" userInput="$$initialTaxRule.code$$" stepKey="fillTaxCodeSearch2"/>
53+
<click selector="{{AdminTaxRuleGridSection.search}}" stepKey="clickSearch2"/>
54+
<see selector="{{AdminTaxRuleGridSection.emptyText}}" userInput="We couldn't find any records." stepKey="seeAssertTaxRuleNotFound"/>
55+
56+
<!-- Verify customer don't tax on the store front product page -->
57+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer">
58+
<argument name="Customer" value="$$customer$$" />
59+
</actionGroup>
60+
<amOnPage url="{{StorefrontProductPage.url($$simpleProduct.custom_attributes[url_key]$$)}}" stepKey="goToProductPageOnStorefront"/>
61+
<waitForPageLoad stepKey="waitForStoreFrontProductPageLoad"/>
62+
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart">
63+
<argument name="product" value="$$simpleProduct$$" />
64+
<argument name="productCount" value="1" />
65+
</actionGroup>
66+
<actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openShoppingCart" />
67+
<actionGroup ref="FillShippingZipForm" stepKey="fillShippingZipForm">
68+
<argument name="address" value="US_Address_Utah" />
69+
</actionGroup>
70+
<scrollTo selector="{{StorefrontProductPageSection.orderTotal}}" x="0" y="-80" stepKey="scrollToOrderTotal"/>
71+
<see selector="{{StorefrontProductPageSection.subTotal}}" userInput="$100.00" stepKey="seeSubTotal"/>
72+
<see selector="{{StorefrontProductPageSection.shipping}}" userInput="$5.00" stepKey="seeShipping"/>
73+
<dontSee selector="{{StorefrontProductPageSection.tax}}" stepKey="dontSeeAssertTaxAmount" />
74+
<see selector="{{StorefrontProductPageSection.orderTotal}}" userInput="$105.00" stepKey="seeAssertOrderTotal"/>
75+
</test>
76+
</tests>

0 commit comments

Comments
 (0)