Skip to content

Commit ac457a4

Browse files
committed
MAGETWO-95532: Unable to upload image from TinyMCE3
- added functional test to cover the bug fix
1 parent f7be8c8 commit ac457a4

File tree

3 files changed

+83
-0
lines changed

3 files changed

+83
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
</section>
3535
<section name="MediaGallerySection">
3636
<element name="Browse" type="button" selector=".mce-i-browse"/>
37+
<element name="browseForImage" type="button" selector="//*[@id='srcbrowser']"/>
3738
<element name="BrowseUploadImage" type="file" selector=".fileupload" />
3839
<element name="image" type="text" selector="//small[text()='{{var1}}']" parameterized="true"/>
3940
<element name="imageOrImageCopy" type="text" selector="//div[contains(@class,'media-gallery-modal')]//img[contains(@alt, '{{arg1}}.{{arg2}}')]|//img[contains(@alt,'{{arg1}}_') and contains(@alt,'.{{arg2}}')]" parameterized="true"/>
@@ -43,6 +44,7 @@
4344
<element name="Height" type="input" selector=".mce-textbox.mce-abs-layout-item.mce-first" />
4445
<element name="UploadImage" type="file" selector=".fileupload" />
4546
<element name="OkBtn" type="button" selector="//span[text()='Ok']"/>
47+
<element name="insertBtn" type="button" selector="#insert"/>
4648
<element name="InsertFile" type="text" selector="#insert_files"/>
4749
<element name="CreateFolder" type="button" selector="#new_folder" />
4850
<element name="DeleteSelectedBtn" type="text" selector="#delete_files"/>
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminAddImageToCMSPageTinyMCE3Test">
12+
<annotations>
13+
<features value="Cms"/>
14+
<stories value="Admin should be able to upload images with TinyMCE3 WYSIWYG"/>
15+
<group value="Cms"/>
16+
<title value="Verify that admin is able to upload image to a CMS Page with TinyMCE3 enabled"/>
17+
<description value="Verify that admin is able to upload image to CMS Page with TinyMCE3 enabled"/>
18+
<severity value="MAJOR"/>
19+
<testCaseId value="MAGETWO-95725"/>
20+
</annotations>
21+
<before>
22+
<actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/>
23+
<actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/>
24+
<comment userInput="Choose TinyMCE3 as the default editor" stepKey="chooseTinyMCE3AsEditor"/>
25+
<waitForElementVisible selector="{{ContentManagementSection.SwitcherSystemValue}}" stepKey="waitForCheckbox1" />
26+
<uncheckOption selector="{{ContentManagementSection.SwitcherSystemValue}}" stepKey="uncheckUseSystemValue2"/>
27+
<waitForElementVisible selector="{{ContentManagementSection.Switcher}}" stepKey="waitForSwitcherDropdown1" />
28+
<selectOption selector="{{ContentManagementSection.Switcher}}" userInput="TinyMCE 3" stepKey="switchToVersion3" />
29+
<click selector="{{ContentManagementSection.WYSIWYGOptions}}" stepKey="collapseWYSIWYGOptions1" />
30+
<click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig1" />
31+
</before>
32+
<after>
33+
<comment userInput="Reset editor as TinyMCE4" stepKey="chooseTinyMCE4AsEditor"/>
34+
<amOnPage url="{{ConfigurationStoresPage.url}}" stepKey="navigateToConfigurationPage" />
35+
<waitForPageLoad stepKey="waitForConfigPageToReload"/>
36+
<conditionalClick stepKey="expandWYSIWYGOptions" selector="{{ContentManagementSection.WYSIWYGOptions}}" dependentSelector="{{ContentManagementSection.CheckIfTabExpand}}" visible="true" />
37+
<waitForElementVisible selector="{{ContentManagementSection.SwitcherSystemValue}}" stepKey="waitForCheckbox2" />
38+
39+
<waitForElementVisible selector="{{ContentManagementSection.Switcher}}" stepKey="waitForSwitcherDropdown3" />
40+
<selectOption selector="{{ContentManagementSection.Switcher}}" userInput="TinyMCE 4" stepKey="switchToVersion4" />
41+
<checkOption selector="{{ContentManagementSection.SwitcherSystemValue}}" stepKey="checkUseSystemValue2"/>
42+
<click selector="{{ContentManagementSection.WYSIWYGOptions}}" stepKey="collapseWYSIWYGOptions2" />
43+
<click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig2" />
44+
<actionGroup ref="logout" stepKey="logOut"/>
45+
</after>
46+
<amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToPage2"/>
47+
<waitForPageLoad stepKey="wait5"/>
48+
<fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle2"/>
49+
<click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab2" />
50+
<waitForElementVisible selector="{{TinyMCESection.TinyMCE3}}" stepKey="waitForTinyMCE3"/>
51+
<seeElement selector="{{TinyMCESection.TinyMCE3}}" stepKey="seeTinyMCE3" />
52+
<comment userInput="Click Insert image button" stepKey="clickImageButton"/>
53+
<click selector="{{TinyMCESection.InsertImageBtnTinyMCE3}}" stepKey="clickInsertImage" />
54+
<waitForPageLoad stepKey="waitForiFrameToLoad" />
55+
<comment userInput="switching to iFrame" stepKey="iFramecomment"/>
56+
<executeJS function="document.querySelector('.clearlooks2 iframe').setAttribute('name', 'insert-image');" stepKey="makeIFrameInteractable"/>
57+
<switchToIFrame selector="insert-image" stepKey="switchToIFrame"/>
58+
<click selector="{{MediaGallerySection.browseForImage}}" stepKey="clickBrowse"/>
59+
<switchToIFrame stepKey="switchOutOfIFrame"/>
60+
<waitForPageLoad stepKey="waitForPageToLoad" />
61+
<actionGroup ref="CreateImageFolder" stepKey="CreateImageFolder">
62+
<argument name="ImageFolder" value="ImageFolder"/>
63+
</actionGroup>
64+
<actionGroup ref="attachImage" stepKey="attachImage1">
65+
<argument name="Image" value="ImageUpload"/>
66+
</actionGroup>
67+
<actionGroup ref="saveImage" stepKey="insertImage"/>
68+
<comment userInput="switching back to iFrame" stepKey="switchBackToIFrame"/>
69+
<executeJS function="document.querySelector('.clearlooks2 iframe').setAttribute('name', 'insert-image');" stepKey="makeIFrameInteractable2"/>
70+
<switchToIFrame selector="insert-image" stepKey="switchToIFrame2"/>
71+
<waitForElementVisible selector="{{MediaGallerySection.insertBtn}}" stepKey="waitForInsertBtnOnIFrame" />
72+
<fillField selector="{{MediaGallerySection.ImageDescription}}" userInput="{{ImageUpload.content}}" stepKey="fillImageDescription" />
73+
<click selector="{{MediaGallerySection.insertBtn}}" stepKey="clickInsertBtn" />
74+
<waitForPageLoad stepKey="wait3"/>
75+
<click selector="{{CmsNewPagePageActionsSection.expandSplitButton}}" stepKey="expandButtonMenu"/>
76+
<waitForElementVisible selector="{{CmsNewPagePageActionsSection.splitButtonMenu}}" stepKey="waitForSplitButtonMenuVisible"/>
77+
<click selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="clickSavePage"/>
78+
<see userInput="You saved the page." stepKey="seeSuccessMessage"/>
79+
</test>
80+
</tests>

app/code/Magento/Tinymce3/Test/Mftf/Section/AdminTinymce3FileldsSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
</section>
1414
<section name="TinyMCESection">
1515
<element name="TinyMCE3" type="text" selector="#cms_page_form_content_tbl"/>
16+
<element name="InsertImageBtnTinyMCE3" type="button" selector="#cms_page_form_content_image"/>
1617
</section>
1718
<section name="NewsletterWYSIWYGSection">
1819
<element name="TinyMCE3" type="text" selector="#cms_page_form_content_tbl"/>

0 commit comments

Comments
 (0)