Skip to content

Commit ee9d85f

Browse files
committed
ACQE-8096: Admin set visibility of Out of Stock products In Storefront
- Added new test file
1 parent d253a44 commit ee9d85f

File tree

1 file changed

+124
-0
lines changed

1 file changed

+124
-0
lines changed
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2025 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="StorefrontVisibilityForOutOfStockProductsTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="Admin manage out Of stock products In Storefront"/>
15+
<title value="Visibility of Out of Stock products In Storefront"/>
16+
<description value="Verify visibility of products in storefront based Display Out of Stock Products configuration"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="AC-5301"/>
19+
</annotations>
20+
<before>
21+
<!--Step 1 & 2 : Create Category-->
22+
<createData entity="CategoryB" stepKey="createCategory"/>
23+
<!--Create 4 Simple Product-->
24+
<createData entity="SimpleProduct" stepKey="simpleProduct1">
25+
<requiredEntity createDataKey="createCategory"/>
26+
<field key="quantity">100</field>
27+
</createData>
28+
<createData entity="SimpleProduct" stepKey="simpleProduct2">
29+
<requiredEntity createDataKey="createCategory"/>
30+
<field key="quantity">100</field>
31+
</createData>
32+
<createData entity="SimpleProduct" stepKey="simpleProduct3">
33+
<requiredEntity createDataKey="createCategory"/>
34+
</createData>
35+
<createData entity="SimpleProduct" stepKey="simpleProduct4">
36+
<requiredEntity createDataKey="createCategory"/>
37+
</createData>
38+
<actionGroup ref="AdminLoginActionGroup" stepKey="login"/>
39+
<!--Set simple product 2 out of stock-->
40+
<amOnPage url="{{AdminProductEditPage.url($$simpleProduct2.id$$)}}" stepKey="openSecondProductEditPageToMakeProductOutOfStock"/>
41+
<selectOption selector="{{AdminProductFormSection.stockStatus}}" userInput="{{UpdateAttributeQtyAndStockToOutOfStock.stockAvailability}}" stepKey="setProductToOutOfStock"/>
42+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
43+
<!--Update simple product 3 quantity to zero -->
44+
<amOnPage url="{{AdminProductEditPage.url($$simpleProduct3.id$$)}}" stepKey="openThirdProductEditPageToUpdateProductQuantity"/>
45+
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="0" stepKey="updateSimpleProduct3Qty"/>
46+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveThirdProduct"/>
47+
<!--Update simple product 4 quantity to -100 -->
48+
<amOnPage url="{{AdminProductEditPage.url($$simpleProduct4.id$$)}}" stepKey="openFourthProductEditPageToUpdateProductQuantity"/>
49+
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="-100" stepKey="updateSimpleProduct4Qty"/>
50+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveFourthProduct"/>
51+
</before>
52+
<after>
53+
<!-- Delete created entity -->
54+
<deleteData createDataKey="simpleProduct1" stepKey="deleteFirstProduct"/>
55+
<deleteData createDataKey="simpleProduct2" stepKey="deleteSecondProduct"/>
56+
<deleteData createDataKey="simpleProduct3" stepKey="deleteThirdProduct"/>
57+
<deleteData createDataKey="simpleProduct4" stepKey="deleteFourthProduct"/>
58+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
59+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
60+
</after>
61+
<!-- Step 3 & 4: Stores - Configuration - Catalog - Inventory - Stock options - Enable display out of stock products to yes -->
62+
<magentoCLI command="config:set {{CatalogInventoryOptionsShowOutOfStockEnable.path}} {{CatalogInventoryOptionsShowOutOfStockEnable.value}}" stepKey="setConfigShowOutOfStockTrue"/>
63+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="runIndexCronJobs">
64+
<argument name="indices" value=""/>
65+
</actionGroup>
66+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanInvalidatedCaches">
67+
<argument name="tags" value="config full_page"/>
68+
</actionGroup>
69+
<!-- Step 5: Go to Storefront. Open Category with created products and verify all the products is visible -->
70+
<actionGroup ref="GoToStorefrontCategoryPageByParametersActionGroup" stepKey="GoToStorefrontCategoryPage">
71+
<argument name="category" value="$$createCategory.custom_attributes[url_key]$$"/>
72+
<argument name="mode" value="list"/>
73+
<argument name="numOfProductsPerPage" value="10"/>
74+
<argument name="sortBy" value="price"/>
75+
<argument name="sort" value="desc"/>
76+
</actionGroup>
77+
<waitForText userInput="$$simpleProduct1.name$$" selector="{{StorefrontCategoryMainSection.lineProductName('1')}}" stepKey="seeFirstProductIsVisibleInStorefront"/>
78+
<waitForText userInput="$$simpleProduct2.name$$" selector="{{StorefrontCategoryMainSection.lineProductName('2')}}" stepKey="seeSecondProductIsVisibleInStorefront"/>
79+
<waitForText userInput="$$simpleProduct3.name$$" selector="{{StorefrontCategoryMainSection.lineProductName('3')}}" stepKey="seeThirdProductIsVisibleInStorefront"/>
80+
<waitForText userInput="$$simpleProduct4.name$$" selector="{{StorefrontCategoryMainSection.lineProductName('4')}}" stepKey="seeFourthProductIsVisibleInStorefront"/>
81+
<!-- Step 6 & 7: Stores - Configuration - Catalog - Inventory - Stock options - Enable display out of stock products to NO -->
82+
<magentoCLI command="config:set {{CatalogInventoryOptionsShowOutOfStockDisable.path}} {{CatalogInventoryOptionsShowOutOfStockDisable.value}}" stepKey="setConfigShowOutOfStockFalse"/>
83+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanInvalidatedCachesAgain">
84+
<argument name="tags" value="config full_page"/>
85+
</actionGroup>
86+
<!-- Step 8: Go to Storefront. Open Category with created products and verify only one product is visible in storefront -->
87+
<actionGroup ref="GoToStorefrontCategoryPageByParametersActionGroup" stepKey="GoToStorefrontCategoryPageAgain">
88+
<argument name="category" value="$$createCategory.custom_attributes[url_key]$$"/>
89+
<argument name="mode" value="list"/>
90+
<argument name="numOfProductsPerPage" value="10"/>
91+
<argument name="sortBy" value="price"/>
92+
<argument name="sort" value="desc"/>
93+
</actionGroup>
94+
<waitForText userInput="$$simpleProduct1.name$$" selector="{{StorefrontCategoryMainSection.lineProductName('1')}}" stepKey="verifyOnlyFirstProductIsVisibleInStoreFront"/>
95+
<waitForElementNotVisible selector="{{StorefrontCategoryMainSection.lineProductName('2')}}" stepKey="seeSecondProductIsNotVisibleInStorefront"/>
96+
<waitForElementNotVisible selector="{{StorefrontCategoryMainSection.lineProductName('3')}}" stepKey="seeThirdProductIsNotVisibleInStorefront"/>
97+
<waitForElementNotVisible selector="{{StorefrontCategoryMainSection.lineProductName('4')}}" stepKey="seeFourthProductIsNotVisibleInStorefront"/>
98+
<!-- Step 9 & 10: Navigate to catalog product page in admin and update stock status and quantity -->
99+
<!--Set simple product 2 In stock-->
100+
<amOnPage url="{{AdminProductEditPage.url($$simpleProduct2.id$$)}}" stepKey="openSecondProductEditPageToMakeProductInStock"/>
101+
<selectOption selector="{{AdminProductFormSection.stockStatus}}" userInput="{{UpdateAttributeQtyAndStockToInStock.stockAvailability}}" stepKey="setProductToInStock"/>
102+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductAfterChangingStockStatus"/>
103+
<!--Update simple product 3 quantity to 1-->
104+
<amOnPage url="{{AdminProductEditPage.url($$simpleProduct3.id$$)}}" stepKey="openThirdProductEditPageToUpdateQty"/>
105+
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="1" stepKey="updateSimpleProduct3Qty"/>
106+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductAfterUpdatingQuantity"/>
107+
<!--Update simple product 4 quantity to 100-->
108+
<amOnPage url="{{AdminProductEditPage.url($$simpleProduct4.id$$)}}" stepKey="openFourthProductEditPageToUpdateQty"/>
109+
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="100" stepKey="updateSimpleProduct4Qty"/>
110+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct4AfterUpdatingQuantity"/>
111+
<!-- Step 11: Go to Storefront. Open Category with created product and verify all the products is visible-->
112+
<actionGroup ref="GoToStorefrontCategoryPageByParametersActionGroup" stepKey="GoToStorefrontCategoryPageAgainToVerifyAllProductVisible">
113+
<argument name="category" value="$$createCategory.custom_attributes[url_key]$$"/>
114+
<argument name="mode" value="list"/>
115+
<argument name="numOfProductsPerPage" value="10"/>
116+
<argument name="sortBy" value="price"/>
117+
<argument name="sort" value="desc"/>
118+
</actionGroup>
119+
<waitForText userInput="$$simpleProduct1.name$$" selector="{{StorefrontCategoryMainSection.lineProductName('1')}}" stepKey="seeFirstProductIsVisibleInStorefrontAgain"/>
120+
<waitForText userInput="$$simpleProduct2.name$$" selector="{{StorefrontCategoryMainSection.lineProductName('2')}}" stepKey="seeSecondProductIsVisibleInStorefrontAgain"/>
121+
<waitForText userInput="$$simpleProduct3.name$$" selector="{{StorefrontCategoryMainSection.lineProductName('3')}}" stepKey="seeThirdProductIsVisibleInStorefrontAgain"/>
122+
<waitForText userInput="$$simpleProduct4.name$$" selector="{{StorefrontCategoryMainSection.lineProductName('4')}}" stepKey="seeFourthProductIsVisibleInStorefrontAgain"/>
123+
</test>
124+
</tests>

0 commit comments

Comments
 (0)