Skip to content

Commit

Permalink
merge magento/2.3-develop into magento-epam/EPAM-PR-73
Browse files Browse the repository at this point in the history
  • Loading branch information
magento-cicd2 authored Sep 18, 2019
2 parents 0d5f052 + 0a390bb commit 102f608
Show file tree
Hide file tree
Showing 28 changed files with 344 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@
<scrollToTopOfPage stepKey="scrollTopPageProduct"/>
<waitForElementVisible selector="{{AdminProductFormActionSection.saveButton}}" stepKey="waitForSaveProductButton"/>
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/>
<waitForPageLoad stepKey="waitForProductToSave"/>
<see selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product." stepKey="seeSaveConfirmation"/>
<waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitProductSaveSuccessMessage"/>
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the product." stepKey="seeSaveConfirmation"/>
</actionGroup>

<actionGroup name="toggleProductEnabled">
Expand All @@ -149,9 +149,10 @@
<!-- Save product but do not expect a success message -->
<actionGroup name="SaveProductFormNoSuccessCheck" extends="saveProductForm">
<annotations>
<description>EXTENDS: saveProductForm. Removes 'seeSaveConfirmation'.</description>
<description>EXTENDS: saveProductForm. Removes 'waitProductSaveSuccessMessage' and 'seeSaveConfirmation'.</description>
</annotations>

<remove keyForRemoval="waitProductSaveSuccessMessage"/>
<remove keyForRemoval="seeSaveConfirmation"/>
</actionGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,4 +423,23 @@
<click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmProductDelete"/>
<waitForPageLoad stepKey="waitForGridLoad"/>
</actionGroup>

<actionGroup name="deleteAllProductsUsingProductGrid">
<annotations>
<description>Deletes all products in Admin Products grid page.</description>
</annotations>

<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="openAdminGridProductsPage"/>
<waitForPageLoad time="60" stepKey="waitForPageFullyLoad"/>
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clearGridFilters"/>

<conditionalClick selector="{{AdminProductGridSection.multicheckDropdown}}" dependentSelector="{{AdminDataGridTableSection.dataGridEmpty}}" visible="false" stepKey="openMulticheckDropdown"/>
<conditionalClick selector="{{AdminProductGridSection.multicheckOption('Select All')}}" dependentSelector="{{AdminDataGridTableSection.dataGridEmpty}}" visible="false" stepKey="selectAllProductsInGrid"/>
<click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/>
<click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction"/>

<waitForElementVisible selector="{{AdminConfirmationModalSection.message}}" stepKey="waitForConfirmModal"/>
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmDelete"/>
<waitForElementVisible selector="{{AdminDataGridTableSection.dataGridEmpty}}" stepKey="waitGridIsEmpty"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
<section name="AdminProductAttributesSection"/>
<section name="AdminProductFormRelatedUpSellCrossSellSection"/>
<section name="AdminProductFormAdvancedPricingSection"/>
<section name="AdminProductFormAdvancedInventorySection"/>
<section name="AdminAddAttributeModalSection"/>
</page>
</pages>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminCatalogInventoryConfigurationMaxQtyAllowedInShoppingCartValidationActionGroup">
<arguments>
<argument name="qty" type="string"/>
<argument name="errorMessage" type="string"/>
</arguments>

<fillField selector="{{AdminInventoryProductStockOptionsConfigSection.maxSaleQty}}" userInput="{{qty}}" stepKey="setMaxSaleQtyValue"/>
<click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveConfigButton"/>
<waitForElementVisible selector="{{AdminInventoryProductStockOptionsConfigSection.maxSaleQtyError}}" stepKey="waitValidationErrorMessageAppears"/>
<see selector="{{AdminInventoryProductStockOptionsConfigSection.maxSaleQtyError}}" userInput="{{errorMessage}}" stepKey="checkValidationErrorMessage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminProductSetMaxQtyAllowedInShoppingCart">
<arguments>
<argument name="qty" type="string"/>
</arguments>
<conditionalClick selector="{{AdminProductFormSection.advancedInventoryLink}}" dependentSelector="{{AdminProductFormAdvancedInventorySection.advancedInventoryModal}}" visible="false" stepKey="clickOnAdvancedInventoryLinkIfNeeded"/>
<waitForElementVisible selector="{{AdminProductFormAdvancedInventorySection.maxiQtyConfigSetting}}" stepKey="waitForAdvancedInventoryModalWindowOpen"/>
<uncheckOption selector="{{AdminProductFormAdvancedInventorySection.maxiQtyConfigSetting}}" stepKey="uncheckMaxQtyCheckBox"/>
<fillField selector="{{AdminProductFormAdvancedInventorySection.maxiQtyAllowedInCart}}" userInput="{{qty}}" stepKey="fillMaxAllowedQty"/>
<click selector="{{AdminSlideOutDialogSection.doneButton}}" stepKey="clickDone"/>
</actionGroup>

