Skip to content

Commit 9e92ab8

Browse files
committed
Convert UpdateCmsPageEntityTest to MFTF
1 parent 70bf7c6 commit 9e92ab8

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed

app/code/Magento/Cms/Test/Mftf/Section/CmsNewPagePageBasicFieldsSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<element name="pageTitle" type="input" selector="input[name=title]"/>
1313
<element name="RequiredFieldIndicator" type="text" selector=" return window.getComputedStyle(document.querySelector('._required[data-index=title]&gt;.admin__field-label span'), ':after').getPropertyValue('content');"/>
1414
<element name="isActive" type="button" selector="//input[@name='is_active' and @value='{{var1}}']" parameterized="true"/>
15+
<element name="isActiveLabel" type="button" selector="div[data-index=is_active] .admin__actions-switch-label"/>
1516
<element name="duplicatedURLKey" type="input" selector="//input[contains(@data-value,'{{var1}}')]" parameterized="true"/>
1617
</section>
1718
</sections>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
*CreateNewPage Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminUpdateCmsPageEntityTest">
12+
<annotations>
13+
<features value="Cms"/>
14+
<title value="Update CMS Page via the Admin"/>
15+
<description value="Admin should be able to update a CMS Page"/>
16+
<group value="backend"/>
17+
<group value="cMSContent"/>
18+
<group value="mtf_migrated"/>
19+
</annotations>
20+
<before>
21+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
22+
<createData entity="_defaultCmsPage" stepKey="createCMSPage" />
23+
</before>
24+
<after>
25+
<deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage" />
26+
<actionGroup ref="logout" stepKey="logout"/>
27+
</after>
28+
<!--Update page, deactivate-->
29+
<!--Navigate to Page in Admin-->
30+
<actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCreatedCMSPage">
31+
<argument name="CMSPage" value="$$createCMSPage$$"/>
32+
</actionGroup>
33+
<!--Fill data using _duplicatedCMSPage-->
34+
<actionGroup ref="FillOutCMSPageContent" stepKey="fillNewData"/>
35+
<!--Deactivate page-->
36+
<seeElement selector="{{CmsNewPagePageBasicFieldsSection.isActive('1')}}" stepKey="seePageIsEnabled" />
37+
<click selector="{{CmsNewPagePageBasicFieldsSection.isActiveLabel}}" stepKey="setPageNotActive"/>
38+
<!--Save page-->
39+
<actionGroup ref="saveCmsPage" stepKey="saveDeactivatedPage"/>
40+
<!--Check that page is not found on frontend-->
41+
<amOnPage url="{{StorefrontHomePage.url}}/{{_duplicatedCMSPage.identifier}}" stepKey="amOnDeactivatedPageOnFrontend"/>
42+
<waitForPageLoad stepKey="waitForDeactivatedPageLoadOnFrontend"/>
43+
<see userInput="Whoops, our bad..." stepKey="seePageError"/>
44+
<!--Check page data is updated properly-->
45+
<!--Navigate to Page in Admin-->
46+
<actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToUpdatedCMSPageInAdmin">
47+
<argument name="CMSPage" value="_duplicatedCMSPage"/>
48+
</actionGroup>
49+
<!--Verify data in admin-->
50+
<actionGroup ref="AssertCMSPageContent" stepKey="verifyPageDataInAdmin"/>
51+
<!--Activate page-->
52+
<seeElement selector="{{CmsNewPagePageBasicFieldsSection.isActive('0')}}" stepKey="seePageIsDisabled" />
53+
<click selector="{{CmsNewPagePageBasicFieldsSection.isActiveLabel}}" stepKey="setPageActive"/>
54+
<actionGroup ref="saveCmsPage" stepKey="saveActivatedPage"/>
55+
<!--Flush cache-->
56+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
57+
<!--Verify data on frontend-->
58+
<amOnPage url="{{StorefrontHomePage.url}}/{{_duplicatedCMSPage.identifier}}" stepKey="amOnPageTestPage"/>
59+
<actionGroup ref="AssertStoreFrontCMSPage" stepKey="verifyPageDataOnFrontend">
60+
<argument name="cmsTitle" value="{{_duplicatedCMSPage.title}}"/>
61+
<argument name="cmsContent" value="{{_duplicatedCMSPage.content}}"/>
62+
<argument name="cmsContentHeading" value="{{_duplicatedCMSPage.content_heading}}"/>
63+
</actionGroup>
64+
</test>
65+
</tests>

dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<data name="cms/data/title" xsi:type="string">CmsPageEdited%isolation%</data>
1313
<data name="cms/data/is_active" xsi:type="string">No</data>
1414
<data name="cms/data/content/content" xsi:type="string">cms_page_text_content_after_edit</data>
15+
<data name="tag" xsi:type="string">mftf_migrated:yes</data>
1516
<constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" />
1617
<constraint name="Magento\Cms\Test\Constraint\AssertCmsPageDisabledOnFrontend" />
1718
</variation>
@@ -21,6 +22,7 @@
2122
<data name="cms/data/identifier" xsi:type="string">cms_page_url_edited_%isolation%</data>
2223
<data name="cms/data/content_heading" xsi:type="string">Content Heading TextEdited</data>
2324
<data name="cms/data/content/content" xsi:type="string">cms_page_text_content_after_edit</data>
25+
<data name="tag" xsi:type="string">mftf_migrated:yes</data>
2426
<constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" />
2527
<constraint name="Magento\Cms\Test\Constraint\AssertCmsPageForm" />
2628
<constraint name="Magento\Cms\Test\Constraint\AssertCmsPagePreview" />

0 commit comments

Comments
 (0)