Skip to content

[MFTF] Check visibility block only x product left for simple product #27549

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,9 @@
<data key="label">No</data>
<data key="value">0</data>
</entity>
<entity name="CatalogInventoryOptionsOnlyXleftThreshold">
<!-- Magento default value -->
<data key="path">cataloginventory/options/stock_threshold_qty</data>
<data key="value">0</data>
</entity>
</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@
<element name="customOptionDropDown" type="select" selector="//*[@id='product-options-wrapper']//select[contains(@class, 'product-custom-option admin__control-select')]"/>
<element name="qtyInputWithProduct" type="input" selector="//tr//strong[contains(.,'{{productName}}')]/../../td[@class='col qty']//input" parameterized="true"/>
<element name="customOptionRadio" type="input" selector="//span[contains(text(),'{{customOption}}')]/../../input" parameterized="true"/>
<element name="onlyProductsLeft" type="block" selector="//div[@class='product-info-price']//div[@class='product-info-stock-sku']//div[@class='availability only']"/>
</section>
</sections>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="StorefrontOnlyXProductLeftForSimpleProductsTest">
<annotations>
<features value="Catalog"/>
<title value="See Only * Left block"/>
<stories value="See Only * Left on product page if Only X left Threshold was set"/>
<description value="See Only * Left on product page if Only X left Threshold was set"/>
<testCaseId value="MC-35235"/>
<severity value="MINOR"/>
</annotations>
<before>
<createData entity="_defaultCategory" stepKey="createCategory"/>
<createData entity="ApiSimpleProduct" stepKey="createProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>
<magentoCLI command="config:set {{CatalogInventoryOptionsOnlyXleftThreshold.path}} 10000" stepKey="setStockThresholdQty"/>
<magentoCLI command="cache:flush config" stepKey="flushCache"/>
</before>
<after>
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
<magentoCLI command="config:set {{CatalogInventoryOptionsOnlyXleftThreshold.path}} {{CatalogInventoryOptionsOnlyXleftThreshold.value}}" stepKey="removedStockThresholdQty"/>
</after>
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage">
<argument name="productUrl" value="$createProduct.custom_attributes[url_key]$"/>
</actionGroup>
<seeElement selector="{{StorefrontProductPageSection.onlyProductsLeft}}" stepKey="seeOnlyLeftBlock"/>
</test>
</tests>