|
| 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="PageBuilderCMSPageContentValidationTest"> |
| 11 | + <annotations> |
| 12 | + <features value="PageBuilder"/> |
| 13 | + <stories value="HTML Code"/> |
| 14 | + <title value="Validate UTF-8 MB4 does not break HTML content"/> |
| 15 | + <description value="Validate that updating the General form for Html with UTF-8 MB4 will not break the text after on the Stage and Storefront."/> |
| 16 | + <severity value="AVERAGE"/> |
| 17 | + <useCaseId value="ACP2E-103"/> |
| 18 | + <testCaseId value="AC-1539"/> |
| 19 | + <group value="pagebuilder"/> |
| 20 | + <group value="pagebuilder-html"/> |
| 21 | + </annotations> |
| 22 | + <before> |
| 23 | + <magentoCLI command="config:set cms/wysiwyg/enabled disabled" stepKey="disableWYSIWYG"/> |
| 24 | + <createData entity="_emptyCmsPage" stepKey="createCMSPage"/> |
| 25 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 26 | + <actionGroup ref="NavigateToCreatedCMSPageActionGroup" stepKey="navigateToCreatedCMSPage"> |
| 27 | + <argument name="CMSPage" value="$$createCMSPage$$"/> |
| 28 | + </actionGroup> |
| 29 | + <actionGroup ref="switchToPageBuilderStage" stepKey="switchToPageBuilderStage"/> |
| 30 | + <actionGroup ref="dragContentTypeToStage" stepKey="dragRowToRootContainer"> |
| 31 | + <argument name="contentType" value="PageBuilderRowContentType"/> |
| 32 | + <argument name="containerTargetType" value="PageBuilderRootContainerContentType"/> |
| 33 | + </actionGroup> |
| 34 | + </before> |
| 35 | + <after> |
| 36 | + <deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage"/> |
| 37 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 38 | + <magentoCLI command="config:set cms/wysiwyg/enabled enabled" stepKey="enableWYSIWYG"/> |
| 39 | + </after> |
| 40 | + <actionGroup ref="expandPageBuilderPanelMenuSection" stepKey="expandPageBuilderPanelMenuSection"> |
| 41 | + <argument name="contentType" value="PageBuilderHtmlContentType"/> |
| 42 | + </actionGroup> |
| 43 | + <actionGroup ref="dragContentTypeToStage" stepKey="dragHtmlIntoStage"> |
| 44 | + <argument name="contentType" value="PageBuilderHtmlContentType"/> |
| 45 | + </actionGroup> |
| 46 | + <actionGroup ref="openPageBuilderEditPanel" stepKey="openEditMenuOnStage"> |
| 47 | + <argument name="contentType" value="PageBuilderHtmlContentType"/> |
| 48 | + </actionGroup> |
| 49 | + <actionGroup ref="fillSlideOutPanelTextArea" stepKey="enterHtmlContent"> |
| 50 | + <argument name="property" value="PageBuilderHtmlPropertyButton"/> |
| 51 | + </actionGroup> |
| 52 | + <actionGroup ref="addTextToHtmlCodeWYSIWYGActionGroup" stepKey="enterWrongHtmlContent"> |
| 53 | + <argument name="selector" value="{{EditPanelForm.panelFieldControl('general', 'html')}}"/> |
| 54 | + <argument name="text" value="\u{1F600}"/> |
| 55 | + </actionGroup> |
| 56 | + <click selector="{{EditPanelForm.editFormSave}}" stepKey="clickSaveButton"/> |
| 57 | + <waitForElementVisible selector="{{HtmlOnStage.baseErrorLabel}}" stepKey="waitForHtmlBaseErrorLabelStage1"/> |
| 58 | + <grabTextFrom selector="{{HtmlOnStage.baseErrorLabel}}" stepKey="grabTextFromErrorLabel"/> |
| 59 | + <assertStringContainsString stepKey="assertErrorMessage"> |
| 60 | + <expectedResult type="string">Please remove invalid characters</expectedResult> |
| 61 | + <actualResult type="variable">grabTextFromErrorLabel</actualResult> |
| 62 | + </assertStringContainsString> |
| 63 | + <actionGroup ref="removeTextFromHtmlCodeWYSIWYGActionGroup" stepKey="removeWrongHtmlContent"> |
| 64 | + <argument name="selector" value="{{EditPanelForm.panelFieldControl('general', 'html')}}"/> |
| 65 | + <argument name="text" value="\u{1F600}"/> |
| 66 | + </actionGroup> |
| 67 | + <actionGroup ref="saveEditPanelSettings" stepKey="saveEditPanelSettings"/> |
| 68 | + <waitForElementNotVisible selector="{{HtmlOnStage.baseErrorLabel}}" stepKey="waitForHtmlBaseErrorLabelRemovedStage1"/> |
| 69 | + |
| 70 | + <actionGroup ref="dragContentTypeToStage" stepKey="dragTextOntoStage"> |
| 71 | + <argument name="contentType" value="PageBuilderTextContentType"/> |
| 72 | + </actionGroup> |
| 73 | + <actionGroup ref="openPageBuilderEditPanel" stepKey="openTextEditMenuOnStage"> |
| 74 | + <argument name="contentType" value="PageBuilderTextContentType"/> |
| 75 | + </actionGroup> |
| 76 | + <fillField selector="{{TextOnConfiguration.textArea}}" userInput="Hello Page From PageBuilder" stepKey="addTextToEditor"/> |
| 77 | + <actionGroup ref="addTextToHtmlCodeWYSIWYGActionGroup" stepKey="enterWrongTextContent"> |
| 78 | + <argument name="selector" value="//textarea[@id="{{TextOnConfiguration.textAreaId}}"][1]"/> |
| 79 | + <argument name="text" value="\u{1F600}"/> |
| 80 | + </actionGroup> |
| 81 | + |
| 82 | + <actionGroup ref="saveEditPanelSettingsFullScreen" stepKey="saveTextEditPanelSettings"/> |
| 83 | + |
| 84 | + <!-- Validate Stage --> |
| 85 | + <comment userInput="Validate Stage" stepKey="commentValidateStage"/> |
| 86 | + <waitForElementVisible selector="{{HtmlOnStage.base('1')}}" stepKey="waitForHtmlBaseStage1"/> |
| 87 | + <waitForElementVisible selector="{{HtmlOnStage.html('1', PageBuilderHtmlPropertyButton.selector)}}" stepKey="waitForHtmlStage1"/> |
| 88 | + <executeJS function="return document.querySelectorAll('{{HtmlOnStage.baseCSS}}')[0].innerText;" stepKey="actualTextFromHtmlCode"/> |
| 89 | + <assertStringContainsString stepKey="assertButtonOnStage"> |
| 90 | + <expectedResult type="string">{{PageBuilderHtmlPropertyButton.value}}</expectedResult> |
| 91 | + <actualResult type="variable">actualTextFromHtmlCode</actualResult> |
| 92 | + </assertStringContainsString> |
| 93 | + <actionGroup ref="exitPageBuilderFullScreen" stepKey="exitPageBuilderFullScreen"/> |
| 94 | + |
| 95 | + <!-- Cannot save invalid text--> |
| 96 | + <actionGroup ref="SaveAndContinueEditCmsPageActionGroup" stepKey="saveAndContinueEditCmsPage"/> |
| 97 | + <waitForElementVisible selector="//div[contains(@class, "field-page-builder")]//label[@class="admin__field-error"]" stepKey="waitForErrorLabelVisible"/> |
| 98 | + <grabTextFrom selector="//div[contains(@class, "field-page-builder")]//label[@class="admin__field-error"]" stepKey="grabTextFromErrorLabel2"/> |
| 99 | + <assertStringContainsString stepKey="assertErrorMessage2"> |
| 100 | + <expectedResult type="string">Please remove invalid characters</expectedResult> |
| 101 | + <actualResult type="variable">grabTextFromErrorLabel2</actualResult> |
| 102 | + </assertStringContainsString> |
| 103 | + |
| 104 | + <!-- Fix error and save again --> |
| 105 | + <actionGroup ref="switchToPageBuilderStage" stepKey="switchToPageBuilderStageToFixText"/> |
| 106 | + <actionGroup ref="openPageBuilderEditPanel" stepKey="openTextEditMenuOnStageToFixText"> |
| 107 | + <argument name="contentType" value="PageBuilderTextContentType"/> |
| 108 | + </actionGroup> |
| 109 | + <actionGroup ref="removeTextFromHtmlCodeWYSIWYGActionGroup" stepKey="removeWrongTextContent"> |
| 110 | + <argument name="selector" value="//textarea[@id="{{TextOnConfiguration.textAreaId}}"][1]"/> |
| 111 | + <argument name="text" value="\u{1F600}"/> |
| 112 | + </actionGroup> |
| 113 | + <actionGroup ref="saveEditPanelSettingsFullScreen" stepKey="saveTextEditPanelSettings2"/> |
| 114 | + <actionGroup ref="exitPageBuilderFullScreen" stepKey="exitPageBuilderFullScreen2"/> |
| 115 | + <waitForElementNotVisible selector="//div[contains(@class, "field-page-builder")]//label[@class="admin__field-error"]" stepKey="waitForErrorLabelNotVisible"/> |
| 116 | + <actionGroup ref="SaveAndContinueEditCmsPageActionGroup" stepKey="saveAndContinueEditCmsPage2"/> |
| 117 | + |
| 118 | + <actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToCMSPageStorefront"> |
| 119 | + <argument name="page" value="$$createCMSPage.identifier$$"/> |
| 120 | + </actionGroup> |
| 121 | + <!-- Validate Storefront --> |
| 122 | + <comment userInput="Validate Storefront" stepKey="commentValidateStorefront"/> |
| 123 | + <waitForElementVisible selector="{{HtmlOnStorefront.base('1')}}" stepKey="waitForHtmlBaseStorefront"/> |
| 124 | + <waitForElementVisible selector="{{HtmlOnStorefront.html('1', PageBuilderHtmlPropertyButton.selectorOnFrontend)}}" stepKey="waitForHtmlStorefront"/> |
| 125 | + <waitForElementVisible selector="{{TextOnStorefront.allText}}" stepKey="waitForTextStorefront"/> |
| 126 | + <grabTextFrom selector="{{TextOnStorefront.allText}}" stepKey="grabTextFromText"/> |
| 127 | + <assertStringContainsString stepKey="assertTextOnStoreFront"> |
| 128 | + <expectedResult type="string">Hello Page From PageBuilder</expectedResult> |
| 129 | + <actualResult type="variable">grabTextFromText</actualResult> |
| 130 | + </assertStringContainsString> |
| 131 | + </test> |
| 132 | +</tests> |
0 commit comments