Skip to content

Commit b2e1c2e

Browse files
ACQE-8575: Verify the price including and excluding tax of Recently Viewed Widget
- Created test to assert the tax for a bundle product
1 parent 1d11147 commit b2e1c2e

File tree

3 files changed

+198
-0
lines changed

3 files changed

+198
-0
lines changed

app/code/Magento/Bundle/Test/Mftf/Data/ProductData.xml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,58 @@
157157
<requiredEntity type="custom_attribute">CustomAttributeFixWeight</requiredEntity>
158158
<requiredEntity type="custom_attribute">CustomAttributeFixSku</requiredEntity>
159159
</entity>
160+
<entity name="SpriteYogaStrapsBundle" type="product2">
161+
<data key="name">Set of Sprite Yoga Straps</data>
162+
<data key="sku" unique="suffix">24-WG085-bundle-dynamic</data>
163+
<data key="type_id">bundle</data>
164+
<data key="attribute_set_id">4</data>
165+
<data key="visibility">4</data>
166+
<data key="status">1</data>
167+
<data key="price">52.00</data>
168+
<data key="weight">3.35</data>
169+
<data key="description">Great set of Sprite Yoga Straps for every stretch and hold you need. There are three straps in this set: 6', 8' and 10'.</data>
170+
<data key="short_description">Complete yoga strap set with 6', 8' and 10' straps made from 100% organic cotton.</data>
171+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
172+
<requiredEntity type="custom_attribute">CustomAttributeDynamicPrice</requiredEntity>
173+
<requiredEntity type="custom_attribute">CustomAttributePriceView</requiredEntity>
174+
</entity>
175+
<entity name="SpriteYogaStrap6Foot" type="product">
176+
<data key="name">Sprite Yoga Strap 6 foot</data>
177+
<data key="sku" unique="suffix">24-WG085</data>
178+
<data key="type_id">simple</data>
179+
<data key="attribute_set_id">4</data>
180+
<data key="price">14.00</data>
181+
<data key="weight">1.23</data>
182+
<data key="status">1</data>
183+
<data key="visibility">4</data>
184+
<data key="quantity">100</data>
185+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
186+
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
187+
</entity>
188+
<entity name="SpriteYogaStrap8Foot" type="product">
189+
<data key="name">Sprite Yoga Strap 8 foot</data>
190+
<data key="sku" unique="suffix">24-WG086</data>
191+
<data key="type_id">simple</data>
192+
<data key="attribute_set_id">4</data>
193+
<data key="price">17.00</data>
194+
<data key="weight">1.00</data>
195+
<data key="status">1</data>
196+
<data key="visibility">4</data>
197+
<data key="quantity">100</data>
198+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
199+
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
200+
</entity>
201+
<entity name="SpriteYogaStrap10Foot" type="product">
202+
<data key="name">Sprite Yoga Strap 10 foot</data>
203+
<data key="sku" unique="suffix">24-WG087</data>
204+
<data key="type_id">simple</data>
205+
<data key="attribute_set_id">4</data>
206+
<data key="price">21.00</data>
207+
<data key="weight">1.00</data>
208+
<data key="status">1</data>
209+
<data key="visibility">4</data>
210+
<data key="quantity">100</data>
211+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
212+
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
213+
</entity>
160214
</entities>

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,12 @@
204204
<data key="tax_postcode">*</data>
205205
<data key="rate">20</data>
206206
</entity>
207+
<entity name="US_All_Rate_20" type="taxRate">
208+
<data key="code" unique="suffix">US All States 20%</data>
209+
<data key="tax_country_id">US</data>
210+
<data key="tax_region_id">0</data>
211+
<data key="tax_postcode">*</data>
212+
<data key="rate">20</data>
213+
<data key="zip_is_range">0</data>
214+
</entity>
207215
</entities>
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
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="StorefrontVerifyRecentlyViewedWidgetTaxPricesTest">
12+
<annotations>
13+
<features value="Tax"/>
14+
<stories value="Recently Viewed Widget Tax Price Display"/>
15+
<title value="Verify price including and excluding tax in Recently Viewed Widget"/>
16+
<description value="Verify that Recently Viewed Widget displays correct prices including and excluding tax based on tax configuration"/>
17+
<severity value="AVERAGE"/>
18+
<testCaseId value="AC-8327"/>
19+
<group value="Tax"/>
20+
</annotations>
21+
<before>
22+
<!-- Pre-Condition 1:- Create Bundle Product -->
23+
<createData entity="_defaultCategory" stepKey="category"/>
24+
<createData entity="SpriteYogaStrap6Foot" stepKey="createYogaStrap6Foot">
25+
<requiredEntity createDataKey="category"/>
26+
</createData>
27+
<createData entity="SpriteYogaStrap8Foot" stepKey="createYogaStrap8Foot">
28+
<requiredEntity createDataKey="category"/>
29+
</createData>
30+
<createData entity="SpriteYogaStrap10Foot" stepKey="createYogaStrap10Foot">
31+
<requiredEntity createDataKey="category"/>
32+
</createData>
33+
<createData entity="SpriteYogaStrapsBundle" stepKey="createSpriteYogaStrapsBundle">
34+
<requiredEntity createDataKey="category"/>
35+
</createData>
36+
<createData entity="MultipleSelectOption" stepKey="createBundleOption1">
37+
<requiredEntity createDataKey="createSpriteYogaStrapsBundle"/>
38+
<field key="title">Choose Your Yoga Straps</field>
39+
<field key="required">true</field>
40+
<field key="type">multi</field>
41+
</createData>
42+
<createData entity="ApiBundleLink" stepKey="linkYogaStrap6Foot">
43+
<requiredEntity createDataKey="createSpriteYogaStrapsBundle"/>
44+
<requiredEntity createDataKey="createBundleOption1"/>
45+
<requiredEntity createDataKey="createYogaStrap6Foot"/>
46+
<field key="qty">1</field>
47+
<field key="is_default">true</field>
48+
<field key="price_type">0</field>
49+
</createData>
50+
<createData entity="ApiBundleLink" stepKey="linkYogaStrap8Foot">
51+
<requiredEntity createDataKey="createSpriteYogaStrapsBundle"/>
52+
<requiredEntity createDataKey="createBundleOption1"/>
53+
<requiredEntity createDataKey="createYogaStrap8Foot"/>
54+
<field key="qty">1</field>
55+
<field key="is_default">false</field>
56+
<field key="price_type">0</field>
57+
</createData>
58+
<createData entity="ApiBundleLink" stepKey="linkYogaStrap10Foot">
59+
<requiredEntity createDataKey="createSpriteYogaStrapsBundle"/>
60+
<requiredEntity createDataKey="createBundleOption1"/>
61+
<requiredEntity createDataKey="createYogaStrap10Foot"/>
62+
<field key="qty">1</field>
63+
<field key="is_default">false</field>
64+
<field key="price_type">0</field>
65+
</createData>
66+
<!-- Pre-Condition 2:- Taxable Goods has Tax Class configured (20%) -->
67+
<createData entity="US_All_Rate_20" stepKey="createUSAllTaxRate20"/>
68+
<!-- Step 1:- Login as admin -->
69+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
70+
<actionGroup ref="AdminCreateTaxRuleActionGroup" stepKey="createDefaultTaxRule">
71+
<argument name="taxRate" value="$$createUSAllTaxRate20$$"/>
72+
<argument name="taxRule" value="defaultTaxRule"/>
73+
</actionGroup>
74+
<!-- Pre-Condition 3:- Price Display is set to show both prices including and excluding from Stores >> Configuration >> Sales >> Tax >> Price Display Settings. -->
75+
<magentoCLI command="config:set {{CustomDisplayProductPricesInCatalog.path}} {{CustomDisplayProductPricesInCatalog.value}}" stepKey="setPriceDisplayToBothPrices"/>
76+
</before>
77+
<after>
78+
<magentoCLI command="config:set tax/display/type 1" stepKey="resetTaxDisplayToDefault"/>
79+
<deleteData createDataKey="createSpriteYogaStrapsBundle" stepKey="deleteBundleProduct"/>
80+
<deleteData createDataKey="createYogaStrap6Foot" stepKey="deleteYogaStrap6Foot"/>
81+
<deleteData createDataKey="createYogaStrap8Foot" stepKey="deleteYogaStrap8Foot"/>
82+
<deleteData createDataKey="createYogaStrap10Foot" stepKey="deleteYogaStrap10Foot"/>
83+
<actionGroup ref="AdminDeleteTaxRule" stepKey="deleteTaxRule">
84+
<argument name="taxRuleCode" value="{{defaultTaxRule.code}}"/>
85+
</actionGroup>
86+
<deleteData createDataKey="createUSAllTaxRate20" stepKey="deleteTaxRate"/>
87+
<deleteData createDataKey="category" stepKey="deleteCategory"/>
88+
<actionGroup ref="AdminEditCMSPageContentActionGroup" stepKey="clearRecentlyViewedWidgetsFromCMSContent">
89+
<argument name="content" value="{{CmsHomePageContent.content}}"/>
90+
<argument name="pageId" value="{{CmsHomePageContent.page_id}}"/>
91+
</actionGroup>
92+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
93+
</after>
94+
<!-- Step 2:- Create "Recently Viewed Widget" and add it to the home page -->
95+
<actionGroup ref="AdminOpenCmsPageActionGroup" stepKey="navigateToEditHomePage">
96+
<argument name="page_id" value="{{CmsHomePageContent.page_id}}"/>
97+
</actionGroup>
98+
<actionGroup ref="AdminInsertRecentlyViewedWidgetActionGroup" stepKey="insertRecentlyViewedWidget">
99+
<argument name="attributeSelector1" value="show_attributes"/>
100+
<argument name="attributeSelector2" value="show_buttons"/>
101+
<argument name="productAttributeSection1" value="1"/>
102+
<argument name="productAttributeSection2" value="4"/>
103+
<argument name="buttonToShowSection2" value="3"/>
104+
</actionGroup>
105+
<!-- Step 3:- Create "Catalog Product List Widget" and add it to the home page (for comparison), limit the visible SKU to created bundle product sku -->
106+
<conditionalClick selector="{{CmsNewPagePageActionsSection.contentSectionName}}" dependentSelector="{{CmsNewPagePageActionsSection.showHideEditor}}" visible="false" stepKey="expandContentSectionIfNotVisible"/>
107+
<waitForPageLoad time="30" stepKey="waitForPageLoadContentSection"/>
108+
<conditionalClick selector="{{CmsNewPagePageActionsSection.showHideEditor}}" dependentSelector="{{CatalogWidgetSection.insertWidgetButton}}" visible="false" stepKey="clickNextShowHideEditorIfVisible"/>
109+
<actionGroup ref="AdminInsertWidgetToCmsPageContentActionGroup" stepKey="insertCatalogProductsListWidget">
110+
<argument name="widgetType" value="Catalog Products List"/>
111+
</actionGroup>
112+
<actionGroup ref="AdminFillCatalogProductsListWidgetSkuActionGroup" stepKey="addSkuCondition">
113+
<argument name="sku" value="$$createSpriteYogaStrapsBundle.sku$$"/>
114+
</actionGroup>
115+
<actionGroup ref="AdminClickInsertWidgetActionGroup" stepKey="insertWidget"/>
116+
<actionGroup ref="AdminSaveAndContinueEditCmsPageActionGroup" stepKey="saveHomePageAfterCatalogProductListWidgetCreation"/>
117+
<!-- Step 4:- Search for "Set of Sprite Yoga Straps" product (the sample grouped product) and add to the cart -->
118+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
119+
<argument name="indices" value=""/>
120+
</actionGroup>
121+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="flushCache">
122+
<argument name="tags" value="full_page"/>
123+
</actionGroup>
124+
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="goToHomepage"/>
125+
<waitForElementVisible selector="{{StorefrontWidgetsSection.widgetProductsGrid}}" stepKey="waitForProductListWidget"/>
126+
<click selector="{{StorefrontWidgetsSection.widgetProductsGrid}} .product-item-link[title*='Set of Sprite Yoga Straps']" stepKey="clickOnBundleProductFromWidget"/>
127+
<actionGroup ref="StorefrontAddBundleProductFromProductToCartActionGroup" stepKey="addBundleProductToCart">
128+
<argument name="productName" value="Set of Sprite Yoga Straps"/>
129+
</actionGroup>
130+
<!-- Step 4 Result:- Verify the price of the "Set of Sprite Yoga Straps" both including and excluding price should be displayed correctly.(including : 15.16 and excluding 14) -->
131+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.includingTaxPrice}}" stepKey="waitForIncludingTaxPrice"/>
132+
<waitForText selector="{{StorefrontProductInfoMainSection.includingTaxPrice}}" userInput="$16.80" stepKey="seeIncludingTaxPrice"/>
133+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.excludingTaxPrice}}" stepKey="waitForExcludingTaxPrice"/>
134+
<waitForText selector="{{StorefrontProductInfoMainSection.excludingTaxPrice}}" userInput="$14.00" stepKey="seeExcludingTaxPrice"/>
135+
</test>
136+
</tests>

0 commit comments

Comments
 (0)