Skip to content

Commit e7f2fbe

Browse files
committed
MC-1438: Editing Text Content Block from the Stage with WYSIWYG turned off completely or by default
1 parent 9ca53c1 commit e7f2fbe

File tree

4 files changed

+45
-35
lines changed

4 files changed

+45
-35
lines changed

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

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@
3636
<click selector="{{VariableSection.InsertWidget}}" stepKey="clickInsertVariable2"/>
3737
<waitForElementNotVisible selector="{{VariableSection.InsertWidget}}" stepKey="waitForVariableModalToClose"/>
3838
</actionGroup>
39+
<actionGroup name="addVariableToTinyMCE3" extends="addVariableToTinyMCE">
40+
<arguments>
41+
<argument name="variable" defaultValue=""/>
42+
</arguments>
43+
<comment userInput="Adding Variable To TinyMCE3" stepKey="commentAddVariableToTinyMCE"/>
44+
<waitForElementVisible selector="{{TextOnConfiguration.tinyMCE3VariableBtn}}" stepKey="waitForInsertVariable1"/>
45+
<click selector="{{TextOnConfiguration.tinyMCE3VariableBtn}}" stepKey="clickInsertVariable1"/>
46+
<waitForElementVisible selector="{{TextOnConfiguration.tinyMCE3VariableBtn}}" stepKey="waitForVariableModalToClose"/>
47+
</actionGroup>
3948
<actionGroup name="addPageLinkVariableWYSIWYGDisabled">
4049
<arguments>
4150
<argument name="variable" defaultValue=""/>
@@ -57,9 +66,9 @@
5766
<argument name="widget" defaultValue=""/>
5867
<argument name="page" defaultValue="" type="string"/>
5968
</arguments>
60-
<comment userInput="Adding Widget To Tiny MCE" stepKey="commentAddWidgetToTinyMCE"/>
69+
<comment userInput="Adding Widget To Tiny MCE" stepKey="commentAddWidget"/>
6170
<waitForElementVisible selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="waitForInsertWidget1"/>
62-
<click selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="clickInsertWidget1"/>
71+
<click selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="clickAddWidgetBtn"/>
6372
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear"/>
6473
<waitForElementVisible selector="{{WidgetSection.WidgetType}}" stepKey="waitForWidgetType"/>
6574
<selectOption selector="{{WidgetSection.WidgetType}}" userInput="{{TinyMCEWidgetCMSPageLink.widgetType}}" stepKey="selectCMSPageLinkWidget"/>
@@ -81,35 +90,25 @@
8190
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear5"/>
8291
<waitForElementNotVisible selector="{{WidgetSection.InsertWidget}}" stepKey="waitForInsertWidgetModalToClose"/>
8392
</actionGroup>
84-
<actionGroup name="addPageLinkWidgetWYSIWYGDisabled">
93+
<actionGroup name="addPageLinkWidgetToTinyMCE3" extends="addPageLinkWidgetToTinyMCE">
8594
<arguments>
8695
<argument name="widget" defaultValue=""/>
8796
<argument name="page" defaultValue="" type="string"/>
8897
</arguments>
89-
<comment userInput="Adding Widget" stepKey="commentAddWidget"/>
98+
<comment userInput="Adding Widget To TinyMCE3" stepKey="commentAddWidget"/>
99+
<waitForElementVisible selector="{{TextOnConfiguration.tinyMCE3WidgetBtn}}" stepKey="waitForInsertWidget1"/>
100+
<click selector="{{TextOnConfiguration.tinyMCE3WidgetBtn}}" stepKey="clickAddWidgetBtn"/>
101+
<waitForElementVisible selector="{{TextOnConfiguration.tinyMCE3WidgetBtn}}" stepKey="waitForInsertWidgetModalToClose"/>
102+
</actionGroup>
103+
<actionGroup name="addPageLinkWidgetWYSIWYGDisabled" extends="addPageLinkWidgetToTinyMCE">
104+
<arguments>
105+
<argument name="widget" defaultValue=""/>
106+
<argument name="page" defaultValue="" type="string"/>
107+
</arguments>
108+
<comment userInput="Adding Widget To Textarea" stepKey="commentAddWidget"/>
90109
<waitForElementVisible selector="{{TextOnConfiguration.insertWidgetButton}}" stepKey="waitForInsertWidget1"/>
91-
<click selector="{{TextOnConfiguration.insertWidgetButton}}" stepKey="clickInsertWidget1"/>
92-
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear"/>
93-
<waitForElementVisible selector="{{WidgetSection.WidgetType}}" stepKey="waitForWidgetType"/>
94-
<selectOption selector="{{WidgetSection.WidgetType}}" userInput="{{TinyMCEWidgetCMSPageLink.widgetType}}" stepKey="selectCMSPageLinkWidget"/>
95-
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear2"/>
96-
<waitForElementVisible selector="{{moveToCE.SelectPageButton}}" stepKey="waitForSelectPage"/>
97-
<click selector="{{moveToCE.SelectPageButton}}" stepKey="clickSelectPage"/>
98-
<waitForLoadingMaskToDisappear stepKey="waitForSelectPageModal"/>
99-
<waitForElementVisible selector="{{moveToCE.generalFilter('chooser_title')}}" stepKey="waitForGrid"/>
100-
<fillField selector="{{moveToCE.generalFilter('chooser_identifier')}}" userInput="{{page}}" stepKey="enterPageName"/>
101-
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickSearch"/>
102-
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear3"/>
103-
<waitForElementVisible selector="//td[contains(@class,'col-url')][contains(text(),'{{page}}')]" stepKey="waitForSearchResult"/>
104-
<click selector="//td[contains(@class,'col-url')][contains(text(),'{{page}}')]" stepKey="clickCmsPageLinkRow"/>
105-
<waitForElementNotVisible selector="//td[contains(@class,'col-url')][contains(text(),'{{page}}')]" stepKey="waitForPageSelectionModalToClose"/>
106-
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear4"/>
107-
<waitForPageLoad stepKey="waitForPanelSlideOut"/>
108-
<waitForElementVisible selector="{{WidgetSection.InsertWidget}}" stepKey="waitForInsertWidget2"/>
109-
<click selector="{{WidgetSection.InsertWidget}}" stepKey="clickInsertWidget2"/>
110-
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear5"/>
111-
<waitForElementNotVisible selector="{{WidgetSection.InsertWidget}}" stepKey="waitForInsertWidgetModalToClose"/>
112-
<waitForElementVisible selector="{{TextOnConfiguration.textArea}}" stepKey="waitForTextArea"/>
110+
<click selector="{{TextOnConfiguration.insertWidgetButton}}" stepKey="clickAddWidgetBtn"/>
111+
<waitForElementVisible selector="{{TextOnConfiguration.textArea}}" stepKey="waitForInsertWidgetModalToClose"/>
113112
<executeJS function="return document.getElementById('{{TextOnConfiguration.textAreaId}}').value;" stepKey="getText"/>
114113
<assertContains actual="getText" actualType="variable" expected="{{widget.editPanelValue}}" expectedType="string" stepKey="assertValue"/>
115114
</actionGroup>

