Skip to content

Commit e92b739

Browse files
Manoranjan.PrakashManoranjan.Prakash
authored andcommitted
AC-6506 automated
1 parent d2bacc2 commit e92b739

File tree

2 files changed

+137
-0
lines changed

2 files changed

+137
-0
lines changed

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection/AdminProductFormSection.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,16 @@
8383
<element name="newAddedAttributeValue" type="text" selector="//option[contains(@data-title,'{{attributeValue}}')]" parameterized="true"/>
8484
<element name="country_Of_Manufacture" type="select" selector="//td[contains(text(), 'country_of_manufacture')]"/>
8585
<element name="textArea" type="text" selector="//textarea[@name='product[test_custom_attribute]']" timeout="30"/>
86+
<element name="unassignSource" type="button" selector="//span[text()='{{source_name}}']/../../..//button[@class='action-delete']//span[text()='Unassign']" parameterized="true"/>
87+
<element name="btnAssignSources" type="button" selector="//button//span[text()='Assign Sources']/.."/>
88+
<element name="chkSourceToAssign" type="checkbox" selector="//input[@id='idscheck{{source_id}}']/.." parameterized="true"/>
89+
<element name="btnDoneAssignedSources" type="button" selector="//aside[@class='modal-slide product_form_product_form_sources_assign_sources_modal _show']//button[@class='action-primary']//span[text()='Done']/.." />
90+
<element name="assignedSourcesQty" type="input" selector="//input[@name='sources[assigned_sources][0][quantity]']"/>
91+
<element name="searchBySource" type="input" selector="//div[contains(@data-bind,'inventory_source_listing.inventory_source_listing')]/div[2]//input[@placeholder='Search by keyword']"/>
92+
<element name="clickSearch" type="button" selector="//div[contains(@data-bind,'inventory_source_listing.inventory_source_listing')]/div[2]//button[@aria-label='Search']"/>
93+
<element name="btnAdvancedInventory" type="button" selector="//button//span[text()='Advanced Inventory']/.."/>
94+
<element name="checkConfigSettingsAdvancedInventory" type="checkbox" selector="//input[@name='product[stock_data][{{args}}]']/..//label[text()='Use Config Settings']/..//input[@type='checkbox']" parameterized="true"/>
95+
<element name="selectManageStockOption" type="select" selector="//select[@name='product[stock_data][manage_stock]']"/>
96+
<element name="btnDoneAdvancedInventory" type="button" selector="//aside[@class='modal-slide product_form_product_form_advanced_inventory_modal _show']//button[@class='action-primary']//span[text()='Done']/.." />
8697
</section>
8798
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
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

Comments
 (0)