Skip to content

MFTF: Replace repetitive actions with Action Groups in CheckStaticBlocksTest #30317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminOpenCmsBlocksGridActionGroup">
<annotations>
<description>Goes to the Cms Blocks grid page.</description>
</annotations>
<amOnPage url="{{CmsBlocksPage.url}}" stepKey="navigateToCMSBlocksGrid"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminPressAddNewCmsBlockButtonActionGroup">
<annotations>
<description>Press Add new block button on Cms Blocks gid page</description>
</annotations>

<click selector="{{BlockPageActionsSection.addNewBlock}}" stepKey="clickOnAddNewBlockButton"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminPressSaveCmsBlockButtonActionGroup">
<annotations>
<description>Press save button on Cms Block page</description>
</annotations>

<click selector="{{BlockNewPagePageActionsSection.saveBlock}}" stepKey="clickOnSaveBlock"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminSelectCMSBlockStoreViewActionGroup">
<arguments>
<argument name="storeViewName" type="string"/>
</arguments>

<selectOption selector="{{BlockNewPageBasicFieldsSection.storeView}}" userInput="{{storeViewName}}" stepKey="selectStoreView"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AssertAdminProperUrlIsShownActionGroup">
<annotations>
<description>Assert current page has proper URL</description>
</annotations>
<arguments>
<argument name="target_path" type="string"/>
</arguments>

<seeInCurrentUrl url="{{target_path}}" stepKey="seePropertUrl"/>
</actionGroup>
</actionGroups>
78 changes: 44 additions & 34 deletions app/code/Magento/Cms/Test/Mftf/Test/CheckStaticBlocksTest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
</annotations>

<before>
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>

<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createAdditionalWebsite">
<argument name="newWebsiteName" value="{{customWebsite.name}}"/>
<argument name="websiteCode" value="{{customWebsite.code}}"/>
Expand All @@ -39,49 +38,60 @@
</before>

<after>
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="DeleteWebsite">
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite">
<argument name="websiteName" value="{{customWebsite.name}}"/>
</actionGroup>
<actionGroup ref="DeleteCMSBlockActionGroup" stepKey="DeleteCMSBlockActionGroup"/>
<actionGroup ref="DeleteCMSBlockActionGroup" stepKey="deleteCMSBlock"/>
<actionGroup ref="DeleteCMSBlockActionGroup" stepKey="deleteSecondCMSBlock"/>
<actionGroup ref="AdminClearFiltersActionGroup" stepKey="clearFilters"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>

<!--Go to Cms blocks page-->
<amOnPage url="{{CmsBlocksPage.url}}" stepKey="navigateToCMSPagesGrid"/>
<waitForPageLoad stepKey="waitForPageLoad1"/>
<seeInCurrentUrl url="cms/block/" stepKey="VerifyPageIsOpened"/>
<actionGroup ref="AdminOpenCmsBlocksGridActionGroup" stepKey="navigateToCMSBlocksGrid"/>
<actionGroup ref="AssertAdminProperUrlIsShownActionGroup" stepKey="verifyPageIsOpened">
<argument name="target_path" value="cms/block/"/>
</actionGroup>

<!--Click to create new block-->
<click selector="{{BlockPageActionsSection.addNewBlock}}" stepKey="ClickToAddNewBlock"/>
<waitForPageLoad stepKey="waitForPageLoad2"/>
<seeInCurrentUrl url="cms/block/new" stepKey="VerifyNewBlockPageIsOpened"/>
<actionGroup ref="AdminPressAddNewCmsBlockButtonActionGroup" stepKey="clickOnAddNewBlockButton"/>
<actionGroup ref="AssertAdminProperUrlIsShownActionGroup" stepKey="verifyNewCmsBlockPageIsOpened">
<argument name="target_path" value="cms/block/new"/>
</actionGroup>
<actionGroup ref="FillOutBlockContent" stepKey="FillOutBlockContent"/>
<click selector="{{BlockNewPagePageActionsSection.saveBlock}}" stepKey="ClickToSaveBlock"/>
<waitForPageLoad stepKey="waitForPageLoad3"/>
<see userInput="You saved the block." stepKey="VerifyBlockIsSaved"/>
<!--Click to go back and add new block-->
<click selector="{{BlockNewPagePageActionsSection.back}}" stepKey="ClickToGoBack"/>
<waitForPageLoad stepKey="waitForPageLoad4"/>
<click selector="{{BlockPageActionsSection.addNewBlock}}" stepKey="ClickToAddNewBlock1"/>
<waitForPageLoad stepKey="waitForPageLoad5"/>
<seeInCurrentUrl url="cms/block/new" stepKey="VerifyNewBlockPageIsOpened1"/>
<actionGroup ref="AdminPressSaveCmsBlockButtonActionGroup" stepKey="saveCmsBlock"/>
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessage">
<argument name="message" value="You saved the block."/>
</actionGroup>

