|
| 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 | + |
| 9 | +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 10 | + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> |
| 11 | + <test name="OnlyXleftNotDisplayedForSimpleProductWithMangeStockAsNoOnTestStockAndMainWebsitesTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Inventory"/> |
| 14 | + <title value="Only X left is not displayed for Simple product with 'Mange Stock' = 'No' on Test stock and Main website"/> |
| 15 | + <stories value="Only X left is not displayed for Simple product with 'Mange Stock' = 'No' on Test stock and Main website"/> |
| 16 | + <description value="Only X left is not displayed for Simple product with 'Mange Stock' = 'No' on Test stock and Main website"/> |
| 17 | + <testCaseId value="AC-6506"/> |
| 18 | + <severity value="CRITICAL"/> |
| 19 | + </annotations> |
| 20 | + <before> |
| 21 | + <!-- Step1: Login as Admin --> |
| 22 | + <actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/> |
| 23 | + |
| 24 | + <!-- Disable all sources and delete any pre-existing stocks --> |
| 25 | + <actionGroup ref="DisableAllSourcesActionGroup" stepKey="DisableAllsources"/> |
| 26 | + <actionGroup ref="AssignWebsiteToStockActionGroup" stepKey="assignMainWebsiteToDefaultStock"> |
| 27 | + <argument name="stockName" value="{{_defaultStock.name}}"/> |
| 28 | + <argument name="websiteName" value="{{_defaultWebsite.name}}"/> |
| 29 | + </actionGroup> |
| 30 | + <magentoCLI stepKey="reindexBefore" command="indexer:reindex"/> |
| 31 | + <magentoCLI stepKey="flushCacheBefore" command="cache:flush"/> |
| 32 | + |
| 33 | + <magentoCLI command="config:set cataloginventory/options/stock_threshold_qty 5" stepKey="setStockThresholdValueTo5"/> |
| 34 | + <magentoCLI command="indexer:reindex" stepKey="reindex1"/> |
| 35 | + <magentoCLI command="cache:flush" stepKey="flushCache1"/> |
| 36 | + </before> |
| 37 | + <after> |
| 38 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 39 | + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> |
| 40 | + <actionGroup ref="DisableSourceActionGroup" stepKey="disableCreatedSource"> |
| 41 | + <argument name="sourceCode" value="$$createSource.source[source_code]$$"/> |
| 42 | + </actionGroup> |
| 43 | + <actionGroup ref="AssignWebsiteToStockActionGroup" stepKey="assignMainWebsiteBackToDefaultStock"> |
| 44 | + <argument name="stockName" value="{{_defaultStock.name}}"/> |
| 45 | + <argument name="websiteName" value="{{_defaultWebsite.name}}"/> |
| 46 | + </actionGroup> |
| 47 | + |
| 48 | + <deleteData createDataKey="createStock" stepKey="deleteStock"/> |
| 49 | + <magentoCLI stepKey="reindexAfter" command="indexer:reindex"/> |
| 50 | + <magentoCLI stepKey="flushCacheAfter" command="cache:flush"/> |
| 51 | + <magentoCLI command="config:set {{CatalogInventoryOptionsOnlyXleftThreshold.path}} {{CatalogInventoryOptionsOnlyXleftThreshold.value}}" stepKey="removedStockThresholdQty"/> |
| 52 | + </after> |
| 53 | + |
| 54 | + <!-- Step2: Create the Subcategory --> |
| 55 | + <createData entity="_defaultCategory" stepKey="createCategory"/> |
| 56 | + |
| 57 | + <!-- Step3: Create the Source and the Stock --> |
| 58 | + <createData entity="BasicMsiStockWithMainWebsite1" stepKey="createStock"/> |
| 59 | + <createData entity="FullSource1" stepKey="createSource"/> |
| 60 | + <createData entity="SourceStockLinked1" stepKey="stockSourceLink"> |
| 61 | + <requiredEntity createDataKey="createSource"/> |
| 62 | + <requiredEntity createDataKey="createStock"/> |
| 63 | + </createData> |
| 64 | + |
| 65 | + <!-- Step8: Create the Simple Product --> |
| 66 | + <createData entity="ApiSimpleProduct" stepKey="createProduct"> |
| 67 | + <requiredEntity createDataKey="createCategory"/> |
| 68 | + </createData> |
| 69 | + |
| 70 | + <!-- Update the product as per the test case --> |
| 71 | + <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForCreatedProduct"> |
| 72 | + <argument name="product" value="$$createProduct$$"/> |
| 73 | + </actionGroup> |
| 74 | + <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProduct"> |
| 75 | + <argument name="product" value="$$createProduct$$"/> |
| 76 | + </actionGroup> |
| 77 | + |
| 78 | + <fillField userInput="10" selector="{{AdminProductFormSection.productPrice}}" stepKey="updatePriceTo10"/> |
| 79 | + <fillField userInput="1" selector="{{AdminProductFormSection.productWeight}}" stepKey="updateWeight"/> |
| 80 | + <conditionalClick selector="{{AdminProductFormSection.unassignSource('Default Source')}}" dependentSelector="{{AdminProductFormSection.unassignSource('Default Source')}}" visible="true" stepKey="unassignDefaultSource"/> |
| 81 | + <click selector="{{AdminProductFormSection.btnAssignSources}}" stepKey="clickAssignSourcesButton"/> |
| 82 | + <waitForElementVisible selector="{{AdminProductFormSection.searchBySource}}" stepKey="waitForSearchSourceToBeVisible"/> |
| 83 | + <fillField userInput="$$createSource.source[source_code]$$" selector="{{AdminProductFormSection.searchBySource}}" stepKey="enterSource"/> |
| 84 | + <click selector="{{AdminProductFormSection.clickSearch}}" stepKey="clickSearchButton"/> |
| 85 | + <waitForElementVisible selector="{{AdminProductFormSection.chkSourceToAssign('$$createSource.source[source_code]$$')}}" stepKey="waitForAssignsourcesToBeVisible"/> |
| 86 | + <checkOption selector="{{AdminProductFormSection.chkSourceToAssign('$$createSource.source[source_code]$$')}}" stepKey="checkTheCreatedSource"/> |
| 87 | + <click selector="{{AdminProductFormSection.btnDoneAssignedSources}}" stepKey="clickOnDoneButton"/> |
| 88 | + <fillField userInput="2" selector="{{AdminProductFormSection.assignedSourcesQty}}" stepKey="setQtyForAssignedSources"/> |
| 89 | + <click selector="{{AdminProductFormSection.save}}" stepKey="clickOnSaveButton"/> |
| 90 | + <see userInput="You saved the product." stepKey="saveSuccessfulForManagestockAsYes"/> |
| 91 | + |
| 92 | + <magentoCLI stepKey="reindexForAssignedSources" command="indexer:reindex"/> |
| 93 | + <magentoCLI stepKey="flushCacheForAssignedSources" command="cache:flush"/> |
| 94 | + |
| 95 | + <!-- Verify with Manage Stock set as Yes for the product --> |
| 96 | + <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage"> |
| 97 | + <argument name="productUrl" value="$createProduct.custom_attributes[url_key]$"/> |
| 98 | + </actionGroup> |
| 99 | + <see selector=".availability.only" userInput="Only 2 left" stepKey="seeCurrentProductQuantity2"/> |
| 100 | + |
| 101 | + <!-- Update the Manage Stock as No for the product --> |
| 102 | + <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForCreatedProductForManageStockAsNo"> |
| 103 | + <argument name="product" value="$$createProduct$$"/> |
| 104 | + </actionGroup> |
| 105 | + <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProductForManageStockAsNo"> |
| 106 | + <argument name="product" value="$$createProduct$$"/> |
| 107 | + </actionGroup> |
| 108 | + <waitForElementVisible selector="{{AdminProductFormSection.btnAdvancedInventory}}" stepKey="waitForAdvancedInventoryToBeVisible"/> |
| 109 | + <click selector="{{AdminProductFormSection.btnAdvancedInventory}}" stepKey="clickOnAdvancedInventoryButton"/> |
| 110 | + <waitForElementVisible selector="{{AdminProductFormSection.checkConfigSettingsAdvancedInventory('use_config_manage_stock')}}" stepKey="waitForAdvancedInventoryPageToBeLoaded"/> |
| 111 | + <uncheckOption selector="{{AdminProductFormSection.checkConfigSettingsAdvancedInventory('use_config_manage_stock')}}" stepKey="uncheckManageStockOption"/> |
| 112 | + <selectOption userInput="No" selector="{{AdminProductFormSection.selectManageStockOption}}" stepKey="selectNoAsManageStock"/> |
| 113 | + <click selector="{{AdminProductFormSection.btnDoneAdvancedInventory}}" stepKey="clickOnAdvancedInventoryDoneButton"/> |
| 114 | + <click selector="{{AdminProductFormSection.save}}" stepKey="clickOnSaveButtonPostSettingManageStockAsNo"/> |
| 115 | + <see userInput="You saved the product." stepKey="saveSuccessfulForManagestockAsNo"/> |
| 116 | + <magentoCLI stepKey="reindexForSettingManagestockAsNo" command="indexer:reindex"/> |
| 117 | + <magentoCLI stepKey="flushCacheForSettingManagestockAsNo" command="cache:flush"/> |
| 118 | + |
| 119 | + <!-- Verify with Manage Stock set as No for the product --> |
| 120 | + <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPageOnStorefrontForManageStockAsNo"> |
| 121 | + <argument name="productUrl" value="$createProduct.custom_attributes[url_key]$"/> |
| 122 | + </actionGroup> |
| 123 | + <dontSee selector=".availability.only" userInput="Only 2 left" stepKey="ShouldNotSeeCurrentProductQuantity"/> |
| 124 | + |
| 125 | + </test> |
| 126 | +</tests> |
0 commit comments