Skip to content

Commit 49d5327

Browse files
committed
refactored according to best practices
1 parent fc8d449 commit 49d5327

18 files changed

+410
-184
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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="AdminCMSPageSetDisabled">
11+
<seeElement selector="{{CmsNewPagePageBasicFieldsSection.isActive('1')}}" stepKey="seePageIsEnabled" />
12+
<click selector="{{CmsNewPagePageBasicFieldsSection.isActiveLabel}}" stepKey="setPageDisabled"/>
13+
</actionGroup>
14+
</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="AdminCmsPageFillContentField">
11+
<arguments>
12+
<argument name="content" type="string"/>
13+
</arguments>
14+
<fillField selector="{{CmsNewPagePageContentSection.content}}" userInput="{{content}}" stepKey="fillFieldContent"/>
15+
</actionGroup>
16+
</actionGroups>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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="AdminCmsPageNavigateToCreateNewPage">
11+
<amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToCreateNewPage"/>
12+
<waitForPageLoad stepKey="waitForNewPagePageLoad"/>
13+
</actionGroup>
14+
</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="AdminCmsPageSelectPageStoreView">
11+
<arguments>
12+
<argument name="storeViewName" type="string"/>
13+
</arguments>
14+
<click selector="{{CmsNewPagePiwSection.header}}" stepKey="clickPageInWebsites"/>
15+
<waitForElementVisible selector="{{CmsNewPagePiwSection.selectStoreView(storeViewName)}}" stepKey="waitForStoreGridReload"/>
16+
<clickWithLeftButton selector="{{CmsNewPagePiwSection.selectStoreView(storeViewName)}}" stepKey="clickStoreView"/>
17+
</actionGroup>
18+
</actionGroups>

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,6 @@
2323
<executeJS function="(el = document.querySelector('[name=\'identifier\']')) &amp;&amp; el['se' + 'tAt' + 'tribute']('data-value', el.value.split('-')[0]);" stepKey="setAttribute" />
2424
<seeElement selector="{{CmsNewPagePageBasicFieldsSection.duplicatedURLKey(_duplicatedCMSPage.title)}}" stepKey="see"/>
2525
</actionGroup>
26-
<actionGroup name="AssertCMSPageStoreId">
27-
<arguments>
28-
<argument name="storeId" type="string"/>
29-
</arguments>
30-
<click selector="{{CmsNewPagePiwSection.header}}" stepKey="clickPageInWebsites"/>
31-
<waitForElementVisible selector="{{CmsNewPagePiwSection.storeIdDropdown}}" stepKey="waitForStoresSectionReload"/>
32-
<grabValueFrom selector="{{CmsNewPagePiwSection.storeIdDropdown}}" stepKey="grabValueFromStoreView"/>
33-
<assertEquals stepKey="assertTitle" message="pass">
34-
<expectedResult type="string">{{storeId}}</expectedResult>
35-
<actualResult type="variable">grabValueFromStoreView</actualResult>
36-
</assertEquals>
37-
</actionGroup>
3826
<actionGroup name="AssertStoreFrontCMSPage">
3927
<arguments>
4028
<argument name="cmsTitle" type="string"/>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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="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" />
24+
</actionGroup>
25+
</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="amOnPageOnStorefront"/>
15+
<waitForPageLoad stepKey="waitForPageLoadOnStorefront"/>
16+
<see userInput="Whoops, our bad..." stepKey="seePageErrorNotFound"/>
17+
</actionGroup>
18+
</actionGroups>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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="AssertCMSPageStoreId">
11+
<arguments>
12+
<argument name="storeId" type="string"/>
13+
</arguments>
14+
<click selector="{{CmsNewPagePiwSection.header}}" stepKey="clickPageInWebsites"/>
15+
<waitForElementVisible selector="{{CmsNewPagePiwSection.storeIdDropdown}}" stepKey="waitForStoresSectionReload"/>
16+
<grabValueFrom selector="{{CmsNewPagePiwSection.storeIdDropdown}}" stepKey="grabValueFromStoreView"/>
17+
<assertEquals stepKey="assertTitle" message="pass">
18+
<expectedResult type="string">{{storeId}}</expectedResult>
19+
<actualResult type="variable">grabValueFromStoreView</actualResult>
20+
</assertEquals>
21+
</actionGroup>
22+
</actionGroups>

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

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,4 @@
1515
<click selector="{{CmsNewPagePageSeoSection.header}}" stepKey="clickExpandSearchEngineOptimisation"/>
1616
<fillField selector="{{CmsNewPagePageSeoSection.urlKey}}" userInput="{{_duplicatedCMSPage.identifier}}" stepKey="fillFieldUrlKey"/>
1717
</actionGroup>
18-
<actionGroup name="SetCMSPageDisabled">
19-
<seeElement selector="{{CmsNewPagePageBasicFieldsSection.isActive('1')}}" stepKey="seePageIsEnabled" />
20-
<click selector="{{CmsNewPagePageBasicFieldsSection.isActiveLabel}}" stepKey="setPageDisabled"/>
21-
</actionGroup>
22-
<actionGroup name="SetCMSPageEnabled">
23-
<seeElement selector="{{CmsNewPagePageBasicFieldsSection.isActive('0')}}" stepKey="seePageIsDisabled" />
24-
<click selector="{{CmsNewPagePageBasicFieldsSection.isActiveLabel}}" stepKey="setPageEnabled"/>
25-
</actionGroup>
26-
<actionGroup name="SelectCMSPageStoreView">
27-
<arguments>
28-
<argument name="storeViewName" type="string"/>
29-
</arguments>
30-
<click selector="{{CmsNewPagePiwSection.header}}" stepKey="clickPageInWebsites"/>
31-
<waitForElementVisible selector="{{CmsNewPagePiwSection.selectStoreView(storeViewName)}}" stepKey="waitForStoreGridReload"/>
32-
<clickWithLeftButton selector="{{CmsNewPagePiwSection.selectStoreView(storeViewName)}}" stepKey="clickStoreView"/>
33-
</actionGroup>
3418
</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="StorefrontCMSPageNavigateToPage">
11+
<arguments>
12+
<argument name="identifier" type="string"/>
13+
</arguments>
14+
<amOnPage url="{{StorefrontHomePage.url}}/{{identifier}}" stepKey="amOnCmsPageOnStorefront"/>
15+
</actionGroup>
16+
</actionGroups>

0 commit comments

Comments
 (0)