Skip to content

Commit 4bbb717

Browse files
committed
#703: Automate MC-4985, MC-4990, MC-30862
- Clean up MFTF tests
1 parent b5079bf commit 4bbb717

File tree

9 files changed

+216
-204
lines changed

9 files changed

+216
-204
lines changed

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/NavigateToCreatedCMSPageWithEnabledSecretKeyActionGroup.xml renamed to app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/AdminActionGroup/AdminNavigateToCreatedCMSPageWithEnabledSecretKeyActionGroup.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88

99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11-
<actionGroup name="NavigateToCreatedCMSPageWithEnabledSecretKeyActionGroup" extends="NavigateToCreatedCMSPageActionGroup">
11+
<actionGroup name="AdminNavigateToCreatedCMSPageWithEnabledSecretKeyActionGroup" extends="NavigateToCreatedCMSPageActionGroup">
1212
<annotations>
13-
<description>Goes to the Admin CMS Pages page. </description>
13+
<description>EXTENDS NavigateToCreatedCMSPageActionGroup. Searches for and goes to the edit page of a created CMS page in admin. Removes URL navigation for secret key testing.</description>
1414
</annotations>
15-
1615
<remove keyForRemoval="navigateToCMSPagesGrid"/>
1716
</actionGroup>
1817
</actionGroups>

app/code/Magento/PageBuilder/Test/Mftf/Section/PageBuilderBannerSection/BannerOnBackendSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<element name="editableButtonItemElement" type="button" selector="(//div[contains(@class,'pagebuilder-banner') and contains(@class,'pagebuilder-content-type')])[{{bannerIndex}}]//a//span[@contenteditable='true']" parameterized="true"/>
2323
<element name="wysiwygLinkUrl" type="button" selector="(//div[contains(@class,'pagebuilder-banner') and contains(@class,'pagebuilder-content-type')])[{{bannerIndex}}]//a[@href='{{link}}']" parameterized="true"/>
2424
<element name="imageOnStage" type="text" selector="(//div[contains(@class,'pagebuilder-banner') and contains(@class,'pagebuilder-content-type')])[{{bannerIndex}}]//img[contains(@src,'{{image}}')]" parameterized="true"/>
25-
<element name="imageSourceByIndex" type="text" selector="(//div[@data-content-type='banner'])[{{bannerIndex}}]/div[contains(@style,'{{image}}')]" parameterized="true"/>
25+
<element name="imageSourceByIndex" type="text" selector="(//div[@data-content-type='banner'])[{{bannerIndex}}]/div[contains(@data-background-images,'{{image}}')]" parameterized="true"/>
2626
<element name="uploadImageInput" type="button" selector="//div[contains(@class,'pagebuilder-image-uploader-container')]//input[@name='background_image']"/>
2727
<element name="variablePlaceholder" type="text" selector="(//div[contains(@class,'pagebuilder-banner')])[{{bannerIndex}}]//*[contains(@class, 'magento-variable') and contains(@class, 'magento-placeholder')]" parameterized="true"/>
2828
<element name="widgetPlaceholder" type="text" selector="(//div[contains(@class,'pagebuilder-banner')])[{{bannerIndex}}]//*[contains(@class, 'magento-placeholder') and contains(@class, 'magento-widget')]" parameterized="true"/>

