Skip to content

Commit 30a822a

Browse files
committed
MAGETWO-94021: Problems with adding products in wish list
- added functional test
1 parent 67dd858 commit 30a822a

File tree

6 files changed

+150
-0
lines changed

6 files changed

+150
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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="EnableCustomerMultipleWishlistOption">
12+
<amOnPage url="{{AdminCustomerWishlistConfigurationPage.url}}" stepKey="goToWishlistConfigurationPage"/>
13+
<waitForPageLoad stepKey="waitForSystemConfigPage"/>
14+
<conditionalClick selector="{{WishlistGeneralSection.GeneralOptionsTab}}" dependentSelector="{{WishlistGeneralSection.CheckIfGeneralOptionsTabExpand}}" visible="true" stepKey="expandGeneralSectionTab"/>
15+
<waitForElementVisible selector="{{WishlistGeneralSection.EnableMultipleWishList}}" stepKey="waitForDropdownToBeVisible"/>
16+
<selectOption selector="{{WishlistGeneralSection.EnableMultipleWishList}}" userInput="Yes" stepKey="enableMultipleWishLists"/>
17+
<click selector="{{WishlistGeneralSection.GeneralOptionsTab}}" stepKey="collapseGeneralOptionsTab"/>
18+
<click selector="{{ContentManagementSection.Save}}" stepKey="saveConfiguration"/>
19+
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the configuration." stepKey="seeConfigSuccessMessage"/>
20+
</actionGroup>
21+
<actionGroup name="ResetCustomerMultipleWishlistOption">
22+
<amOnPage url="{{AdminCustomerWishlistConfigurationPage.url}}" stepKey="goToWishlistConfigurationPage"/>
23+
<waitForPageLoad stepKey="waitForSystemConfigPage"/>
24+
<conditionalClick selector="{{WishlistGeneralSection.GeneralOptionsTab}}" dependentSelector="{{WishlistGeneralSection.CheckIfGeneralOptionsTabExpand}}" visible="true" stepKey="expandGeneralSectionTab"/>
25+
<waitForElementVisible selector="{{WishlistGeneralSection.EnableMultipleWishList}}" stepKey="waitForDropdownToBeVisible"/>
26+
<selectOption selector="{{WishlistGeneralSection.EnableMultipleWishList}}" userInput="No" stepKey="enableMultipleWishLists"/>
27+
<click selector="{{WishlistGeneralSection.GeneralOptionsTab}}" stepKey="collapseGeneralOptionsTab"/>
28+
<click selector="{{ContentManagementSection.Save}}" stepKey="saveConfiguration"/>
29+
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the configuration." stepKey="seeConfigSuccessMessage"/>
30+
</actionGroup>
31+
</actionGroups>

app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,39 @@
2020
<seeCurrentUrlMatches regex="~/wishlist_id/\d+/$~" stepKey="seeCurrentUrlMatches"/>
2121
</actionGroup>
2222

