Skip to content

Commit edf2630

Browse files
committed
MAGETWO-90317: Product Added to the Wishlist gets deleted if another product from another store is added to the wishlist
1 parent e6253f5 commit edf2630

18 files changed

+271
-9
lines changed

app/code/Magento/Wishlist/Controller/Index/Add.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,9 @@ public function execute()
114114
if (is_string($result)) {
115115
throw new \Magento\Framework\Exception\LocalizedException(__($result));
116116
}
117-
$wishlist->save();
118-
117+
if ($wishlist->isObjectNew()) {
118+
$wishlist->save();
119+
}
119120
$this->_eventManager->dispatch(
120121
'wishlist_add_product',
121122
['wishlist' => $wishlist, 'product' => $product, 'item' => $result]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="OpenEditProductOnBackendActionGroup">
11+
<arguments>
12+
<argument name="product" defaultValue="product"/>
13+
</arguments>
14+
<click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProductRow"/>
15+
<waitForPageLoad time="30" stepKey="waitForProductPageLoad"/>
16+
<seeInField userInput="{{product.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="seeProductSkuOnEditProductPage"/>
17+
</actionGroup>
18+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="SearchForProductOnBackendActionGroup">
11+
<arguments>
12+
<argument name="product" defaultValue="product"/>
13+
</arguments>
14+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
15+
<waitForPageLoad time="30" stepKey="waitForProductsPageToLoad"/>
16+
<click selector="{{AdminProductFiltersSection.filtersButton}}" stepKey="openFiltersSectionOnProductsPage"/>
17+
<conditionalClick selector="{{AdminProductFiltersSection.clearFiltersButton}}" dependentSelector="{{AdminProductFiltersSection.clearFiltersButton}}" visible="true" stepKey="cleanFiltersIfTheySet"/>
18+
<fillField userInput="{{product.sku}}" selector="{{AdminProductFiltersSection.skuInput}}" stepKey="fillSkuFieldOnFiltersSection"/>
19+
<click selector="{{AdminProductFiltersSection.apply}}" stepKey="clickApplyFiltersButton"/>
20+
</actionGroup>
21+
</actionGroups>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/CustomAttributeData.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
98
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
109
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
1110
<entity name="CustomAttributeCategoryUrlKey" type="custom_attribute">

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Page/AdminProductIndexPage.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
98
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
109
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
1110
<page name="AdminProductIndexPage" url="catalog/product/index" area="admin" module="Magento_Catalog">
@@ -14,5 +13,6 @@
1413
<section name="AdminProductGridPaginationSection"/>
1514
<section name="AdminProductGridSection" />
1615
<section name="AdminMessagesSection" />
16+
<section name="AdminProductFiltersSection" />
1717
</page>
1818
</pages>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
10+
<section name="AdminProductFiltersSection">
11+
<element name="filtersButton" type="button" selector="#container > div > div.admin__data-grid-header > div:nth-child(1) > div.data-grid-filters-actions-wrap > div > button"/>
12+
<element name="clearFiltersButton" type="button" selector="//div[@class='admin__data-grid-header']//button[@class='action-tertiary action-clear']" timeout="10"/>
13+
<element name="nameInput" type="input" selector="input[name=name]"/>
14+
<element name="skuInput" type="input" selector="input[name=sku]"/>
15+
<element name="apply" type="button" selector="button[data-action=grid-filter-apply]" timeout="30"/>
16+
</section>
17+
</sections>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
98
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
109
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
1110
<section name="AdminProductFormActionSection">
1211
<element name="backButton" type="button" selector="#back" timeout="30"/>
1312
<element name="saveButton" type="button" selector="#save-button" timeout="30"/>
1413
<element name="saveArrow" type="button" selector="button[data-ui-id='save-button-dropdown']" timeout="10"/>
1514
<element name="saveAndClose" type="button" selector="span[title='Save &amp; Close']" timeout="30"/>
15+
<element name="changeStoreButton" type="button" selector="#store-change-button"/>
1616
</section>
1717
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
10+
<section name="AdminProductFormChangeStoreSection">
11+
<element name="storeSelector" type="button" selector="//a[contains(text(),'{{var1}}')]" parameterized="true"/>
12+
<element name="acceptButton" type="button" selector="button[class='action-primary action-accept']" timeout="30"/>
13+
</section>
14+
</sections>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
98
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
109
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
1110
<section name="AdminProductFormSection">
@@ -28,6 +27,8 @@
2827
<element name="frontendInput" type="select" selector="select[name = 'frontend_input']"/>
2928
<element name="productFormTab" type="button" selector="//strong[@class='admin__collapsible-title']/span[contains(text(), '{{tabName}}')]" parameterized="true"/>
3029
<element name="productFormTabState" type="text" selector="//strong[@class='admin__collapsible-title']/span[contains(text(), '{{tabName}}')]/parent::*/parent::*[@data-state-collapsible='{{state}}']" parameterized="true"/>
30+
<element name="visibility" type="select" selector="//select[@name='product[visibility]']"/>
31+
<element name="visibilityUseDefault" type="checkbox" selector="//input[@name='use_default[visibility]']"/>
3132
</section>
3233
<section name="ProductDesignSection">
3334
<element name="DesignTab" type="button" selector="//strong[@class='admin__collapsible-title']//span[text()='Design']"/>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
98
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
109
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
1110
<section name="AdminProductGridSection">
@@ -24,5 +23,6 @@
2423
<element name="bulkActionDropdown" type="button" selector="div.admin__data-grid-header-row.row div.action-select-wrap button.action-select"/>
2524
<element name="bulkActionOption" type="button" selector="//div[contains(@class,'admin__data-grid-header-row') and contains(@class, 'row')]//div[contains(@class, 'action-select-wrap')]//ul/li/span[text() = '{{label}}']" parameterized="true"/>
2625
<element name="productGridXRowYColumnButton" type="input" selector="table.data-grid tr.data-row:nth-child({{row}}) td:nth-child({{column}})" parameterized="true" timeout="30"/>
26+
<element name="firstRow" type="button" selector="tr.data-row:nth-of-type(1)"/>
2727
</section>
2828
</sections>

0 commit comments

Comments
 (0)