app/code/Magento/PageBuilder/Test/Mftf/Section/PageBuilderImageSection/ImageOnStageSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
<element name="imageAltText" type="text" selector="(//figure[@data-content-type='image'])[{{arg1}}]//img[@alt='{{arg2}}']" parameterized="true"/>
1616
<element name="imageTitleAttribute" type="text" selector="(//figure[@data-content-type='image'])[{{arg1}}]//img[@title='{{arg2}}']" parameterized="true"/>
1717
<element name="caption" type="text" selector="(//div[contains(@class,'pagebuilder-content-type') and contains(@class,'pagebuilder-image')])[{{arg1}}]//figcaption" parameterized="true"/>
18+
<element name="onHoverSelectFromGalleryButton" type="button" selector="(//div[contains(@class,'pagebuilder-content-type') and contains(@class,'pagebuilder-{{arg1}}')])[{{arg2}}]//ul[contains(@class,'pagebuilder-options-links')]//label[text()='Select from Gallery']" parameterized="true"/>
19+
<element name="onHoverUploadImageButton" type="button" selector="(//div[contains(@class,'pagebuilder-content-type') and contains(@class,'pagebuilder-{{arg1}}')])[{{arg2}}]//label[text()='Upload New Image']" parameterized="true"/>
1820
<!-- Advanced Configuration -->
1921
<element name="noAlignment" type="text" selector="(//div[contains(@class,'pagebuilder-content-type') and contains(@class,'pagebuilder-image')])[{{arg1}}]//figure[not(contains(@style,'text-align:'))]" parameterized="true"/>
2022
<element name="alignment" type="text" selector="(//div[contains(@class,'pagebuilder-content-type') and contains(@class,'pagebuilder-image')])[{{arg1}}]//figure[contains(@style,'text-align: {{arg2}};')]" parameterized="true"/>

app/code/Magento/PageBuilder/Test/Mftf/Section/PageBuilderSliderSection/SlideOnBackendSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<element name="overlay" type="text" selector="(//div[@data-content-type=&quot;slide&quot;])[{{slideIndex}}]//div[@data-element=&quot;overlay&quot; or contains(@class,&quot;pagebuilder-overlay&quot;)]" parameterized="true"/>
1919
<element name="overlayJS" type="button" selector="document.querySelectorAll('[data-content-type=slider] div.pagebuilder-overlay')[{{slideOverlayIndex}} - 1]" parameterized="true"/>
2020
<element name="editableButtonItemElement" type="button" selector="(//div[@data-content-type='slide'])[{{slideIndex}}]//a[@data-element='button']//span[contains(@contenteditable, 'true')]" parameterized="true"/>
21-
<element name="imageSourceByIndex" type="text" selector="(//div[@data-content-type='slide'])[{{slideIndex}}]/div[contains(@style,'{{image}}')]" parameterized="true" deprecated="Styles are not inline"/>
21+
<element name="imageSourceByIndex" type="text" selector="(//div[@data-content-type='slide'])[{{slideIndex}}]/div[contains(@data-background-images,'{{image}}')]" parameterized="true" deprecated="Styles are not inline"/>
2222
<element name="openOptionsMenu" type="button" selector="(//div[contains(@class,'navigation-dot')])[{{navigationDotIndex}}]" parameterized="true"/>
2323
<element name="optionsMenu" type="button" selector="(//div[contains(@class,'navigation-dot')])[{{navigationDotIndex}}]//div[@class='pagebuilder-options-wrapper']" parameterized="true"/>
2424
<element name="optionsMenuButton" type="button" selector="(//div[contains(@class,'navigation-dot')])[{{navigationDotIndex}}]//li[contains(@class,'pagebuilder-options-link')]//a[contains(@class,'{{buttonClass}}')]" parameterized="true"/>

app/code/Magento/PageBuilder/Test/Mftf/Test/AdminPageBuilderBannerCommonTest/BannerUploadImageWithSecretKeyEnabledTest.xml

