Skip to content

Commit f905963

Browse files
committed
Cover changes with mftf tests
1 parent f434c97 commit f905963

File tree

5 files changed

+80
-2
lines changed

5 files changed

+80
-2
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminCloseMediaGalleryActionGroup">
12+
<annotations>
13+
<description>Validates that the Media Gallery 'Cancel' buttons are present, and click on it</description>
14+
</annotations>
15+
<see selector="{{MediaGallerySection.CancelBtn}}" userInput="Cancel" stepKey="seeCancelBtn"/>
16+
<click selector="{{MediaGallerySection.CancelBtn}}" stepKey="clickCancel"/>
17+
</actionGroup>
18+
</actionGroups>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminOpenMediaGalleryTinyMce4ActionGroup">
11+
<annotations>
12+
<description>Opens MediaGallery by tyniMce4 image icon</description>
13+
</annotations>
14+
15+
<click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickExpandContent"/>
16+
<waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4" />
17+
<click selector="{{TinyMCESection.InsertImageIcon}}" stepKey="clickInsertImageIcon" />
18+
<waitForPageLoad stepKey="waitForPageLoad" />
19+
<click selector="{{MediaGallerySection.Browse}}" stepKey="clickBrowse"/>
20+
<waitForPageLoad stepKey="waitForPopup"/>
21+
</actionGroup>
22+
</actionGroups>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
<element name="WysiwygArrow" type="button" selector="#d3lzaXd5Zw-- &gt; .jstree-icon"/>
3535
<element name="checkIfWysiwygArrowExpand" type="button" selector="//li[@id='d3lzaXd5Zw--' and contains(@class,'jstree-closed')]"/>
3636
<element name="confirmDelete" type="button" selector=".action-primary.action-accept"/>
37+
<element name="higlightedFolder" type="block" selector="//li[@id='{{folderId}}']/a[@class='jstree-clicked']" parameterized="true"/>
3738
<element name="imageBlockByName" type="block" selector="//div[@data-row='file'][contains(., '{{imageName}}')]" parameterized="true"/>
3839
</section>
3940
</sections>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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="AdminVerifyDefaultCurrentTreePathTest">
11+
<annotations>
12+
<features value="Cms"/>
13+
<group value="Cms"/>
14+
<stories value="CMS Block Creation and Reset Removal"/>
15+
<title value="Admin should be see preselcted default folder in Media Gallery"/>
16+
<description value="Admin should be see preselcted default folder in Media Gallery"/>
17+
</annotations>
18+
<before>
19+
<actionGroup ref="AdminLoginActionGroup" stepKey="login"/>
20+
</before>
21+
22+
<after>
23+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
24+
</after>
25+
26+
<actionGroup ref="NavigateToMediaGalleryActionGroup" stepKey="navigateToMediaGallery"/>
27+
<!-- Verify catalog/category folder selected -->
28+
<waitForPageLoad stepKey="waitForFoldersLoad"/>
29+
<seeElement selector="{{MediaGallerySection.higlightedFolder('Y2F0YWxvZy9jYXRlZ29yeQ--')}}" stepKey="assertCategoryFolder"/>
30+
<actionGroup ref="AdminCloseMediaGalleryActionGroup" stepKey="closeMEdiaGallery"/>
31+
<actionGroup ref="AdminOpenMediaGalleryTinyMce4ActionGroup" stepKey="opneMediaGalleryFromTinyMce4"/>
32+
<!-- Verify wysiwyg folder selected -->
33+
<seeElement selector="{{MediaGallerySection.higlightedFolder('d3lzaXd5Zw--')}}" stepKey="assertWysiwygFolder"/>
34+
</test>
35+
</tests>

app/code/Magento/Cms/view/adminhtml/web/js/folder-tree.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ define([
7878
var path = this.options.currentPath,
7979
tree = this.element,
8080
lastExistentFolderEl,
81+
pathId,
8182

8283
/**
8384
* Recursively open folders specified in path array.
@@ -104,9 +105,10 @@ define([
104105
};
105106

106107
$(window).on('reload.MediaGallery', function () {
108+
pathId = window.MediabrowserUtility.pathId.replace(',,', '--');
107109
tree.jstree('deselect_all');
108-
tree.jstree('open_node', $('[data-id="' + window.MediabrowserUtility.pathId.replace(',,', '--') + '"]'), function () {
109-
tree.jstree('select_node', $('[data-id="' + window.MediabrowserUtility.pathId.replace(',,', '--') + '"]'));
110+
tree.jstree('open_node', $('[data-id="' + pathId + '"]'), function () {
111+
tree.jstree('select_node', $('[data-id="' + pathId + '"]'));
110112
});
111113
});
112114

0 commit comments

Comments
 (0)