Skip to content

Commit a546d4a

Browse files
Merge pull request #15 from magento-obsessive-owls/PR
Page Builder Stories
2 parents 39771a2 + dd196fb commit a546d4a

File tree

176 files changed

+9533
-398
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+9533
-398
lines changed

app/code/Magento/PageBuilder/Component/Form/Element/Wysiwyg.php

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99

1010
use Magento\Framework\App\ObjectManager;
1111
use Magento\Framework\Data\FormFactory;
12+
use Magento\Framework\View\Asset\Repository;
1213
use Magento\Framework\View\Element\UiComponent\ContextInterface;
13-
use Magento\PageBuilder\Model\View\File\Collector\PageBuilder;
1414
use Magento\Ui\Component\Wysiwyg\ConfigInterface;
1515
use Magento\Catalog\Api\CategoryAttributeRepositoryInterface;
1616
use Magento\Framework\Exception\NoSuchEntityException;
1717
use Magento\PageBuilder\Model\Config as PageBuilderConfig;
1818
use Magento\PageBuilder\Model\State as PageBuilderState;
1919
use Magento\PageBuilder\Model\Stage\Config as Config;
20+
use Magento\Framework\View\ConfigInterface as ViewConfigInterface;
2021

2122
/**
2223
* Updates wysiwyg element with Page Builder specific config
@@ -25,6 +26,11 @@
2526
*/
2627
class Wysiwyg extends \Magento\Ui\Component\Form\Element\Wysiwyg
2728
{
29+
/**
30+
* @var Repository
31+
*/
32+
private $assetRepo;
33+
2834
/**
2935
* WYSIWYG Constructor
3036
*
@@ -39,8 +45,11 @@ class Wysiwyg extends \Magento\Ui\Component\Form\Element\Wysiwyg
3945
* @param array $config
4046
* @param PageBuilderConfig|null $pageBuilderConfig
4147
* @param bool $overrideSnapshot
48+
* @param ViewConfigInterface $viewConfig
49+
* @param Repository $assetRepo
4250
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
4351
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
52+
* @SuppressWarnings(PHPMD.NPathComplexity)
4453
* @throws \Magento\Framework\Exception\NoSuchEntityException
4554
*/
4655
public function __construct(
@@ -54,8 +63,12 @@ public function __construct(
5463
array $data = [],
5564
array $config = [],
5665
PageBuilderConfig $pageBuilderConfig = null,
57-
bool $overrideSnapshot = false
66+
bool $overrideSnapshot = false,
67+
ViewConfigInterface $viewConfig = null,
68+
Repository $assetRepo = null
5869
) {
70+
$viewConfig = $viewConfig ?: ObjectManager::getInstance()->get(ViewConfigInterface::class);
71+
$this->assetRepo = $assetRepo ?: ObjectManager::getInstance()->get(Repository::class);
5972
$wysiwygConfigData = isset($config['wysiwygConfigData']) ? $config['wysiwygConfigData'] : [];
6073

6174
// If a dataType is present we're dealing with an attribute
@@ -84,6 +97,11 @@ public function __construct(
8497
$wysiwygConfigData = $stageConfig->getConfig();
8598
$wysiwygConfigData['pagebuilder_button'] = true;
8699
$wysiwygConfigData['pagebuilder_content_snapshot'] = true;
100+
$wysiwygConfigData['viewports'] = $viewConfig->getViewConfig()->getVarValue(
101+
'Magento_PageBuilder',
102+
'breakpoints'
103+
);
104+
$wysiwygConfigData = $this->processBreakpointsIcons($wysiwygConfigData);
87105

88106
if ($overrideSnapshot) {
89107
$pageBuilderConfig = $pageBuilderConfig ?: ObjectManager::getInstance()->get(PageBuilderConfig::class);
@@ -108,4 +126,24 @@ public function __construct(
108126

109127
parent::__construct($context, $formFactory, $wysiwygConfig, $components, $data, $config);
110128
}
129+
130+
/**
131+
* Process viewport icon paths
132+
*
133+
* @param array $wysiwygConfigData
134+
* @return array
135+
*/
136+
private function processBreakpointsIcons(array $wysiwygConfigData): array
137+
{
138+
if ($wysiwygConfigData && isset($wysiwygConfigData['viewports'])) {
139+
foreach ($wysiwygConfigData['viewports'] as $breakpoint => $attributes) {
140+
if (isset($attributes['icon'])) {
141+
$wysiwygConfigData['viewports'][$breakpoint]['icon'] = $this->assetRepo->getUrl(
142+
$attributes['icon']
143+
);
144+
}
145+
}
146+
}
147+
return $wysiwygConfigData;
148+
}
111149
}

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/BackgroundConfigurationActionGroup/ValidateVideoBackgroundWithOnlyVideoUrlActionGroup.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,15 @@
1818
<argument name="lazyLoad" defaultValue="PageBuilderVideoBackgroundLazyLoad_Enabled"/>
1919
<argument name="playOnlyWhenVisible" defaultValue="PageBuilderVideoBackgroundPlayOnlyWhenVisible_Enabled"/>
2020
<argument name="index" defaultValue="1" type="string"/>
21+
<argument name="defaultBackgroundColor" defaultValue="PageBuilderBackgroundColor_Default"/>
2122
</arguments>
2223
<waitForPageLoad stepKey="waitForPageLoad"/>
2324
<waitForElementVisible selector="{{section.backgroundType(index, 'video')}}" stepKey="waitForVideoBackground"/>
24-
<dontSeeElementInDOM selector="{{section.backgroundColorElement(index)}}" stepKey="dontSeeBackgroundColorInDOM"/>
25+
<executeJS function="return window.getComputedStyle(document.evaluate('{{section.backgroundPath(index)}}', document.body).iterateNext()).backgroundColor" stepKey="grabBackgroundColorValue"/>
26+
<assertEquals stepKey="dontSeeBackgroundColorInDOM">
27+
<expectedResult type="string">{{defaultBackgroundColor.rgb}}</expectedResult>
28+
<actualResult type="variable">grabBackgroundColorValue</actualResult>
29+
</assertEquals>
2530
<waitForElementVisible selector="{{section.videoBackgroundVideoElement(index)}}" stepKey="waitForVideoVisible"/>
2631
<waitForElement selector="{{section.videoBackgroundVideoUrl(index, videoUrl.renderedValue)}}" stepKey="waitForVideoUrl"/>
2732
<grabAttributeFrom selector="{{section.videoBackgroundJarallaxContainer(index)}}" userInput="style" stepKey="jarallaxStyle"/>

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/ContentTypeBlockActionGroup/VerifyBlockOnStageActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
<argument name="block"/>
1313
<argument name="index" defaultValue="1" type="string"/>
1414
</arguments>
15-
<moveMouseOver selector="{{PageBuilderStage.contentTypeInStageByIndex(PageBuilderBlockContentType.role, index)}}" stepKey="onMouseOverContentTypeStage"/>
1615
<waitForPageLoad stepKey="waitForPageLoad"/>
16+
<moveMouseOver selector="{{PageBuilderStage.contentTypeInStageByIndex(PageBuilderBlockContentType.role, index)}}" stepKey="onMouseOverContentTypeStage"/>
1717
<waitForElementVisible selector="{{BlockOnStage.title(index, block.title)}}" stepKey="wait"/>
1818
<seeElement selector="{{BlockOnStage.title(index,block.title)}}" stepKey="seeOptionMenuTitle"/>
1919
<see selector="{{BlockOnStage.content(index)}}" userInput="{{block.content}}" stepKey="seeBlockContentOnStage"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
9+
<actionGroup name="VerifyAffordanceSizeActionGroup">
10+
<annotations>
11+
<description>Verifies the size of the affordance on Container content types.</description>
12+
</annotations>
13+
<arguments>
14+
<argument name="expectedAffordanceSize" defaultValue="{{PageBuilderRowAffordanceWidth.borderWidth}}" type="string"/>
15+
<argument name="index" defaultValue="1" type="string"/>
16+
<argument name="section" defaultValue="RowOnStage"/>
17+
</arguments>
18+
<waitForElementVisible selector="{{section.affordance(index)}}" stepKey="waitForAffordanceVisible"/>
19+
<executeJS function="return parseInt(window.getComputedStyle({{section.affordanceJS(index)}}).borderWidth, 10)" stepKey="actualAffordanceSize"/>
20+
<assertEquals stepKey="assertActualAffordanceSizeEqualsExpected">
21+
<expectedResult type="int">{{expectedAffordanceSize}}</expectedResult>
22+
<actualResult type="variable">actualAffordanceSize</actualResult>
23+
</assertEquals>
24+
</actionGroup>
25+
</actionGroups>

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/ContentTypeRowActionGroup/ValidateFullWidthRowAppearanceActionGroup.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717
<argument name="childContentTypeIndex" defaultValue="1" type="string"/>
1818
<argument name="padding" defaultValue="PageBuilderPaddingPropertyRowDefault"/>
1919
<argument name="acceptableOffset" defaultValue="2" type="string"/>
20+
<argument name="affordanceValue" defaultValue="0" type="string"/>
2021
</arguments>
2122
<comment userInput="Increase window size to see varying widths for rows" stepKey="commentResizeWindow"/>
2223
<resizeWindow width="1920" height="1024" stepKey="resizeWindow"/>
23-
<executeJS function="return {{pageOrStageWidthJS}}" stepKey="pageOrStageWidth"/>
24+
<executeJS function="return {{pageOrStageWidthJS}} - {{affordanceValue}}" stepKey="pageOrStageWidth"/>
2425
<executeJS function="return {{section.rowWidthJS(rowIndex)}}" stepKey="rowWidth"/>
2526
<executeJS function="return parseInt({{section.rowChildContentWidthJS(rowIndex, childContentType.role, childContentTypeIndex)}} + {{padding.paddingLeft}} + {{padding.paddingRight}} + ({{childContentTypeBorder.value}}*2))" stepKey="rowChildElementWidth"/>
2627
<executeJS function="return Math.abs({$pageOrStageWidth} - {$rowWidth})" stepKey="pageMinusRowWidth"/>

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/OptionsMenuActionGroup/DuplicateContentTypeActionGroup.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
<executeJS function="return document.querySelectorAll('{{PageBuilderStage.contentTypeTotalInStage(contentType.role)}}').length+1" stepKey="expectedContentTypeCount"/>
2020
<waitForElementVisible selector="{{PageBuilderStage.contentTypeInStageByIndex(contentType.role, targetIndex)}}" stepKey="waitForContentTypeInStageVisible"/>
2121
<executeJS function="return ['row', 'column'].include('{{contentType.role}}') ? '//div[contains(@class, &quot;pagebuilder-display-label&quot;) and contains(.,&quot;'+'{{contentType.role}}'.toUpperCase()+'&quot;)]' : ['tabs'].include('{{contentType.role}}') ? '//ul[@data-element=&quot;navigation&quot;]' : '';" stepKey="contentTypeLabelSelector" />
22-
<moveMouseOver selector="{{PageBuilderStage.contentTypeInStageByIndex(contentType.role, targetIndex)}}{$contentTypeLabelSelector}" x="{{contentTypeXCoordinate}}" y="{{contentTypeYCoordinate}}" stepKey="onMouseOverContentTypeStage"/>
22+
<executeJS function="return ['row'].include('{{contentType.role}}') ? '(//div[contains(@class, &quot;pagebuilder-content-type-affordance&quot;) and contains(@class, &quot;pagebuilder-affordance-{{contentType.role}}&quot;)])[{{targetIndex}}]' : '(//div[contains(@class, &quot;pagebuilder-content-type&quot;) and contains(@class, &quot;pagebuilder-{{contentType.role}}&quot;)])[{{targetIndex}}]';" stepKey="contentTypeByIndexSelector" />
23+
<moveMouseOver selector="{$contentTypeByIndexSelector}{$contentTypeLabelSelector}" x="{{contentTypeXCoordinate}}" y="{{contentTypeYCoordinate}}" stepKey="onMouseOverContentTypeStage"/>
2324
<waitForElementVisible selector="{{PageBuilderContentTypeOptionsMenu.contentTypeOptionsMenuByIndex(contentType.role, targetIndex)}}" stepKey="waitForOptionsMenu"/>
2425
<waitForElementVisible selector="{{PageBuilderContentTypeOptionsMenu.contentTypeDuplicate(contentType.role, targetIndex)}}" stepKey="waitForDuplicate"/>
2526
<click selector="{{PageBuilderContentTypeOptionsMenu.contentTypeDuplicate(contentType.role, targetIndex)}}" stepKey="clickDuplicateContentType"/>

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/OptionsMenuActionGroup/HideContentTypeActionGroup.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
<comment userInput="Hiding content type" stepKey="commentHideContentType"/>
2020
<waitForElementVisible selector="{{section.base(targetIndex)}}" stepKey="waitForContentType"/>
2121
<executeJS function="return ['row', 'column'].include('{{contentType.role}}') ? '//div[contains(@class, &quot;pagebuilder-display-label&quot;) and contains(.,&quot;'+'{{contentType.role}}'.toUpperCase()+'&quot;)]' : '';" stepKey="contentTypeLabelSelector" />
22-
<moveMouseOver selector="{{section.base(targetIndex)}}{$contentTypeLabelSelector}" x="{{x}}" y="{{y}}" stepKey="moveMouseOverContentType"/>
22+
<executeJS function="return ['row'].include('{{contentType.role}}') ? '(//div[contains(@class, &quot;pagebuilder-content-type-affordance&quot;) and contains(@class, &quot;pagebuilder-affordance-{{contentType.role}}&quot;)])[{{targetIndex}}]' : '(//div[contains(@class, &quot;pagebuilder-content-type&quot;) and contains(@class, &quot;pagebuilder-{{contentType.role}}&quot;)])[{{targetIndex}}]';" stepKey="contentTypeByIndexSelector" />
23+
<moveMouseOver selector="{$contentTypeByIndexSelector}{$contentTypeLabelSelector}" x="{{x}}" y="{{y}}" stepKey="moveMouseOverContentType"/>
2324
<waitForPageLoad stepKey="waitForMouseOver"/>
2425
<waitForElementVisible selector="{{PageBuilderContentTypeOptionsMenu.contentTypeHide(contentType.role, targetIndex)}}" stepKey="waitForHideOptionVisible"/>
2526
<click selector="{{PageBuilderContentTypeOptionsMenu.contentTypeHide(contentType.role, targetIndex)}}" stepKey="hideContentType"/>

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/OptionsMenuActionGroup/OpenPageBuilderEditPanelActionGroup.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
<moveMouseOver selector="{{PageBuilderPanel.searchPanel}}" stepKey="moveMouseToSearchPanel"/>
1717
<waitForElementVisible time="10" selector="{{PageBuilderStage.contentTypeInStage(contentType.role)}}" stepKey="waitForContentTypeInStageVisible"/>
1818
<executeJS function="return ['row', 'column'].include('{{contentType.role}}') ? '//div[contains(@class, &quot;pagebuilder-display-label&quot;) and contains(.,&quot;'+'{{contentType.role}}'.toUpperCase()+'&quot;)]' : ['tabs'].include('{{contentType.role}}') ? '//ul[@data-element=&quot;navigation&quot;]' : '';" stepKey="contentTypeLabelSelector" />
19-
<moveMouseOver selector="{{PageBuilderStage.contentTypeInStage(contentType.role)}}{$contentTypeLabelSelector}" x="{{offsetXCoordinate}}" y="{{offsetYCoordinate}}" stepKey="onMouseOverContentTypeStage"/>
19+
<executeJS function="return ['row'].include('{{contentType.role}}') ? '//div[contains(@class, &quot;pagebuilder-content-type-affordance&quot;) and contains(@class, &quot;pagebuilder-affordance-{{contentType.role}}&quot;)]' : '//div[contains(@class, &quot;pagebuilder-content-type&quot;) and contains(@class, &quot;pagebuilder-{{contentType.role}}&quot;)]';" stepKey="contentTypeSelector" />
20+
<moveMouseOver selector="{$contentTypeSelector}{$contentTypeLabelSelector}" x="{{offsetXCoordinate}}" y="{{offsetYCoordinate}}" stepKey="onMouseOverContentTypeStage"/>
2021
<waitForPageLoad stepKey="waitForPageLoad"/>
2122
<waitForElementVisible time="10" selector="{{PageBuilderContentTypeOptionsMenu.contentTypeOptionsMenu(contentType.role)}}" stepKey="waitForOptions"/>
2223
<click selector="{{PageBuilderContentTypeOptionsMenu.contentTypeEdit(contentType.role)}}" stepKey="clickEditContentType"/>

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/OptionsMenuActionGroup/OpenPageBuilderEditPanelByIndexActionGroup.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
<argument name="contentTypeYCoordinate" defaultValue="null" type="string"/>
1616
</arguments>
1717
<executeJS function="return ['row', 'column'].include('{{contentType.role}}') ? '//div[contains(@class, &quot;pagebuilder-display-label&quot;) and contains(.,&quot;'+'{{contentType.role}}'.toUpperCase()+'&quot;)]' : ['tabs'].include('{{contentType.role}}') ? '//ul[@data-element=&quot;navigation&quot;]' : '';" stepKey="contentTypeLabelSelector" />
18-
<waitForElementVisible time="20" selector="{{PageBuilderStage.contentTypeInStageByIndex(contentType.role, contentTypeIndex)}}{$contentTypeLabelSelector}" stepKey="waitForContentTypeInStageVisible"/>
18+
<executeJS function="return ['row'].include('{{contentType.role}}') ? '(//div[contains(@class, &quot;pagebuilder-content-type-affordance&quot;) and contains(@class, &quot;pagebuilder-affordance-{{contentType.role}}&quot;)])[{{contentTypeIndex}}]' : '(//div[contains(@class, &quot;pagebuilder-content-type&quot;) and contains(@class, &quot;pagebuilder-{{contentType.role}}&quot;)])[{{contentTypeIndex}}]';" stepKey="contentTypeByIndexSelector" />
19+
<waitForElementVisible time="20" selector="{$contentTypeByIndexSelector}{$contentTypeLabelSelector}" stepKey="waitForContentTypeInStageVisible"/>
1920
<moveMouseOver stepKey="moveMouseOverSearch" selector="{{PageBuilderPanel.searchPanel}}" />
20-
<moveMouseOver selector="{{PageBuilderStage.contentTypeInStageByIndex(contentType.role, contentTypeIndex)}}{$contentTypeLabelSelector}" x="{{contentTypeXCoordinate}}" y="{{contentTypeYCoordinate}}" stepKey="onMouseOverContentTypeStage"/>
21+
<moveMouseOver selector="{$contentTypeByIndexSelector}{$contentTypeLabelSelector}" x="{{contentTypeXCoordinate}}" y="{{contentTypeYCoordinate}}" stepKey="onMouseOverContentTypeStage"/>
2122
<waitForPageLoad stepKey="waitForPageLoad"/>
2223
<waitForElementVisible time="10" selector="{{PageBuilderContentTypeOptionsMenu.contentTypeOptionsMenuByIndex(contentType.role, contentTypeIndex)}}" stepKey="waitForOptions"/>
2324
<waitForElementVisible selector="{{PageBuilderContentTypeOptionsMenu.contentTypeEditByIndex(contentType.role, contentTypeIndex)}}" stepKey="waitForEditButton"/>

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/OptionsMenuActionGroup/RemoveContentTypeFromStageByIndexActionGroup.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
<waitForElementVisible time="20" selector="{{PageBuilderStage.contentTypeInStageByIndex(contentType.role, contentTypeNumber)}}" stepKey="waitForContentTypeInStageVisible"/>
1919
<moveMouseOver stepKey="moveMouseOverSearch" selector="{{PageBuilderPanel.searchPanel}}" />
2020
<executeJS function="return ['row', 'column'].include('{{contentType.role}}') ? '//div[contains(@class, &quot;pagebuilder-display-label&quot;) and contains(.,&quot;'+'{{contentType.role}}'.toUpperCase()+'&quot;)]' : ['tabs'].include('{{contentType.role}}') ? '//ul[@data-element=&quot;navigation&quot;]' : '';" stepKey="contentTypeLabelSelector" />
21-
<moveMouseOver selector="{{PageBuilderStage.contentTypeInStageByIndex(contentType.role, contentTypeNumber)}}{$contentTypeLabelSelector}" x="{{x}}" y="{{y}}" stepKey="onMouseOverContentTypeStage"/>
21+
<executeJS function="return ['row'].include('{{contentType.role}}') ? '(//div[contains(@class, &quot;pagebuilder-content-type-affordance&quot;) and contains(@class, &quot;pagebuilder-affordance-{{contentType.role}}&quot;)])[{{contentTypeNumber}}]' : '(//div[contains(@class, &quot;pagebuilder-content-type&quot;) and contains(@class, &quot;pagebuilder-{{contentType.role}}&quot;)])[{{contentTypeNumber}}]';" stepKey="contentTypeByIndexSelector" />
22+
<moveMouseOver selector="{$contentTypeByIndexSelector}{$contentTypeLabelSelector}" x="{{x}}" y="{{y}}" stepKey="onMouseOverContentTypeStage"/>
2223
<waitForPageLoad stepKey="waitForOptionsAnimation"/>
2324
<waitForElementVisible time="10" selector="{{PageBuilderContentTypeOptionsMenu.contentTypeOptionsMenuByIndex(contentType.role, contentTypeNumber)}}" stepKey="waitForOptions"/>
2425
<click selector="{{PageBuilderContentTypeOptionsMenu.contentTypeRemoveByIndex(contentType.role, contentTypeNumber)}}" stepKey="clickRemoveContentType"/>

0 commit comments

Comments
 (0)