Lines changed: 54 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,47 @@
1111
<annotations>
1212
<features value="PageBuilder"/>
1313
<stories value="Banner"/>
14-
<title value="Upload Image to Banner with Secret Key Enabled"/>
15-
<description value="Verify that user are able to upload image to Banner when Secret URL Key is enabled."/>
16-
<severity value="CRITICAL"/>
17-
<useCaseId value=""/>
18-
<testCaseId value="MC-4990"/>
14+
<title value="Upload Image to Banner with Secret Key URLs Enabled"/>
15+
<description value="Verify that users are able to upload images to a Banner when 'Add Secret Key to URLs' is
16+
enabled and that the images render correctly on the storefront."/>
17+
<severity value="BLOCKER"/>
18+
<testCaseId value="PB-907"/>
1919
<group value="pagebuilder"/>
2020
<group value="pagebuilder-banner"/>
2121
<group value="pagebuilder-bannerCommon"/>
22+
<group value="secret-key-urls"/>
2223
</annotations>
24+
2325
<before>
26+
<!-- Create CMS Page, Add Banner to Row on Page -->
2427
<createData entity="_emptyCmsPage" stepKey="createCMSPage"/>
2528
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
26-
<magentoCLI command="config:set admin/security/use_form_key 0" stepKey="disableUrlSecretKeys1"/>
27-
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanInvalidatedCaches1">
28-
<argument name="tags" value="config full_page"/>
29-
</actionGroup>
30-
<reloadPage stepKey="reloadPage1"/>
31-
<actionGroup ref="NavigateToCreatedCMSPageActionGroup" stepKey="navigateToContentCreatedCMSPage1">
29+
<actionGroup ref="NavigateToCreatedCMSPageActionGroup" stepKey="navigateToCreatedCMSPage">
3230
<argument name="CMSPage" value="$$createCMSPage$$"/>
3331
</actionGroup>
32+
<actionGroup ref="switchToPageBuilderStage" stepKey="switchToPageBuilderStage"/>
33+
<actionGroup ref="dragContentTypeToStage" stepKey="dragRowToRootContainer">
34+
<argument name="contentType" value="PageBuilderRowContentType"/>
35+
<argument name="containerTargetType" value="PageBuilderRootContainerContentType"/>
36+
</actionGroup>
37+
<actionGroup ref="expandPageBuilderPanelMenuSection" stepKey="expandPageBuilderPanelMenuSection">
38+
<argument name="contentType" value="PageBuilderBannerContentType"/>
39+
</actionGroup>
40+
<actionGroup ref="dragContentTypeToStage" stepKey="dragBannerToRow">
41+
<argument name="contentType" value="PageBuilderBannerContentType"/>
42+
</actionGroup>
43+
<actionGroup ref="exitPageBuilderFullScreen" stepKey="exitPageBuilderFullScreen"/>
44+
<actionGroup ref="SaveAndContinueEditCmsPageActionGroup" stepKey="saveAndContinueEditCmsPage"/>
3445
</before>
46+
3547
<after>
36-
<deleteData createDataKey="createCMSPage" stepKey="deleteCreateCMSPage"/>
48+
<!-- Revert Configurations & Delete Data -->
49+
<deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage"/>
50+
<magentoCLI command="config:set admin/security/use_form_key 0" stepKey="disableSecretKeyUrls"/>
51+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanInvalidatedCaches">
52+
<argument name="tags" value="config full_page"/>
53+
</actionGroup>
54+
<actionGroup ref="ReloadPageActionGroup" stepKey="reloadPage"/>
3755
<actionGroup ref="NavigateToMediaGalleryActionGroup" stepKey="navigateToMediaGallery"/>
3856
<actionGroup ref="NavigateToMediaFolderActionGroup" stepKey="NavigateToFolder">
3957
<argument name="FolderName" value="{{PageBuilderBackgroundImage_JPG.path}}"/>
@@ -44,67 +62,53 @@
4462
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
4563
</after>
4664