23+
<!-- Add Product to split wishlist from the category page and check message -->
24+
<actionGroup name="StorefrontCustomerAddCategoryProductToWishlistActionGroup2">
25+
<arguments>
26+
<argument name="productVar"/>
27+
</arguments>
28+
<moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(productVar.name)}}" stepKey="addCategoryProductToWishlistMoveMouseOverProduct" />
29+
<!--<click selector="{{StorefrontCategoryProductSection.ProductAddToSplitWishlistByName(productVar.name)}}" stepKey="addCategoryProductToWishlistClickAddProductToWishlist"/>-->
30+
<click selector="{{StorefrontCategoryProductSection.addToWishListArrow(productVar.name)}}" stepKey="clickAddToWishlist"/>
31+
<click selector="{{StorefrontCategoryProductSection.chooseWishlist}}" stepKey="selectWishlist"/>
32+
33+
<waitForElement selector="{{StorefrontCustomerWishlistSection.successMsg}}" time="30" stepKey="addCategoryProductToWishlistWaitForSuccessMessage"/>
34+
<see selector="{{StorefrontCustomerWishlistSection.successMsg}}" userInput="{{productVar.name}} has been added to your Wish List." stepKey="addCategoryProductToWishlistSeeProductNameAddedToWishlist"/>
35+
<seeCurrentUrlMatches regex="~/wishlist_id/\d+/$~" stepKey="seeCurrentUrlMatches"/>
36+
</actionGroup>
37+
38+
<actionGroup name="StorefrontCustomerAddCategoryProductToWishlistActionGroup3">
39+
<arguments>
40+
<argument name="productVar"/>
41+
</arguments>
42+
<moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(productVar.name)}}" stepKey="addCategoryProductToWishlistMoveMouseOverProduct" />
43+
<!--<click selector="{{StorefrontCategoryProductSection.ProductAddToSplitWishlistByName(productVar.name)}}" stepKey="addCategoryProductToWishlistClickAddProductToWishlist"/>-->
44+
<click selector="{{StorefrontCategoryProductSection.addToWishListArrow(productVar.name)}}" stepKey="clickDropdownToAddToWishlist"/>
45+
<!--<click selector="{{StorefrontCategoryProductSection.testWishlist(productVar.name)}}" stepKey="chooseWishlistSpan"/>-->
46+
<!--<scrollTo selector="{{StorefrontCategoryProductSection.testWishlist(productVar.name)}}" x="-10" y="10" stepKey="selectWishlistwithOffset"/>-->
47+
<!--<scrollTo selector="{{StorefrontCategoryProductSection.chooseWishlist}}" x="10" y="10" stepKey="selectWishlistwithOffset"/>-->
48+
<!--<clickWithLeftButton selector="{{StorefrontCategoryProductSection.chooseWishlist}}" x="-90" y="0" stepKey="selectWishlistWithOffset"/>-->
49+
<clickWithLeftButton selector="{{StorefrontCategoryProductSection.testWishlist(productVar.name)}}" x="90" y="0" stepKey="selectWishlistWithOffset"/>
50+
51+
<waitForElement selector="{{StorefrontCustomerWishlistSection.successMsg}}" time="30" stepKey="addCategoryProductToWishlistWaitForSuccessMessage"/>
52+
<see selector="{{StorefrontCustomerWishlistSection.successMsg}}" userInput="{{productVar.name}} has been added to your Wish List." stepKey="addCategoryProductToWishlistSeeProductNameAddedToWishlist"/>
53+
<seeCurrentUrlMatches regex="~/wishlist_id/\d+/$~" stepKey="seeCurrentUrlMatches"/>
54+
</actionGroup>
55+
2356
<!-- Add Product to wishlist from the product page and check message -->
2457
<actionGroup name="StorefrontCustomerAddProductToWishlistActionGroup">
2558
<arguments>

app/code/Magento/Wishlist/Test/Mftf/Page/StorefrontCustomerWishlistPage.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@
1111
<page name="StorefrontCustomerWishlistPage" url="/wishlist/" area="storefront" module="Magento_Wishlist">
1212
<section name="StorefrontCustomerWishlistSection" />
1313
</page>
14+
<page name="AdminCustomerWishlistConfigurationPage" url="admin/system_config/edit/section/wishlist/" area="admin" module="Magento_Wishlist">
15+
<section name="WishlistGeneralSection"/>
16+
</page>
1417
</pages>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="WishlistGeneralSection">
12+
<element name="GeneralOptionsTab" type="button" selector="#wishlist_general-head"/>
13+
<element name="CheckIfGeneralOptionsTabExpand" type="button" selector="#wishlist_general-head:not(.open)"/>
14+
<element name="EnableMultipleWishList" type="select" selector="#wishlist_general_multiple_enabled"/>
15+
</section>
16+
</sections>

