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>
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="StorefrontFooterSection">
11+
<element name="switchStoreButton" type="button" selector="#switcher-store-trigger"/>
12+
<element name="storeLink" type="button" selector="//ul[@class='dropdown switcher-dropdown']//a[contains(text(),'{{var1}}')]" parameterized="true" timeout="30"/>
13+
</section>
14+
</sections>
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+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11+
<section name="StorefrontProductPageSection">
12+
<element name="qtyInput" type="button" selector="input.input-text.qty"/>
13+
<element name="addToCartBtn" type="button" selector="button.action.tocart.primary"/>
14+
<element name="successMsg" type="button" selector="div.message-success"/>
15+
<element name="addToWishlist" type="button" selector="//a[@class='action towishlist']" timeout="30"/>
16+
</section>
17+
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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="CreateCustomStoreViewActionGroup">
11+
<arguments>
12+
<argument name="storeGroupName" defaultValue="customStoreGroup.name"/>
13+
</arguments>
14+
<amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/>
15+
<click selector="{{AdminStoresMainActionsSection.createStoreViewButton}}" stepKey="clickCreateStoreViewButton"/>
16+
<waitForPageLoad time="30" stepKey="waitForProductPageLoad"/>
17+
<selectOption userInput="{{storeGroupName}}" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/>
18+
<fillField userInput="{{customStore.name}}" selector="{{AdminNewStoreSection.storeNameTextField}}" stepKey="fillStoreViewName"/>
19+
<fillField userInput="{{customStore.code}}" selector="{{AdminNewStoreSection.storeCodeTextField}}" stepKey="fillStoreViewCode"/>
20+
<selectOption userInput="{{customStore.is_active}}" selector="{{AdminNewStoreSection.statusDropdown}}" stepKey="selectStoreViewStatus"/>
21+
<click selector="{{AdminStoresMainActionsSection.saveButton}}" stepKey="clickSaveStoreViewButton"/>
22+
<waitForElementVisible selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" stepKey="waitForAcceptNewStoreViewCreationButton" />
23+
<conditionalClick selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" dependentSelector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" visible="true" stepKey="clickAcceptNewStoreViewCreationButton"/>
24+
</actionGroup>
25+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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="DeleteCustomStoreActionGroup">
11+
<arguments>
12+
<argument name="storeGroupName" defaultValue="customStoreGroup.name"/>
13+
</arguments>
14+
<amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/>
15+
<click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/>
16+
<fillField userInput="{{storeGroupName}}" selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="fillSearchStoreGroupField"/>
17+
<click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/>
18+
<see userInput="{{storeGroupName}}" selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" stepKey="verifyThatCorrectStoreGroupFound"/>
19+
<click selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" stepKey="clickEditExistingStoreRow"/>
20+
<click selector="{{AdminStoresMainActionsSection.deleteButton}}" stepKey="clickDeleteStoreGroupButtonOnEditStorePage"/>
21+
<selectOption userInput="No" selector="{{AdminStoresDeleteStoreGroupSection.createDbBackup}}" stepKey="setCreateDbBackupToNo"/>
22+
<click selector="{{AdminStoresDeleteStoreGroupSection.deleteStoreGroupButton}}" stepKey="clickDeleteStoreGroupButtonOnDeleteStorePage"/>
23+
</actionGroup>
24+
</actionGroups>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Section/AdminNewStoreSection.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
<section name="AdminNewStoreSection">
1010
<element name="storeNameTextField" type="input" selector="#store_name"/>
1111
<element name="storeCodeTextField" type="input" selector="#store_code"/>
12-
<element name="statusDropdown" type="button" selector="#store_is_active"/>
13-
<element name="storeGrpDropdown" type="button" selector="#store_group_id"/>
12+
<element name="statusDropdown" type="select" selector="#store_is_active"/>
13+
<element name="storeGrpDropdown" type="select" selector="#store_group_id"/>
1414
<element name="sortOrderTextField" type="input" selector="#store_sort_order"/>
15+
<element name="acceptNewStoreViewCreation" type="button" selector=".action-primary.action-accept" />
1516
</section>
1617
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
9+
<section name="AdminStoresDeleteStoreGroupSection">
10+
<element name="createDbBackup" type="select" selector="#store_create_backup"/>
11+
<element name="deleteStoreGroupButton" type="button" selector="#delete" timeout="30"/>
12+
</section>
13+
</sections>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Section/AdminStoresMainActionsSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
<element name="createWebsiteButton" type="button" selector="#add"/>
1313
<element name="saveButton" type="button" selector="#save"/>
1414
<element name="backButton" type="button" selector="#back"/>
15+
<element name="deleteButton" type="button" selector="#delete" timeout="30"/>
1516
</section>
1617
</sections>

0 commit comments

Comments
 (0)