Skip to content

Commit

Permalink
Merge pull request #5976 from magento-borg/MC-34573
Browse files Browse the repository at this point in the history
[CIA] Bugfixes
  • Loading branch information
dvoskoboinikov authored Aug 10, 2020
2 parents 2d65211 + d3e9c19 commit b817af4
Show file tree
Hide file tree
Showing 29 changed files with 138 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="ProductWYSIWYGSection">
<element name="Switcher" type="button" selector="select#dropdown-switcher"/>
<element name="v436" type="button" selector="//select[@id='dropdown-switcher']/option[text()='TinyMCE 4.3.6']"/>
<element name="v3" type="button" selector="//select[@id='dropdown-switcher']/option[text()='TinyMCE 3.6(Deprecated)']"/>
<element name="v436" type="button" selector="//select[@id='dropdown-switcher']/option[text()='TinyMCE 4.3.6']" deprecated="New element was introduced. Please use 'ProductWYSIWYGSection.v4910'"/>
<element name="v3" type="button" selector="//select[@id='dropdown-switcher']/option[text()='TinyMCE 3.6(Deprecated)']" deprecated="New element was introduced. Please use 'ProductWYSIWYGSection.v4910'"/>
<element name="v4910" type ="button" selector="//select[@id='dropdown-switcher']/option[text()='TinyMCE 4.9.10']" />
<element name="TinymceDescription3" type="button" selector="//span[text()='Description']"/>
<element name="SaveConfig" type="button" selector="#save"/>
<element name="v4" type="button" selector="#category_form_description_v4"/>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Cms/Test/Mftf/Data/WysiwygConfigData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<data key="scope_id">0</data>
<data key="value">hidden</data>
</entity>
<entity name="WysiwygTinyMCE3Enable">
<entity name="WysiwygTinyMCE3Enable" deprecated="Use WysiwygTinyMCE4Enable instead">
<data key="path">cms/wysiwyg/editor</data>
<data key="scope_id">0</data>
<data key="value">Magento_Tinymce3/tinymce3Adapter</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
<element name="imageSelected" type="text" selector="//small[text()='{{var1}}']/parent::*[@class='filecnt selected']" parameterized="true"/>
<element name="ImageSource" type="input" selector=".mce-combobox.mce-abs-layout-item.mce-last.mce-has-open"/>
<element name="ImageDescription" type="input" selector=".mce-textbox.mce-abs-layout-item.mce-last"/>
<element name="ImageDescriptionTinyMCE3" type="input" selector="#alt"/>
<element name="ImageDescriptionTinyMCE3" type="input" selector="#alt" deprecated="Deprecated New element was introduced. Please use 'ImageDescriptionTinyMCE4'"/>
<element name="ImageDescriptionTinyMCE4" type="input" selector="#alt" />
<element name="Height" type="input" selector=".mce-textbox.mce-abs-layout-item.mce-first"/>
<element name="UploadImage" type="file" selector=".fileupload"/>
<element name="OkBtn" type="button" selector="//span[text()='Ok']"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminAddImageToCMSPageTinyMCE3Test">
<test name="AdminAddImageToCMSPageTinyMCE3Test" deprecated="TinyMCE3 is no longer supported">
<annotations>
<features value="Cms"/>
<stories value="Admin should be able to upload images with TinyMCE3 WYSIWYG"/>
Expand All @@ -17,6 +17,9 @@
<description value="Verify that admin is able to upload image to CMS Page with TinyMCE3 enabled"/>
<severity value="BLOCKER"/>
<testCaseId value="MAGETWO-95725"/>
<skip>
<issueId value="DEPRECATED">TinyMCE3 is no longer supported</issueId>
</skip>
</annotations>
<before>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
Expand All @@ -38,11 +41,11 @@
<waitForPageLoad stepKey="wait5"/>
<fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle2"/>
<click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab2" />
<waitForElementVisible selector="{{TinyMCESection.TinyMCE3}}" stepKey="waitForTinyMCE3"/>
<seeElement selector="{{TinyMCESection.TinyMCE3}}" stepKey="seeTinyMCE3" />
<comment userInput="removing deprecated element" stepKey="waitForTinyMCE3"/>
<comment userInput="removing deprecated element" stepKey="seeTinyMCE3" />
<wait time="3" stepKey="waiting"/>
<comment userInput="Click Insert image button" stepKey="clickImageButton"/>
<click selector="{{TinyMCESection.InsertImageBtnTinyMCE3}}" stepKey="clickInsertImage" />
<comment userInput="removing deprecated element" stepKey="clickInsertImage" />
<waitForPageLoad stepKey="waitForiFrameToLoad" />
<!-- Switch to the Edit/Insert Image iFrame -->
<comment userInput="Switching to iFrame" stepKey="insertImageiFrame"/>
Expand All @@ -66,7 +69,7 @@
<executeJS function="document.querySelector('.clearlooks2 iframe').setAttribute('name', 'insert-image');" stepKey="makeIFrameInteractable2"/>
<switchToIFrame selector="insert-image" stepKey="switchToIFrame2"/>
<waitForElementVisible selector="{{MediaGallerySection.insertBtn}}" stepKey="waitForInsertBtnOnIFrame" />
<fillField selector="{{MediaGallerySection.ImageDescriptionTinyMCE3}}" userInput="{{ImageUpload.content}}" stepKey="fillImageDescription" />
<comment userInput="removing deprecated element" stepKey="fillImageDescription" />
<click selector="{{MediaGallerySection.insertBtn}}" stepKey="clickInsertBtn" />
<waitForPageLoad stepKey="wait3"/>
<click selector="{{CmsNewPagePageActionsSection.expandSplitButton}}" stepKey="expandButtonMenu"/>
Expand Down
92 changes: 92 additions & 0 deletions app/code/Magento/Config/Setup/Patch/Data/UnsetTinymce3.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Config\Setup\Patch\Data;