<actionGroup name="AdminProductMaxQtyAllowedInShoppingCartValidationActionGroup" extends="AdminProductSetMaxQtyAllowedInShoppingCart">
<arguments>
<argument name="qty" type="string"/>
<argument name="errorMessage" type="string"/>
</arguments>

<waitForElementVisible selector="{{AdminProductFormAdvancedInventorySection.maxiQtyAllowedInCartError}}" after="clickDone" stepKey="waitProductValidationErrorMessageAppears"/>
<see selector="{{AdminProductFormAdvancedInventorySection.maxiQtyAllowedInCartError}}" userInput="{{errorMessage}}" after="waitProductValidationErrorMessageAppears" stepKey="checkProductValidationErrorMessage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,17 @@
<data key="label">No</data>
<data key="value">0</data>
</entity>
<entity name="EnableCatalogInventoryConfigData">
<!--Default Value -->
<data key="path">cataloginventory/options/can_subtract</data>
<data key="scope_id">0</data>
<data key="label">Yes</data>
<data key="value">1</data>
</entity>
<entity name="DisableCatalogInventoryConfigData">
<data key="path">cataloginventory/options/can_subtract</data>
<data key="scope_id">0</data>
<data key="label">No</data>
<data key="value">0</data>
</entity>
</entities>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
<entity name="DefaultValueForMaxSaleQty" type="cataloginventory_item_options">
<requiredEntity type="max_sale_qty">MaxSaleQtyDefaultValue</requiredEntity>
</entity>
<entity name="MaxSaleQtyDefaultValue" type="max_sale_qty">
<data key="value">10000</data>
</entity>
</entities>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd">
<operation name="CatalogInventoryProductStockOptionsConfiguration" dataType="cataloginventory_item_options" type="create"
auth="adminFormKey" url="/admin/system_config/save/section/cataloginventory/" method="POST" successRegex="/messages-message-success/">
<object key="groups" dataType="cataloginventory_item_options">
<object key="item_options" dataType="cataloginventory_item_options">
<object key="fields" dataType="cataloginventory_item_options">
<object key="max_sale_qty" dataType="max_sale_qty">
<field key="value">integer</field>
</object>
</object>
</object>
</object>
</operation>
</operations>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
<page name="AdminInventoryProductStockOptionsConfigPage" url="admin/system_config/edit/section/cataloginventory/#cataloginventory_item_options-link" area="admin" module="Magento_Config">
<section name="AdminInventoryProductStockOptionsConfigSection"/>
</page>
</pages>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
<page name="AdminProductCreatePage" url="catalog/product/new/set/{{set}}/type/{{type}}/" area="admin" module="Magento_Catalog" parameterized="true">
<section name="AdminProductFormAdvancedInventorySection"/>
</page>
</pages>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminInventoryProductStockOptionsConfigSection">
<element name="maxSaleQtyInherit" type="checkbox" selector="#cataloginventory_item_options_max_sale_qty_inherit" timeout="30"/>
<element name="maxSaleQty" type="input" selector="#cataloginventory_item_options_max_sale_qty"/>
<element name="maxSaleQtyError" type="input" selector="#cataloginventory_item_options_max_sale_qty-error"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,7 @@
<element name="advancedInventoryStockStatus" type="select" selector="//div[@class='modal-inner-wrap']//select[@name='product[quantity_and_stock_status][is_in_stock]']"/>
<element name="outOfStockThreshold" type="select" selector="//*[@name='product[stock_data][min_qty]']" timeout="30"/>
<element name="minQtyConfigSetting" type="checkbox" selector="//input[@name='product[stock_data][use_config_min_qty]']" timeout="30"/>
<element name="advancedInventoryModal" type="block" selector=".product_form_product_form_advanced_inventory_modal[data-role=modal]"/>
<element name="maxiQtyAllowedInCartError" type="text" selector="[name='product[stock_data][max_sale_qty]'] + label.admin__field-error"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminProductFormSection">
<element name="advancedInventoryLink" type="button" selector="button[data-index='advanced_inventory_button']" timeout="30"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?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="AdminCreateProductWithZeroMaximumQtyAllowedInShoppingCartTest">
<annotations>
<features value="CatalogInventory"/>
<stories value="Sales restrictions"/>
<title value="Verify that product maximum qty allowed in shopping cart can't be set to zero or less"/>
<description value="Verify that product maximum qty allowed in shopping cart can't be set to zero or less"/>
<severity value="MAJOR"/>
<useCaseId value="MC-17606"/>
<testCaseId value="MC-17636"/>
<group value="catalog"/>
<group value="catalogInventory"/>
</annotations>
<before>
<createData entity="DefaultValueForMaxSaleQty" stepKey="setDefaultValueForMaxSaleQty"/>
<createData entity="SimpleProduct2" stepKey="createdProduct"/>
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
</before>
<after>
<createData entity="DefaultValueForMaxSaleQty" stepKey="setDefaultValueForMaxSaleQty"/>
<deleteData createDataKey="createdProduct" stepKey="deleteProduct"/>
<actionGroup ref="logout" stepKey="logout"/>
</after>

