Skip to content

Commit 4747968

Browse files
authored
ENGCOM-9383: Replace repetitive actions with Action Groups in AdminCreateCategoryWithAnchorFieldTest #34874
2 parents 801ee3c + 26f14ea commit 4747968

File tree

1 file changed

+26
-17
lines changed

1 file changed

+26
-17
lines changed

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

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,18 @@
2929
<deleteData stepKey="deleteSimpleProduct" createDataKey="simpleProduct"/>
3030
</after>
3131
<!--Create SubCategory-->
32-
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="openAdminCategoryIndexPage"/>
33-
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/>
34-
<fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{_defaultCategory.name}}" stepKey="fillCategoryName"/>
32+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openAdminCategoryIndexPage"/>
33+
<actionGroup ref="GoToCreateCategoryPageActionGroup" stepKey="clickOnAddSubCategoryButton"/>
34+
<actionGroup ref="AdminChangeCategoryNameActionGroup" stepKey="fillCategoryName"/>
3535
<checkOption selector="{{AdminCategoryBasicFieldSection.EnableCategory}}" stepKey="enableCategory"/>
3636
<!--Select Content and fill the options-->
37-
<scrollTo selector="{{AdminCategoryContentSection.sectionHeader}}" x="0" y="-80" stepKey="scrollToContent"/>
38-
<click selector="{{AdminCategoryContentSection.sectionHeader}}" stepKey="selectContent"/>
39-
<scrollTo selector="{{AdminCategoryContentSection.AddCMSBlock}}" x="0" y="-80" stepKey="scrollToAddCMSBlock"/>
40-
<selectOption selector="{{AdminCategoryContentSection.AddCMSBlock}}" userInput="$$createDefaultCMSBlock.title$$" stepKey="selectCMSBlock"/>
37+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="scrollToContent"/>
38+
<actionGroup ref="AdminCategoriesOpenContentSectionActionGroup" stepKey="selectContent"/>
39+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="scrollToAddCMSBlock"/>
40+
<actionGroup ref="AdminCategoriesSetStaticBlockActionGroup" stepKey="selectCMSBlock">
41+
<argument name="block" value="$$createDefaultCMSBlock$$"/>
42+
</actionGroup>
43+
4144
<!--Select Display Setting and fill the options-->
4245
<scrollTo selector="{{CategoryDisplaySettingsSection.DisplaySettingTab}}" x="0" y="-80" stepKey="scrollToDisplaySetting"/>
4346
<click selector="{{CategoryDisplaySettingsSection.DisplaySettingTab}}" stepKey="selectDisplaySetting"/>
@@ -52,16 +55,20 @@
5255
<click selector="{{CategoryDisplaySettingsSection.layeredNavigationPriceCheckBox}}" stepKey="enableLayeredNavigationPrice"/>
5356
<fillField selector="{{CategoryDisplaySettingsSection.layeredNavigationPriceInput}}" userInput="5.5" stepKey="fillThePrice"/>
5457
<!--Search the products and select the category products-->
55-
<scrollTo selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" x="0" y="-80" stepKey="scrollToProductInCategory"/>
56-
<click selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" stepKey="clickOnProductInCategory"/>
57-
<fillField selector="{{AdminCategoryContentSection.productTableColumnName}}" userInput="$$simpleProduct.name$$" stepKey="selectProduct"/>
58-
<click selector="{{AdminCategoryContentSection.productSearch}}" stepKey="clickSearchButton"/>
59-
<click selector="{{AdminCategoryContentSection.productTableRow}}" stepKey="selectProductFromTableRow"/>
58+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="scrollToProductInCategory"/>
59+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnProductInCategory"/>
60+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectProduct"/>
61+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickSearchButton"/>
62+
<actionGroup ref="AdminAddProductToCategoryActionGroup" stepKey="selectProductFromTableRow">
63+
<argument name="product" value="$$simpleProduct$$"/>
64+
</actionGroup>
6065
<actionGroup ref="AdminSaveCategoryActionGroup" stepKey="clickSaveButton"/>
6166
<actionGroup ref="AssertAdminCategorySaveSuccessMessageActionGroup" stepKey="assertSuccessMessage"/>
6267
<waitForPageLoad stepKey="waitForPageTitleToBeSaved"/>
6368
<!--Verify the Category Title-->
64-
<see selector="{{AdminCategoryContentSection.categoryPageTitle}}" userInput="{{_defaultCategory.name}}" stepKey="seePageTitle" />
69+
<actionGroup ref="AssertAdminCategoryPageTitleActionGroup" stepKey="seePageTitle">
70+
<argument name="categoryName" value="{{_defaultCategory.name}}"/>
71+
</actionGroup>
6572
<grabFromCurrentUrl stepKey="categoryId" regex="#\/([0-9]*)?\/$#"/>
6673
<!-- Assert Redirect path, Target Path and Redirect type in grid -->
6774
<actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath">
@@ -73,10 +80,12 @@
7380
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/>
7481
<comment userInput="Adding the comment to replace CliCacheFlushActionGroup action group ('cache:flush' command) for preserving Backward Compatibility" stepKey="flushCache"/>
7582
<!--Verify Product in store front page-->
76-
<amOnPage url="{{StorefrontCategoryPage.url(_defaultCategory.urlKey)}}" stepKey="amOnCategoryPage"/>
77-
<waitForPageLoad stepKey="waitForPageToBeLoaded"/>
78-
<see selector="{{StorefrontCategoryMainSection.CategoryTitle}}" userInput="{{_defaultCategory.name}}" stepKey="seeCategoryPageTitle"/>
79-
<seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(_defaultCategory.name)}}" stepKey="seeCategoryOnNavigation"/>
83+
<actionGroup ref="CheckCategoryOnStorefrontActionGroup" stepKey="amOnCategoryPage"/>
84+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageToBeLoaded"/>
85+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeCategoryPageTitle"/>
86+
<actionGroup ref="StorefrontAssertCategoryNameIsShownInMenuActionGroup" stepKey="seeCategoryOnNavigation">
87+
<argument name="categoryName" value="{{_defaultCategory.name}}"/>
88+
</actionGroup>
8089
<waitForPageLoad stepKey="waitForProductToLoad"/>
8190
<seeElement selector="{{StorefrontCategoryMainSection.productLinkByHref($$simpleProduct.custom_attributes[url_key]$$)}}" stepKey="seeProductInCategory"/>
8291
</test>

0 commit comments

Comments
 (0)