Skip to content

Commit c025cc6

Browse files
committed
refactored according to best practices
1 parent 62b49e8 commit c025cc6

6 files changed

+95
-22
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminCMSPageMassActionDisable">
11+
<click selector="{{CmsPagesPageActionsSection.massActionsButton}}" stepKey="clickMassActionDropdown"/>
12+
<click selector="{{CmsPagesPageActionsSection.massActionsOption('Disable')}}" stepKey="clickDisableAction"/>
13+
<waitForPageLoad stepKey="waitForPageToReload"/>
14+
</actionGroup>
15+
</actionGroups>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminNavigateToCMSPageGrid">
11+
<amOnPage url="{{CmsPagesPage.url}}" stepKey="navigateToCMSPagesGrid"/>
12+
</actionGroup>
13+
</actionGroups>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminSelectCMSPageInGrid">
11+
<arguments>
12+
<argument name="identifier" type="string"/>
13+
</arguments>
14+
<checkOption selector="{{CmsPagesPageActionsSection.pageRowCheckboxByIdentifier(identifier)}}" stepKey="selectCmsPageInGrid"/>
15+
</actionGroup>
16+
</actionGroups>

app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageInGridActionGroup.xml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,19 @@
77
-->
88
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10-
<actionGroup name="AssertCMSPageInGrid" extends="navigateToCreatedCMSPage">
11-
<remove keyForRemoval="navigateToCreatedCMSPage"/>
12-
<remove keyForRemoval="waitForPageLoad3"/>
13-
<remove keyForRemoval="clickExpandContentTabForPage"/>
14-
<remove keyForRemoval="waitForLoadingMaskOfStagingSection"/>
10+
<actionGroup name="AssertCMSPageInGrid">
11+
<arguments>
12+
<argument name="identifier" defaultValue=""/>
13+
</arguments>
14+
<amOnPage url="{{CmsPagesPage.url}}" stepKey="navigateToCMSPagesGrid"/>
15+
<waitForPageLoad stepKey="waitForPageLoad1"/>
16+
<conditionalClick selector="{{CmsPagesPageActionsSection.clearAllButton}}" dependentSelector="{{CmsPagesPageActionsSection.activeFilters}}" stepKey="clickToResetFilter" visible="true"/>
17+
<waitForPageLoad stepKey="waitForPageLoad2"/>
18+
<conditionalClick selector="//div[contains(@data-role, 'grid-wrapper')]/table/thead/tr/th/span[contains(text(), 'ID')]" dependentSelector="//span[contains(text(), 'ID')]/parent::th[not(contains(@class, '_descend'))]/parent::tr/parent::thead/parent::table/parent::div[contains(@data-role, 'grid-wrapper')]" stepKey="clickToAttemptSortByIdDescending" visible="true"/>
19+
<waitForLoadingMaskToDisappear stepKey="waitForFirstIdSortDescendingToFinish" />
20+
<!-- Conditional Click again in case it goes from default state to ascending on first click -->
21+
<conditionalClick selector="//div[contains(@data-role, 'grid-wrapper')]/table/thead/tr/th/span[contains(text(), 'ID')]" dependentSelector="//span[contains(text(), 'ID')]/parent::th[not(contains(@class, '_descend'))]/parent::tr/parent::thead/parent::table/parent::div[contains(@data-role, 'grid-wrapper')]" stepKey="secondClickToAttemptSortByIdDescending" visible="true"/>
22+
<waitForLoadingMaskToDisappear stepKey="waitForSecondIdSortDescendingToFinish" />
23+
<click selector="{{CmsPagesPageActionsSection.select(identifier)}}" stepKey="clickSelectCMSPage" />
1524
</actionGroup>
1625
</actionGroups>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AssertCMSPageNotFoundOnFront">
11+
<arguments>
12+
<argument name="identifier" type="string"/>
13+
</arguments>
14+
<amOnPage url="{{StorefrontHomePage.url}}/{{identifier}}" stepKey="amOnFirstPageOnFrontend"/>
15+
<waitForPageLoad stepKey="waitForFirstPageLoadOnFrontend"/>
16+
<see userInput="Whoops, our bad..." stepKey="seePageErrorForFirstPage"/>
17+
</actionGroup>
18+
</actionGroups>