<!-- Go to Inventory configuration page -->
<amOnPage url="{{AdminInventoryProductStockOptionsConfigPage.url}}" stepKey="openInventoryConfigPage"/>
<uncheckOption selector="{{AdminInventoryProductStockOptionsConfigSection.maxSaleQtyInherit}}" stepKey="uncheckUseDefaultValueForMaxSaleQty"/>
<!-- Validate zero value -->
<actionGroup ref="AdminCatalogInventoryConfigurationMaxQtyAllowedInShoppingCartValidationActionGroup" stepKey="validateZeroValue">
<argument name="qty" value="0"/>
<argument name="errorMessage" value="Please enter a number greater than 0 in this field."/>
</actionGroup>
<!-- Validate negative value -->
<actionGroup ref="AdminCatalogInventoryConfigurationMaxQtyAllowedInShoppingCartValidationActionGroup" stepKey="validateNegativeValue">
<argument name="qty" value="-1"/>
<argument name="errorMessage" value="Please enter a number greater than 0 in this field."/>
</actionGroup>
<!-- Validate alphabetical value -->
<actionGroup ref="AdminCatalogInventoryConfigurationMaxQtyAllowedInShoppingCartValidationActionGroup" stepKey="validateAlphabeticalValue">
<argument name="qty" value="abc"/>
<argument name="errorMessage" value="Please enter a valid number in this field."/>
</actionGroup>
<!-- Fill correct value -->
<fillField selector="{{AdminInventoryProductStockOptionsConfigSection.maxSaleQty}}" userInput="100" stepKey="setMaxSaleQtyValueToCorrectNumber"/>
<actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfigWithCorrectNumber"/>

<!-- Go to product page -->
<amOnPage url="{{AdminProductEditPage.url($$createdProduct.id$$)}}" stepKey="openAdminProductEditPage"/>
<!-- Validate zero value -->
<actionGroup ref="AdminProductMaxQtyAllowedInShoppingCartValidationActionGroup" stepKey="productValidateZeroValue">
<argument name="qty" value="0"/>
<argument name="errorMessage" value="Please enter a number greater than 0 in this field."/>
</actionGroup>
<!-- Validate negative value -->
<actionGroup ref="AdminProductMaxQtyAllowedInShoppingCartValidationActionGroup" stepKey="productValidateNegativeValue">
<argument name="qty" value="-1"/>
<argument name="errorMessage" value="Please enter a number greater than 0 in this field."/>
</actionGroup>
<!-- Validate alphabetical value -->
<actionGroup ref="AdminProductMaxQtyAllowedInShoppingCartValidationActionGroup" stepKey="productValidateAlphabeticalValue">
<argument name="qty" value="abc"/>
<argument name="errorMessage" value="Please enter a valid number in this field."/>
</actionGroup>
<!-- Fill correct value -->
<actionGroup ref="AdminProductSetMaxQtyAllowedInShoppingCart" stepKey="setProductMaxQtyAllowedInShoppingCartToCorrectNumber">
<argument name="qty" value="50"/>
</actionGroup>
<waitForElementNotVisible selector="{{AdminProductFormAdvancedInventorySection.advancedInventoryModal}}" stepKey="waitForModalFormToDisappear"/>
<actionGroup ref="saveProductForm" stepKey="saveProduct"/>
</test>
</tests>
2 changes: 1 addition & 1 deletion app/code/Magento/CatalogInventory/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</field>
<field id="max_sale_qty" translate="label" type="text" sortOrder="4" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
<label>Maximum Qty Allowed in Shopping Cart</label>
<validate>validate-number</validate>
<validate>validate-number validate-greater-than-zero</validate>
</field>
<field id="min_qty" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
<label>Out-of-Stock Threshold</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@
<settings>
<scopeLabel>[GLOBAL]</scopeLabel>
<validation>
<rule name="validate-number" xsi:type="boolean">true</rule>
<rule name="validate-greater-than-zero" xsi:type="boolean">true</rule>
</validation>
<label translate="true">Maximum Qty Allowed in Shopping Cart</label>
Expand Down
Loading

0 comments on commit 102f608

Please sign in to comment.