Skip to content

Commit 19bfad9

Browse files
committed
ACQE-8835: Validate price on frontend product search and product details pages.
- New test case added.
1 parent f6aa682 commit 19bfad9

File tree

2 files changed

+161
-0
lines changed

2 files changed

+161
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2025 Adobe
5+
* All Rights Reserved.
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="AdminSetCatalogPriceScopeCliActionGroup">
12+
<annotations>
13+
<description>Set catalog price scope to global or website based on argument</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="scopeValue" type="string"/>
17+
</arguments>
18+
<magentoCLI command="config:set catalog/price/scope {{scopeValue}}" stepKey="setCatalogPriceScope"/>
19+
</actionGroup>
20+
</actionGroups>
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2025 Adobe
5+
* All Rights Reserved.
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="StorefrontValidatePriceTest">
11+
<annotations>
12+
<features value="Catalog"/>
13+
<stories value="Validate Price in frontend product search and product details pages"/>
14+
<title value="Product price validation"/>
15+
<description value=" This test case verifies price in frontend product search and product details pages based on catalog price scope"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="AC-3183"/>
18+
<group value="catalog"/>
19+
</annotations>
20+
<before>
21+
<!-- Precondition 2:Create Customer with allowed remote shopping assistance-->
22+
<createData entity="Simple_US_Customer_Assistance_Allowed" stepKey="createCustomer"/>
23+
<!-- Precondition 4:Create Simple Product -->
24+
<createData entity="_defaultProduct" stepKey="createProduct">
25+
<field key="price">100</field>
26+
</createData>
27+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin1"/>
28+
<!-- Precondition 1:Create website-->
29+
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createWebsite">
30+
<argument name="newWebsiteName" value="{{customWebsite.name}}"/>
31+
<argument name="websiteCode" value="{{customWebsite.code}}"/>
32+
</actionGroup>
33+
<!-- Create second store -->
34+
<actionGroup ref="CreateCustomStoreActionGroup" stepKey="createCustomStore">
35+
<argument name="website" value="{{customWebsite.name}}"/>
36+
<argument name="store" value="{{customStoreGroup.name}}"/>
37+
<argument name="rootCategory" value="Default Category"/>
38+
</actionGroup>
39+
<!-- Create second store view -->
40+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createCustomStoreView">
41+
<argument name="StoreGroup" value="customStoreGroup"/>
42+
<argument name="customStore" value="customStoreEN"/>
43+
</actionGroup>
44+
<!--Open customer edit page-->
45+
<actionGroup ref="AdminOpenCustomerEditPageActionGroup" stepKey="openCustomerEditPage">
46+
<argument name="customerId" value="$createCustomer.id$"/>
47+
</actionGroup>
48+
<!--Navigate to "Account Information" tab-->
49+
<actionGroup ref="AdminOpenAccountInformationTabFromCustomerEditPageActionGroup" stepKey="openAccountInformationEditPage"/>
50+
<!-- Precondition 3:Assign customer to custom website-->
51+
<actionGroup ref="AdminUpdateCustomerWebsiteInCustomerInformationPageActionGroup" stepKey="updateCustomerWebsite">
52+
<argument name="websiteName" value="{{customWebsite.name}}"/>
53+
</actionGroup>
54+
<!--Verify that changes are saved successfully-->
55+
<actionGroup ref="AdminSaveCustomerAndAssertSuccessMessage" stepKey="assertThatChangesAreSavedSuccessfully"/>
56+
</before>
57+
<after>
58+
<!-- Logout from customer, delete product, customer, website -->
59+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
60+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
61+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite">
62+
<argument name="websiteName" value="{{customWebsite.name}}"/>
63+
</actionGroup>
64+
</after>
65+
<!-- Step-1: Set catalog price scope to website -->
66+
<actionGroup ref="AdminSetCatalogPriceScopeCliActionGroup" stepKey="setScopeWebsite">
67+
<argument name="scopeValue" value="1" />
68+
</actionGroup>
69+
<!-- Step 2: Reindex and cache clear -->
70+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
71+
<argument name="indices" value=""/>
72+
</actionGroup>
73+
<actionGroup ref="CliCacheFlushActionGroup" stepKey="cleanCache">
74+
<argument name="tags" value=""/>
75+
</actionGroup>
76+
<!-- Step 3: Open created product and assign to website-->
77+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openProductEdit">
78+
<argument name="productId" value="$createProduct.id$"/>
79+
</actionGroup>
80+
<actionGroup ref="AdminAssignProductInWebsiteActionGroup" stepKey="assignProductToSecondWebsite">
81+
<argument name="website" value="{{customWebsite.name}}"/>
82+
</actionGroup>
83+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveTheProduct"/>
84+
<!-- Step 4: Edit product and change the price in default scope-->
85+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openTheProductEdit">
86+
<argument name="productId" value="$createProduct.id$"/>
87+
</actionGroup>
88+
<actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="SwitchDefaultStoreView">
89+
<argument name="storeViewName" value="'Default Store View'"/>
90+
</actionGroup>
91+
<waitForElementVisible selector="{{AdminProductFormSection.productPrice}}" stepKey="waitForProductPriceField"/>
92+
<uncheckOption selector="{{AdminProductFormSection.productPriceUseDefault}}" stepKey="uncheckPriceDefaultValue"/>
93+
<fillField selector="{{AdminProductFormSection.productPrice}}" userInput="150" stepKey="fillSimpleProductPrice"/>
94+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductPrice"/>
95+
<!-- Step 5: Edit product and change the price in custom website-->
96+
<actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="changeScopeToStoreView2">
97+
<argument name="storeViewName" value="{{customStoreEN.name}}"/>
98+
</actionGroup>
99+
<waitForElementVisible selector="{{AdminProductFormSection.productPrice}}" stepKey="waitForTheProductPriceField"/>
100+
<uncheckOption selector="{{AdminProductFormSection.productPriceUseDefault}}" stepKey="uncheckThePriceDefaultValue"/>
101+
<fillField selector="{{AdminProductFormSection.productPrice}}" userInput="200" stepKey="fillTheSimpleProductPrice"/>
102+
<!--Save product-->
103+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
104+
<!--Step6: From admin login as customer to storefront and verify website scope product price is displayed in catalog search results page and product details page -->
105+
<actionGroup ref="AdminLoginAsCustomerLoginFromCustomerPageActionGroup"
106+
stepKey="loginAsCustomerFromCustomerPage">
107+
<argument name="customerId" value="$$createCustomer.id$$"/>
108+
</actionGroup>
109+
<actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchByProductName">
110+
<argument name="phrase" value="$createProduct.name$"/>
111+
</actionGroup>
112+
<waitForPageLoad stepKey="waitForSearchResultsPage" />
113+
<waitForText selector="{{StorefrontCategoryMainSection.productPrice}}" userInput="$200.00" stepKey="seeWebsiteScopeProductPriceInSearchResultsPage"/>
114+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage">
115+
<argument name="productUrl" value="$createProduct.custom_attributes[url_key]$"/>
116+
</actionGroup>
117+
<waitForText userInput="$200.00" selector="{{StorefrontProductInfoMainSection.price}}" stepKey="seeWebsiteScopeProductPrice"/>
118+
<!-- Step 7: Set catalog price scope to website -->
119+
<actionGroup ref="AdminSetCatalogPriceScopeCliActionGroup" stepKey="setScopeGlobal">
120+
<argument name="scopeValue" value="0" />
121+
</actionGroup>
122+
<!-- Step 8: Reindex and cache clear -->
123+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindexing">
124+
<argument name="indices" value=""/>
125+
</actionGroup>
126+
<actionGroup ref="CliCacheFlushActionGroup" stepKey="cacheClean">
127+
<argument name="tags" value=""/>
128+
</actionGroup>
129+
<!--Step 9: Login as customer to storefront and verify global scope product price is displayed in catalog search results page and product details page -->
130+
<actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchByProductName">
131+
<argument name="phrase" value="$createProduct.name$"/>
132+
</actionGroup>
133+
<waitForPageLoad stepKey="waitSearchResult" />
134+
<waitForText selector="{{StorefrontCategoryMainSection.productPrice}}" userInput="$100.00" stepKey="seeGlobalPrice"/>
135+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openTheProductPage">
136+
<argument name="productUrl" value="$createProduct.custom_attributes[url_key]$"/>
137+
</actionGroup>
138+
<waitForPageLoad stepKey="waitForTheProductPageToOpen"/>
139+
<waitForText userInput="$100.00" selector="{{StorefrontProductInfoMainSection.price}}" stepKey="seeTheGlobalPrice"/>
140+
</test>
141+
</tests>

0 commit comments

Comments
 (0)