Skip to content

Commit 52f6df2

Browse files
committed
MC-12180: Verify that information about viewing, comparison, wishlist and last ordered items is persisted under long-term cookie
1 parent d81b399 commit 52f6df2

File tree

7 files changed

+245
-0
lines changed

7 files changed

+245
-0
lines changed
Lines changed: 25 additions & 0 deletions
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+
9+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
10+
<entity name="EnableSynchronizeWidgetProductsWithBackendStorage" type="catalog_recently_products">
11+
<requiredEntity type="synchronize_with_backend">EnableCatalogRecentlyProductsSynchronize</requiredEntity>
12+
</entity>
13+
14+
<entity name="EnableCatalogRecentlyProductsSynchronize" type="synchronize_with_backend">
15+
<data key="value">1</data>
16+
</entity>
17+
18+
<entity name="DisableSynchronizeWidgetProductsWithBackendStorage" type="catalog_recently_products">
19+
<requiredEntity type="synchronize_with_backend">DefaultCatalogRecentlyProductsSynchronize</requiredEntity>
20+
</entity>
21+
22+
<entity name="DefaultCatalogRecentlyProductsSynchronize" type="synchronize_with_backend">
23+
<data key="value">0</data>
24+
</entity>
25+
</entities>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd">
9+
<operation name="CatalogRecentlyProductsConfiguration" dataType="catalog_recently_products" type="create" auth="adminFormKey" url="/admin/system_config/save/section/catalog/" method="POST">
10+
<object key="groups" dataType="catalog_recently_products">
11+
<object key="recently_products" dataType="catalog_recently_products">
12+
<object key="fields" dataType="catalog_recently_products">
13+
<object key="synchronize_with_backend" dataType="synchronize_with_backend">
14+
<field key="value">integer</field>
15+
</object>
16+
</object>
17+
</object>
18+
</object>
19+
</operation>
20+
</operations>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
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="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontVerifyThatInformationAboutViewingComparisonWishlistIsPersistedUnderLongTermCookieTest">
12+
<annotations>
13+
<features value="Persistent"/>
14+
<stories value="Check the widgets is persisted"/>
15+
<title value="Verify that information about viewing, comparison, wishlist and last ordered items is persisted under long-term cookie"/>
16+
<description value="Verify that information about viewing, comparison, wishlist and last ordered items is persisted under long-term cookie"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-12180"/>
19+
<group value="persistent"/>
20+
<skip>
21+
<issueId value="MC-15741"/>
22+
</skip>
23+
</annotations>
24+
<before>
25+
<createData entity="PersistentConfigEnabled" stepKey="enablePersistent"/>
26+
<createData entity="PersistentLogoutClearDisable" stepKey="persistentLogoutClearDisable"/>
27+
<createData entity="EnableSynchronizeWidgetProductsWithBackendStorage" stepKey="enableSynchronizeWidgetProductsWithBackendStorage"/>
28+
<createData entity="_defaultCategory" stepKey="createCategory"/>
29+
<createData entity="_defaultProduct" stepKey="createSimpleProduct">
30+
<requiredEntity createDataKey="createCategory"/>
31+
</createData>
32+
<createData entity="SimpleProduct" stepKey="createSimpleProduct2">
33+
<requiredEntity createDataKey="createCategory"/>
34+
</createData>
35+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
36+
37+
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
38+
<actionGroup ref="AdminCreateRecentlyProductsWidgetActionGroup" stepKey="createRecentlyComparedProductsWidget">
39+
<argument name="widget" value="RecentlyComparedProductsWidget"/>
40+
</actionGroup>
41+
<actionGroup ref="AdminCreateRecentlyProductsWidgetActionGroup" stepKey="createRecentlyViewedProductsWidget">
42+
<argument name="widget" value="RecentlyViewedProductsWidget"/>
43+
</actionGroup>
44+
</before>
45+
<after>
46+
<createData entity="PersistentConfigDefault" stepKey="setDefaultPersistentState"/>
47+
<createData entity="PersistentLogoutClearEnabled" stepKey="persistentLogoutClearEnabled"/>
48+
<createData entity="DisableSynchronizeWidgetProductsWithBackendStorage" stepKey="disableSynchronizeWidgetProductsWithBackendStorage"/>
49+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
50+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
51+
<deleteData createDataKey="createSimpleProduct2" stepKey="deleteSimpleProduct2"/>
52+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
53+
54+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutFromCustomer"/>
55+
<actionGroup ref="AdminDeleteWidgetActionGroup" stepKey="deleteRecentlyComparedProductsWidget">
56+
<argument name="widget" value="RecentlyComparedProductsWidget"/>
57+
</actionGroup>
58+
<actionGroup ref="AdminDeleteWidgetActionGroup" stepKey="deleteRecentlyViewedProductsWidget">
59+
<argument name="widget" value="RecentlyViewedProductsWidget"/>
60+
</actionGroup>
61+
<actionGroup ref="logout" stepKey="logout"/>
62+
</after>
63+
64+
<!--Login to storefront from customer-->
65+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="logInFromCustomer">
66+
<argument name="Customer" value="$$createCustomer$$"/>
67+
</actionGroup>
68+
<see userInput="Welcome, $$createCustomer.firstname$$ $$createCustomer.lastname$$!" selector="{{StorefrontPanelHeaderSection.WelcomeMessage}}" stepKey="homeCheckWelcome"/>
69+
70+
<!--Open the details page of Simple Product 1, Simple Product 2 and add to cart, get to the category-->
71+
<actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart">
72+
<argument name="product" value="$$createSimpleProduct$$"/>
73+
</actionGroup>
74+
<actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart2">
75+
<argument name="product" value="$$createSimpleProduct2$$"/>
76+
</actionGroup>
77+
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onStorefrontCategoryPage3"/>
78+
<!--The Recently Viewed widget displays Simple Product 1 and Simple Product 2-->
79+
<waitForElementVisible selector="{{StorefrontWidgetsSection.widgetRecentlyViewedProductsGrid}}" stepKey="waitWidgetRecentlyViewedProductsGrid"/>
80+
<see selector="{{StorefrontWidgetsSection.widgetRecentlyViewedProductsGrid}}" userInput="$$createSimpleProduct.name$$" stepKey="seeProduct1InRecentlyViewedWidget"/>
81+
<see selector="{{StorefrontWidgetsSection.widgetRecentlyViewedProductsGrid}}" userInput="$$createSimpleProduct2.name$$" stepKey="seeProduct2InRecentlyViewedWidget"/>
82+
83+
<!--Add Simple Product 1 and Simple Product 2 to Wishlist-->
84+
<actionGroup ref="StorefrontCustomerAddCategoryProductToWishlistActionGroup" stepKey="addSimpleProduct1ToWishlist">
85+
<argument name="productVar" value="$$createSimpleProduct$$"/>
86+
</actionGroup>
87+
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onStorefrontCategoryPage4"/>
88+
<actionGroup ref="StorefrontCustomerAddCategoryProductToWishlistActionGroup" stepKey="addSimpleProduct2ToWishlist">
89+
<argument name="productVar" value="$$createSimpleProduct2$$"/>
90+
</actionGroup>
91+
<!--The My Wishlist widget displays Simple Product 1 and Simple Product 2-->
92+
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onStorefrontCategoryPage5"/>
93+
<actionGroup ref="StorefrontCustomerCheckProductInWishlistSidebar" stepKey="checkSimpleProductInWishlistSidebar">
94+
<argument name="productVar" value="$$createSimpleProduct$$"/>
95+
</actionGroup>
96+
<actionGroup ref="StorefrontCustomerCheckProductInWishlistSidebar" stepKey="checkSimpleProduct2InWishlistSidebar">
97+
<argument name="productVar" value="$$createSimpleProduct2$$"/>
98+
</actionGroup>
99+
100+
<!--Add to compare Simple Product and Simple Product 2-->
101+
<actionGroup ref="StorefrontAddCategoryProductToCompareActionGroup" stepKey="compareAddSimpleProduct1ToCompare" >
102+
<argument name="productVar" value="$$createSimpleProduct$$"/>
103+
</actionGroup>
104+
<actionGroup ref="StorefrontAddCategoryProductToCompareActionGroup" stepKey="compareAddSimpleProduct2ToCompare" >
105+
<argument name="productVar" value="$$createSimpleProduct2$$"/>
106+
</actionGroup>
107+
<!--The Compare Products widget displays Simple Product 1 and Simple Product 2-->
108+
<actionGroup ref="StorefrontCheckCompareSidebarProductActionGroup" stepKey="compareSimpleProduct1InSidebar">
109+
<argument name="productVar" value="$$createSimpleProduct$$"/>
110+
</actionGroup>
111+
<actionGroup ref="StorefrontCheckCompareSidebarProductActionGroup" stepKey="compareSimpleProduct2InSidebar">
112+
<argument name="productVar" value="$$createSimpleProduct2$$"/>
113+
</actionGroup>
114+
115+
<!--Click Clear all in the Compare Products widget-->
116+
<waitForElementVisible selector="{{WidgetSection.ClearCompare}}" stepKey="waitForClearCompareBtn"/>
117+
<click selector="{{WidgetSection.ClearCompare}}" stepKey="clickClearCompareBtn"/>
118+
<waitForElementVisible selector="{{WidgetSection.AcceptClear}}" stepKey="waitForAcceptBtn"/>
119+
<click selector="{{WidgetSection.AcceptClear}}" stepKey="acceptClearCompare"/>
120+
<waitForPageLoad stepKey="waitForPageLoad"/>
121+
<!--The Recently Compared widget displays Simple Product 1 and Simple Product 2-->
122+
<waitForElementVisible selector="{{StorefrontWidgetsSection.widgetRecentlyComparedProductsGrid}}" stepKey="waitWidgetRecentlyComparedProductsGrid"/>
123+
<see selector="{{StorefrontWidgetsSection.widgetRecentlyComparedProductsGrid}}" userInput="$$createSimpleProduct.name$$" stepKey="seeProductInRecentlyComparedWidget"/>
124+
<see selector="{{StorefrontWidgetsSection.widgetRecentlyComparedProductsGrid}}" userInput="$$createSimpleProduct.name$$" stepKey="seeProduct2InRecentlyComparedWidget"/>
125+
126+
<!--Place the order-->
127+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToShoppingCartPage"/>
128+
<actionGroup ref="PlaceOrderWithLoggedUserActionGroup" stepKey="placeOrder">
129+
<argument name="shippingMethod" value="Flat Rate"/>
130+
</actionGroup>
131+
<!--The Recently Ordered widget displays Simple Product 1 and Simple Product 2-->
132+
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onStorefrontCategoryPage6"/>
133+
<waitForElementVisible selector="{{StorefrontWidgetsSection.widgetRecentlyOrderedProductsGrid}}" stepKey="waitWidgetRecentlyOrderedProductsGrid"/>
134+
<see selector="{{StorefrontWidgetsSection.widgetRecentlyOrderedProductsGrid}}" userInput="$$createSimpleProduct.name$$" stepKey="seeProductInRecentlyOrderedWidget"/>
135+
<see selector="{{StorefrontWidgetsSection.widgetRecentlyOrderedProductsGrid}}" userInput="$$createSimpleProduct.name$$" stepKey="seeProduct2InRecentlyOrderedWidget"/>
136+
137+
<!--Sign out and check that widgets persist the information about the items-->
138+
<actionGroup ref="StorefrontSignOutActionGroup" stepKey="storefrontSignOut"/>
139+
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onStorefrontCategoryPage7"/>
140+
<see userInput="Welcome, $$createCustomer.firstname$$ $$createCustomer.lastname$$!" selector="{{StorefrontPanelHeaderSection.WelcomeMessage}}" stepKey="homeCheckWelcome2"/>
141+
<seeElement selector="{{StorefrontPanelHeaderSection.notYouLink}}" stepKey="checkLinkNotYoy"/>
142+
<see selector="{{StorefrontWidgetsSection.widgetRecentlyViewedProductsGrid}}" userInput="$$createSimpleProduct.name$$" stepKey="seeProduct1InRecentlyViewedWidget2"/>
143+
<actionGroup ref="StorefrontCustomerCheckProductInWishlistSidebar" stepKey="checkSimpleProductInWishlistSidebar2">
144+
<argument name="productVar" value="$$createSimpleProduct$$"/>
145+
</actionGroup>
146+
<see selector="{{StorefrontWidgetsSection.widgetRecentlyComparedProductsGrid}}" userInput="$$createSimpleProduct.name$$" stepKey="seeProductInRecentlyComparedWidget2"/>
147+
<see selector="{{StorefrontWidgetsSection.widgetRecentlyOrderedProductsGrid}}" userInput="$$createSimpleProduct.name$$" stepKey="seeProductInRecentlyOrderedWidget2"/>
148+
149+
<!--Click the *Not you?* link and check the price for Simple Product-->
150+
<click selector="{{StorefrontPanelHeaderSection.notYouLink}}" stepKey="clickNext"/>
151+
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onStorefrontCategoryPage8"/>
152+
<see userInput="Default welcome msg!" selector="{{StorefrontPanelHeaderSection.WelcomeMessage}}" stepKey="homeCheckWelcome3"/>
153+
<dontSee selector="{{StorefrontWidgetsSection.widgetRecentlyViewedProductsGrid}}" userInput="$$createSimpleProduct.name$$" stepKey="dontSeeProduct1InRecentlyViewedWidget"/>
154+
<dontSee selector="{{StorefrontCustomerWishlistSidebarSection.ProductTitleByName($$createSimpleProduct.name$$)}}" stepKey="dontSeeProduct1InWishlistWidget"/>
155+
<dontSee selector="{{StorefrontWidgetsSection.widgetRecentlyComparedProductsGrid}}" userInput="$$createSimpleProduct.name$$" stepKey="dontSeeProductInRecentlyComparedWidget"/>
156+
<dontSee selector="{{StorefrontWidgetsSection.widgetRecentlyOrderedProductsGrid}}" userInput="$$createSimpleProduct.name$$" stepKey="dontSeeProductInRecentlyOrderedWidget"/>
157+
158+
<!--Login to storefront from customer again-->
159+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="logInFromCustomer2">
160+
<argument name="Customer" value="$$createCustomer$$"/>
161+
</actionGroup>
162+
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onStorefrontCategoryPage9"/>
163+
<see userInput="Welcome, $$createCustomer.firstname$$ $$createCustomer.lastname$$!" selector="{{StorefrontPanelHeaderSection.WelcomeMessage}}" stepKey="homeCheckWelcome4"/>
164+
<waitForElementVisible selector="{{StorefrontCustomerWishlistSidebarSection.ProductTitleByName($$createSimpleProduct.name$$)}}" stepKey="assertWishlistSidebarProductName"/>
165+
<see selector="{{StorefrontWidgetsSection.widgetRecentlyViewedProductsGrid}}" userInput="$$createSimpleProduct.name$$" stepKey="seeProduct1InRecentlyViewedWidget3"/>
166+
<see selector="{{StorefrontWidgetsSection.widgetRecentlyComparedProductsGrid}}" userInput="$$createSimpleProduct.name$$" stepKey="seeProductInRecentlyComparedWidget3"/>
167+
<see selector="{{StorefrontWidgetsSection.widgetRecentlyOrderedProductsGrid}}" userInput="$$createSimpleProduct.name$$" stepKey="seeProductInRecentlyOrderedWidget3"/>
168+
</test>
169+
</tests>