app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCategoryProductSection.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@
1111
<section name="StorefrontCategoryProductSection">
1212
<element name="ProductAddToWishlistByNumber" type="text" selector="//main//li[{{var1}}]//a[contains(@class, 'towishlist')]" parameterized="true"/>
1313
<element name="ProductAddToWishlistByName" type="text" selector="//main//li[.//a[contains(text(), '{{var1}}')]]//a[contains(@class, 'towishlist')]" parameterized="true"/>
14+
<element name="addToWishListArrow" type="button" selector="//main//li[.//a[contains(text(), '{{var1}}')]]//button[@title='Add to:']" parameterized="true"/>
15+
<element name="chooseWishlist" type="button" selector="span[title='Wish List']" timeout="30"/>
16+
<element name="testWishlist" type="button" selector="(//main//li[.//a[contains(text(), '{{var1}}')]]//li[contains(@class,'item')]/span)[1]" parameterized="true"/>
1417
</section>
1518
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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" xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
10+
<test name="StoreFrontAddProductsToWishListWithMultipleWishlistsEnabledTest">
11+
<annotations>
12+
<stories value="Wishlist"/>
13+
<title value="Add products from the wishlist to the cart using the sidebar."/>
14+
<description value="Products added to the cart from wishlist and a customer remains on the same page."/>
15+
<severity value="MAJOR"/>
16+
<testCaseId value="MAGETWO-94021"/>
17+
<group value="wishlist"/>
18+
</annotations>
19+
<before>
20+
<createData entity="SimpleSubCategory" stepKey="categoryFirst"/>
21+
22+
<createData entity="SimpleProduct" stepKey="simpleProduct1">
23+
<requiredEntity createDataKey="categoryFirst"/>
24+
</createData>
25+
<!--<createData entity="SimpleProduct" stepKey="simpleProduct2">-->
26+
<!--<requiredEntity createDataKey="categoryFirst"/>-->
27+
<!--</createData>-->
28+
29+
<createData entity="Simple_US_Customer" stepKey="customer"/>
30+
</before>
31+
<after>
32+
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
33+
<!--<deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/>-->
34+
<deleteData createDataKey="categoryFirst" stepKey="deleteCategoryFirst"/>
35+
<deleteData createDataKey="customer" stepKey="deleteCustomer"/>
36+
<actionGroup ref="ResetCustomerMultipleWishlistOption" stepKey="resetWishlistConfiguration"/>
37+
<amOnPage url="admin/admin/auth/logout/" stepKey="logout"/>
38+
</after>
39+
<!--Login to admin-->
40+
<actionGroup ref="LoginAsAdmin" stepKey="loginToAdmin"/>
41+
<comment userInput="Enable multiple wishlist" stepKey="enableMultipleWishlist"/>
42+
<actionGroup ref="EnableCustomerMultipleWishlistOption" stepKey="enableCustomerWishlist"/>
43+
<actionGroup ref="ClearCacheActionGroup" stepKey="clearCache"/>
44+
45+
<!--<amOnPage url="admin/admin/auth/logout/" stepKey="logout"/>-->
46+
<!-- Sign in as customer -->
47+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontAccount">
48+
<argument name="Customer" value="$$customer$$"/>
49+
</actionGroup>
50+
<!-- Add product from first category to the wishlist -->
51+
<amOnPage url="{{StorefrontCategoryPage.url($$categoryFirst.name$$)}}" stepKey="navigateToCategoryFirstPage"/>
52+
<actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="browseAssertCategoryProduct1">
53+
<argument name="product" value="$$simpleProduct1$$"/>
54+
</actionGroup>
55+
<!--<actionGroup ref="StorefrontCustomerAddCategoryProductToWishlistActionGroup2" stepKey="addSimpleProduct1ToWishlist">-->
56+
<!--<argument name="productVar" value="$$simpleProduct1$$"/>-->
57+
<!--</actionGroup>-->
58+
59+
<!-- Add product from first category to the wishlist after shifting-->
60+
<actionGroup ref="StorefrontCustomerAddCategoryProductToWishlistActionGroup3" stepKey="addSimpleProduct1ToWishlist">
61+
<argument name="productVar" value="$$simpleProduct1$$"/>
62+
</actionGroup>
63+
</test>
64+
</tests>

0 commit comments

Comments
 (0)