Skip to content

Commit 5565a24

Browse files
authored
Merge pull request #2650 from magento-honey-badgers/MAGETWO-91436-Custom-Options-are-corruputed
[honey] MAGETWO-91436: Custom Options are corruputed when saving product to a different website
2 parents 6110fdd + 92392b5 commit 5565a24

15 files changed

+465
-2
lines changed

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormSection.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
<element name="productName" type="input" selector=".admin__field[data-index=name] input"/>
1212
<element name="productSku" type="input" selector=".admin__field[data-index=sku] input"/>
1313
<element name="productStatus" type="checkbox" selector="input[name='product[status]']"/>
14+
<element name="enableProductLabel" type="checkbox" selector="input[name='product[status]']+label"/>
15+
<element name="productStatusUseDefault" type="checkbox" selector="input[name='use_default[status]']"/>
1416
<element name="productPrice" type="input" selector=".admin__field[data-index=price] input"/>
1517
<element name="advancedPricingLink" type="button" selector="button[data-index='advanced_pricing_button']"/>
1618
<element name="categoriesDropdown" type="multiselect" selector="div[data-index='category_ids']"/>
@@ -32,6 +34,11 @@
3234
<element name="visibility" type="select" selector="//select[@name='product[visibility]']"/>
3335
<element name="visibilityUseDefault" type="checkbox" selector="//input[@name='use_default[visibility]']"/>
3436
</section>
37+
<section name="ProductInWebsitesSection">
38+
<element name="sectionHeader" type="button" selector="div[data-index='websites']" timeout="30"/>
39+
<!--<element name="websites" type="checkbox" selector="input[name='product[website_ids][{{var1}}]']" parameterized="true"/>-->
40+
<element name="website" type="checkbox" selector="//label[contains(text(), '{{var1}}')]/parent::div//input[@type='checkbox']" parameterized="true"/>
41+
</section>
3542
<section name="ProductDesignSection">
3643
<element name="DesignTab" type="button" selector="//strong[@class='admin__collapsible-title']//span[text()='Design']"/>
3744
<element name="LayoutDropdown" type="select" selector="select[name='product[page_layout]']"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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="SaveProductWithCustomOptionsAdditionalWebsiteTest">
12+
<annotations>
13+
<features value="Save a product with Custom Options and assign to a different website"/>
14+
<stories value="Purchase a product with Custom Options of different types"/>
15+
<title value="You should be able to save a product with custom options assigned to a different website"/>
16+
<description value="Custom Options should not be split when saving the product after assigning to a different website"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MAGETWO-91436"/>
19+
<group value="product"/>
20+
</annotations>
21+
22+
<after>
23+
<actionGroup ref="ResetWebUrlOptions" stepKey="resetUrlOption"/>
24+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite"/>
25+
26+
<amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/>
27+
</after>
28+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
29+
<actionGroup ref="EnableWebUrlOptions" stepKey="addStoreCodeToUrls"/>
30+
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="addnewWebsite"/>
31+
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="addNewStoreGroup"/>
32+
33+
<!--Create Store view -->
34+
<amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/>
35+
<click selector="{{AdminStoresMainActionsSection.createStoreViewButton}}" stepKey="createStoreViewButton"/>
36+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
37+
<selectOption userInput="Second Store" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/>
38+
<fillField userInput="Second Store View" selector="{{AdminNewStoreSection.storeNameTextField}}" stepKey="fillStoreViewName"/>
39+
<fillField userInput="second_store_view" selector="{{AdminNewStoreSection.storeCodeTextField}}" stepKey="fillStoreViewCode"/>
40+
<selectOption userInput="1" selector="{{AdminNewStoreSection.statusDropdown}}" stepKey="enableStoreViewStatus"/>
41+
<click selector="{{AdminStoresMainActionsSection.saveButton}}" stepKey="clickStoreViewSaveButton"/>
42+
<waitForElementVisible selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" stepKey="waitForAcceptNewStoreViewCreationModal" />
43+
<conditionalClick selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" dependentSelector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" visible="true" stepKey="AcceptNewStoreViewCreation"/>
44+
<waitForElementVisible selector="{{AdminStoresGridSection.storeFilterTextField}}" stepKey="waitForPageReolad"/>
45+
<see userInput="You saved the store view." stepKey="seeSaveMessage" />
46+
47+
<!--Create a Simple Product with Custom Options -->
48+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToCatalogProductGrid"/>
49+
<click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/>
50+
<click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="clickAddSimpleProduct"/>
51+
<fillField userInput="{{_defaultProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillName"/>
52+
<fillField userInput="{{_defaultProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillSKU"/>
53+
<fillField userInput="{{_defaultProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/>
54+
<fillField userInput="{{_defaultProduct.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/>
55+
56+
<!--<click selector="{{AdminProductCustomizableOptionsSection.customezableOptions}}" stepKey="openCustomOptionsSection"/>-->
57+
<conditionalClick selector="{{AdminProductCustomizableOptionsSection.customezableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.checkIfCustomizableOptionsTabOpen}}" visible="true" stepKey="clickIfContentTabCloses2"/>
58+
<click selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" stepKey="clickAddOption"/>
59+
<waitForPageLoad stepKey="waitAfterAddOption"/>
60+
<fillField selector="input[name='product[options][0][title]']" userInput="Radio Option" stepKey="fillOptionTitle"/>
61+
<click selector=".admin__dynamic-rows[data-index='options'] .action-select" stepKey="openOptionTypeDropDown"/>
62+
<click selector=".admin__dynamic-rows[data-index='options'] .action-menu._active li:nth-of-type(3) li:nth-of-type(2)" stepKey="selectRadioButtonType"/>
63+
64+
<!--Add Option Values -->
65+
<click selector="{{AdminProductCustomizableOptionsSection.clickAddValue('Radio Option')}}" stepKey="clickAddValue1"/>
66+
<fillField selector="{{AdminProductCustomizableOptionsSection.fillOptionValueTitle('Radio Option', '0')}}" userInput="option 1" stepKey="fillOptionValueTitle1"/>
67+
<fillField selector="{{AdminProductCustomizableOptionsSection.fillOptionValuePrice('Radio Option', '0')}}" userInput="5" stepKey="fillOptionValuePrice1"/>
68+
69+
<click selector="{{AdminProductCustomizableOptionsSection.clickAddValue('Radio Option')}}" stepKey="clickAddValue2"/>
70+
<fillField selector="{{AdminProductCustomizableOptionsSection.fillOptionValueTitle('Radio Option', '1')}}" userInput="option 2" stepKey="fillOptionValueTitle2"/>
71+
<fillField selector="{{AdminProductCustomizableOptionsSection.fillOptionValuePrice('Radio Option', '1')}}" userInput="6" stepKey="fillOptionValuePrice2"/>
72+
73+
<click selector="{{AdminProductCustomizableOptionsSection.clickAddValue('Radio Option')}}" stepKey="clickAddValue3"/>
74+
<fillField selector="{{AdminProductCustomizableOptionsSection.fillOptionValueTitle('Radio Option', '2')}}" userInput="option 3" stepKey="fillOptionValueTitle3"/>
75+
<fillField selector="{{AdminProductCustomizableOptionsSection.fillOptionValuePrice('Radio Option', '2')}}" userInput="7" stepKey="fillOptionValuePrice3"/>
76+
77+
<!--Save the product with custom options -->
78+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton"/>
79+
<waitForLoadingMaskToDisappear stepKey="waitProductPageSave"/>
80+
<seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeProductSavedMessage"/>
81+
82+
<!-- Add this product to second website -->
83+
<click selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="openProductInWebsitesSection1"/>
84+
<click selector="{{ProductInWebsitesSection.website('Second Website')}}" stepKey="selectSecondWebsite"/>
85+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSave"/>
86+
<waitForLoadingMaskToDisappear stepKey="waitForProductPagetoSaveAgain"/>
87+
<seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessageAgain"/>
88+
89+
<click selector="{{AdminProductCustomizableOptionsSection.customezableOptions}}" stepKey="openCustomOptionsSection2"/>
90+
<seeNumberOfElements selector=".admin__dynamic-rows[data-index='values'] tr.data-row" userInput="3" stepKey="see4RowsOfOptions"/>
91+
92+
</test>
93+
</tests>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="EnableWebUrlOptions">
12+
<amOnPage url="{{WebConfigurationPage.url}}" stepKey="navigateToWebConfigurationPage"/>
13+
<waitForPageLoad stepKey="waitForPageLoad"/>
14+
<conditionalClick selector="{{WebSection.UrlOptionsTab}}" dependentSelector="{{WebSection.CheckIfUrlOptionsTabExpand}}" visible="true" stepKey="expandUrlSectionTab"/>
15+
<waitForElementVisible selector="{{UrlOptionsSection.addStoreCodeToUrl}}" stepKey="seeAddStoreCodeToUrl"/>
16+
<uncheckOption selector="{{UrlOptionsSection.systemValueForStoreCode}}" stepKey="uncheckUseSystemValue"/>
17+
<selectOption selector="{{UrlOptionsSection.addStoreCodeToUrl}}" userInput="Yes" stepKey="enableStoreCode"/>
18+
<click selector="{{WebSection.UrlOptionsTab}}" stepKey="collapseUrlOptions"/>
19+
<click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig" />
20+
</actionGroup>
21+
<actionGroup name="ResetWebUrlOptions">
22+
<amOnPage url="{{WebConfigurationPage.url}}" stepKey="navigateToWebConfigurationPagetoReset"/>
23+
<waitForPageLoad stepKey="waitForPageLoad2"/>
24+
<conditionalClick selector="{{WebSection.UrlOptionsTab}}" dependentSelector="{{WebSection.CheckIfUrlOptionsTabExpand}}" visible="true" stepKey="closeUrlSectionTab"/>
25+
<waitForElementVisible selector="{{UrlOptionsSection.addStoreCodeToUrl}}" stepKey="seeAddStoreCodeToUrl2"/>
26+
<!--<uncheckOption selector="{{UrlOptionsSection.systemValueForStoreCode}}" stepKey="uncheckUseSystemValue"/>-->
27+
<selectOption selector="{{UrlOptionsSection.addStoreCodeToUrl}}" userInput="No" stepKey="enableStoreCode"/>
28+
<checkOption selector="{{UrlOptionsSection.systemValueForStoreCode}}" stepKey="checkUseSystemValue"/>
29+
<click selector="{{WebSection.UrlOptionsTab}}" stepKey="collapseUrlOptions"/>
30+
<click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig"/>
31+
</actionGroup>
32+
</actionGroups>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/Section/GeneralSection.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,16 @@
2020
<section name="WebSection">
2121
<element name="DefaultLayoutsTab" type="button" selector="#web_default_layouts-head"/>
2222
<element name="CheckIfTabExpand" type="button" selector="#web_default_layouts-head:not(.open)"/>
23+
<element name="UrlOptionsTab" type="button" selector="#web_url-head"/>
24+
<element name="CheckIfUrlOptionsTabExpand" type="button" selector="#web_url-head:not(.open)"/>
2325
</section>
2426
<section name="DefaultLayoutsSection">
2527
<element name="productLayout" type="select" selector="#web_default_layouts_default_product_layout"/>
2628
<element name="categoryLayout" type="select" selector="#web_default_layouts_default_category_layout"/>
2729
<element name="pageLayout" type="select" selector="#web_default_layouts_default_cms_layout"/>
2830
</section>
31+
<section name="UrlOptionsSection">
32+
<element name="addStoreCodeToUrl" type="select" selector="#web_url_use_store"/>
33+
<element name="systemValueForStoreCode" type="checkbox" selector="#web_url_use_store_inherit"/>
34+
</section>
2935
</sections>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Data/ProductConfigurableAttributeData.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,17 @@
2929
<data key="name" unique="suffix">Orange</data>
3030
<data key="price">99.99</data>
3131
</entity>
32+
<entity name="colorDefaultProductAttribute" type="product_attribute">
33+
<data key="default_label">Color</data>
34+
<data key="input_type">Dropdown</data>
35+
<data key="attribute_quantity">2</data>
36+
</entity>
37+
<entity name="colorDefaultProductAttribute1" type="product_attribute">
38+
<data key="name">Green</data>
39+
<data key="price">4.00</data>
40+
</entity>
41+
<entity name="colorDefaultProductAttribute2" type="product_attribute">
42+
<data key="name">Black</data>
43+
<data key="price">5.00</data>
44+
</entity>
3245
</entities>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Section/AdminCreateProductConfigurationsPanelSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
<element name="attributeCheckboxByIndex" type="input" selector="li.attribute-option:nth-of-type({{var1}}) input" parameterized="true"/>
2525

