Skip to content

Commit 1e71b2a

Browse files
committed
Merge branch 'pre-release' of https://github.com/magento-commerce/magento2-page-builder into ACP2E-2849
2 parents 9a039d2 + d2c9333 commit 1e71b2a

File tree

37 files changed

+171
-51
lines changed

37 files changed

+171
-51
lines changed

app/code/Magento/PageBuilder/Model/Dom/Document.php

+13-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
namespace Magento\PageBuilder\Model\Dom;
99

1010
use DOMNode;
11-
use Gt\Dom\Document as GtDomDocument;
11+
use Magento\PageBuilder\Model\Dom\DomDocument;
1212
use Magento\Framework\ObjectManagerInterface;
1313
use Magento\PageBuilder\Model\Dom\Adapter\DocumentFragmentInterface;
1414
use Magento\PageBuilder\Model\Dom\Adapter\DocumentInterface;
@@ -26,21 +26,29 @@ class Document implements DocumentInterface
2626
protected $objectManager;
2727

2828
/**
29-
* @var GtDomDocument
29+
* @var DOMDocument
3030
*/
3131
protected $document;
3232

3333
/**
3434
* Document constructor.
3535
* @param ObjectManagerInterface $objectManager
36-
* @param string $document
36+
* @param string $characterSet
37+
* @param string $contentType
3738
*/
3839
public function __construct(
3940
ObjectManagerInterface $objectManager,
40-
string $document = ""
41+
string $characterSet,
42+
string $contentType
4143
) {
4244
$this->objectManager = $objectManager;
43-
$this->document = $this->objectManager->create(GtDomDocument::class, [ 'document' => $document ]);
45+
$this->document = $this->objectManager->create(
46+
DomDocument::class,
47+
[
48+
'characterSet' => $characterSet,
49+
'contentType' => $contentType
50+
]
51+
);
4452
}
4553

4654
/**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\PageBuilder\Model\Dom;
9+
10+
use Gt\Dom\Document as GtDomDocument;
11+
12+
/**
13+
* PhpGt DOM Document wrapper.
14+
*/
15+
class DomDocument extends GtDomDocument
16+
{
17+
}

app/code/Magento/PageBuilder/Model/Dom/HtmlCollection.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
use ArrayAccess;
1111
use Countable;
12-
use Gt\Dom\HTMLCollection as GtDomHTMLCollection;
12+
use Gt\Dom\NodeList as GtDomNodeList;
1313
use Iterator;
1414
use Magento\Framework\ObjectManagerInterface;
1515
use Magento\PageBuilder\Model\Dom\Adapter\ElementInterface;
@@ -26,19 +26,19 @@ class HtmlCollection implements Iterator, ArrayAccess, Countable, HtmlCollection
2626
private $objectManager;
2727

2828
/**
29-
* @var GtDomHTMLCollection
29+
* @var GtDomNodeList
3030
*/
3131
private $collection;
3232

