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