47-
<!-- Add Banner -->
48-
<actionGroup ref="switchToPageBuilderStage" stepKey="switchToPageBuilderStage"/>
49-
<actionGroup ref="dragContentTypeToStage" stepKey="dragRowToRootContainer">
50-
<argument name="contentType" value="PageBuilderRowContentType"/>
51-
<argument name="containerTargetType" value="PageBuilderRootContainerContentType"/>
52-
</actionGroup>
53-
<actionGroup ref="expandPageBuilderPanelMenuSection" stepKey="expandPageBuilderPanelMenuSection">
54-
<argument name="contentType" value="PageBuilderBannerContentType"/>
55-
</actionGroup>
56-
<actionGroup ref="dragContentTypeToStage" stepKey="dragBannerIntoStage">
57-
<argument name="contentType" value="PageBuilderBannerContentType"/>
58-
</actionGroup>
59-
60-
<!-- Save CMS Page -->
61-
<actionGroup ref="exitPageBuilderFullScreen" stepKey="exitPageBuilderFullScreen"/>
62-
<actionGroup ref="SaveAndContinueEditCmsPageActionGroup" stepKey="saveAndContinueEditCmsPage"/>
63-
64-
<!-- Enable Secret Key -->
65-
<magentoCLI command="config:set admin/security/use_form_key 1" stepKey="enableUrlSecretKeys"/>
65+
<!-- Enable 'Add Secret Key to URLs' -->
66+
<magentoCLI command="config:set admin/security/use_form_key 1" stepKey="enableSecretKeyUrls"/>
6667
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanInvalidatedCaches">
6768
<argument name="tags" value="config full_page"/>
6869
</actionGroup>
69-
<reloadPage stepKey="reloadPage"/>
70+
<actionGroup ref="ReloadPageActionGroup" stepKey="reloadPage"/>
7071

71-
<!-- Navigate back to the created CMS page, upload image to Banner and Verify -->
72-
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToContentPagesPage">
72+
<!-- Navigate Back to CMS Page -->
73+
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToCMSPagesGrid">
7374
<argument name="menuUiId" value="{{AdminMenuContent.dataUiId}}"/>
7475
<argument name="submenuUiId" value="{{AdminMenuContentElementsPages.dataUiId}}"/>
7576
</actionGroup>
76-
<actionGroup ref="NavigateToCreatedCMSPageWithEnabledSecretKeyActionGroup" stepKey="navigateToContentCreatedCMSPage1">
77+
<actionGroup ref="AdminNavigateToCreatedCMSPageWithEnabledSecretKeyActionGroup" stepKey="navigateToCreatedCMSPage">
7778
<argument name="CMSPage" value="$$createCMSPage$$"/>
7879
</actionGroup>
79-
<actionGroup ref="switchToPageBuilderStage" stepKey="switchToPageBuilderStage2"/>
80+
81+
<!-- Upload Image to Banner -->
82+
<actionGroup ref="switchToPageBuilderStage" stepKey="switchToPageBuilderStage"/>
8083
<actionGroup ref="verifyUploadImageButtons" stepKey="verifyUploadImageButtons">
8184
<argument name="contentType" value="PageBuilderBannerContentType"/>
8285
</actionGroup>
83-
<attachFile selector="{{PageBuilderStage.uploadImageInput('1')}}" userInput="{{PageBuilderImageProperty_JPG.value}}" stepKey="attachImageFromLocalToStage"/>
84-
<waitForPageLoad stepKey="waitForPageLoad"/>
86+
<actionGroup ref="uploadImageToContentTypeFromStage" stepKey="uploadImageToBanner">
87+
<argument name="property" value="PageBuilderImageProperty_JPG"/>
88+
<argument name="section" value="BannerOnBackend"/>
89+
</actionGroup>
8590

86-
<!-- Save CMS Page Again -->
87-
<actionGroup ref="exitPageBuilderFullScreen" stepKey="exitPageBuilderFullScreen2"/>
88-
<actionGroup ref="SaveAndContinueEditCmsPageActionGroup" stepKey="saveAndContinueEditCmsPage2"/>
91+
<!-- Save CMS Page -->
92+
<actionGroup ref="exitPageBuilderFullScreen" stepKey="exitPageBuilderFullScreen"/>
93+
<actionGroup ref="SaveAndContinueEditCmsPageActionGroup" stepKey="saveAndContinueEditCmsPage"/>
8994

90-
<!-- Validate Storefront -->
91-
<amOnPage url="$$createCMSPage.identifier$$" stepKey="amOnCmsStorefront"/>
92-
<waitForPageLoad stepKey="waitForPageLoad1"/>
95+
<!-- Verify Banner Background Image Renders on Storefront -->
96+
<actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToStorefront">
97+
<argument name="page" value="$$createCMSPage.identifier$$"/>
98+
</actionGroup>
9399
<actionGroup ref="validateBackgroundImageContainer" stepKey="validateImageOnStorefront">
94100
<argument name="section" value="BannerOnFrontend"/>
95101
<argument name="backgroundImage" value="PageBuilderBackgroundImage_JPG"/>
96102
</actionGroup>
97103

