Skip to content

Commit bc2a9b5

Browse files
committed
MAGETWO-91433: ProductListing: Grid view is getting changed to List view when user adding product from wishlist section.
1 parent 1159d68 commit bc2a9b5

File tree

5 files changed

+146
-2
lines changed

5 files changed

+146
-2
lines changed

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/StorefrontCategoryActionGroup.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,9 @@
3232
<!-- @TODO: MAGETWO-80272 Move to Magento_Checkout -->
3333
<seeElement selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="AssertAddToCart" />
3434
</actionGroup>
35-
</actionGroups>
35+
36+
<actionGroup name="StorefrontSwitchCategoryViewToListMode">
37+
<click selector="{{StorefrontCategoryMainSection.modeListButton}}" stepKey="switchCategoryViewToListMode"/>
38+
<waitForElement selector="{{StorefrontCategoryMainSection.CategoryTitle}}" time="30" stepKey="waitForCategoryReload"/>
39+
</actionGroup>
40+
</actionGroups>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Wishlist/ActionGroup/StorefrontCustomerWishlistActionGroup.xml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,24 @@
5353
<seeElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductAddToCartByName(productVar.name)}}" stepKey="AssertWishlistSidebarAddToCart" />
5454
<seeElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductImageByName(productVar.name)}}" stepKey="AssertWishlistSidebarProductImage" />
5555
</actionGroup>
56-
</actionGroups>
56+
57+
<!--Remove a product from the wishlist using the sidebar -->
58+
<actionGroup name="StorefrontCustomerRemoveProductFromWishlistUsingSidebar">
59+
<arguments>
60+
<argument name="product"/>
61+
</arguments>
62+
<click selector="{{StorefrontCustomerWishlistSidebarSection.ProductRemoveByName(product.name)}}" stepKey="RemoveProductFromWishlistUsingSidebarClickRemoveItemFromWishlist"/>
63+
<waitForElement selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="RemoveProductFromWishlistUsingSidebarWaitForSuccessMessage"/>
64+
<see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="{{product.name}} has been removed from your Wish List." stepKey="RemoveProductFromWishlistUsingSidebarSeeProductNameRemovedFromWishlist"/>
65+
</actionGroup>
66+
67+
<!--Add a product to the cart from the wishlist using the sidebar -->
68+
<actionGroup name="StorefrontCustomerAddProductToCartFromWishlistUsingSidebar">
69+
<arguments>
70+
<argument name="product"/>
71+
</arguments>
72+
<click selector="{{StorefrontCustomerWishlistSidebarSection.ProductAddToCartByName(product.name)}}" stepKey="AddProductToCartFromWishlistUsingSidebarClickAddToCartFromWishlist"/>
73+
<waitForElement selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="AddProductToCartFromWishlistUsingSidebarWaitForSuccessMessage"/>
74+
<see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added {{product.name}} to your shopping cart." stepKey="AddProductToCartFromWishlistUsingSidebarSeeProductNameAddedToCartFromWishlist"/>
75+
</actionGroup>
76+
</actionGroups>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Wishlist/Section/StorefrontCustomerWishlistSidebarSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
<element name="ProductPriceByName" type="text" selector="//main//ol[@id='wishlist-sidebar']//a[@class='product-item-link']/span[text()='{{var1}}']//ancestor::ol//span[@class='price']" parameterized="true"/>
1414
<element name="ProductImageByName" type="text" selector="//main//ol[@id='wishlist-sidebar']//a[@class='product-item-link']/span[text()='{{var1}}']//ancestor::ol//img[@class='product-image-photo']" parameterized="true"/>
1515
<element name="ProductAddToCartByName" type="button" selector="//main//ol[@id='wishlist-sidebar']//a[@class='product-item-link']/span[text()='{{var1}}']//ancestor::ol//button[contains(@class, 'action tocart primary')]" parameterized="true"/>
16+
<element name="ProductRemoveByName" type="button" selector="//main//ol[@id='wishlist-sidebar']//a[@class='product-item-link']/span[text()='{{var1}}']//ancestor::ol//a[contains(@class, 'action delete')]" parameterized="true"/>
1617
</section>
1718
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
10+
<test name="StorefrontAddProductsToCartFromWishlistUsingSidebarTest">
11+
<annotations>
12+
<title value="Add products from the wishlist to the cart using the sidebar."/>
13+
<description value="Products added to the cart from wishlist and a customer remains on the same page."/>
14+
<group value="wishlist"/>
15+
</annotations>
16+
<before>
17+
<createData entity="SimpleSubCategory" stepKey="categoryFirst"/>
18+
<createData entity="SimpleSubCategory" stepKey="categorySecond"/>
19+
<createData entity="SimpleProduct" stepKey="simpleProduct1">
20+
<requiredEntity createDataKey="categoryFirst"/>
21+
</createData>
22+
<createData entity="SimpleProduct" stepKey="simpleProduct2">
23+
<requiredEntity createDataKey="categorySecond"/>
24+
</createData>
25+
<createData entity="Simple_US_Customer" stepKey="customer"/>
26+
</before>
27+
<after>
28+
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
29+
<deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/>
30+
<deleteData createDataKey="categoryFirst" stepKey="deleteCategoryFirst"/>
31+
<deleteData createDataKey="categorySecond" stepKey="deleteCategorySecond"/>
32+
<deleteData createDataKey="customer" stepKey="deleteCustomer"/>
33+
</after>
34+
<!-- Sign in as customer -->
35+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontAccount">
36+
<argument name="Customer" value="$$customer$$"/>
37+
</actionGroup>
38+
<!-- Add product from first category to the wishlist -->
39+
<amOnPage url="{{StorefrontCategoryPage.url($$categoryFirst.name$$)}}" stepKey="navigateToCategoryFirstPage"/>
40+
<actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="browseAssertCategoryProduct1">
41+
<argument name="product" value="$$simpleProduct1$$"/>
42+
</actionGroup>
43+
<actionGroup ref="StorefrontCustomerAddCategoryProductToWishlistActionGroup" stepKey="addSimpleProduct1ToWishlist">
44+
<argument name="productVar" value="$$simpleProduct1$$"/>
45+
</actionGroup>
46+
<!--Add product to the cart from the Wishlist using the sidebar from the second category page-->
47+
<amOnPage url="{{StorefrontCategoryPage.url($$categorySecond.name$$)}}" stepKey="navigateToCategorySecondPage"/>
48+
<actionGroup ref="StorefrontSwitchCategoryViewToListMode" stepKey="switchCategoryViewToListMode"/>
49+
<actionGroup ref="StorefrontCustomerCheckProductInWishlistSidebar" stepKey="checkSimpleProduct1InWishlistSidebar">
50+
<argument name="productVar" value="$$simpleProduct1$$"/>
51+
</actionGroup>
52+
<actionGroup ref="StorefrontCustomerAddProductToCartFromWishlistUsingSidebar" stepKey="addProduct1ToCartFromWishlistUsingSidebar">
53+
<argument name="product" value="$$simpleProduct1$$"/>
54+
</actionGroup>
55+
<!--Check that a customer on the same page as before-->
56+
<!--hardcoded URL because this method does not support replacement-->
57+
<seeCurrentUrlMatches regex="~\/$$categorySecond.name$$\.html\?(\S+)?\w+=list(&amp;\S+)?$~i" stepKey="seeCurrentCategoryUrlMatches"/>
58+
</test>
59+
</tests>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
10+
<test name="StorefrontRemoveProductsFromWishlistUsingSidebarTest">
11+
<annotations>
12+
<title value="Remove products from the wishlist using the sidebar."/>
13+
<description value="Products removed from wishlist and a customer remains on the same page."/>
14+
<group value="wishlist"/>
15+
</annotations>
16+
<before>
17+
<createData entity="SimpleSubCategory" stepKey="categoryFirst"/>
18+
<createData entity="SimpleSubCategory" stepKey="categorySecond"/>
19+
<createData entity="SimpleProduct" stepKey="simpleProduct1">
20+
<requiredEntity createDataKey="categoryFirst"/>
21+
</createData>
22+
<createData entity="SimpleProduct" stepKey="simpleProduct2">
23+
<requiredEntity createDataKey="categorySecond"/>
24+
</createData>
25+
<createData entity="Simple_US_Customer" stepKey="customer"/>
26+
</before>
27+
<after>
28+
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
29+
<deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/>
30+
<deleteData createDataKey="categoryFirst" stepKey="deleteCategoryFirst"/>
31+
<deleteData createDataKey="categorySecond" stepKey="deleteCategorySecond"/>
32+
<deleteData createDataKey="customer" stepKey="deleteCustomer"/>
33+
</after>
34+
<!-- Sign in as customer -->
35+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontAccount">
36+
<argument name="Customer" value="$$customer$$"/>
37+
</actionGroup>
38+
<!-- Add product from first category to the wishlist -->
39+
<amOnPage url="{{StorefrontCategoryPage.url($$categoryFirst.name$$)}}" stepKey="navigateToCategoryFirstPage"/>
40+
<actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="browseAssertCategoryProduct1">
41+
<argument name="product" value="$$simpleProduct1$$"/>
42+
</actionGroup>
43+
<actionGroup ref="StorefrontCustomerAddCategoryProductToWishlistActionGroup" stepKey="addSimpleProduct1ToWishlist">
44+
<argument name="productVar" value="$$simpleProduct1$$"/>
45+
</actionGroup>
46+
<!--Remove product from the Wishlist using the sidebar from the second category page-->
47+
<amOnPage url="{{StorefrontCategoryPage.url($$categorySecond.name$$)}}" stepKey="navigateToCategorySecondPage"/>
48+
<actionGroup ref="StorefrontSwitchCategoryViewToListMode" stepKey="switchCategoryViewToListMode"/>
49+
<actionGroup ref="StorefrontCustomerCheckProductInWishlistSidebar" stepKey="checkSimpleProduct1InWishlistSidebar">
50+
<argument name="productVar" value="$$simpleProduct1$$"/>
51+
</actionGroup>
52+
<actionGroup ref="StorefrontCustomerRemoveProductFromWishlistUsingSidebar" stepKey="removeProduct1FromWishlistUsingSidebar">
53+
<argument name="product" value="$$simpleProduct1$$"/>
54+
</actionGroup>
55+
<!--Check that a customer on the same page as before-->
56+
<!--hardcoded URL because this method does not support replacement-->
57+
<seeCurrentUrlMatches regex="~\/$$categorySecond.name$$\.html\?(\S+)?\w+=list(&amp;\S+)?$~i" stepKey="seeCurrentCategoryUrlMatches"/>
58+
</test>
59+
</tests>

0 commit comments

Comments
 (0)