2626
<element name="applyUniquePricesByAttributeToEachSku" type="radio" selector=".admin__field-label[for='apply-unique-prices-radio']"/>
27+
<element name="applySinglePriceToAllSkus" type="radio" selector=".admin__field-label[for='apply-single-price-radio']"/>
28+
<element name="singlePrice" type="input" selector="#apply-single-price-input"/>
2729
<element name="selectAttribute" type="select" selector="#select-each-price" timeout="30"/>
2830
<element name="attribute1" type="input" selector="#apply-single-price-input-0"/>
2931
<element name="attribute2" type="input" selector="#apply-single-price-input-1"/>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Section/AdminProductFormConfigurationsSection.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@
1616
<element name="currentVariationsPriceCells" type="textarea" selector=".admin__control-fields[data-index='price_container']"/>
1717
<element name="currentVariationsQuantityCells" type="textarea" selector=".admin__control-fields[data-index='quantity_container']"/>
1818
<element name="currentVariationsAttributesCells" type="textarea" selector=".admin__control-fields[data-index='attributes']"/>
19+
<element name="currentVariationsStatusCells" type="textarea" selector="._no-header[data-index='status']"/>
1920
<element name="actionsBtn" type="button" selector="(//button[@class='action-select']/span[contains(text(), 'Select')])[{{var1}}]" parameterized="true"/>
2021
<element name="removeProductBtn" type="button" selector="//a[text()='Remove Product']"/>
2122
<element name="disableProductBtn" type="button" selector="//a[text()='Disable Product']"/>
23+
<element name="enableProductBtn" type="button" selector="//a[text()='Enable Product']"/>
2224
</section>
2325
<section name="AdminConfigurableProductFormSection">
2426
<element name="productWeight" type="input" selector=".admin__control-text[name='product[weight]']"/>
2527
<element name="productQuantity" type="input" selector=".admin__control-text[name='product[quantity_and_stock_status][qty]']"/>
26-
<element name="currentVariationsQuantityCells" type="button" selector="td[data-index='quantity_per_source_container']"/>
28+
<element name="currentVariationsQuantityCells" type="button" selector="td[data-index='quantity_container']"/>
2729
<element name="rowByCode" type="textarea" selector="//span[contains(text(), '{{var1}}-{{var2}}')]//ancestor-or-self::tr" parameterized="true"/>
2830
</section>
2931
<section name="AdminConfigurableProductSelectAttributesSlideOut">

0 commit comments

Comments
 (0)