3333
/**
3434
* HtmlCollection constructor.
3535
*
3636
* @param ObjectManagerInterface $objectManager
37-
* @param GtDomHTMLCollection $collection
37+
* @param GtDomNodeList $collection
3838
*/
3939
public function __construct(
4040
ObjectManagerInterface $objectManager,
41-
GtDomHTMLCollection $collection
41+
GtDomNodeList $collection
4242
) {
4343
$this->objectManager = $objectManager;
4444
$this->collection = $collection;

app/code/Magento/PageBuilder/Model/Dom/HtmlDocument.php

+13-3
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,23 @@ class HtmlDocument extends Document implements HtmlDocumentInterface
2121
* HtmlDocument constructor.
2222
* @param ObjectManagerInterface $objectManager
2323
* @param string $document
24+
* @param string $characterSet
25+
* @param string $contentType
2426
*/
2527
public function __construct(
2628
ObjectManagerInterface $objectManager,
27-
string $document = ""
29+
string $document,
30+
string $characterSet = "UTF-8",
31+
string $contentType = "text/html"
2832
) {
29-
parent::__construct($objectManager, $document);
30-
$this->document = $this->objectManager->create(GtDomHTMLDocument::class, [ 'document' => $document ]);
33+
parent::__construct($objectManager, $characterSet, $contentType);
34+
$this->document = $this->objectManager->create(
35+
GtDomHTMLDocument::class,
36+
[
37+
"html" => $document,
38+
"characterSet" => $characterSet
39+
]
40+
);
3141
}
3242

3343
/**

app/code/Magento/PageBuilder/Model/Dom/StringMap.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace Magento\PageBuilder\Model\Dom;
99

10-
use Gt\Dom\StringMap as GtDomStringMap;
10+
use Gt\Dom\DOMStringMap as GtDomStringMap;
1111
use Magento\Framework\ObjectManagerInterface;
1212
use Magento\PageBuilder\Model\Dom\Adapter\StringMapInterface;
1313

app/code/Magento/PageBuilder/Model/Dom/TokenList.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace Magento\PageBuilder\Model\Dom;
99

10-
use Gt\Dom\TokenList as GtDomTokenList;
10+
use Gt\Dom\DOMTokenList as GtDomTokenList;
1111
use Magento\Framework\ObjectManagerInterface;
1212
use Magento\PageBuilder\Model\Dom\Adapter\TokenListInterface;
1313

app/code/Magento/PageBuilder/Model/Dom/XmlDocument.php

+13-3
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,22 @@ class XmlDocument extends Document implements XmlDocumentInterface
2121
*
2222
* @param ObjectManagerInterface $objectManager
2323
* @param string $document
24+
* @param string $characterSet
25+
* @param string $contentType
2426
*/
2527
public function __construct(
2628
ObjectManagerInterface $objectManager,
27-
string $document = ""
29+
string $document = "",
30+
string $characterSet = "UTF-8",
31+
string $contentType = "text/html"
2832
) {
29-
parent::__construct($objectManager, $document);
30-
$this->document = $this->objectManager->create(GtDomXmlDocument::class, [ 'document' => $document ]);
33+
parent::__construct($objectManager, $characterSet, $contentType);
34+
$this->document = $this->objectManager->create(
35+
GtDomXmlDocument::class,
36+
[
37+
"document" => $document,
38+
"characterSet" => $characterSet
39+
]
40+
);
3141
}
3242
}

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/ContentTypeImageActionGroup/AddImageToStageActionGroup.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<argument name="property"/>
1313
</arguments>
1414
<comment userInput="Attach image A to PageBuilder stage" stepKey="commentAttach"/>
15-
<attachFile userInput="{{property.value}}" selector="{{ImageOnStageWithoutImageUploaded.attachImageBtn}}" stepKey="attachImageFileOnStage"/>
15+
<attachFile userInput="{{property.value}}" selector="{{ImageOnStageWithoutImageUploaded.attachImageBtnWithUploaderId}}" stepKey="attachImageFileOnStage"/>
1616
<waitForPageLoad stepKey="waitForPageLoad"/>
1717
<waitForElementVisible selector="{{ImageOnStageWithoutImageUploaded.imagePreview}}" stepKey="waitForImagePreview"/>
1818
<waitForElementVisible selector="{{ImageOnStageWithoutImageUploaded.imageSource(property.fileName)}}" stepKey="waitForImageSource"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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="validateSlideOutPanelFieldHelperTextWithUploaderId">
11+
<annotations>
12+
<description>Validates the helper text for a field on the edit panel form.</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="property"/>
16+
</arguments>
17+
<waitForElement time="2" selector="{{EditPanelForm.panelFieldHelperTextWithUploaderId(property.section, property.fieldName)}}" stepKey="waitForElement"/>
18+
<see userInput="{{property.helperText}}" selector="{{EditPanelForm.panelFieldHelperTextWithUploaderId(property.section, property.fieldName)}}" stepKey="seeHelperText"/>
19+
</actionGroup>
20+
</actionGroups>
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="validateSlideOutPanelFieldTooltipWithUploaderId">
11+
<annotations>
12+
<description>Validates the tooltip for a field on the edit panel form.</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="property"/>
16+
</arguments>
17+
<waitForElement time="2" selector="{{EditPanelForm.panelFieldTooltipWithUploaderId(property.section, property.fieldName)}}" stepKey="waitForTooltip"/>
18+
<moveMouseOver selector="{{EditPanelForm.panelFieldTooltipWithUploaderId(property.section, property.fieldName)}}" stepKey="mouseOverTooltip"/>
19+
<waitForElementVisible selector="{{EditPanelForm.panelFieldTooltipContentWithUploaderId(property.section, property.fieldName)}}" stepKey="waitForTooltipContentVisible"/>
20+
<see userInput="{{property.tooltipText}}" selector="{{EditPanelForm.panelFieldTooltipContentWithUploaderId(property.section, property.fieldName)}}" stepKey="seeTooltipContent"/>
21+
</actionGroup>
22+
</actionGroups>
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="validateSlideOutPanelFieldWithUploaderId">
11+
<arguments>
12+
<argument name="property"/>
13+
</arguments>
14+
<waitForElement time="2" selector="{{EditPanelForm.panelFieldControlWithUploaderId(property.section, property.fieldName)}}" stepKey="waitForElementVisible"/>
15+
<see userInput="{{property.name}}" selector="{{EditPanelForm.panelFieldLabel(property.section, property.fieldName, property.section, property.name)}}" stepKey="seePropertyLabel"/>
16+
<seeElementInDOM selector="{{EditPanelForm.panelFieldControlWithUploaderId(property.section, property.fieldName)}}" stepKey="seePropertyControl"/>
17+
</actionGroup>
18+
</actionGroups>

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/EditFormImageUploadActionGroup/AttachFileSlideOutPropertyActionGroup.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
<arguments>
1616
<argument name="property"/>
1717
</arguments>
18-
<attachFile userInput="{{property.value}}" selector="{{EditPanelForm.panelFieldControl(property.section, property.fieldName)}}" stepKey="attachBackgroundImageFile"/>
18+
<attachFile userInput="{{property.value}}" selector="{{EditPanelForm.panelFieldControlWithUploaderId(property.section, property.fieldName)}}" stepKey="attachBackgroundImageFile"/>
1919
<waitForLoadingMaskToDisappear stepKey="waitForLoading"/>
20-
<waitForElementVisible selector="{{EditPanelForm.editFormUploadedImage(property.section, property.fieldName)}}" stepKey="waitForImageUpload"/>
20+
<waitForElementVisible selector="{{EditPanelForm.editFormUploadedImageWithUploaderId(property.section, property.fieldName)}}" stepKey="waitForImageUpload"/>
2121
</actionGroup>
2222
</actionGroups>

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/EditFormImageUploadActionGroup/AttachFileSlideOutPropertyGeneralActionGroup.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
<arguments>
1616
<argument name="property"/>
1717
</arguments>
18-
<waitForElement selector="{{EditPanelForm.panelFieldControl(property.section, property.fieldName)}}" stepKey="waitForImageElement"/>
19-
<attachFile userInput="{{property.value}}" selector="{{EditPanelForm.panelFieldControl(property.section, property.fieldName)}}" stepKey="attachImageFile"/>
18+
<waitForElement selector="{{EditPanelForm.panelFieldControlWithUploaderId(property.section, property.fieldName)}}" stepKey="waitForImageElement"/>
19+
<attachFile userInput="{{property.value}}" selector="{{EditPanelForm.panelFieldControlWithUploaderId(property.section, property.fieldName)}}" stepKey="attachImageFile"/>
2020
<waitForLoadingMaskToDisappear stepKey="waitForLoading"/>
21-
<waitForElementVisible time="10" selector="{{EditPanelForm.editFormUploadedImage(property.section, property.fieldName)}}" stepKey="waitForImageUploaded"/>
21+
<waitForElementVisible time="10" selector="{{EditPanelForm.editFormUploadedImageWithUploaderId(property.section, property.fieldName)}}" stepKey="waitForImageUploaded"/>
2222
</actionGroup>
2323
</actionGroups>

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/EditFormImageUploadActionGroup/AttachInvalidFileOnSlideOutActionGroup.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<arguments>
1212
<argument name="property"/>
1313
</arguments>
14-
<attachFile userInput="{{property.value}}" selector="{{EditPanelForm.panelFieldControl(property.section, property.fieldName)}}" stepKey="attachBackgroundImageFile"/>
14+
<attachFile userInput="{{property.value}}" selector="{{EditPanelForm.panelFieldControlWithUploaderId(property.section, property.fieldName)}}" stepKey="attachBackgroundImageFile"/>
1515
<waitForPageLoad stepKey="waitForPageLoad"/>
1616
<waitForElementVisible selector="{{EditPanelForm.invalidUploadTitle}}" stepKey="waitForInvalidUploadTitle"/>
1717
<waitForElementVisible selector="{{EditPanelForm.invalidUploadMessage(property.errorMessage)}}" stepKey="waitForInvalidUploadMessage"/>

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/EditFormImageUploadActionGroup/ClickSelectFromGallerySlideOutActionGroup.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
<arguments>
1212
<argument name="property"/>
1313
</arguments>
14-
<waitForElementVisible selector="{{EditPanelForm.selectFromGalleryBtn(property.section, property.fieldName)}}" stepKey="waitForSelectFromGalleryBtn"/>
15-
<click selector="{{EditPanelForm.selectFromGalleryBtn(property.section, property.fieldName)}}" stepKey="clickSelectFromGalleryBtn"/>
14+
<waitForElementVisible selector="{{EditPanelForm.selectFromGalleryBtnWithUploaderId(property.section, property.fieldName)}}" stepKey="waitForSelectFromGalleryBtn"/>
15+
<click selector="{{EditPanelForm.selectFromGalleryBtnWithUploaderId(property.section, property.fieldName)}}" stepKey="clickSelectFromGalleryBtn"/>
1616
<waitForPageLoad stepKey="waitForPageLoad"/>
1717
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear"/>
1818
</actionGroup>

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/EditFormImageUploadActionGroup/SeeImageUploadedOnSlideOutActionGroup.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<arguments>
1212
<argument name="property"/>
1313
</arguments>
14-
<waitForElement selector="{{EditPanelForm.panelFieldControl(property.section, property.fieldName)}}" stepKey="waitForElement"/>
15-
<waitForElementVisible selector="{{EditPanelForm.editFormUploadedImageSource(property.section, property.fieldName, property.fileName, property.extension)}}" stepKey="seeUploadedFile"/>
14+
<waitForElement selector="{{EditPanelForm.panelFieldControlWithUploaderId(property.section, property.fieldName)}}" stepKey="waitForElement"/>
15+
<waitForElementVisible selector="{{EditPanelForm.editFormUploadedImageSourceWithUploaderId(property.section, property.fieldName, property.fileName, property.extension)}}" stepKey="seeUploadedFile"/>
1616
</actionGroup>
1717
</actionGroups>

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/EditFormImageUploadActionGroup/SeeNoImageUploadedOnSlideOutActionGroup.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<arguments>
1212
<argument name="property"/>
1313
</arguments>
14-
<waitForElement selector="{{EditPanelForm.panelFieldControl(property.section, property.fieldName)}}" stepKey="waitForElement"/>
14+
<waitForElement selector="{{EditPanelForm.panelFieldControlWithUploaderId(property.section, property.fieldName)}}" stepKey="waitForElement"/>
1515
<waitForElementVisible selector="{{EditPanelForm.editFormNoUploadedImage(property.name)}}" stepKey="seeNoUploadedFile"/>
1616
</actionGroup>
1717
</actionGroups>

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/StageActionGroup/AddInvalidFileToStageActionGroup.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<moveMouseOver selector="{{section.base('1')}}" stepKey="hoverSectionArea"/>
2323
<waitForPageLoad stepKey="waitForPageLoad"/>
2424
<waitForElementVisible selector="{{PageBuilderStage.onHoverUploadImageButton(contentType.role, '1')}}" stepKey="waitForUploadImageButton"/>
25-
<attachFile userInput="{{file.value}}" selector="{{section.uploadImageInput('1')}}" stepKey="attachFile"/>
25+
<attachFile userInput="{{file.value}}" selector="{{section.uploadImageInputWithUploaderId('1')}}" stepKey="attachFile"/>
2626
<waitForPageLoad stepKey="waitForFileLoad"/>
2727
<waitForElementVisible selector="{{PageBuilderStage.modal}}" stepKey="waitForModal"/>
2828
<waitForElementVisible selector="{{PageBuilderStage.errorModalMessage(file.errorMessage)}}" stepKey="waitForModalMessage"/>

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/StageActionGroup/UploadBackgroundImageToContentTypeFromStageActionGroup.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<argument name="section"/>
1717
<argument name="index" defaultValue="1" type="string"/>
1818
</arguments>
19-
<attachFile userInput="{{backgroundImage.value}}" selector="{{section.uploadImageInput(index)}}" stepKey="attachBackgroundImageFromLocalToStage"/>
19+
<attachFile userInput="{{backgroundImage.value}}" selector="{{section.uploadImageInputWithUploaderId(index)}}" stepKey="attachBackgroundImageFromLocalToStage"/>
2020
<waitForPageLoad stepKey="waitForLoadingMaskToDisappear"/>
2121
<executeJS function="return window.getComputedStyle(document.evaluate('{{section.backgroundPath(index)}}', document.body).iterateNext()).backgroundImage" stepKey="backgroundImageRawValue"/>
2222
<!-- Return the string value of background-image -->

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/StageActionGroup/UploadImageToContentTypeFromStageActionGroup.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<argument name="section" defaultValue="PageBuilderStage"/>
1414
<argument name="index" defaultValue="1" type="string"/>
1515
</arguments>
16-
<attachFile userInput="{{property.value}}" selector="{{section.uploadImageInput(index)}}" stepKey="attachImageFromLocalToStage"/>
16+
<attachFile userInput="{{property.value}}" selector="{{section.uploadImageInputWithUploaderId(index)}}" stepKey="attachImageFromLocalToStage"/>
1717
<waitForPageLoad stepKey="waitForLoadingMaskToDisappear"/>
1818
<waitForElementVisible selector="{{section.imageSourceByIndex(index, property.fileName)}}" stepKey="waitForMainImageSource1"/>
1919
</actionGroup>

