Skip to content

Commit ed79ec2

Browse files
glo74186Manjusha.S
authored andcommitted
Create product and taxrule and validate product prices on frontend
1 parent 375fc52 commit ed79ec2

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed

app/code/Magento/Bundle/Test/Mftf/Section/StorefrontProductInfoMainSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@
1616
<element name="asLowAsFinalPrice" type="text" selector="div.price-box.price-final_price p.minimal-price > span.price-final_price span.price"/>
1717
<element name="fixedFinalPrice" type="text" selector="div.price-box.price-final_price > span.price-final_price span.price"/>
1818
<element name="productBundleOptionsCheckbox" type="checkbox" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{childName}}')]/../input" parameterized="true" timeout="30"/>
19+
<element name="includingTaxPrice" type="text" selector=".//*[@class='price-wrapper price-including-tax']/span"/>
20+
<element name="excludingTaxPrice" type="text" selector=".//*[@class='price-wrapper price-excluding-tax']/span"/>
1921
</section>
2022
</sections>

app/code/Magento/Catalog/Test/Mftf/Data/CatalogPriceData.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,20 @@
2929
<entity name="defaultProductPrice" type="default_product_price">
3030
<data key="value"/>
3131
</entity>
32+
<entity name="CustomCatalogPrices">
33+
<data key="path">tax/calculation/price_includes_tax</data>
34+
<data key="value">1</data>
35+
</entity>
36+
<entity name="CustomDisplayProductPricesInCatalog">
37+
<data key="path">tax/display/type</data>
38+
<data key="value">3</data>
39+
</entity>
40+
<entity name="CatalogPrices">
41+
<data key="path">tax/calculation/price_includes_tax</data>
42+
<data key="value">0</data>
43+
</entity>
44+
<entity name="DisplayProductPricesInCatalog">
45+
<data key="path">tax/display/type</data>
46+
<data key="value">1</data>
47+
</entity>
3248
</entities>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminValidateProductPricesOnTheFrontendWithTierPricingSetupTest">
11+
<annotations>
12+
<features value="Product and tax rule"/>
13+
<stories value="Create product and validate product prices on frontend"/>
14+
<title value="Create product and validate product tier prices on frontend"/>
15+
<description value="Create product and tax rule and validate product tier prices on frontend"/>
16+
<testCaseId value="MC-43283"/>
17+
<severity value="CRITICAL"/>
18+
<group value="mtf_migrated"/>
19+
</annotations>
20+
<before>
21+
<!-- Create category -->
22+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
23+
<!-- Admin Login -->
24+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
25+
<!--Create Product-->
26+
<createData entity="SimpleProduct2" stepKey="createProduct">
27+
<field key="price">100</field>
28+
<requiredEntity createDataKey="createCategory"/>
29+
</createData>
30+
<!-- Create Tax Rate & Rule -->
31+
<createData entity="USFullTaxRate" stepKey="initialTaxRate"/>
32+
<actionGroup ref="AdminCreateTaxRuleActionGroup" stepKey="createTaxRule">
33+
<argument name="taxRate" value="$$initialTaxRate$$"/>
34+
<argument name="taxRule" value="SimpleTaxRule"/>
35+
</actionGroup>
36+
<!-- change configurations -->
37+
<magentoCLI command="config:set {{CustomCatalogPrices.path}} {{CustomCatalogPrices.value}}" stepKey="selectIncludingTax"/>
38+
<magentoCLI command="config:set {{CustomDisplayProductPricesInCatalog.path}} {{CustomDisplayProductPricesInCatalog.value}}" stepKey="selectInclAndExlTax"/>
39+
<magentoCLI command="cron:run --group=index" stepKey="runCronReindex"/>
40+
</before>
41+
<after>
42+
<!-- delete created product -->
43+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
44+
<!-- delete created category -->
45+
<deleteData createDataKey="createCategory" stepKey="deleteCategory1"/>
46+
<!-- delete created Tax Rate & Rule -->
47+
<actionGroup ref="AdminDeleteTaxRule" stepKey="deleteTaxRule">
48+
<argument name="taxRuleCode" value="{{SimpleTaxRule.code}}"/>
49+
</actionGroup>
50+
<deleteData createDataKey="initialTaxRate" stepKey="deleteTaxRate"/>
51+
<!-- Revert back configurations -->
52+
<magentoCLI command="config:set {{CatalogPrices.path}} {{CatalogPrices.value}}" stepKey="setExlTax"/>
53+
<magentoCLI command="config:set {{DisplayProductPricesInCatalog.path}} {{DisplayProductPricesInCatalog.value}}" stepKey="selectExlTax"/>
54+
<magentoCron groups="index" stepKey="reindex"/>
55+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="flushCache">
56+
<argument name="tags" value="full_page"/>
57+
</actionGroup>
58+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
59+
</after>
60+
61+
<!-- Go to product page -->
62+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="GoToProductPage">
63+
<argument name="productUrl" value="$$createProduct.custom_attributes[url_key]$$"/>
64+
</actionGroup>
65+
<waitForPageLoad stepKey="waitForAssertPrices"/>
66+
67+
<!-- Check Incl & Exl Tax prices -->
68+
<see stepKey="seeNewPriceSide" selector="{{StorefrontProductInfoMainSection.includingTaxPrice}}" userInput="$100.00"/>
69+
<see stepKey="seeNewPriceSide1" selector="{{StorefrontProductInfoMainSection.excludingTaxPrice}}" userInput="$90.91"/>
70+
71+
</test>
72+
</tests>

0 commit comments

Comments
 (0)