Skip to content

Commit 7c68a18

Browse files
committed
MC-1438: Editing Text Content Block from the Stage with WYSIWYG turned off completely or by default
Added test for data consistency
1 parent 05f7171 commit 7c68a18

File tree

3 files changed

+105
-3
lines changed

3 files changed

+105
-3
lines changed

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/WYSIWYGActionGroup.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
<arguments>
4141
<argument name="variable" defaultValue=""/>
4242
</arguments>
43-
<comment userInput="Adding Variable To Tiny MCE" stepKey="commentAddVariableToTinyMCE"/>
4443
<waitForElementVisible selector="{{TextOnConfiguration.insertVariableButton}}" stepKey="waitForInsertVariable1"/>
4544
<click selector="{{TextOnConfiguration.insertVariableButton}}" stepKey="clickInsertVariable1"/>
4645
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear"/>
@@ -98,7 +97,7 @@
9897
<click selector="{{moveToCE.SelectPageButton}}" stepKey="clickSelectPage"/>
9998
<waitForLoadingMaskToDisappear stepKey="waitForSelectPageModal"/>
10099
<waitForElementVisible selector="{{moveToCE.generalFilter('chooser_title')}}" stepKey="waitForGrid"/>
101-
<fillField selector="{{moveToCE.generalFilter('chooser_title')}}" userInput="{{page}}" stepKey="enterPageName"/>
100+
<fillField selector="{{moveToCE.generalFilter('chooser_identifier')}}" userInput="{{page}}" stepKey="enterPageName"/>
102101
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickSearch"/>
103102
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear3"/>
104103
<waitForElementVisible selector="//td[contains(@class,'col-url')][contains(text(),'{{page}}')]" stepKey="waitForSearchResult"/>

app/code/Magento/PageBuilder/Test/Mftf/Section/PageBuilderTextSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
<element name="textAreaTextContains" type="text" selector="(//div[contains(@class,'pagebuilder-text')])[{{arg1}}]//textarea[contains(@value,'{{arg2}}')]" parameterized="true"/>
1414
<element name="text" type="text" selector="(//div[contains(@class,'pagebuilder-text')])[{{arg1}}]/div//*[contains(.,'{{arg2}}')]" parameterized="true"/>
1515
<element name="mcePlaceholder" type="text" selector="(//div[contains(@class,'pagebuilder-text')])[{{arg1}}]/div//*[starts-with(@id, '{{arg2}}')]" parameterized="true"/>
16+
<element name="variablePlaceholder" selector="(//div[contains(@class,'pagebuilder-text')])[{{arg}}]//*[@data-bind='html: data.main.html']//*[contains(@class, 'magento-variable magento-placeholder')]" parameterized="true"/>
17+
<element name="widgetPlaceholder" selector="(//div[contains(@class,'pagebuilder-text')])[{{arg}}]//*[@data-bind='html: data.main.html']//*[contains(@class, 'magento-placeholder magento-widget')]" parameterized="true"/>
1618
<element name="placeholder" type="text" selector="(//div[contains(@class,'pagebuilder-text')])[{{arg1}}]//div[contains(@class, 'placeholder-text') and text()='Edit Text']" parameterized="true"/>
1719
<element name="textArea" type="text" selector="(//div[contains(@class,'pagebuilder-text')])[{{arg}}]//textarea[contains(@class,'inline-wysiwyg-textarea')]" parameterized="true"/>
1820
<element name="textareaPlaceholder" type="text" selector="(//div[contains(@class,'pagebuilder-text')])[{{arg1}}]//textarea[contains(@class, 'inline-wysiwyg-textarea') and contains(@placeholder,'Edit Text')]" parameterized="true"/>

app/code/Magento/PageBuilder/Test/Mftf/Test/AdminPageBuilderTextTest.xml

