Skip to content

Commit ff5d282

Browse files
committed
MAGETWO-97349: [FT] [MFTF] AdminFilteringCategoryProductsUsingScopeSelectorTest fails because of bad design
1 parent 2b27bc0 commit ff5d282

File tree

5 files changed

+50
-48
lines changed

5 files changed

+50
-48
lines changed

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070

7171
<!--Save product and see success message-->
7272
<actionGroup name="saveProductForm">
73+
<scrollToTopOfPage stepKey="scrollToTop"/>
7374
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/>
7475
<see selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product." stepKey="seeSaveConfirmation"/>
7576
</actionGroup>

app/code/Magento/Catalog/Test/Mftf/Test/AdminFilteringCategoryProductsUsingScopeSelectorTest.xml

Lines changed: 23 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@
1919
</annotations>
2020
<before>
2121
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
22-
<!--Create website, Sore adn Store View-->
23-
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="adminCreateWebsite">
24-
<argument name="newWebsiteName" value="secondWebsite"/>
25-
<argument name="websiteCode" value="second_website"/>
22+
<!--Create website, Store and Store View-->
23+
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createSecondWebsite">
24+
<argument name="newWebsiteName" value="{{secondCustomWebsite.name}}"/>
25+
<argument name="websiteCode" value="{{secondCustomWebsite.code}}"/>
2626
</actionGroup>
27-
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="adminCreateStore">
28-
<argument name="website" value="secondWebsite"/>
29-
<argument name="storeGroupName" value="secondStore"/>
30-
<argument name="storeGroupCode" value="second_store"/>
27+
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createSecondStoreGroup">
28+
<argument name="website" value="{{secondCustomWebsite.name}}"/>
29+
<argument name="storeGroupName" value="{{SecondStoreGroupUnique.name}}"/>
30+
<argument name="storeGroupCode" value="{{SecondStoreGroupUnique.code}}"/>
3131
</actionGroup>
32-
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="adminCreateStoreView">
33-
<argument name="StoreGroup" value="customStoreTierPrice"/>
34-
<argument name="customStore" value="customStoreView"/>
32+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createSecondStoreView">
33+
<argument name="StoreGroup" value="SecondStoreGroupUnique"/>
34+
<argument name="customStore" value="SecondStoreUnique"/>
3535
</actionGroup>
3636

3737
<!--Create Simple Product and Category -->
@@ -60,9 +60,7 @@
6060
<click selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="clickToOpenWebsiteSection"/>
6161
<waitForPageLoad stepKey="waitForToOpenedWebsiteSection"/>
6262
<uncheckOption selector="{{ProductInWebsitesSection.website('Main Website')}}" stepKey="uncheckWebsite"/>
63-
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/>
64-
<see selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product."
65-
stepKey="seeSuccessMessage"/>
63+
<actionGroup ref="saveProductForm" stepKey="saveProduct1"/>
6664

6765
<!-- Set filter to product name and product2 in website 2 only -->
6866
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForProduct2">
@@ -72,12 +70,10 @@
7270
<argument name="product" value="$$createProduct2$$"/>
7371
</actionGroup>
7472
<actionGroup ref="SelectProductInWebsitesActionGroup" stepKey="selectProductInWebsites">
75-
<argument name="website" value="secondWebsite"/>
73+
<argument name="website" value="{{secondCustomWebsite.name}}"/>
7674
</actionGroup>
7775
<uncheckOption selector="{{ProductInWebsitesSection.website('Main Website')}}" stepKey="uncheckWebsite1"/>
78-
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct1"/>
79-
<see selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product."
80-
stepKey="seeSuccessMessage1"/>
76+
<actionGroup ref="saveProductForm" stepKey="saveProduct2"/>
8177

8278
<!-- Set filter to product name and product12 assigned to both websites 1 and 2 -->
8379
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForProduct12">
@@ -87,15 +83,13 @@
8783
<argument name="product" value="$$createProduct12$$"/>
8884
</actionGroup>
8985
<actionGroup ref="SelectProductInWebsitesActionGroup" stepKey="selectProductInWebsites1">
90-
<argument name="website" value="secondWebsite"/>
86+
<argument name="website" value="{{secondCustomWebsite.name}}"/>
9187
</actionGroup>
92-
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct2"/>
93-
<see selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product."
94-
stepKey="seeSuccessMessage2"/>
88+
<actionGroup ref="saveProductForm" stepKey="saveProduct3"/>
9589
</before>
9690
<after>
9791
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite">
98-
<argument name="websiteName" value="secondWebsite"/>
92+
<argument name="websiteName" value="{{secondCustomWebsite.name}}"/>
9993
</actionGroup>
10094
<actionGroup ref="ClearProductsFilterActionGroup" stepKey="clearProductsFilter"/>
10195
<deleteData createDataKey="createProduct0" stepKey="deleteProduct"/>
@@ -107,7 +101,6 @@
107101
</after>
108102
<!-- Step 1-2: Open Category page and Set scope selector to All Store Views-->
109103
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="goToCategoryPage"/>
110-
<waitForPageLoad stepKey="waitForCategoryPageLoad"/>
111104
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree($$createCategory.name$$)}}"
112105
stepKey="clickCategoryName"/>
113106
<click selector="{{AdminCategoryProductsSection.sectionHeader}}" stepKey="openProductSection"/>
@@ -126,17 +119,9 @@
126119

