Skip to content

Commit ca60fb6

Browse files
Manoranjan.PrakashManoranjan.Prakash
authored andcommitted
ACQE-4425: [Test case Automation]OnlyXleftNotDisplayedForSimpleProductWithMangeStockAsNoOnTestStockAndMainWebsitesTest code review implementation - removed all the unwanted spaces from the test case and optimised the usage of indexing
1 parent 7d5df7c commit ca60fb6

File tree

1 file changed

+8
-21
lines changed

1 file changed

+8
-21
lines changed

app/code/Magento/Catalog/Test/Mftf/Test/OnlyXleftNotDisplayedForSimpleProductWithMangeStockAsNoOnTestStockAndMainWebsitesTest.xml

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,15 @@
2020
<before>
2121
<!-- Step1: Login as Admin -->
2222
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>
23-
2423
<!-- Disable all sources and delete any pre-existing stocks -->
2524
<actionGroup ref="DisableAllSourcesActionGroup" stepKey="DisableAllSources"/>
2625
<actionGroup ref="AssignWebsiteToStockActionGroup" stepKey="assignMainWebsiteToDefaultStock">
2726
<argument name="stockName" value="{{_defaultStock.name}}"/>
2827
<argument name="websiteName" value="{{_defaultWebsite.name}}"/>
2928
</actionGroup>
30-
<magentoCLI stepKey="reindexBefore" command="indexer:reindex"/>
31-
<magentoCLI stepKey="flushCacheBefore" command="cache:flush"/>
32-
3329
<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"/>
30+
<magentoCLI stepKey="reindexPostSettingTheMainWebsiteToDefaultStock" command="indexer:reindex"/>
31+
<magentoCLI stepKey="flushCachePostSettingTheMainWebsiteToDefaultStock" command="cache:flush"/>
3632
</before>
3733
<after>
3834
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
@@ -44,37 +40,31 @@
4440
<argument name="stockName" value="{{_defaultStock.name}}"/>
4541
<argument name="websiteName" value="{{_defaultWebsite.name}}"/>
4642
</actionGroup>
47-
4843
<deleteData createDataKey="createStock" stepKey="deleteStock"/>
49-
<magentoCLI stepKey="reindexAfter" command="indexer:reindex"/>
50-
<magentoCLI stepKey="flushCacheAfter" command="cache:flush"/>
5144
<magentoCLI command="config:set {{CatalogInventoryOptionsOnlyXleftThreshold.path}} {{CatalogInventoryOptionsOnlyXleftThreshold.value}}" stepKey="removedStockThresholdQty"/>
45+
<magentoCLI stepKey="reindexAfterDeletingTheStock" command="indexer:reindex"/>
46+
<magentoCLI stepKey="flushCacheAfterDeletingTheStock" command="cache:flush"/>
5247
</after>
5348

5449
<!-- Step2: Create the Subcategory -->
5550
<createData entity="_defaultCategory" stepKey="createCategory"/>
56-
5751
<!-- Step3: Create the Source and the Stock -->
5852
<createData entity="BasicMsiStockWithMainWebsite1" stepKey="createStock"/>
5953
<createData entity="FullSource1" stepKey="createSource"/>
6054
<createData entity="SourceStockLinked1" stepKey="stockSourceLink">
6155
<requiredEntity createDataKey="createSource"/>
6256
<requiredEntity createDataKey="createStock"/>
6357
</createData>
64-
65-
<!-- Step8: Create the Simple Product -->
58+
<!-- Create and Update the product as per the test case -->
6659
<createData entity="ApiSimpleProduct" stepKey="createProduct">
6760
<requiredEntity createDataKey="createCategory"/>
6861
</createData>
69-
70-
<!-- Update the product as per the test case -->
7162
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForCreatedProduct">
7263
<argument name="product" value="$$createProduct$$"/>
7364
</actionGroup>
7465
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProduct">
7566
<argument name="product" value="$$createProduct$$"/>
7667
</actionGroup>
77-
7868
<fillField userInput="10" selector="{{AdminProductFormSection.productPrice}}" stepKey="updatePriceTo10"/>
7969
<fillField userInput="1" selector="{{AdminProductFormSection.productWeight}}" stepKey="updateWeight"/>
8070
<conditionalClick selector="{{AdminProductFormConfigurationsSection.unAssignSource('Default Source')}}" dependentSelector="{{AdminProductFormConfigurationsSection.unAssignSource('Default Source')}}" visible="true" stepKey="unAssignDefaultSource"/>
@@ -88,16 +78,13 @@
8878
<fillField userInput="2" selector="{{AdminProductFormSection.assignedSourcesQty}}" stepKey="setQtyForAssignedSources"/>
8979
<click selector="{{AdminProductFormSection.save}}" stepKey="clickOnSaveButton"/>
9080
<see userInput="You saved the product." stepKey="saveSuccessfulForManageStockAsYes"/>
91-
92-
<magentoCLI stepKey="reindexForAssignedSources" command="indexer:reindex"/>
93-
<magentoCLI stepKey="flushCacheForAssignedSources" command="cache:flush"/>
94-
81+
<magentoCLI stepKey="reindexPostAssigningTheSource" command="indexer:reindex"/>
82+
<magentoCLI stepKey="flushCachePostAssigningTheSource" command="cache:flush"/>
9583
<!-- Verify with Manage Stock set as Yes for the product -->
9684
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage">
9785
<argument name="productUrl" value="$createProduct.custom_attributes[url_key]$"/>
9886
</actionGroup>
9987
<see selector=".availability.only" userInput="Only 2 left" stepKey="seeCurrentProductQuantity2"/>
100-
10188
<!-- Update the Manage Stock as No for the product -->
10289
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForCreatedProductForManageStockAsNo">
10390
<argument name="product" value="$$createProduct$$"/>
@@ -115,11 +102,11 @@
115102
<see userInput="You saved the product." stepKey="saveSuccessfulForManageStockAsNo"/>
116103
<magentoCLI stepKey="reindexForSettingManageStockAsNo" command="indexer:reindex"/>
117104
<magentoCLI stepKey="flushCacheForSettingManageStockAsNo" command="cache:flush"/>
118-
119105
<!-- Verify with Manage Stock set as No for the product -->
120106
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPageOnStorefrontForManageStockAsNo">
121107
<argument name="productUrl" value="$createProduct.custom_attributes[url_key]$"/>
122108
</actionGroup>
123109
<dontSee selector=".availability.only" userInput="Only 2 left" stepKey="ShouldNotSeeCurrentProductQuantity"/>
110+
124111
</test>
125112
</tests>

0 commit comments

Comments
 (0)