Lines changed: 102 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,106 @@
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="TextDataConsistencyBetweenTextEditor">
12+
<annotations>
13+
<features value="PageBuilder"/>
14+
<stories value="Text"/>
15+
<title value="Data consistency between TextArea, TinyMCE4, TinyMCE4 in PageBuilder stage"/>
16+
<description value="Verify data consistent when switching between TinyMCE versions and TextArea"/>
17+
<severity value="MAJOR"/>
18+
<useCaseId value="MC-1438"/>
19+
<testCaseId value="MC-3741"/>
20+
<group value="pagebuilder"/>
21+
<group value="pagebuilder-text"/>
22+
</annotations>
23+
<before>
24+
<createData entity="_defaultCmsPage" stepKey="createCMSPage" />
25+
<createData entity="_defaultCmsPage" stepKey="createCMSPageB" />
26+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
27+
<actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/>
28+
</before>
29+
<after>
30+
<deleteData createDataKey="createCMSPage" stepKey="deletePreReqCMSPage" />
31+
<deleteData createDataKey="createCMSPageB" stepKey="deletePreReqCMSPageB" />
32+
<actionGroup ref="logout" stepKey="logout"/>
33+
</after>
34+
<actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCreatedCMSPage1">
35+
<argument name="CMSPage" value="$$createCMSPage$$"/>
36+
</actionGroup>
37+
<actionGroup ref="expandPageBuilderPanelGroup" stepKey="expandPageBuilderPanelGroup1">
38+
<argument name="group" value="PageBuilderTextContentType"/>
39+
</actionGroup>
40+
<actionGroup ref="dragContentTypeToStage" stepKey="dragButtonsOntoStage">
41+
<argument name="contentType" value="PageBuilderTextContentType"/>
42+
</actionGroup>
43+
<click selector="{{TextOnStage.textareaPlaceholder('1')}}" stepKey="focusOnEditorArea"/>
44+
<fillField selector="{{TextOnStage.textareaPlaceholder('1')}}" userInput="{{PageBuilderTextProperty.value}}" stepKey="fillTextToTextarea"/>
45+
<click selector="{{PageBuilderPanel.searchPanel}}" stepKey="lostFocusFromTextarea"/>
46+
<actionGroup ref="saveAndContinueEditCmsPage" stepKey="saveAndContinueEditCmsPage2"/>
47+
<actionGroup ref="switchToPageBuilderStage" stepKey="switchToPageBuilderStage2"/>
48+
<!--Verify Text Content Type on stage after saving cms page-->
49+
<comment userInput="Verify text content type on stage" stepKey="commentVerifyTextOnStage"/>
50+
<waitForElementVisible selector="{{TextOnStage.textArea('1')}}" stepKey="waitForTextStage2"/>
51+
<executeJS function="return document.evaluate(&quot;{{TextOnStage.textArea('1')}}&quot;, document.body).iterateNext().value" stepKey="textareaValueAfterSaving"/>
52+
<assertEquals stepKey="assertTextValueAfterSaving">
53+
<expectedResult type="string">{{PageBuilderTextProperty.value}}</expectedResult>
54+
<actualResult type="variable">textareaValueAfterSaving</actualResult>
55+
</assertEquals>
56+
<actionGroup ref="openPageBuilderEditPanel" stepKey="openEditMenuOnStage">
57+
<argument name="contentType" value="PageBuilderTextContentType"/>
58+
</actionGroup>
59+
<!-- Add image to TextArea -->
60+
<comment userInput="Add image to TextArea" stepKey="comment1"/>
61+
<waitForElementVisible selector="{{TextOnConfiguration.insertImageButton}}" stepKey="waitForInsertImage"/>
62+
<click selector="{{TextOnConfiguration.insertImageButton}}" stepKey="clickInsertImage"/>
63+
<actionGroup ref="CreateImageFolder" stepKey="CreateImageFolder">
64+
<argument name="ImageFolder" value="ImageFolder"/>
65+
</actionGroup>
66+
<actionGroup ref="attachImage" stepKey="attachImage1">
67+
<argument name="Image" value="ImageUpload3"/>
68+
</actionGroup>
69+
<actionGroup ref="saveImage" stepKey="insertImage"/>
70+
<!-- Add widget to TextArea -->
71+
<comment userInput="Add widget to TextArea" stepKey="comment2"/>
72+
<actionGroup ref="addPageLinkWidgetWYSIWYGDisabled" stepKey="addPageLinkWidgetWYSIWYGDisabled">
73+
<argument name="widget" value="PageBuilderTextArea_WidgetCMSPageLink"/>
74+
<argument name="page" value="$$createCMSPageB.identifier$$"/>
75+
</actionGroup>
76+
<!-- Add variable to TextArea -->
77+
<comment userInput="Add variable to TextArea" stepKey="comment3"/>
78+
<actionGroup ref="addPageLinkVariableWYSIWYGDisabled" stepKey="addPageLinkVariableWYSIWYGDisabled">
79+
<argument name="variable" value="PageBuilderTextArea_VariableBaseURL"/>
80+
</actionGroup>
81+
<actionGroup ref="saveEditPanelSettings" stepKey="saveEditPanelSettings"/>
82+
<actionGroup ref="saveAndContinueEditCmsPage" stepKey="saveAndContinueEditCmsPage3"/>
83+
<!-- Switch to TinyMCE4 -->
84+
<comment userInput="Switch to TinyMCE4 " stepKey="comment4"/>
85+
<magentoCLI command="config:set cms/wysiwyg/enabled enabled" stepKey="enableWYSIWYG"/>
86+
<magentoCLI command="config:set cms/wysiwyg/editor mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter" stepKey="enableTinyMCE4"/>
87+
<!-- Verify data on TinyMCE4 -->
88+
<comment userInput="Verify data on TinyMCE4" stepKey="comment5"/>
89+
<reloadPage stepKey="reloadPage"/>
90+
<actionGroup ref="switchToPageBuilderStage" stepKey="switchToPageBuilderStage3"/>
91+
<waitForElementVisible selector="{{TextOnStage.tinymce('1')}}" stepKey="waitforTinyMCE4"/>
92+
<waitForElementVisible selector="//*[contains(@class, 'pagebuilder-text')]//*[text()='{{PageBuilderTextProperty.value}}']" stepKey="waitForText"/>
93+
<waitForElementVisible selector="{{TextOnStage.tinymce('1')}}{{CmsWYSIWYGSection.imageSource(ImageUpload3.fileName)}}" stepKey="assertMediaSourceOnStage2"/>
94+
<waitForElementVisible selector="{{TextOnStage.text('1', TinyMCEVariableBaseURL.editPanelValue)}}" stepKey="waitForVariabBaseURL"/>
95+
<waitForElementVisible selector="{{TextOnStage.variablePlaceholder('1')}}" stepKey="waitForVariablePlaceholder"/>
96+
<waitForElementVisible selector="{{TextOnStage.text('1', TinyMCEWidgetCMSPageLink.editPanelValue)}}" stepKey="waitForWidgetValue"/>
97+
<waitForElementVisible selector="{{TextOnStage.widgetPlaceholder('1')}}" stepKey="waitForWidgetPlaceholder"/>
98+
<actionGroup ref="saveEditPanelSettings" stepKey="saveEditPanelSettings1"/>
99+
<!-- Switch to TinyMCE3 -->
100+
<comment userInput="Switch to TinyMCE3" stepKey="comment6"/>
101+
<magentoCLI command="config:set cms/wysiwyg/editor Magento_Tinymce3/tinymce3Adapter" stepKey="enableTinyMCE3"/>
102+
<reloadPage stepKey="reloadPage1"/>
103+
<actionGroup ref="switchToPageBuilderStage" stepKey="switchToPageBuilderStage4"/>
104+
<executeJS function="return document.evaluate(&quot;{{TextOnStage.textArea('1')}}&quot;, document.body).iterateNext().value" stepKey="textareaValue"/>
105+
<assertEquals stepKey="assertTextValue">
106+
<expectedResult type="string">{{PageBuilderTextProperty.value}}{{CmsWYSIWYGSection.imageSource(ImageUpload3.fileName)}}{{TinyMCEVariableBaseURL.editPanelValue}}{{TinyMCEWidgetCMSPageLink.editPanelValue}}</expectedResult>
107+
<actualResult type="variable">textareaValue</actualResult>
108+
</assertEquals>
109+
110+
</test>
11111
<test name="TextAreaInitalStatus">
12112
<annotations>
13113
<features value="PageBuilder"/>
@@ -147,7 +247,7 @@
147247
<actionGroup ref="switchToPageBuilderStage" stepKey="switchToPageBuilderStage"/>
148248
</before>
149249
<after>
150-
<magentoCLI command="config:set config:set cms/wysiwyg/editor mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter" stepKey="enableTinyMCE4"/>
250+
<magentoCLI command="config:set cms/wysiwyg/editor mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter" stepKey="enableTinyMCE4"/>
151251
<actionGroup ref="logout" stepKey="logout"/>
152252
</after>
153253
<actionGroup ref="addPageBuilderPageTitle" stepKey="enterPageTitle">
@@ -1522,6 +1622,7 @@
15221622
<actionGroup ref="DeleteImageFromStorageActionGroup" stepKey="DeleteImageFromStorage2">
15231623
<argument name="Image" value="PageBuilderImageProperty_JPG2"/>
15241624
</actionGroup>
1625+
<actionGroup ref="EnabledWYSIWYG" stepKey="enabledWYSIWYG"/>
15251626
<actionGroup ref="logout" stepKey="logout"/>
15261627
</after>
15271628
<actionGroup ref="expandPageBuilderPanelGroup" stepKey="expandPageBuilderPanelGroup">

0 commit comments

Comments
 (0)