98-
<!-- Disable Secret Key -->
99-
<magentoCLI command="config:set admin/security/use_form_key 0" stepKey="disableUrlSecretKeys"/>
104+
<!-- Disable 'Add Secret Key to URLs' -->
105+
<magentoCLI command="config:set admin/security/use_form_key 0" stepKey="disableSecretKeyUrls"/>
100106
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanInvalidatedCaches2">
101107
<argument name="tags" value="config full_page"/>
102108
</actionGroup>
103-
<reloadPage stepKey="reloadPage2"/>
109+
<actionGroup ref="ReloadPageActionGroup" stepKey="reloadPage2"/>
104110

105-
<!-- Validate Storefront -->
106-
<amOnPage url="$$createCMSPage.identifier$$" stepKey="amOnCmsStorefront2"/>
107-
<waitForPageLoad stepKey="waitForPageLoad2"/>
111+
<!-- Verify Banner Background Image Renders on Storefront -->
108112
<actionGroup ref="validateBackgroundImageContainer" stepKey="validateImageOnStorefront2">
109113
<argument name="section" value="BannerOnFrontend"/>
110114
<argument name="backgroundImage" value="PageBuilderBackgroundImage_JPG"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="ImageUploadImageWithSecretKeyEnabledTest" extends="BannerUploadImageWithSecretKeyEnabledTest">
11+
<annotations>
12+
<features value="PageBuilder"/>
13+
<stories value="Image"/>
14+
<title value="Upload Image to Image Content Type with Secret Key URLs Enabled"/>
15+
<description value="Verify that users are able to upload images to an Image content type when 'Add Secret
16+
Key to URLs' is enabled and that the images render correctly on the storefront."/>
17+
<severity value="BLOCKER"/>
18+
<testCaseId value="PB-880"/>
19+
<group value="pagebuilder"/>
20+
<group value="pagebuilder-image"/>
21+
<group value="secret-key-urls"/>
22+
</annotations>
23+
24+
<before>
25+
<actionGroup ref="expandPageBuilderPanelMenuSection" stepKey="expandPageBuilderPanelMenuSection">
26+
<argument name="contentType" value="PageBuilderImageContentType"/>
27+
</actionGroup>
28+
<actionGroup ref="dragContentTypeToStage" stepKey="dragBannerToRow">
29+
<argument name="contentType" value="PageBuilderImageContentType"/>
30+
</actionGroup>
31+
</before>
32+
33+
<waitForElementVisible selector="{{ImageOnStageWithoutImageUploaded.uploadImageBtn}}" stepKey="verifyUploadImageButtons"/>
34+
<waitForElementVisible selector="{{ImageOnStageWithoutImageUploaded.selectFromGalleryBtn}}" stepKey="seeSelectFromGalleryButton" after="verifyUploadImageButtons"/>
35+
<actionGroup ref="uploadImageToContentTypeFromStage" stepKey="uploadImageToBanner">
36+
<argument name="property" value="PageBuilderImageProperty_JPG"/>
37+
<argument name="section" value="ImageOnStageWithoutImageUploaded"/>
38+
</actionGroup>
39+
<actionGroup ref="validateImage" stepKey="validateImageOnStorefront">
40+
<argument name="section" value="ImageOnStorefront"/>
41+
<argument name="image" value="PageBuilderImageProperty_JPG"/>
42+
</actionGroup>
43+
<actionGroup ref="validateImage" stepKey="validateImageOnStorefront2">
44+
<argument name="section" value="ImageOnStorefront"/>
45+
<argument name="image" value="PageBuilderImageProperty_JPG"/>
46+
</actionGroup>
47+
</test>
48+
</tests>

0 commit comments

Comments
 (0)