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+ <tests xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
9+ xsi : noNamespaceSchemaLocation =" urn:magento:mftf:Test/etc/testSchema.xsd" >
10+ <test name =" StoreFrontRecentlyViewedAtStoreLevelTest" >
11+ <annotations >
12+ <stories value =" Recently Viewed Product" />
13+ <title value =" Recently Viewed Product at store level" />
14+ <description value =" Recently Viewed Product should not be displayed on second store , if configured as, Per Store " />
15+ <testCaseId value =" MC-32018" />
16+ <severity value =" CRITICAL" />
17+ <group value =" catalog" />
18+ </annotations >
19+ <before >
20+ <actionGroup ref =" LoginAsAdmin" stepKey =" loginAsAdmin" />
21+ <!-- Create Simple Product and Category -->
22+ <createData entity =" SimpleSubCategory" stepKey =" createCategory" />
23+ <createData entity =" SimpleProduct" stepKey =" createSimpleProduct1" >
24+ <requiredEntity createDataKey =" createCategory" />
25+ </createData >
26+ <createData entity =" SimpleProduct" stepKey =" createSimpleProduct2" >
27+ <requiredEntity createDataKey =" createCategory" />
28+ </createData >
29+ <createData entity =" SimpleProduct" stepKey =" createSimpleProduct3" >
30+ <requiredEntity createDataKey =" createCategory" />
31+ </createData >
32+ <createData entity =" SimpleProduct" stepKey =" createSimpleProduct4" >
33+ <requiredEntity createDataKey =" createCategory" />
34+ </createData >
35+ <!-- Create store1 for default website -->
36+ <actionGroup ref =" AdminCreateNewStoreGroupActionGroup" stepKey =" createFirstStore" >
37+ <argument name =" website" value =" {{_defaultWebsite.name}}" />
38+ <argument name =" storeGroupName" value =" {{customStore.name}}" />
39+ <argument name =" storeGroupCode" value =" {{customStore.code}}" />
40+ </actionGroup >
41+ <!-- Create Storeview1 for Store1-->
42+ <actionGroup ref =" AdminCreateStoreViewActionGroup" stepKey =" createStoreView" >
43+ <argument name =" StoreGroup" value =" customStore" />
44+ <argument name =" customStore" value =" storeViewData" />
45+ </actionGroup >
46+ <!-- Create storeView 2-->
47+ <actionGroup ref =" AdminCreateStoreViewActionGroup" stepKey =" createStoreViewTwo" >
48+ <argument name =" StoreGroup" value =" customStore" />
49+ <argument name =" customStore" value =" customStoreEN" />
50+ </actionGroup >
51+ <!-- Set Stores > Configurations > Catalog > Recently Viewed/Compared Products > Show for Current = store -->
52+ <magentoCLI command =" config:set {{RecentlyViewedProductScopeStoreGroup.path}} {{RecentlyViewedProductScopeStoreGroup.value}}" stepKey =" RecentlyViewedProductScopeStoreGroup" />
53+ </before >
54+ <after >
55+ <!-- Delete Product and Category -->
56+ <deleteData createDataKey =" createSimpleProduct1" stepKey =" deleteSimpleProduct1" />
57+ <deleteData createDataKey =" createSimpleProduct2" stepKey =" deleteSimpleProduct2" />
58+ <deleteData createDataKey =" createSimpleProduct3" stepKey =" deleteSimpleProduct3" />
59+ <deleteData createDataKey =" createSimpleProduct4" stepKey =" deleteSimpleProduct4" />
60+ <deleteData createDataKey =" createCategory" stepKey =" deleteCategory" />
61+ <!-- Delete store1 for default website -->
62+ <actionGroup ref =" DeleteCustomStoreActionGroup" stepKey =" deleteFirstStore" >
63+ <argument name =" storeGroupName" value =" customStore.name" />
64+ </actionGroup >
65+
66+ <!-- Reset Stores > Configurations > Catalog > Recently Viewed/Compared Products > Show for Current = Website-->
67+ <magentoCLI command =" config:set {{RecentlyViewedProductScopeWebsite.path}} {{RecentlyViewedProductScopeWebsite.value}}" stepKey =" RecentlyViewedProductScopeWebsite" />
68+
69+ <!-- Clear Widget-->
70+ <actionGroup ref =" AdminEditCMSPageContentActionGroup" stepKey =" clearRecentlyViewedWidgetsFromCMSContent" >
71+ <argument name =" content" value =" {{CmsHomePageContent.content}}" />
72+ <argument name =" pageId" value =" {{CmsHomePageContent.page_id}}" />
73+ </actionGroup >
74+ <!-- Logout Admin -->
75+ <actionGroup ref =" logout" stepKey =" logout" />
76+ <magentoCLI command =" indexer:reindex" stepKey =" reindex" />
77+ <magentoCLI command =" cache:flush" stepKey =" flushCacheAfterDeletion" />
78+ </after >
79+ <!-- Create widget for recently viewed products-->
80+ <actionGroup ref =" AdminEditCMSPageContentActionGroup" stepKey =" clearRecentlyViewedWidgetsFromCMSContentBefore" >
81+ <argument name =" content" value =" {{CmsHomePageContent.content}}" />
82+ <argument name =" pageId" value =" {{CmsHomePageContent.page_id}}" />
83+ </actionGroup >
84+
85+ <amOnPage url =" {{AdminCmsPageEditPage.url(CmsHomePageContent.page_id)}}" stepKey =" navigateToEditCmsHomePage" />
86+ <waitForPageLoad time =" 50" stepKey =" waitForCmsContentPageToLoad" />
87+
88+ <actionGroup ref =" AdminInsertRecentlyViewedWidgetActionGroup" stepKey =" insertRecentlyViewedWidget" >
89+ <argument name =" attributeSelector1" value =" show_attributes" />
90+ <argument name =" attributeSelector2" value =" show_buttons" />
91+ <argument name =" productAttributeSection1" value =" 1" />
92+ <argument name =" productAttributeSection2" value =" 4" />
93+ <argument name =" buttonToShowSection1" value =" 1" />
94+ <argument name =" buttonToShowSection2" value =" 3" />
95+ </actionGroup >
96+ <!-- Warm up cache -->
97+ <magentoCLI command =" cache:flush" stepKey =" flushCacheAfterWidgetCreated" />
98+ <!-- Navigate to product 3 on store front -->
99+ <amOnPage url =" {{StorefrontProductPage.url($createSimpleProduct2.name$)}}" stepKey =" goToStoreOneProductPageTwo" />
100+ <amOnPage url =" {{StorefrontProductPage.url($createSimpleProduct3.name$)}}" stepKey =" goToStoreOneProductPageThree" />
101+ <!-- Go to Home Page -->
102+ <amOnPage url =" {{StorefrontHomePage.url}}" stepKey =" amOnStoreFrontHomePage" />
103+ <waitForPageLoad time =" 30" stepKey =" waitForHomeContentPageToLoad" />
104+ <actionGroup ref =" AssertSeeProductDetailsOnStorefrontRecentlyViewedWidgetActionGroup" stepKey =" assertStoreOneRecentlyViewedProduct2" >
105+ <argument name =" productName" value =" $$createSimpleProduct2.name$$" />
106+ <argument name =" productPosition" value =" 2" />
107+ </actionGroup >
108+ <actionGroup ref =" AssertSeeProductDetailsOnStorefrontRecentlyViewedWidgetActionGroup" stepKey =" assertStoreOneRecentlyViewedProduct3" >
109+ <argument name =" productName" value =" $$createSimpleProduct3.name$$" />
110+ <argument name =" productPosition" value =" 1" />
111+ </actionGroup >
112+ <!-- Switch to second store and add second product (visible on second store) to wishlist -->
113+ <click selector =" {{StorefrontFooterSection.switchStoreButton}}" stepKey =" clickSwitchStoreButtonOnDefaultStore" />
114+ <click selector =" {{StorefrontFooterSection.storeLink(customStore.name)}}" stepKey =" selectCustomStore" />
115+ <amOnPage url =" {{StorefrontProductPage.url($createSimpleProduct1.name$)}}" stepKey =" goToStore2ProductPage1" />
116+ <amOnPage url =" {{StorefrontProductPage.url($createSimpleProduct2.name$)}}" stepKey =" goToStore2ProductPage2" />
117+ <!-- Go to Home Page -->
118+ <amOnPage url =" {{StorefrontHomePage.url}}" stepKey =" amOnHomePage2" />
119+ <waitForPageLoad time =" 30" stepKey =" waitForStoreHomeContentPageToLoad" />
120+ <actionGroup ref =" AssertSeeProductDetailsOnStorefrontRecentlyViewedWidgetActionGroup" stepKey =" assertNextStore1RecentlyViewedProduct1" >
121+ <argument name =" productName" value =" $$createSimpleProduct1.name$$" />
122+ <argument name =" productPosition" value =" 2" />
123+ </actionGroup >
124+ <actionGroup ref =" AssertSeeProductDetailsOnStorefrontRecentlyViewedWidgetActionGroup" stepKey =" assertNextStore1RecentlyViewedProduct2" >
125+ <argument name =" productName" value =" $$createSimpleProduct2.name$$" />
126+ <argument name =" productPosition" value =" 1" />
127+ </actionGroup >
128+
129+ <grabTextFrom selector =" {{StoreFrontRecentlyViewedProductSection.ProductName('2')}}" stepKey =" grabDontSeeHomeProduct3" />
130+ <assertNotContains expected =" $$createSimpleProduct3.name$$" actual =" $grabDontSeeHomeProduct3" stepKey =" assertNotSeeProduct3" />
131+
132+ <!-- Switch Storeview-->
133+ <actionGroup ref =" StorefrontSwitchStoreViewActionGroup" stepKey =" switchStoreViewActionGroup" >
134+ <argument name =" storeView" value =" customStoreEN" />
135+ </actionGroup >
136+ <actionGroup ref =" AssertSeeProductDetailsOnStorefrontRecentlyViewedWidgetActionGroup" stepKey =" assertNextStoreView2RecentlyViewedProduct1" >
137+ <argument name =" productName" value =" $$createSimpleProduct1.name$$" />
138+ <argument name =" productPosition" value =" 2" />
139+ </actionGroup >
140+ <actionGroup ref =" AssertSeeProductDetailsOnStorefrontRecentlyViewedWidgetActionGroup" stepKey =" assertNextStoreView2RecentlyViewedProduct2" >
141+ <argument name =" productName" value =" $$createSimpleProduct2.name$$" />
142+ <argument name =" productPosition" value =" 1" />
143+ </actionGroup >
144+
145+ <grabTextFrom selector =" {{StoreFrontRecentlyViewedProductSection.ProductName('2')}}" stepKey =" grabStoreView2DontSeeHomeProduct3" />
146+ <assertNotContains expected =" $$createSimpleProduct3.name$$" actual =" $grabDontSeeHomeProduct3" stepKey =" assertStoreView2NotSeeProduct3" />
147+
148+ <!-- Switch to default store-->
149+
150+ <click selector =" {{StorefrontFooterSection.switchStoreButton}}" stepKey =" clickSwitchStoreButtonOnHomeDefaultStore" />
151+ <click selector =" {{StorefrontFooterSection.storeLink('Main Website Store')}}" stepKey =" selectDefaultStoreToSwitchOn" />
152+
153+ <actionGroup ref =" AssertSeeProductDetailsOnStorefrontRecentlyViewedWidgetActionGroup" stepKey =" assertSwitchStore1RecentlyViewedProduct2" >
154+ <argument name =" productName" value =" $$createSimpleProduct2.name$$" />
155+ <argument name =" productPosition" value =" 2" />
156+ </actionGroup >
157+
158+ <actionGroup ref =" AssertSeeProductDetailsOnStorefrontRecentlyViewedWidgetActionGroup" stepKey =" assertSwitchStore1RecentlyViewedProduct3" >
159+ <argument name =" productName" value =" $$createSimpleProduct3.name$$" />
160+ <argument name =" productPosition" value =" 1" />
161+ </actionGroup >
162+ <grabTextFrom selector =" {{StoreFrontRecentlyViewedProductSection.ProductName('2')}}" stepKey =" grabDontSeeHomeProduct1" />
163+ <assertNotContains expected =" $$createSimpleProduct1.name$$" actual =" $grabDontSeeHomeProduct1" stepKey =" assertNotSeeProduct1" />
164+
165+ </test >
166+ </tests >
0 commit comments