Skip to content

Commit a15f822

Browse files
committed
MC-17606: Unable to save edited product when max_sale_qty is Magento's default
1 parent 2ac7ada commit a15f822

File tree

7 files changed

+55
-35
lines changed

7 files changed

+55
-35
lines changed

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
<!-- Save product but do not expect a success message -->
150150
<actionGroup name="SaveProductFormNoSuccessCheck" extends="saveProductForm">
151151
<annotations>
152-
<description>EXTENDS: saveProductForm. Removes 'seeSaveConfirmation'.</description>
152+
<description>EXTENDS: saveProductForm. Removes 'waitProductSaveSuccessMessage' and 'seeSaveConfirmation'.</description>
153153
</annotations>
154154

155155
<remove keyForRemoval="waitProductSaveSuccessMessage"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminCatalogInventoryConfigurationMaxQtyAllowedInShoppingCartValidationActionGroup">
12+
<arguments>
13+
<argument name="qty" type="string"/>
14+
<argument name="errorMessage" type="string"/>
15+
</arguments>
16+
17+
<fillField selector="{{AdminInventoryProductStockOptionsConfigSection.maxSaleQty}}" userInput="{{qty}}" stepKey="setMaxSaleQtyValue"/>
18+
<click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveConfigButton"/>
19+
<waitForElementVisible selector="{{AdminInventoryProductStockOptionsConfigSection.maxSaleQtyError}}" stepKey="waitValidationErrorMessageAppears"/>
20+
<see selector="{{AdminInventoryProductStockOptionsConfigSection.maxSaleQtyError}}" userInput="{{errorMessage}}" stepKey="checkValidationErrorMessage"/>
21+
</actionGroup>
22+
</actionGroups>

app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/AdminProductActionGroup.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,14 @@
1818
<fillField selector="{{AdminProductFormAdvancedInventorySection.maxiQtyAllowedInCart}}" userInput="{{qty}}" stepKey="fillMaxAllowedQty"/>
1919
<click selector="{{AdminSlideOutDialogSection.doneButton}}" stepKey="clickDone"/>
2020
</actionGroup>
21+
22+
<actionGroup name="AdminProductMaxQtyAllowedInShoppingCartValidationActionGroup" extends="AdminProductSetMaxQtyAllowedInShoppingCart">
23+
<arguments>
24+
<argument name="qty" type="string"/>
25+
<argument name="errorMessage" type="string"/>
26+
</arguments>
27+
28+
<waitForElementVisible selector="{{AdminProductFormAdvancedInventorySection.maxiQtyAllowedInCartError}}" after="clickDone" stepKey="waitProductValidationErrorMessageAppears"/>
29+
<see selector="{{AdminProductFormAdvancedInventorySection.maxiQtyAllowedInCartError}}" userInput="{{errorMessage}}" after="waitProductValidationErrorMessageAppears" stepKey="checkProductValidationErrorMessage"/>
30+
</actionGroup>
2131
</actionGroups>

app/code/Magento/CatalogInventory/Test/Mftf/Data/CatalogInventoryItemOptionsData.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@
88

99
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11-
<entity name="ZeroValueForMaxSaleQty" type="cataloginventory_item_options">
12-
<requiredEntity type="max_sale_qty">MaxSaleQtyZeroValue</requiredEntity>
13-
</entity>
14-
<entity name="MaxSaleQtyZeroValue" type="max_sale_qty">
15-
<data key="value">0</data>
16-
</entity>
17-
1811
<entity name="DefaultValueForMaxSaleQty" type="cataloginventory_item_options">
1912
<requiredEntity type="max_sale_qty">MaxSaleQtyDefaultValue</requiredEntity>
2013
</entity>

app/code/Magento/CatalogInventory/Test/Mftf/Section/AdminProductFormAdvancedInventorySection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
<element name="outOfStockThreshold" type="select" selector="//*[@name='product[stock_data][min_qty]']" timeout="30"/>
3232
<element name="minQtyConfigSetting" type="checkbox" selector="//input[@name='product[stock_data][use_config_min_qty]']" timeout="30"/>
3333
<element name="advancedInventoryModal" type="block" selector=".product_form_product_form_advanced_inventory_modal[data-role=modal]"/>
34-
<element name="maxiQtyAllowedInCartError" type="text" selector="//*[@name='product[stock_data][max_sale_qty]']/..//label[@class='admin__field-error']"/>
34+
<element name="maxiQtyAllowedInCartError" type="text" selector="[name='product[stock_data][max_sale_qty]'] + label.admin__field-error"/>
3535
</section>
3636
</sections>

