Skip to content

Commit 66a80a7

Browse files
ENGCOM-7712: MFTF: Refactoring the test AdminCreateCategoryWithCustomRootCategoryTest #28679
- Merge Pull Request #28679 from kate-kyzyma/magento2:Refactoring-AdminCreateCategoryWithCustomRootCategoryTest - Merged commits: 1. c503af9 2. ce09431 3. f4341f8 4. dc6342e
2 parents ad41c3b + dc6342e commit 66a80a7

File tree

2 files changed

+42
-30
lines changed

2 files changed

+42
-30
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontSwitchStoreActionGroup">
12+
<annotations>
13+
<description>Switch the Storefront to the provided Store.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="storeName" type="string"/>
17+
</arguments>
18+
<click selector="{{StorefrontFooterSection.switchStoreButton}}" stepKey="clickOnSwitchStoreButton"/>
19+
<click selector="{{StorefrontFooterSection.storeLink(storeName)}}" stepKey="selectStoreToSwitchOn"/>
20+
</actionGroup>
21+
</actionGroups>

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

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@
2121
<actionGroup ref="AdminLoginActionGroup" stepKey="loginToAdminPanel"/>
2222
</before>
2323
<after>
24-
<amOnPage url="{{AdminSystemStorePage.url}}" stepKey="navigateToStoresIndex"/>
25-
<waitForPageLoad stepKey="waitStoreIndexPageLoad" />
2624
<actionGroup ref="DeleteCustomStoreActionGroup" stepKey="deleteCustomStore">
27-
<argument name="storeGroupName" value="customStore.name"/>
25+
<argument name="storeGroupName" value="customStoreGroup.name"/>
2826
</actionGroup>
2927
<actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCreatedNewRootCategory">
3028
<argument name="categoryEntity" value="NewRootCategory"/>
@@ -37,39 +35,32 @@
3735
<argument name="categoryEntity" value="NewRootCategory"/>
3836
</actionGroup>
3937
<!--Create subcategory-->
40-
<scrollToTopOfPage stepKey="scrollToTopOfPage"/>
41-
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree(NewRootCategory.name)}}" stepKey="clickOnCreatedNewRootCategory"/>
42-
<scrollToTopOfPage stepKey="scrollToTopOfPage1"/>
38+
<actionGroup ref="NavigateToCreatedCategoryActionGroup" stepKey="openCreatedCategory">
39+
<argument name="Category" value="NewRootCategory"/>
40+
</actionGroup>
41+
4342
<actionGroup ref="CreateCategoryActionGroup" stepKey="createSubcategory">
4443
<argument name="categoryEntity" value="SimpleSubCategory"/>
4544
</actionGroup>
4645
<!--Create a Store-->
47-
<amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/>
48-
<waitForPageLoad stepKey="waitForSystemStorePage"/>
49-
<click selector="{{AdminStoresMainActionsSection.createStoreButton}}" stepKey="selectCreateStore"/>
50-
<fillField userInput="{{customStore.name}}" selector="{{AdminNewStoreGroupSection.storeGrpNameTextField}}" stepKey="fillStoreName"/>
51-
<fillField userInput="{{customStore.code}}" selector="{{AdminNewStoreGroupSection.storeGrpCodeTextField}}" stepKey="fillStoreCode"/>
52-
<selectOption userInput="{{NewRootCategory.name}}" selector="{{AdminNewStoreGroupSection.storeRootCategoryDropdown}}" stepKey="selectStoreStatus"/>
53-
<click selector="{{AdminStoresMainActionsSection.saveButton}}" stepKey="clickSaveStoreButton"/>
46+
<actionGroup ref="CreateCustomStoreActionGroup" stepKey="createCustomStore">
47+
<argument name="website" value="{{_defaultWebsite.name}}"/>
48+
<argument name="store" value="{{customStoreGroup.name}}"/>
49+
<argument name="rootCategory" value="{{NewRootCategory.name}}"/>
50+
</actionGroup>
5451
<!--Create a Store View-->
55-
<click selector="{{AdminStoresMainActionsSection.createStoreViewButton}}" stepKey="selectCreateStoreView"/>
56-
<click selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="clickDropDown"/>
57-
<selectOption userInput="{{customStore.name}}" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreViewStatus"/>
58-
<fillField userInput="{{customStore.name}}" selector="{{AdminNewStoreSection.storeNameTextField}}" stepKey="fillStoreViewName"/>
59-
<fillField userInput="{{customStore.code}}" selector="{{AdminNewStoreSection.storeCodeTextField}}" stepKey="fillStoreViewCode"/>
60-
<selectOption selector="{{AdminNewStoreSection.statusDropdown}}" userInput="Enabled" stepKey="enableStatus"/>
61-
<click selector="{{AdminStoresMainActionsSection.saveButton}}" stepKey="clickSaveStoreViewButton"/>
62-
<waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitForModal" />
63-
<see selector="{{AdminConfirmationModalSection.title}}" userInput="Warning message" stepKey="seeWarning" />
64-
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="dismissModal" />
65-
<waitForElementNotVisible selector="{{AdminNewStoreViewActionsSection.loadingMask}}" stepKey="waitForElementVisible"/>
52+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView">
53+
<argument name="StoreGroup" value="customStoreGroup"/>
54+
<argument name="customStore" value="customStore"/>
55+
</actionGroup>
6656
<!--Go to store front page-->
67-
<amOnPage url="/{{NewRootCategory.name}}/{{SimpleSubCategory.name}}.html" stepKey="seeTheCategoryInStoreFrontPage"/>
68-
<waitForPageLoad time="60" stepKey="waitForStoreFrontPageLoad"/>
57+
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="openHomepage"/>
6958
<!--Verify subcategory displayed in store front page-->
70-
<click selector="{{StorefrontFooterSection.switchStoreButton}}" stepKey="selectMainWebsite"/>
71-
<click selector="{{StorefrontFooterSection.storeLink(customStore.name)}}" stepKey="selectCustomStore"/>
72-
<waitForPageLoad stepKey="waitForCategoryToLoad"/>
73-
<seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="seeSubCategoryInStoreFrontPage"/>
59+
<actionGroup ref="StorefrontSwitchStoreActionGroup" stepKey="switchToCustomStore">
60+
<argument name="storeName" value="{{customStoreGroup.name}}"/>
61+
</actionGroup>
62+
<actionGroup ref="StorefrontAssertCategoryNameIsShownInMenuActionGroup" stepKey="seeCatergoryNameInStoreFront">
63+
<argument name="categoryName" value="{{SimpleSubCategory.name}}"/>
64+
</actionGroup>
7465
</test>
7566
</tests>

0 commit comments

Comments
 (0)