127120
<!-- Step 3: Set scope selector to Website1( Storeview for the Website 1) -->
128121
<scrollToTopOfPage stepKey="scrollToTopOfPage"/>
129-
<click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewDropdownToggle}}"
130-
stepKey="clickStoresList"/>
131-
<waitForPageLoad stepKey="waitForCategoryPageLoad1"/>
132-
<click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewOption('Default Store View')}}"
133-
stepKey="clickStoreView"/>
134-
<waitForElementVisible selector="{{AdminCategoryMainActionsSection.CategoryStoreViewModalAccept}}"
135-
stepKey="waitForPopup1"/>
136-
<click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewModalAccept}}" stepKey="clickActionAccept"/>
137-
<waitForElementNotVisible selector="{{AdminCategoryMainActionsSection.CategoryStoreViewModalAccept}}"
138-
stepKey="waitForNotVisibleModalAccept"/>
139-
<waitForPageLoad stepKey="waitForCategoryPageLoad2"/>
122+
<actionGroup ref="AdminSwitchStoreViewActionGroup" stepKey="swichToDefaultStoreView">
123+
<argument name="storeView" value="_defaultStore.name"/>
124+
</actionGroup>
140125
<grabTextFrom selector="{{AdminCategorySidebarTreeSection.categoryInTree($$createCategory.name$$)}}"
141126
stepKey="grabTextFromCategory1"/>
142127
<assertRegExp expected="/\(2\)$/" expectedType="string" actual="$grabTextFromCategory1" actualType="variable"
@@ -154,18 +139,9 @@
154139

155140
<!-- Step 4: Set scope selector to Website2 ( StoreView for Website 2) -->
156141
<scrollToTopOfPage stepKey="scrollToTopOfPage1"/>
157-
<click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewDropdownToggle}}"
158-
stepKey="clickStoresList1"/>
159-
<waitForPageLoad stepKey="waitForCategoryPageLoad3"/>
160-
<click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewOption('secondStoreView')}}"
161-
stepKey="clickStoreView1"/>
162-
<waitForElementVisible selector="{{AdminCategoryMainActionsSection.CategoryStoreViewModalAccept}}"
163-
stepKey="waitForPopup2"/>
164-
<click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewModalAccept}}"
165-
stepKey="clickActionAccept1"/>
166-
<waitForElementNotVisible selector="{{AdminCategoryMainActionsSection.CategoryStoreViewModalAccept}}"
167-
stepKey="waitForNotVisibleModalAccept1"/>
168-
<waitForPageLoad stepKey="waitForCategoryPageLoad4"/>
142+
<actionGroup ref="AdminSwitchStoreViewActionGroup" stepKey="swichToSecondStoreView">
143+
<argument name="storeView" value="SecondStoreUnique.name"/>
144+
</actionGroup>
169145
<click selector="{{AdminCategoryProductsSection.sectionHeader}}" stepKey="openProductSection2"/>
170146
<grabTextFrom selector="{{AdminCategorySidebarTreeSection.categoryInTree($$createCategory.name$$)}}"
171147
stepKey="grabTextFromCategory2"/>

app/code/Magento/Store/Test/Mftf/Data/StoreData.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,13 @@
6565
<data key="name" unique="suffix">StoreView</data>
6666
<data key="code" unique="suffix">StoreViewCode</data>
6767
</entity>
68+
<entity name="SecondStoreUnique" type="store">
69+
<data key="name" unique="suffix">Second Store View </data>
70+
<data key="code" unique="suffix">second_store_view_</data>
71+
<data key="is_active">1</data>
72+
<data key="store_id">null</data>
73+
<data key="store_action">add</data>
74+
<data key="store_type">store</data>
75+
<requiredEntity type="storeGroup">SecondStoreGroup</requiredEntity>
76+
</entity>
6877
</entities>

app/code/Magento/Store/Test/Mftf/Data/StoreGroupData.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,22 @@
2121
<data key="store_action">add</data>
2222
<data key="store_type">group</data>
2323
</entity>
24+
<entity name="SecondStoreGroup" type="group">
25+
<data key="group_id">null</data>
26+
<data key="name">Second Store</data>
27+
<data key="code">second_store</data>
28+
<var key="root_category_id" entityKey="id" entityType="category"/>
29+
<data key="store_action">add</data>
30+
<data key="store_type">group</data>
31+
</entity>
32+
<entity name="SecondStoreGroupUnique" type="group">
33+
<data key="group_id">null</data>
34+
<data key="name" unique="suffix">Second Store </data>
35+
<data key="code" unique="suffix">second_store_</data>
36+
<var key="root_category_id" entityKey="id" entityType="category"/>
37+
<data key="store_action">add</data>
38+
<data key="store_type">group</data>
39+
</entity>
2440
<entity name="staticStoreGroup" type="group">
2541
<data key="name">NewStore</data>
2642
<data key="code" unique="suffix">Base12</data>

app/code/Magento/Store/Test/Mftf/Section/AdminMainActionsSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
<section name="AdminMainActionsSection">
1212
<element name="storeSwitcher" type="text" selector=".store-switcher"/>
1313
<element name="storeViewDropdown" type="button" selector="#store-change-button"/>
14-
<element name="storeViewByName" type="button" selector="//*[@class='store-switcher-store-view ']/a[contains(text(), '{{storeViewName}}')]" timeout="30" parameterized="true"/>
14+
<element name="storeViewByName" type="button" selector="//*[contains(@class,'store-switcher-store-view')]/*[contains(text(), '{{storeViewName}}')]" timeout="30" parameterized="true"/>
1515
</section>
1616
</sections>

0 commit comments

Comments
 (0)