use Magento\Framework\Setup\Patch\DataPatchInterface;
use Magento\Framework\Setup\Patch\PatchVersionInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;

/**
* Update config to Tinymce4 if Tinymce3 adapter is used.
*/
class UnsetTinymce3 implements DataPatchInterface, PatchVersionInterface
{
/**
* @var ModuleDataSetupInterface
*/
private $moduleDataSetup;

/**
* CreateDefaultPages constructor.
* @param ModuleDataSetupInterface $moduleDataSetup
*/
public function __construct(
ModuleDataSetupInterface $moduleDataSetup
) {
$this->moduleDataSetup = $moduleDataSetup;
}

/**
* @inheritdoc
*/
public function apply()
{
try {
$connection = $this->moduleDataSetup->getConnection();
$table = $this->moduleDataSetup->getTable('core_config_data');
$select = $connection
->select()
->from(
$table,
['value']
)
->where('path = ?', 'cms/wysiwyg/editor');

if (strpos($connection->fetchOne($select), 'Tinymce3/tinymce3Adapter') !== false) {
$row = [
'value' => 'mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter'
];
$where = $connection->quoteInto(
'path = ?',
'cms/wysiwyg/editor'
);
$connection->update(
$table,
$row,
$where
);
}
return $this;
} catch (\Exception $e) {
return $this;
}
}

/**
* @inheritdoc
*/
public static function getDependencies()
{
return [];
}

/**
* @inheritdoc
*/
public static function getVersion()
{
return '2.3.6';
}

/**
* @inheritdoc
*/
public function getAliases()
{
return [];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="SwitchToTinyMCE3ActionGroup">
<actionGroup name="SwitchToTinyMCE3ActionGroup" deprecated="This version of TinyMCE is no longer supported">
<annotations>
<description>Goes to the 'Configuration' page for 'Content Management'. Sets 'WYSIWYG Editor' to 'TinyMCE 3'. Clicks on the Save button. PLEASE NOTE: The value is Hardcoded.</description>
</annotations>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="NewsletterWYSIWYGSection">
<element name="TinyMCE3" type="text" selector="#cms_page_form_content_tbl"/>
<element name="TinyMCE3" type="text" selector="#cms_page_form_content_tbl" deprecated="This version of TinyMCE is no longer supported"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-->
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="ProductWYSIWYGSection">
<section name="ProductWYSIWYGSection" deprecated="This version of TinyMCE is no longer supported">
<element name="Tinymce3MSG" type="button" selector=".admin__field-error"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="TinyMCESection">
<element name="TinyMCE3" type="text" selector="#cms_page_form_content_tbl"/>
<element name="InsertImageBtnTinyMCE3" type="button" selector="#cms_page_form_content_image"/>
<element name="TinyMCE3" type="text" selector="#cms_page_form_content_tbl" deprecated="Deprecated this version of TinyMCE is no longer supported"/>
<element name="InsertImageBtnTinyMCE3" type="button" selector="#cms_page_form_content_image" deprecated="Deprecated this version of TinyMCE is no longer supported"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminSwitchWYSIWYGOptionsTest">
<test name="AdminSwitchWYSIWYGOptionsTest" deprecated="TinyMCE3 is no longer supported">
<annotations>
<features value="Cms"/>
<stories value="MAGETWO-51829-Extensible list of WYSIWYG editors available in Magento"/>
Expand All @@ -17,6 +17,9 @@
<description value="Admin should able to switch between versions of TinyMCE"/>
<severity value="CRITICAL"/>
<testCaseId value="MC-6114"/>
<skip>
<issueId value="DEPRECATED">TinyMCE3 is no longer supported</issueId>
</skip>
</annotations>
<before>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginGetFromGeneralFile"/>
Expand Down Expand Up @@ -63,8 +66,8 @@
<waitForPageLoad stepKey="wait5"/>
<fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle2"/>
<click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab2" />
<waitForElementVisible selector="{{TinyMCESection.TinyMCE3}}" stepKey="waitForTinyMCE3"/>
<seeElement selector="{{TinyMCESection.TinyMCE3}}" stepKey="seeTinyMCE3" />
<comment userInput="removing deprecated element" stepKey="waitForTinyMCE3"/>
<comment userInput="removing deprecated element" stepKey="seeTinyMCE3" />
<executeJS function="tinyMCE.activeEditor.setContent('Hello TinyMCE3!');" stepKey="executeJSFillContent2"/>
<click selector="{{CmsWYSIWYGSection.ShowHideBtn}}" stepKey="clickShowHideBtn2" />
<scrollTo selector="{{CmsNewPagePageSeoSection.header}}" stepKey="scrollToSearchEngineTab2" />
Expand Down
10 changes: 0 additions & 10 deletions app/code/Magento/Tinymce3/etc/adminhtml/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,4 @@
</argument>
</arguments>
</type>
<type name="Magento\Cms\Model\Config\Source\Wysiwyg\Editor">
<arguments>
<argument name="adapterOptions" xsi:type="array">
<item name="tinymce3" xsi:type="array">
<item name="value" xsi:type="const">Magento\Tinymce3\Model\Config\Source\Wysiwyg\Editor::WYSIWYG_EDITOR_CONFIG_VALUE</item>
<item name="label" xsi:type="string" translatable="true">TinyMCE 3 (deprecated)</item>
</item>
</argument>
</arguments>
</type>
</config>
7 changes: 0 additions & 7 deletions app/code/Magento/Tinymce3/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,4 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Ui\Block\Wysiwyg\ActiveEditor">
<arguments>
<argument name="availableAdapterPaths" xsi:type="array">
<item name="Magento_Tinymce3/tinymce3Adapter" xsi:type="string"/>
</argument>
</arguments>
</type>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@
interface WysiwygModifierInterface
{
/**
* Provide editor name
* For example tmce3 or tmce4
* Provide editor name for example tmce4
*
* @return array
* @since 101.1.0
*/
public function getEditorName();

/**
* Modifies the meta
*
* @param array $meta
*
* @return array
* @since 101.1.0
*/
Expand Down
Loading

0 comments on commit b817af4

Please sign in to comment.