Skip to content

Commit 41d2a82

Browse files
ENGCOM-9325: Replace repetitive actions with Action Groups in AdminCreateInactiveFlatCategoryTest and AdminUpdateFlatCategoryAndAddProductsTest #34470
- Merge Pull Request #34470 from kate-kyzyma/magento2:Refactoring-AdminCreateInactiveFlatCategoryTest - Merged commits: 1. 8fad53d 2. 22b786b 3. c9e0317 4. 64f5457 5. 3076e8d 6. ab51a28 7. 5a345ae 8. 3d3f70b
2 parents f3e8f25 + 3d3f70b commit 41d2a82

File tree

2 files changed

+80
-40
lines changed

2 files changed

+80
-40
lines changed

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

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,18 @@
5555
<!-- Select created category and make category inactive-->
5656
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="openAdminCategoryIndexPage"/>
5757
<actionGroup ref="AdminExpandCategoryTreeActionGroup" stepKey="clickOnExpandTree"/>
58-
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree(SimpleSubCategory.name)}}" stepKey="selectCreatedCategory"/>
59-
<waitForPageLoad stepKey="waitForCategoryPageToLoad"/>
60-
<click selector="{{AdminCategoryBasicFieldSection.enableCategoryLabel}}" stepKey="disableActiveCategory"/>
58+
<actionGroup ref="AdminCategoriesOpenCategoryActionGroup" stepKey="selectCreatedCategory">
59+
<argument name="category" value="$$createCategory$$"/>
60+
</actionGroup>
61+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForCategoryPageToLoad"/>
62+
<actionGroup ref="AdminDisableActiveCategoryActionGroup" stepKey="disableActiveCategory"/>
6163
<actionGroup ref="AdminSaveCategoryActionGroup" stepKey="saveSubCategory"/>
62-
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccessMessage"/>
63-
<see selector="{{AdminCategoryContentSection.categoryPageTitle}}" userInput="{{SimpleSubCategory.name}}" stepKey="seeUpdatedCategoryTitle"/>
64+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="seeSuccessMessage">
65+
<argument name="message" value="You saved the category."/>
66+
</actionGroup>
67+
<actionGroup ref="AssertAdminCategoryPageTitleActionGroup" stepKey="seeUpdatedCategoryTitle">
68+
<argument name="categoryName" value="{{SimpleSubCategory.name}}"/>
69+
</actionGroup>
6470
<dontSeeCheckboxIsChecked selector="{{AdminCategoryBasicFieldSection.enableCategoryLabel}}" stepKey="verifyInactiveIncludeInMenu"/>
6571
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
6672
<argument name="indices" value="catalog_category_flat"/>
@@ -69,19 +75,31 @@
6975
<actionGroup ref="AdminOpenIndexManagementPageActionGroup" stepKey="openIndexManagementPage"/>
7076
<see stepKey="seeIndexStatus" selector="{{AdminIndexManagementSection.indexerStatus('Category Flat Data')}}" userInput="Ready"/>
7177
<!--Verify Category In Store Front-->
72-
<amOnPage url="/$$createCategory.custom_attributes[url_key]$$.html" stepKey="openCategoryPage1"/>
73-
<waitForPageLoad stepKey="waitForCategoryStoreFrontPageToLoad"/>
78+
<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="openCategoryPage1">
79+
<argument name="category" value="$createCategory$"/>
80+
</actionGroup>
81+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForCategoryStoreFrontPageToLoad"/>
82+
7483
<!--Verify category is not visible in First Store View -->
75-
<click stepKey="selectStoreSwitcher" selector="{{StorefrontHeaderSection.storeViewSwitcher}}"/>
76-
<click stepKey="selectForstStoreView" selector="{{StorefrontHeaderSection.storeViewList(customStoreEN.name)}}"/>
77-
<waitForPageLoad stepKey="waitForFirstStoreView"/>
78-
<dontSeeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="dontSeeCategoryOnNavigation"/>
84+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectStoreSwitcher"/>
85+
<actionGroup ref="StorefrontSwitchStoreViewActionGroup" stepKey="selectForstStoreView">
86+
<argument name="storeView" value="customStoreEN"/>
87+
</actionGroup>
88+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForFirstStoreView"/>
7989
<seeElement selector="{{StorefrontBundledSection.pageNotFound}}" stepKey="seeWhoopsOurBadMessage"/>
90+
<actionGroup ref="StorefrontAssertCategoryNameIsNotShownInMenuActionGroup" stepKey="dontSeeCategoryOnNavigation">
91+
<argument name="categoryName" value="$$createCategory.name$$"/>
92+
</actionGroup>
93+
8094
<!--Verify category is not visible in Second Store View -->
81-
<click stepKey="selectStoreSwitcher1" selector="{{StorefrontHeaderSection.storeViewSwitcher}}"/>
82-
<click stepKey="selectSecondStoreView" selector="{{StorefrontHeaderSection.storeViewList(customStoreFR.name)}}"/>
83-
<waitForPageLoad stepKey="waitForSecondstoreView"/>
84-
<dontSeeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="dontSeeCategoryOnNavigation1"/>
95+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectStoreSwitcher1"/>
96+
<actionGroup ref="StorefrontSwitchStoreViewActionGroup" stepKey="selectSecondStoreView">
97+
<argument name="storeView" value="customStoreFR"/>
98+
</actionGroup>
99+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForSecondstoreView"/>
100+
<actionGroup ref="StorefrontAssertCategoryNameIsNotShownInMenuActionGroup" stepKey="dontSeeCategoryOnNavigation1">
101+
<argument name="categoryName" value="$$createCategory.name$$"/>
102+
</actionGroup>
85103
<seeElement selector="{{StorefrontBundledSection.pageNotFound}}" stepKey="seeWhoopsOurBadMessage1"/>
86104
</test>
87105
</tests>

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

