Skip to content

Commit 5388808

Browse files
committed
ACP2E-45: Tiered pricing tax always shows including tax
- Added the test coverage.
1 parent e665b5f commit 5388808

File tree

3 files changed

+125
-1
lines changed

3 files changed

+125
-1
lines changed

app/code/Magento/Catalog/Pricing/Price/TierPrice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class TierPrice extends AbstractPrice implements TierPriceInterface, BasePricePr
3333
/**
3434
* Price type tier
3535
*/
36-
const PRICE_CODE = 'tier_price';
36+
private const PRICE_CODE = 'tier_price';
3737

3838
/**
3939
* @var Session

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@
2424
<element name="attributeSelectByAttributeID" type="select" selector="//div[@class='fieldset']//div[//span[text()='{{attribute_code}}']]//select" parameterized="true"/>
2525
<element name="attributeOptionByAttributeID" type="select" selector="//div[@class='fieldset']//div[//span[text()='{{attribute_code}}']]//option[text()='{{optionName}}']" parameterized="true"/>
2626
<element name="tierPriceExcludingPrice" type="text" selector=".item [data-label='Excl. Tax']"/>
27+
<element name="tierPriceContainsExcludingTax" type="text" selector=".item .price"/>
2728
</section>
2829
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
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="StorefrontConfigurableProductWithTierPriceWithExcludingTaxTest">
11+
<annotations>
12+
<features value="ConfigurableProduct"/>
13+
<stories value="Tiered pricing tax always shows including tax"/>
14+
<title value="Store front to validate the tier price with excluding tax for configurable product"/>
15+
<description value="Store front to validate the tier price with excluding tax for configurable product"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="AC-2386"/>
18+
<useCaseId value="ACP2E-45"/>
19+
<group value="ConfigurableProduct"/>
20+
</annotations>
21+
<before>
22+
<createData entity="productAttributeWithTwoOptionsNotVisible" stepKey="createConfigProductAttribute"/>
23+
<createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOptionOne">
24+
<requiredEntity createDataKey="createConfigProductAttribute"/>
25+
</createData>
26+
<createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOptionTwo">
27+
<requiredEntity createDataKey="createConfigProductAttribute"/>
28+
</createData>
29+
<createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet">
30+
<requiredEntity createDataKey="createConfigProductAttribute"/>
31+
</createData>
32+
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOptionOne">
33+
<requiredEntity createDataKey="createConfigProductAttribute"/>
34+
</getData>
35+
<getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOptionTwo">
36+
<requiredEntity createDataKey="createConfigProductAttribute"/>
37+
</getData>
38+
39+
<createData entity="ApiSimpleOne" stepKey="createFirstSimpleProduct">
40+
<requiredEntity createDataKey="createConfigProductAttribute"/>
41+
<requiredEntity createDataKey="getConfigAttributeOptionOne"/>
42+
</createData>
43+
<createData entity="ApiSimpleTwo" stepKey="createSecondSimpleProduct">
44+
<requiredEntity createDataKey="createConfigProductAttribute"/>
45+
<requiredEntity createDataKey="getConfigAttributeOptionTwo"/>
46+
</createData>
47+
48+
<createData entity="tierProductPrice" stepKey="addTierPrice">
49+
<requiredEntity createDataKey="createFirstSimpleProduct" />
50+
</createData>
51+
52+
<createData entity="CustomerEntityOne" stepKey="createCustomer"/>
53+
<createData entity="SimpleTaxRule" stepKey="createTaxRule"/>
54+
55+
<magentoCLI command="config:set tax/calculation/based_on origin" stepKey="setTaxCalculationBasedOn"/>
56+
<magentoCLI command="config:set tax/calculation/price_includes_tax 1" stepKey="setCatalogPrice"/>
57+
<magentoCLI command="config:set tax/display/type 1" stepKey="enableShowExcludingTax"/>
58+
59+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
60+
</before>
61+
<after>
62+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogOut"/>
63+
<actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct">
64+
<argument name="product" value="ApiConfigurableProduct"/>
65+
</actionGroup>
66+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
67+
68+
<deleteData createDataKey="createFirstSimpleProduct" stepKey="deleteFirstSimpleProduct"/>
69+
<deleteData createDataKey="createSecondSimpleProduct" stepKey="deleteSecondSimpleProduct"/>
70+
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
71+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
72+
<deleteData createDataKey="createTaxRule" stepKey="deleteTaxRule"/>
73+
74+
<magentoCLI command="config:set tax/calculation/based_on shipping" stepKey="unSetTaxCalculationBasedOn"/>
75+
<magentoCLI command="config:set tax/calculation/price_includes_tax 0" stepKey="unsetCatalogPrice"/>
76+
<magentoCLI command="config:set tax/display/type 0" stepKey="disableShowExcludingTax"/>
77+
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
78+
</after>
79+
80+
<!-- Create configurable product -->
81+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="amOnProductGridPage"/>
82+
<actionGroup ref="GoToCreateProductPageActionGroup" stepKey="createConfigurableProduct">
83+
<argument name="product" value="ApiConfigurableProduct"/>
84+
</actionGroup>
85+
86+
<!-- Fill configurable product values -->
87+
<actionGroup ref="FillMainProductFormActionGroup" stepKey="fillConfigurableProductValues">
88+
<argument name="product" value="ApiConfigurableProduct"/>
89+
</actionGroup>
90+
91+
<!-- Create product configurations and add attribute and select all options -->
92+
<actionGroup ref="GenerateConfigurationsByAttributeCodeActionGroup" stepKey="generateConfigurationsByAttributeCode">
93+
<argument name="attributeCode" value="$$createConfigProductAttribute.attribute_code$$"/>
94+
</actionGroup>
95+
96+
<!-- Add associated products to configurations grid -->
97+
<actionGroup ref="AddProductToConfigurationsGridActionGroup" stepKey="addFirstSimpleProduct">
98+
<argument name="sku" value="$$createFirstSimpleProduct.sku$$"/>
99+
<argument name="name" value="$$createConfigProductAttributeOptionOne.option[store_labels][1][label]$$"/>
100+
</actionGroup>
101+
<actionGroup ref="AddProductToConfigurationsGridActionGroup" stepKey="addSecondSimpleProduct">
102+
<argument name="sku" value="$$createSecondSimpleProduct.sku$$"/>
103+
<argument name="name" value="$$createConfigProductAttributeOptionTwo.option[store_labels][1][label]$$"/>
104+
</actionGroup>
105+
106+
<!-- Save configurable product -->
107+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveConfigurableProduct"/>
108+
109+
<!--Login customer on storefront-->
110+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginCustomer">
111+
<argument name="Customer" value="$$createCustomer$$" />
112+
</actionGroup>
113+
114+
<!-- Assert product tier price on product page -->
115+
<amOnPage url="{{ApiConfigurableProduct.urlKey}}.html" stepKey="amOnProductPage"/>
116+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
117+
<selectOption userInput="$$createConfigProductAttributeOptionOne.option[store_labels][1][label]$$"
118+
selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}"
119+
stepKey="selectOption"/>
120+
121+
<see stepKey="seeTierPriceContainsExcludingTax" selector="{{StorefrontProductInfoMainSection.tierPriceContainsExcludingTax}}" userInput="$83.14"/>
122+
</test>
123+
</tests>

0 commit comments

Comments
 (0)