app/code/Magento/Widget/Test/Mftf/ActionGroup/AdminCreateWidgetActionGroup.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,10 @@
7878
<click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveWidget"/>
7979
<see selector="{{AdminMessagesSection.successMessage}}" userInput="The widget instance has been saved" stepKey="seeSuccess"/>
8080
</actionGroup>
81+
<actionGroup name="AdminCreateRecentlyProductsWidgetActionGroup" extends="AdminCreateWidgetActionGroup">
82+
<selectOption selector="{{AdminNewWidgetSection.productAttributesToShow}}" parameterArray="['Name', 'Image', 'Price']" stepKey="selectAllProductAttributes"/>
83+
<selectOption selector="{{AdminNewWidgetSection.productButtonsToShow}}" parameterArray="['Add to Cart', 'Add to Compare', 'Add to Wishlist']" stepKey="selectAllProductButtons"/>
84+
<click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveWidget"/>
85+
<see selector="{{AdminMessagesSection.successMessage}}" userInput="The widget instance has been saved" stepKey="seeSuccess"/>
86+
</actionGroup>
8187
</actionGroups>

app/code/Magento/Widget/Test/Mftf/Data/WidgetsData.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,24 @@
3232
<data key="display_mode">Cart Price Rule Related</data>
3333
<data key="restrict_type">Header</data>
3434
</entity>
35+
<entity name="RecentlyComparedProductsWidget" type="widget">
36+
<data key="type">Recently Compared Products</data>
37+
<data key="design_theme">Magento Luma</data>
38+
<data key="name" unique="suffix">Recently Compared Products</data>
39+
<array key="store_ids">
40+
<item>All Store Views</item>
41+
</array>
42+
<data key="display_on">All Pages</data>
43+
<data key="container">Sidebar Additional</data>
44+
</entity>
45+
<entity name="RecentlyViewedProductsWidget" type="widget">
46+
<data key="type">Recently Viewed Products</data>
47+
<data key="design_theme">Magento Luma</data>
48+
<data key="name" unique="suffix">Recently Viewed Products</data>
49+
<array key="store_ids">
50+
<item>All Store Views</item>
51+
</array>
52+
<data key="display_on">All Pages</data>
53+
<data key="container">Sidebar Additional</data>
54+
</entity>
3555
</entities>