<!--Add new BLock with the same data-->
<actionGroup ref="AdminOpenCmsBlocksGridActionGroup" stepKey="openCmsBlocksGrid"/>
<actionGroup ref="AdminPressAddNewCmsBlockButtonActionGroup" stepKey="pressAddNewBlockButton"/>
<actionGroup ref="AssertAdminProperUrlIsShownActionGroup" stepKey="assertNewCmsBlockPageIsOpened">
<argument name="target_path" value="cms/block/new"/>
</actionGroup>
<actionGroup ref="FillOutBlockContent" stepKey="FillOutBlockContent1"/>
<click selector="{{BlockNewPagePageActionsSection.saveBlock}}" stepKey="ClickToSaveBlock1"/>
<waitForPageLoad stepKey="waitForPageLoad6"/>
<!--Verify that corresponding message is displayed-->
<see userInput="A block identifier with the same properties already exists in the selected store." stepKey="VerifyBlockIsSaved1"/>
<!--Click to go back and add new block-->
<click selector="{{BlockNewPagePageActionsSection.back}}" stepKey="ClickToGoBack1"/>
<waitForPageLoad stepKey="waitForPageLoad7"/>
<click selector="{{BlockPageActionsSection.addNewBlock}}" stepKey="ClickToAddNewBlock2"/>
<waitForPageLoad stepKey="waitForPageLoad8"/>
<seeInCurrentUrl url="cms/block/new" stepKey="VerifyNewBlockPageIsOpened2"/>
<actionGroup ref="AdminPressSaveCmsBlockButtonActionGroup" stepKey="clickOnSaveButton"/>
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertErrorMessage">
<argument name="messageType" value="error"/>
<argument name="message" value="A block identifier with the same properties already exists in the selected store."/>
</actionGroup>

<!--Add new BLock with the same data for another store view-->
<actionGroup ref="AdminOpenCmsBlocksGridActionGroup" stepKey="goToCmsBlocksGrid"/>
<actionGroup ref="AdminPressAddNewCmsBlockButtonActionGroup" stepKey="clickToAddNewButton"/>
<actionGroup ref="AssertAdminProperUrlIsShownActionGroup" stepKey="confirmNewCmsBlockPageIsOpened">
<argument name="target_path" value="cms/block/new"/>
</actionGroup>
<actionGroup ref="FillOutBlockContent" stepKey="FillOutBlockContent2"/>
<selectOption selector="{{BlockNewPageBasicFieldsSection.storeView}}" userInput="Default Store View" stepKey="selectDefaultStoreView" />
<selectOption selector="{{BlockNewPageBasicFieldsSection.storeView}}" userInput="{{customStore.name}}" stepKey="selectSecondStoreView1" />
<click selector="{{BlockNewPagePageActionsSection.saveBlock}}" stepKey="ClickToSaveBlock2"/>
<waitForPageLoad stepKey="waitForPageLoad9"/>
<see userInput="You saved the block." stepKey="VerifyBlockIsSaved2"/>

<actionGroup ref="AdminSelectCMSBlockStoreViewActionGroup" stepKey="selectCustomStoreView">
<argument name="storeViewName" value="{{customStore.name}}"/>
</actionGroup>

<actionGroup ref="AdminPressSaveCmsBlockButtonActionGroup" stepKey="saveNewCmsBlock"/>
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="verifyBlockIsSaved">
<argument name="message" value="You saved the block."/>
</actionGroup>
</test>
</tests>