Skip to content

Commit b9b9399

Browse files
committed
Check visibility block only x product left for simple product
1 parent 1116437 commit b9b9399

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

app/code/Magento/Catalog/Test/Mftf/Data/CatalogInventoryConfigData.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,9 @@
3030
<data key="label">No</data>
3131
<data key="value">0</data>
3232
</entity>
33+
<entity name="CatalogInventoryOptionsOnlyXleftThreshold">
34+
<!-- Magento default value -->
35+
<data key="path">cataloginventory/options/stock_threshold_qty</data>
36+
<data key="value">0</data>
37+
</entity>
3338
</entities>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@
2525
<element name="customOptionDropDown" type="select" selector="//*[@id='product-options-wrapper']//select[contains(@class, 'product-custom-option admin__control-select')]"/>
2626
<element name="qtyInputWithProduct" type="input" selector="//tr//strong[contains(.,'{{productName}}')]/../../td[@class='col qty']//input" parameterized="true"/>
2727
<element name="customOptionRadio" type="input" selector="//span[contains(text(),'{{customOption}}')]/../../input" parameterized="true"/>
28+
<element name="onlyProductsLeft" type="block" selector="//div[@class='availability only']"/>
2829
</section>
29-
</sections>
30+
</sections>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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="StorefrontOnlyXProductLeftForSimpleProductsTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<title value="See Only * Left block"/>
15+
<stories value="See Only * Left on product page if Only X left Threshold was set"/>
16+
<description value="See Only * Left on product page if Only X left Threshold was set"/>
17+
<severity value="MINOR"/>
18+
</annotations>
19+
<before>
20+
<createData entity="_defaultCategory" stepKey="createCategory"/>
21+
<createData entity="ApiSimpleProduct" stepKey="createProduct">
22+
<requiredEntity createDataKey="createCategory"/>
23+
</createData>
24+
<magentoCLI command="config:set {{CatalogInventoryOptionsOnlyXleftThreshold.path}} 10000" stepKey="setStockThresholdQty"/>
25+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
26+
</before>
27+
<after>
28+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
29+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
30+
<magentoCLI command="config:set {{CatalogInventoryOptionsOnlyXleftThreshold.path}} {{CatalogInventoryOptionsOnlyXleftThreshold.value}}" stepKey="removedStockThresholdQty"/>
31+
</after>
32+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage">
33+
<argument name="productUrl" value="$createProduct.custom_attributes[url_key]$"/>
34+
</actionGroup>
35+
<seeElement selector="{{StorefrontProductPageSection.onlyProductsLeft}}" stepKey="seeOnlyLeftBlock"/>
36+
</test>
37+
</tests>

0 commit comments

Comments
 (0)