app/code/Magento/PageBuilder/Test/Mftf/Section/PageBuilderBannerSection/BannerOnBackendSection.xml

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<element name="bannerAltText" type="text" selector="(//div[@data-content-type='banner'])[{{arg1}}]//div[@aria-label='{{arg2}}']" parameterized="true"/>
2727
<element name="bannerTitleAttribute" type="text" selector="(//div[@data-content-type='banner'])[{{arg1}}]//div[@title='{{arg2}}']" parameterized="true"/>
2828
<element name="uploadImageInput" type="button" selector="//div[contains(@class,'pagebuilder-image-uploader-container')]//input[@name='background_image']"/>
29+
<element name="uploadImageInputWithUploaderId" type="button" selector="//div[contains(@class,'pagebuilder-image-uploader-container')]//div[@upload-area-id='background_image']//div[contains(@class,'uppy-Root')]//input[contains(@class,'uppy-Dashboard-input')]"/>
2930
<element name="variablePlaceholder" type="text" selector="(//div[contains(@class,'pagebuilder-banner')])[{{bannerIndex}}]//*[contains(@class, 'magento-variable') and contains(@class, 'magento-placeholder')]" parameterized="true"/>
3031
<element name="widgetPlaceholder" type="text" selector="(//div[contains(@class,'pagebuilder-banner')])[{{bannerIndex}}]//*[contains(@class, 'magento-placeholder') and contains(@class, 'magento-widget')]" parameterized="true"/>
3132
<element name="tinymce" type="text" selector="(//div[contains(@class,'pagebuilder-banner')])[{{bannerIndex}}]//div[contains(@class, 'inline-wysiwyg')]" parameterized="true"/>

0 commit comments

Comments
 (0)