Skip to content

Commit f2fe862

Browse files
author
Joan He
authored
Merge pull request #2919 from magento-borg/MAGETWO-90927-product-save-warning
[2.3.0-Regression] Bug Fixes
2 parents e08b953 + 04b2487 commit f2fe862

File tree

20 files changed

+248
-59
lines changed

20 files changed

+248
-59
lines changed

app/code/Magento/Bundle/Test/Mftf/Test/AdminRemoveDefaultImageBundleProductTest.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@
7474
<!-- Remove image from product -->
7575
<actionGroup ref="removeProductImage" stepKey="removeProductImage"/>
7676

77-
<!-- Skip success message check when saving product because of bug MAGETWO-91177 -->
78-
<!-- actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove"/-->
79-
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProductFormAfterRemove"/>
77+
<actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove"/>
8078

8179
<!-- Assert product image not in admin product form -->
8280
<actionGroup ref="assertProductImageNotInAdminProductPage" stepKey="assertProductImageNotInAdminProductPage"/>

app/code/Magento/Catalog/Controller/Adminhtml/Product/Save.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ private function handleImageRemoveError($postData, $productId)
204204
if ($removedImagesAmount) {
205205
$expectedImagesAmount = count($postData['product']['media_gallery']['images']) - $removedImagesAmount;
206206
$product = $this->productRepository->getById($productId);
207-
if ($expectedImagesAmount != count($product->getMediaGallery('images'))) {
207+
$images = $product->getMediaGallery('images');
208+
if (is_array($images) && $expectedImagesAmount != count($images)) {
208209
$this->messageManager->addNoticeMessage(
209210
__('The image cannot be removed as it has been assigned to the other image role')
210211
);

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,32 @@
219219
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
220220
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
221221
</entity>
222+
<entity name="productWithHTMLEntityOne" type="product">
223+
<data key="sku" unique="suffix">SimpleOne&#8482;Product</data>
224+
<data key="type_id">simple</data>
225+
<data key="attribute_set_id">4</data>
226+
<data key="visibility">4</data>
227+
<data key="name" unique="suffix">SimpleOne&#8482;Product</data>
228+
<data key="price">50.00</data>
229+
<data key="urlKey" unique="suffix">testurlkey</data>
230+
<data key="status">1</data>
231+
<data key="quantity">100</data>
232+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
233+
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
234+
</entity>
235+
<entity name="productWithHTMLEntityTwo" type="product">
236+
<data key="sku" unique="suffix">SimpleTwo&#38657;&#20135;&#21697;&lt;カネボウPro</data>
237+
<data key="type_id">simple</data>
238+
<data key="attribute_set_id">4</data>
239+
<data key="visibility">4</data>
240+
<data key="name" unique="suffix">SimpleTwo&#38657;&#20135;&#21697;&lt;カネボウPro</data>
241+
<data key="price">50.00</data>
242+
<data key="urlKey" unique="suffix">testurlkey</data>
243+
<data key="status">1</data>
244+
<data key="quantity">100</data>
245+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
246+
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
247+
</entity>
222248
<entity name="defaultVirtualProduct" type="product">
223249
<data key="sku" unique="suffix">virtualProduct</data>
224250
<data key="type_id">virtual</data>

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414
<element name="useDefaultOptionTitle" type="text" selector="[data-index='options'] tr.data-row [data-index='title'] [name^='options_use_default']"/>
1515
<element name="useDefaultOptionTitleByIndex" type="text" selector="[data-index='options'] [data-index='values'] tr[data-repeat-index='{{var1}}'] [name^='options_use_default']" parameterized="true"/>
1616
<element name="addOptionBtn" type="button" selector="button[data-index='button_add']"/>
17-
<element name="fillOptionTitle" type="input" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//span[text()='Option Title']/parent::label/parent::div//input[@class='admin__control-text']" parameterized="true"/>
17+
<element name="fillOptionTitle" type="input" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//label[text()='Option Title']/parent::span/parent::div//input[@class='admin__control-text']" parameterized="true"/>
1818
<element name="optionTitleInput" type="input" selector="input[name='product[options][0][title]']"/>
1919
<element name="optionTypeOpenDropDown" type="button" selector=".admin__dynamic-rows[data-index='options'] .action-select"/>
2020
<element name="optionTypeTextField" type="button" selector=".admin__dynamic-rows[data-index='options'] .action-menu._active li li"/>
2121
<element name="maxCharactersInput" type="input" selector="input[name='product[options][0][max_characters]']"/>
2222

23-
<element name="checkSelect" type="select" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//span[text()='Option Type']/parent::label/parent::div//div[@data-role='selected-option']" parameterized="true"/>
24-
<element name="checkDropDown" type="select" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//parent::label/parent::div//li[@class='admin__action-multiselect-menu-inner-item']//label[text()='Drop-down']" parameterized="true"/>
23+
<element name="checkSelect" type="select" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//label[text()='Option Type']/parent::span/parent::div//div[@data-role='selected-option']" parameterized="true"/>
24+
<element name="checkDropDown" type="select" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//parent::label/parent::span/parent::div//li[@class='admin__action-multiselect-menu-inner-item']//label[text()='Drop-down']" parameterized="true"/>
2525
<element name="clickAddValue" type="button" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tfoot//button" parameterized="true"/>
26-
<element name="fillOptionValueTitle" type="input" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tbody/tr[@data-repeat-index='{{var2}}']//span[text()='Title']/parent::label/parent::div//div[@class='admin__field-control']/input" parameterized="true"/>
26+
<element name="fillOptionValueTitle" type="input" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tbody/tr[@data-repeat-index='{{var2}}']//label[text()='Title']/parent::span/parent::div//div[@class='admin__field-control']/input" parameterized="true"/>
2727
<element name="fillOptionValuePrice" type="input" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tbody/tr[@data-repeat-index='{{var2}}']//span[text()='Price']/parent::label/parent::div//div[@class='admin__control-addon']/input" parameterized="true"/>
28-
<element name="clickSelectPriceType" type="select" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tbody//tr[@data-repeat-index='{{var2}}']//span[text()='Price Type']/parent::label/parent::div//select" parameterized="true"/>
28+
<element name="clickSelectPriceType" type="select" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tbody//tr[@data-repeat-index='{{var2}}']//label[text()='Price Type']/parent::span/parent::div//select" parameterized="true"/>
2929
<element name="checkboxUseDefaultTitle" type="checkbox" selector="//span[text()='Option Title']/parent::label/parent::div/div//input[@type='checkbox']"/>
3030
<element name="checkboxUseDefaultOption" type="checkbox" selector="//table[@data-index='values']//tbody//tr[@data-repeat-index='{{var1}}']//div[@class='admin__field-control']//input[@type='checkbox']" parameterized="true"/>
3131

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
<element name="attributeSetFilterResult" type="input" selector="div[data-index='attribute_set_id'] .action-menu-item._last" timeout="30"/>
1414
<element name="productName" type="input" selector=".admin__field[data-index=name] input"/>
1515
<element name="productSku" type="input" selector=".admin__field[data-index=sku] input"/>
16+
<element name="enableProductAttributeLabel" type="text" selector="//label[text()='Enable Product']"/>
17+
<element name="enableProductAttributeLabelWrapper" type="text" selector="//label[text()='Enable Product']/parent::span"/>
1618
<element name="productStatus" type="checkbox" selector="input[name='product[status]']"/>
1719
<element name="enableProductLabel" type="checkbox" selector="input[name='product[status]']+label"/>
1820
<element name="productStatusUseDefault" type="checkbox" selector="input[name='use_default[status]']"/>
@@ -39,11 +41,10 @@
3941
<element name="visibility" type="select" selector="//select[@name='product[visibility]']"/>
4042
<element name="visibilityUseDefault" type="checkbox" selector="//input[@name='use_default[visibility]']"/>
4143
<element name="divByDataIndex" type="input" selector="div[data-index='{{var}}']" parameterized="true"/>
42-
<element name="attributeLabelByText" type="text" selector="//*[@class='admin__field']//span[text()='{{attributeLabel}}']" parameterized="true"/>
44+
<element name="attributeLabelByText" type="text" selector="//*[@class='admin__field']//label[text()='{{attributeLabel}}']" parameterized="true"/>
4345
</section>
4446
<section name="ProductInWebsitesSection">
4547
<element name="sectionHeader" type="button" selector="div[data-index='websites']" timeout="30"/>
46-
<!--<element name="websites" type="checkbox" selector="input[name='product[website_ids][{{var1}}]']" parameterized="true"/>-->
4748
<element name="website" type="checkbox" selector="//label[contains(text(), '{{var1}}')]/parent::div//input[@type='checkbox']" parameterized="true"/>
4849
</section>
4950
<section name="ProductDesignSection">

app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveDefaultImageSimpleProductTest.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@
4646
<!-- Remove image from product -->
4747
<actionGroup ref="removeProductImage" stepKey="removeProductImage"/>
4848

49-
<!-- Skip success message check when saving product because of bug MAGETWO-91177 -->
50-
<!-- actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove"/-->
51-
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProductFormAfterRemove"/>
49+
<actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove"/>
5250

5351
<!-- Assert product image not in admin product form -->
5452
<actionGroup ref="assertProductImageNotInAdminProductPage" stepKey="assertProductImageNotInAdminProductPage"/>

app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveDefaultImageVirtualProductTest.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@
4646
<!-- Remove image from product -->
4747
<actionGroup ref="removeProductImage" stepKey="removeProductImage"/>
4848

49-
<!-- Skip success message check when saving product because of bug MAGETWO-91177 -->
50-
<!-- actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove"/-->
51-
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProductFormAfterRemove"/>
49+
<actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove"/>
5250

5351
<!-- Assert product image not in admin product form -->
5452
<actionGroup ref="assertProductImageNotInAdminProductPage" stepKey="assertProductImageNotInAdminProductPage"/>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<test name="AdminSimpleProductUiValidationTest">
12+
<annotations>
13+
<title value="UI elements on the simple product edit screen should be organized as expected"/>
14+
<description value="Admin should be able to use simple product UI in expected manner"/>
15+
<testCaseId value="MAGETWO-92835"/>
16+
<group value="Catalog"/>
17+
</annotations>
18+
19+
<before>
20+
<!-- This was copied and modified from the EndToEndB2CGuestUserTest -->
21+
<createData entity="ApiCategory" stepKey="createCategory"/>
22+
<createData entity="_defaultProduct" stepKey="createSimpleProduct">
23+
<requiredEntity createDataKey="createCategory"/>
24+
</createData>
25+
</before>
26+
27+
<after>
28+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
29+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
30+
</after>
31+
32+
<!--check admin for valid Enable Status label-->
33+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
34+
<amOnPage url="{{AdminProductEditPage.url($$createSimpleProduct.id$$)}}" stepKey="goToEditPage"/>
35+
<waitForPageLoad stepKey="wait1"/>
36+
<seeCheckboxIsChecked selector="{{AdminProductFormSection.productStatus}}" stepKey="seeCheckboxEnableProductIsChecked"/>
37+
38+
<!--check click on wrapping container does not trigger status change-->
39+
<click selector="{{AdminProductFormSection.enableProductAttributeLabelWrapper}}" stepKey="clickEnableProductWrapper"/>
40+
<seeCheckboxIsChecked selector="{{AdminProductFormSection.productStatus}}" stepKey="seeCheckboxEnableProductIsCheckedAfterWrapperClick"/>
41+
42+
<!--check click on label itself does trigger status change-->
43+
<click selector="{{AdminProductFormSection.enableProductAttributeLabel}}" stepKey="clickEnableProductLabel"/>
44+
<dontSeeCheckboxIsChecked selector="{{AdminProductFormSection.productStatus}}" stepKey="dontSeeCheckboxEnableProductIsCheckedAfterLabelClick"/>
45+
</test>
46+
</tests>

app/code/Magento/Catalog/Test/Mftf/Test/SaveProductWithCustomOptionsSecondWebsiteTest.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<testCaseId value="MAGETWO-91436"/>
1919
<group value="product"/>
2020
</annotations>
21+
<before>
2122
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
2223
<!--Create new website -->
2324
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createAdditionalWebsite">
@@ -34,7 +35,6 @@
3435

3536
<!--Create Store view -->
3637
<amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/>
37-
<waitForElementVisible selector="{{AdminStoresMainActionsSection.createStoreViewButton}}" stepKey="waitForStoreViewBtn"/>
3838
<click selector="{{AdminStoresMainActionsSection.createStoreViewButton}}" stepKey="createStoreViewButton"/>
3939
<waitForPageLoad stepKey="waitForProductPageLoad"/>
4040
<selectOption userInput="Second Store" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/>
@@ -46,7 +46,7 @@
4646
<conditionalClick selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" dependentSelector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" visible="true" stepKey="AcceptNewStoreViewCreation"/>
4747
<waitForElementVisible selector="{{AdminStoresGridSection.storeFilterTextField}}" stepKey="waitForPageReolad"/>
4848
<see userInput="You saved the store view." stepKey="seeSaveMessage" />
49-
49+
</before>
5050
<after>
5151
<actionGroup ref="ResetWebUrlOptions" stepKey="resetUrlOption"/>
5252
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteTestWebsite">
@@ -65,8 +65,7 @@
6565
<fillField userInput="{{_defaultProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/>
6666
<fillField userInput="{{_defaultProduct.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/>
6767

68-
<!--<click selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" stepKey="openCustomOptionsSection"/>-->
69-
<conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.checkIfCustomizableOptionsTabOpen}}" visible="true" stepKey="clickIfContentTabCloses2"/>
68+
<conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.checkIfCustomizableOptionsTabOpen}}" visible="true" stepKey="clickIfContentTabCloses2"/>
7069
<click selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" stepKey="clickAddOption"/>
7170
<waitForPageLoad stepKey="waitAfterAddOption"/>
7271
<fillField selector="input[name='product[options][0][title]']" userInput="Radio Option" stepKey="fillOptionTitle"/>

0 commit comments

Comments
 (0)