app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageMassActionTest.xml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-->
88
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10-
<test name="CmsPageMassActionTest">
10+
<test name="AdminCmsPageMassActionTest">
1111
<annotations>
1212
<features value="Cms"/>
1313
<title value="Create two CMS Pages and perform mass disable action"/>
@@ -27,27 +27,29 @@
2727
<actionGroup ref="logout" stepKey="logout"/>
2828
</after>
2929
<!--Go to Grid page-->
30-
<amOnPage url="{{CmsPagesPage.url}}" stepKey="navigateToCMSPagesGrid"/>
30+
<actionGroup ref="AdminNavigateToCMSPageGrid" stepKey="navigateToCMSPageGrid"/>
3131
<!--Select pages in Grid-->
32-
<checkOption selector="{{CmsPagesPageActionsSection.pageRowCheckboxByIdentifier($$firstCMSPage.identifier$$)}}" stepKey="selectFirstPage"/>
33-
<checkOption selector="{{CmsPagesPageActionsSection.pageRowCheckboxByIdentifier($$secondCMSPage.identifier$$)}}" stepKey="selectSecondPage"/>
32+
<actionGroup ref="AdminSelectCMSPageInGrid" stepKey="selectFirstCMSPage">
33+
<argument name="identifier" value="$$firstCMSPage.identifier$$"/>
34+
</actionGroup>
35+
<actionGroup ref="AdminSelectCMSPageInGrid" stepKey="selectSecondCMSPage">
36+
<argument name="identifier" value="$$secondCMSPage.identifier$$"/>
37+
</actionGroup>
3438
<!-- Disable Pages-->
35-
<click selector="{{CmsPagesPageActionsSection.massActionsButton}}" stepKey="clickMassActionDropdown"/>
36-
<click selector="{{CmsPagesPageActionsSection.massActionsOption('Disable')}}" stepKey="clickDisableAction"/>
37-
<waitForPageLoad stepKey="waitForPageToReload"/>
39+
<actionGroup ref="AdminCMSPageMassActionDisable" stepKey="disablePages"/>
3840
<!--Verify pages in Grid-->
39-
<actionGroup ref="AssertCMSPageInGrid" stepKey="VerifyFirstPageinGrid">
40-
<argument name="CMSPage" value="$$firstCMSPage$$"/>
41+
<actionGroup ref="AssertCMSPageInGrid" stepKey="verifyFirstPageinGrid">
42+
<argument name="identifier" value="$$firstCMSPage.identifier$$$$"/>
4143
</actionGroup>
42-
<actionGroup ref="AssertCMSPageInGrid" stepKey="VerifySecondPageinGrid">
43-
<argument name="CMSPage" value="$$secondCMSPage$$"/>
44+
<actionGroup ref="AssertCMSPageInGrid" stepKey="verifySecondPageinGrid">
45+
<argument name="identifier" value="$$secondCMSPage.identifier$$$$"/>
4446
</actionGroup>
4547
<!--Verify Pages are disabled on Frontend-->
46-
<amOnPage url="{{StorefrontHomePage.url}}/{{$$firstCMSPage.identifier$$}}" stepKey="amOnFirstPageOnFrontend"/>
47-
<waitForPageLoad stepKey="waitForFirstPageLoadOnFrontend"/>
48-
<see userInput="Whoops, our bad..." stepKey="seePageErrorForFirstPage"/>
49-
<amOnPage url="{{StorefrontHomePage.url}}/{{$$secondCMSPage.identifier$$}}" stepKey="amOnSecondPageOnFrontend"/>
50-
<waitForPageLoad stepKey="waitForSecondPageLoadOnFrontend"/>
51-
<see userInput="Whoops, our bad..." stepKey="seePageErrorForSecondPage"/>
48+
<actionGroup ref="AssertCMSPageNotFoundOnFront" stepKey="checkFirstPageNotFoundOnFront">
49+
<argument name="identifier" value="$$firstCMSPage.identifier$$"/>
50+
</actionGroup>
51+
<actionGroup ref="AssertCMSPageNotFoundOnFront" stepKey="checkSecondPageNotFoundOnFront">
52+
<argument name="identifier" value="$$secondCMSPage.identifier$$"/>
53+
</actionGroup>
5254
</test>
5355
</tests>

0 commit comments

Comments
 (0)