Lines changed: 47 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -57,39 +57,61 @@
5757
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindexBeforeFlow"/>
5858
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="openAdminCategoryIndexPage"/>
5959
<actionGroup ref="AdminExpandCategoryTreeActionGroup" stepKey="clickOnExpandTree"/>
60-
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree(SimpleSubCategory.name)}}" stepKey="selectCreatedCategory"/>
61-
<waitForPageLoad stepKey="waitForTheCategoryPageToLoaded"/>
60+
<actionGroup ref="AdminCategoriesOpenCategoryActionGroup" stepKey="selectCreatedCategory">
61+
<argument name="category" value="SimpleSubCategory"/>
62+
</actionGroup>
63+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForTheCategoryPageToLoaded"/>
6264
<!--Add Products in Category-->
63-
<scrollTo selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" x="0" y="-80" stepKey="scrollToProductInCategory"/>
64-
<click selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" stepKey="clickOnProductInCategory"/>
65-
<scrollToTopOfPage stepKey="scrollOnTopOfPage"/>
66-
<conditionalClick selector="{{CatalogProductsSection.resetFilter}}" dependentSelector="{{CatalogProductsSection.resetFilter}}" visible="true" stepKey="clickOnResetFilter"/>
67-
<waitForPageLoad stepKey="waitForProductsToLoad"/>
68-
<fillField selector="{{AdminCategoryContentSection.productTableColumnName}}" userInput="$$createSimpleProduct.name$$" stepKey="selectProduct"/>
69-
<click selector="{{AdminCategoryContentSection.productSearch}}" stepKey="clickSearchButton"/>
70-
<waitForPageLoad stepKey="waitFroPageToLoad1"/>
71-
<scrollTo selector="{{AdminCategoryContentSection.productTableRow}}" stepKey="scrollToTableRow"/>
72-
<click selector="{{AdminCategoryContentSection.productTableRow}}" stepKey="selectProductFromTableRow"/>
65+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="scrollToProductInCategory"/>
66+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnProductInCategory"/>
67+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="scrollOnTopOfPage"/>
68+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnResetFilter"/>
69+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductsToLoad"/>
70+
<actionGroup ref="AdminAddProductToCategoryActionGroup" stepKey="selectProduct">
71+
<argument name="product" value="$$createSimpleProduct$$"/>
72+
</actionGroup>
73+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickSearchButton"/>
74+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitFroPageToLoad1"/>
75+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="scrollToTableRow"/>
76+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectProductFromTableRow"/>
7377
<actionGroup ref="AdminSaveCategoryActionGroup" stepKey="saveSubCategory"/>
74-
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccessMessage"/>
78+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="seeSuccessMessage">
79+
<argument name="message" value="You saved the category."/>
80+
</actionGroup>
7581
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/>
7682
<comment userInput="Adding the comment to replace CliCacheFlushActionGroup action group ('cache:flush' command) for preserving Backward Compatibility" stepKey="flushCache"/>
7783
<actionGroup ref="AdminOpenIndexManagementPageActionGroup" stepKey="openIndexManagementPage"/>
7884
<see stepKey="seeCategoryIndexStatus" selector="{{AdminIndexManagementSection.indexerStatus('Category Flat Data')}}" userInput="Ready"/>
7985
<!--Verify Product In Store Front-->
80-
<amOnPage url="$$createSimpleProduct.custom_attributes[url_key]$$.html" stepKey="goToStorefrontPage"/>
81-
<waitForPageLoad stepKey="waitForPageToBeLoaded"/>
86+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="goToStorefrontPage">
87+
<argument name="product" value="$createSimpleProduct$"/>
88+
</actionGroup>
89+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageToBeLoaded"/>
8290
<!--Verify product and category is visible in First Store View -->
83-
<click stepKey="selectStoreSwitcher" selector="{{StorefrontHeaderSection.storeViewSwitcher}}"/>
84-
<click stepKey="selectFirstStoreView" selector="{{StorefrontHeaderSection.storeViewList(customStoreEN.name)}}"/>
85-
<waitForPageLoad stepKey="waitForFirstStoreView"/>
86-
<seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$category.name$$)}}" stepKey="seeCategoryOnNavigation"/>
87-
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{defaultSimpleProduct.name}}" stepKey="assertProductName"/>
91+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectStoreSwitcher"/>
92+
<actionGroup ref="StorefrontSwitchStoreViewActionGroup" stepKey="selectFirstStoreView">
93+
<argument name="storeView" value="customStoreEN"/>
94+
</actionGroup>
95+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForFirstStoreView"/>
96+
<!--<seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$category.name$$)}}" stepKey="seeCategoryOnNavigation"/>-->
97+
<actionGroup ref="StorefrontAssertCategoryNameIsShownInMenuActionGroup" stepKey="seeCategoryOnNavigation">
98+
<argument name="categoryName" value="$$category.name$$"/>
99+
</actionGroup>
100+
<!--<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{defaultSimpleProduct.name}}" stepKey="assertProductName"/>-->
101+
<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="assertProductName">
102+
<argument name="productName" value="{{defaultSimpleProduct.name}}"/>
103+
</actionGroup>
88104
<!--Verify product and category is visible in Second Store View -->
89-
<click stepKey="selectStoreSwitcher1" selector="{{StorefrontHeaderSection.storeViewSwitcher}}"/>
90-
<click stepKey="selectSecondStoreView" selector="{{StorefrontHeaderSection.storeViewList(customStoreFR.name)}}"/>
91-
<waitForPageLoad stepKey="waitForSecondStoreView"/>
92-
<seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$category.name$$)}}" stepKey="seeCategoryOnNavigation1"/>
93-
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{defaultSimpleProduct.name}}" stepKey="seeProductName"/>
105+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectStoreSwitcher1"/>
106+
<actionGroup ref="StorefrontSwitchStoreViewActionGroup" stepKey="selectSecondStoreView">
107+
<argument name="storeView" value="customStoreFR"/>
108+
</actionGroup>
109+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForSecondStoreView"/>
110+
<actionGroup ref="StorefrontAssertCategoryNameIsShownInMenuActionGroup" stepKey="seeCategoryOnNavigation1">
111+
<argument name="categoryName" value="$$category.name$"/>
112+
</actionGroup>
113+
<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="seeProductName">
114+
<argument name="productName" value="{{defaultSimpleProduct.name}}"/>
115+
</actionGroup>
94116
</test>
95117
</tests>

0 commit comments

Comments
 (0)