app/code/Magento/Widget/Test/Mftf/Section/AdminNewWidgetSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,7 @@
3535
<element name="displayMode" type="select" selector="select[id*='display_mode']"/>
3636
<element name="restrictTypes" type="select" selector="select[id*='types']"/>
3737
<element name="saveAndContinue" type="button" selector="#save_and_edit_button" timeout="30"/>
38+
<element name="productAttributesToShow" type="multiselect" selector="select[name='parameters[show_attributes][]']"/>
39+
<element name="productButtonsToShow" type="multiselect" selector="select[name='parameters[show_buttons][]']"/>
3840
</section>
3941
</sections>

app/code/Magento/Widget/Test/Mftf/Section/StorefrontWidgetsSection.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@
1111
<section name="StorefrontWidgetsSection">
1212
<element name="widgetProductsGrid" type="block" selector=".block.widget.block-products-list.grid"/>
1313
<element name="widgetProductName" type="text" selector=".product-item-name"/>
14+
<element name="widgetRecentlyViewedProductsGrid" type="block" selector=".block.widget.block-viewed-products-grid" timeout="30"/>
15+
<element name="widgetRecentlyComparedProductsGrid" type="block" selector=".block.widget.block-compared-products-grid" timeout="30"/>
16+
<element name="widgetRecentlyOrderedProductsGrid" type="block" selector=".block.block-reorder" timeout="30"/>
1417
</section>
1518
</sections>

0 commit comments

Comments
 (0)