app/code/Magento/PageBuilder/Test/Mftf/Data/TextData.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<entity name="TinyMCEWidgetCMSPageLink" type="pagebuilder_text_widget_property">
5252
<data key="widgetType">Magento\Cms\Block\Widget\Page\Link</data>
5353
<data key="editPanelValue">CMS Page Link</data>
54-
<data key="stageValue">{{widget type=&quot;Magento\\Cms\\Block\\Widget\\Page\\Link&quot; template=&quot;widget/link/link_block.phtml&quot; page_id=</data>
54+
<data key="stageValue">{{widget type=&quot;Magento\Cms\Block\Widget\Page\Link&quot; template=&quot;widget/link/link_block.phtml&quot; page_id=</data>
5555
<data key="stageValueEncoded">e3t3aWRnZXQgdHlwZT0iTWFnZW50b1xDbXNcQmxvY2tcV2lkZ2V0XFBhZ2VcTGluayIgdGVtcGxhdGU9IndpZGdldC9saW5rL2xpbmtfYmxvY2sucGh0bWwiIHBhZ2VfaWQ9</data>
5656
</entity>
5757
<entity name="PageBuilderTextArea_WidgetCMSPageLink" type="pagebuilder_text_widget_property">

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
<element name="tinyMCEVariable" type="text" selector="(//body//span[contains(@class,'magento-variable') and .='{{arg1}}'])[{{arg2}}]" parameterized="true"/>
4949
<element name="tinyMCEWidget" type="text" selector="(//body//span[contains(@class,'magento-widget') and .='{{arg1}}'])[{{arg2}}]" parameterized="true"/>
5050
<element name="tinyMCEImage" type="text" selector="//img[contains(@src,'{{arg}}')]" parameterized="true"/>
51+
<element name="tinyMCE3" type="text" selector="#pagebuilder_text_form_content_tbl"/>
52+
<element name="tinyMCE3VariableBtn" type="text" selector="#pagebuilder_text_form_content_magentovariable"/>
53+
<element name="tinyMCE3WidgetBtn" type="text" selector="#pagebuilder_text_form_content_magentowidget"/>
5154
<!-- WYSIWYG Disabled -->
5255
<element name="textArea" type="text" selector="#pagebuilder_text_form_content"/>
5356
<element name="textAreaId" type="text" selector="pagebuilder_text_form_content"/>

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

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,14 @@
271271
<group value="pagebuilder-text"/>
272272
</annotations>
273273
<before>
274+
<createData entity="_defaultCmsPage" stepKey="createCMSPageB" />
274275
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
275276
<magentoCLI command="config:set cms/wysiwyg/editor Magento_Tinymce3/tinymce3Adapter" stepKey="enableTinyMCE3"/>
276277
<actionGroup ref="navigateToAPageWithPageBuilder" stepKey="navigateToAPageWithPageBuilder"/>
277278
<actionGroup ref="switchToPageBuilderStage" stepKey="switchToPageBuilderStage"/>
278279
</before>
279280
<after>
281+
<deleteData createDataKey="createCMSPageB" stepKey="deletePreReqCMSPageB" />
280282
<magentoCLI command="config:set cms/wysiwyg/editor mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter" stepKey="enableTinyMCE4"/>
281283
<actionGroup ref="logout" stepKey="logout"/>
282284
</after>
@@ -299,23 +301,29 @@
299301
<actionGroup ref="openPageBuilderEditPanel" stepKey="openEditMenuOnStage2">
300302
<argument name="contentType" value="PageBuilderTextContentType"/>
301303
</actionGroup>
302-
<waitForElementVisible selector="{{TinyMCESection.TinyMCE3}}" stepKey="waitForTinyMCE3" />
304+
<waitForElementVisible selector="{{TextOnConfiguration.tinyMCE3WidgetBtn}}" stepKey="waitForTinyMCE3"/>
303305
<switchToIFrame selector="{{TextOnConfiguration.tinyMCEIFrame}}" stepKey="switchToIFrame1"/>
304306
<!-- Verify inputed text is carried out to slideout -->
305307
<comment userInput="Verify inputed text is carried out to slideout" stepKey="comment1"/>
306308
<waitForElementVisible selector="{{TextOnConfiguration.textInIFrame(PageBuilderTextProperty.value)}}" stepKey="waitForText"/>
307309
<switchToIFrame stepKey="exitIFrame1"/>
308-
<!-- Add variable to tinymce3 -->
309-
<comment userInput="Add variable to tinymce3" stepKey="comment2"/>
310-
<executeJS function="tinymce.get('pagebuilder_text_form_content').setContent('{{PageBuilderTextArea_VariableBaseURL.editPanelValue}}');" stepKey="addVariable"/>
311310
<!-- Add widget to tinymce3 -->
312-
<!--<comment userInput="Add widget to tinymce3" stepKey="comment3"/>-->
313-
<!--<executeJS function="tinymce.get('pagebuilder_text_form_content').setContent('{{PageBuilderTextArea_WidgetCMSHomepageLink.editPanelValue}}');" stepKey="addWidget"/>-->
311+
<actionGroup ref="addPageLinkWidgetToTinyMCE3" stepKey="addPageLinkWidgetToTinyMCE3">
312+
<argument name="widget" value="TinyMCEWidgetCMSPageLink"/>
313+
<argument name="page" value="$$createCMSPageB.identifier$$"/>
314+
</actionGroup>
315+
<actionGroup ref="addVariableToTinyMCE3" stepKey="addVariableToTinyMCE3">
316+
<argument name="variable" value="TinyMCEVariableBaseURL"/>
317+
</actionGroup>
314318
<actionGroup ref="saveEditPanelSettings" stepKey="saveEditPanelSettings"/>
315319
<!-- Validate Stage After Save -->
320+
<executeJS function="return '{{TinyMCEWidgetCMSPageLink.stageValue}}{{TinyMCEVariableBaseURL.stageValue}}{{PageBuilderTextProperty.value}}'" stepKey="expectedData"/>
316321
<comment userInput="Validate Stage After Save" stepKey="commentValidateStage2"/>
317-
<!--<waitForElementVisible selector="{{TextOnStage.textAreaTextContains('1', PageBuilderTextArea_WidgetCMSHomepageLink.editPanelValue)}}" stepKey="waitForWidgetOnStage"/>-->
318-
<waitForElementVisible selector="{{TextOnStage.textAreaTextContains('1', PageBuilderTextArea_VariableBaseURL.editPanelValue)}}" stepKey="waitForVariableOnStage"/>
322+
<executeJS function="return document.evaluate(&quot;{{TextOnStage.textArea('1')}}&quot;, document.body).iterateNext().value" stepKey="actualData"/>
323+
<assertContains stepKey="assertTextValue">
324+
<expectedResult type="variable">expectedData</expectedResult>
325+
<actualResult type="variable">actualData</actualResult>
326+
</assertContains>
319327
<actionGroup ref="saveAndContinueEditCmsPage" stepKey="saveAndContinueEditCmsPage2"/>
320328
<amOnPage url="" stepKey="goToBaseURL"/>
321329
<grabFromCurrentUrl stepKey="grabBaseURL"/>

0 commit comments

Comments
 (0)