app/code/Magento/CatalogInventory/Test/Mftf/Test/AdminCreateProductWithZeroMaximumQtyAllowedInShoppingCartTest.xml

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,48 +31,45 @@
3131
<actionGroup ref="logout" stepKey="logout"/>
3232
</after>
3333

34+
<!-- Go to Inventory configuration page -->
3435
<amOnPage url="{{AdminInventoryProductStockOptionsConfigPage.url}}" stepKey="openInventoryConfigPage"/>
3536
<uncheckOption selector="{{AdminInventoryProductStockOptionsConfigSection.maxSaleQtyInherit}}" stepKey="uncheckUseDefaultValueForMaxSaleQty"/>
3637
<!-- Validate zero value -->
37-
<fillField selector="{{AdminInventoryProductStockOptionsConfigSection.maxSaleQty}}" userInput="0" stepKey="setMaxSaleQtyValueToZero"/>
38-
<click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveConfigButton"/>
39-
<waitForElementVisible selector="{{AdminInventoryProductStockOptionsConfigSection.maxSaleQtyError}}" stepKey="waitValidationErrorMessageAppearsZero"/>
40-
<see selector="{{AdminInventoryProductStockOptionsConfigSection.maxSaleQtyError}}" userInput="Please enter a number greater than 0 in this field." stepKey="checkValidationErrorMessageZero"/>
38+
<actionGroup ref="AdminCatalogInventoryConfigurationMaxQtyAllowedInShoppingCartValidationActionGroup" stepKey="validateZeroValue">
39+
<argument name="qty" value="0"/>
40+
<argument name="errorMessage" value="Please enter a number greater than 0 in this field."/>
41+
</actionGroup>
4142
<!-- Validate negative value -->
42-
<fillField selector="{{AdminInventoryProductStockOptionsConfigSection.maxSaleQty}}" userInput="-1" stepKey="setMaxSaleQtyValueToNegative"/>
43-
<click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveConfigButtonNegative"/>
44-
<waitForElementVisible selector="{{AdminInventoryProductStockOptionsConfigSection.maxSaleQtyError}}" stepKey="waitValidationErrorMessageAppearsNegative"/>
45-
<see selector="{{AdminInventoryProductStockOptionsConfigSection.maxSaleQtyError}}" userInput="Please enter a number greater than 0 in this field." stepKey="checkValidationErrorMessageNegative"/>
43+
<actionGroup ref="AdminCatalogInventoryConfigurationMaxQtyAllowedInShoppingCartValidationActionGroup" stepKey="validateNegativeValue">
44+
<argument name="qty" value="-1"/>
45+
<argument name="errorMessage" value="Please enter a number greater than 0 in this field."/>
46+
</actionGroup>
4647
<!-- Validate alphabetical value -->
47-
<fillField selector="{{AdminInventoryProductStockOptionsConfigSection.maxSaleQty}}" userInput="abc" stepKey="setMaxSaleQtyValueToAlphabetical"/>
48-
<click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveConfigButtonAlphabetical"/>
49-
<waitForElementVisible selector="{{AdminInventoryProductStockOptionsConfigSection.maxSaleQtyError}}" stepKey="waitValidationErrorMessageAppearsAlphabetical"/>
50-
<see selector="{{AdminInventoryProductStockOptionsConfigSection.maxSaleQtyError}}" userInput="Please enter a valid number in this field." stepKey="checkValidationErrorMessageAlphabetical"/>
48+
<actionGroup ref="AdminCatalogInventoryConfigurationMaxQtyAllowedInShoppingCartValidationActionGroup" stepKey="validateAlphabeticalValue">
49+
<argument name="qty" value="abc"/>
50+
<argument name="errorMessage" value="Please enter a valid number in this field."/>
51+
</actionGroup>
5152
<!-- Fill correct value -->
5253
<fillField selector="{{AdminInventoryProductStockOptionsConfigSection.maxSaleQty}}" userInput="100" stepKey="setMaxSaleQtyValueToCorrectNumber"/>
5354
<actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfigWithCorrectNumber"/>
5455

5556
<!-- Go to product page -->
5657
<amOnPage url="{{AdminProductEditPage.url($$createdProduct.id$$)}}" stepKey="openAdminProductEditPage"/>
5758
<!-- Validate zero value -->
58-
<actionGroup ref="AdminProductSetMaxQtyAllowedInShoppingCart" stepKey="setProductMaxQtyAllowedInShoppingCartToZero">
59+
<actionGroup ref="AdminProductMaxQtyAllowedInShoppingCartValidationActionGroup" stepKey="productValidateZeroValue">
5960
<argument name="qty" value="0"/>
61+
<argument name="errorMessage" value="Please enter a number greater than 0 in this field."/>
6062
</actionGroup>
61-
<waitForElementVisible selector="{{AdminProductFormAdvancedInventorySection.maxiQtyAllowedInCartError}}" stepKey="waitProductValidationErrorMessageAppearsZero"/>
62-
<see selector="{{AdminProductFormAdvancedInventorySection.maxiQtyAllowedInCartError}}" userInput="Please enter a number greater than 0 in this field." stepKey="checkProductValidationErrorMessageZero"/>
6363
<!-- Validate negative value -->
64-
<actionGroup ref="AdminProductSetMaxQtyAllowedInShoppingCart" stepKey="setProductMaxQtyAllowedInShoppingCartToNegative">
64+
<actionGroup ref="AdminProductMaxQtyAllowedInShoppingCartValidationActionGroup" stepKey="productValidateNegativeValue">
6565
<argument name="qty" value="-1"/>
66+
<argument name="errorMessage" value="Please enter a number greater than 0 in this field."/>
6667
</actionGroup>
67-
<waitForElementVisible selector="{{AdminProductFormAdvancedInventorySection.maxiQtyAllowedInCartError}}" stepKey="waitProductValidationErrorMessageAppearsNegative"/>
68-
<see selector="{{AdminProductFormAdvancedInventorySection.maxiQtyAllowedInCartError}}" userInput="Please enter a number greater than 0 in this field." stepKey="checkProductValidationErrorMessageNegative"/>
6968
<!-- Validate alphabetical value -->
70-
<actionGroup ref="AdminProductSetMaxQtyAllowedInShoppingCart" stepKey="setProductMaxQtyAllowedInShoppingCartToAlphabetical">
69+
<actionGroup ref="AdminProductMaxQtyAllowedInShoppingCartValidationActionGroup" stepKey="productValidateAlphabeticalValue">
7170
<argument name="qty" value="abc"/>
71+
<argument name="errorMessage" value="Please enter a valid number in this field."/>
7272
</actionGroup>
73-
<waitForElementVisible selector="{{AdminProductFormAdvancedInventorySection.maxiQtyAllowedInCartError}}" stepKey="waitProductValidationErrorMessageAppearsAlphabetical"/>
74-
<see selector="{{AdminProductFormAdvancedInventorySection.maxiQtyAllowedInCartError}}" userInput="Please enter a valid number in this field." stepKey="checkProductValidationErrorMessageAlphabetical"/>
75-
7673
<!-- Fill correct value -->
7774
<actionGroup ref="AdminProductSetMaxQtyAllowedInShoppingCart" stepKey="setProductMaxQtyAllowedInShoppingCartToCorrectNumber">
7875
<argument name="qty" value="50"/>

app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontShoppingCartSummaryWithShippingActionGroup.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
<argument name="shipping" type="string"/>
1717
</arguments>
1818

19-
<reloadPage stepKey="reloadPage" after="waitForElementToBeVisible" />
20-
<waitForPageLoad after="reloadPage" stepKey="WaitForPageLoaded" />
21-
<waitForElementVisible selector="{{CheckoutCartSummarySection.shipping}}" stepKey="waitForElementToBeVisible" after="assertSubtotal"/>
22-
<waitForText userInput="{{shipping}}" selector="{{CheckoutCartSummarySection.shipping}}" time="30" stepKey="assertShipping" after="WaitForPageLoaded"/>
19+
<waitForElementVisible selector="{{CheckoutCartSummarySection.shipping}}" after="assertSubtotal" stepKey="waitForShippingElementToBeVisible"/>
20+
<waitForText userInput="{{shipping}}" selector="{{CheckoutCartSummarySection.shipping}}" time="30" after="waitForShippingElementToBeVisible" stepKey="assertShipping"/>
2321
</actionGroup>
2422
</actionGroups>

0 commit comments

Comments
 (0)