Skip to content

Commit e109fa0

Browse files
committed
Merge remote-tracking branch 'mainline/develop' into cms-team-2-sprint-13
2 parents be90be4 + 589ef85 commit e109fa0

File tree

235 files changed

+4052
-1097
lines changed

Some content is hidden

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

235 files changed

+4052
-1097
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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\Block\Catalog\Block\Product\View;
9+
10+
class Attributes extends \Magento\Catalog\Block\Product\View\Attributes
11+
{
12+
const DISPLAY_ATTRIBUTES_NON_PAGEBUILDER = 'non_pagebuilder';
13+
14+
const DISPLAY_ATTRIBUTES_PAGEBUILDER_ONLY = 'pagebuilder_only';
15+
16+
/**
17+
* Determine if we should display the attribute on the front-end, add support for exclude page builder & page
18+
* builder only options on class.
19+
*
20+
* display_attributes can be set to determine whether to include just Page Builder attributes or to exclude
21+
* them.
22+
*
23+
* @param \Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute
24+
* @param array $excludeAttr
25+
* @return bool
26+
* @throws \Magento\Framework\Exception\LocalizedException
27+
*/
28+
protected function isVisibleOnFrontend(
29+
\Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute,
30+
array $excludeAttr
31+
) : bool {
32+
return parent::isVisibleOnFrontend($attribute, $excludeAttr)
33+
&& (($this->getDisplayAttributes() == self::DISPLAY_ATTRIBUTES_NON_PAGEBUILDER
34+
&& !$attribute->getIsPagebuilderEnabled())
35+
|| ($this->getDisplayAttributes() == self::DISPLAY_ATTRIBUTES_PAGEBUILDER_ONLY
36+
&& $attribute->getIsPagebuilderEnabled()));
37+
}
38+
}

app/code/Magento/PageBuilder/Setup/DataConverter/Renderer/Row.php

Lines changed: 53 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,67 @@ public function __construct(StyleExtractorInterface $styleExtractor)
3030
*/
3131
public function render(array $itemData, array $additionalData = []) : string
3232
{
33-
$rootElementAttributes = [
34-
'data-element' => 'main',
35-
'data-role' => 'row',
36-
'data-appearance' => 'default',
37-
'class' => $itemData['formData']['css_classes'] ?? '',
38-
];
39-
4033
$formData = $itemData['formData'] ?? [];
4134

4235
$style = $this->styleExtractor->extractStyle($formData);
43-
if ($style) {
44-
$rootElementAttributes['style'] = $style;
36+
37+
$childrenHtml = (isset($additionalData['children']) ? $additionalData['children'] : '');
38+
39+
// Return an altered appearance for full width
40+
if (isset($formData['template']) && $formData['template'] === 'full-width.phtml') {
41+
return $this->renderElementWithAttributes(
42+
[
43+
'data-element' => 'main',
44+
'data-role' => 'row',
45+
'data-appearance' => 'full-width',
46+
'class' => $itemData['formData']['css_classes'] ?? '',
47+
'style' => $style ?? null
48+
],
49+
$this->renderElementWithAttributes(
50+
[
51+
'data-element' => 'inner',
52+
'class' => 'row-full-width-inner',
53+
],
54+
$childrenHtml
55+
)
56+
);
4557
}
4658

59+
// All other rows default to our new default of contained
60+
return $this->renderElementWithAttributes(
61+
[
62+
'data-element' => 'main',
63+
'data-role' => 'row',
64+
'data-appearance' => 'contained',
65+
],
66+
$this->renderElementWithAttributes(
67+
[
68+
'data-element' => 'inner',
69+
'class' => $itemData['formData']['css_classes'] ?? '',
70+
'style' => $style ?? null
71+
],
72+
$childrenHtml
73+
)
74+
);
75+
}
76+
77+
/**
78+
* Render an element with an attributes array
79+
*
80+
* @param array $attributes
81+
* @param string $childrenHtml
82+
* @return string
83+
*/
84+
private function renderElementWithAttributes(array $attributes, string $childrenHtml = '') : string
85+
{
4786
$rootElementHtml = '<div';
48-
foreach ($rootElementAttributes as $attributeName => $attributeValue) {
87+
foreach ($attributes as $attributeName => $attributeValue) {
4988
$attributeValue = trim($attributeValue);
50-
$rootElementHtml .= $attributeValue ? " $attributeName=\"$attributeValue\"" : '';
89+
if ($attributeValue) {
90+
$rootElementHtml .= $attributeValue ? " $attributeName=\"$attributeValue\"" : '';
91+
}
5192
}
52-
$rootElementHtml .= '>' . (isset($additionalData['children']) ? $additionalData['children'] : '') . '</div>';
53-
93+
$rootElementHtml .= '>' . $childrenHtml . '</div>';
5494
return $rootElementHtml;
5595
}
5696
}

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/AdminActionGroup.xml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,17 @@
5959
<see userInput="You saved the page." selector="{{CmsPagesPageActionsSection.savePageSuccessMessage}}" stepKey="assertSavePageSuccessMessage"/>
6060
</actionGroup>
6161
<actionGroup name="verifyPageBuilderVisibleOnPage">
62-
<waitForElementVisible selector="{{PageBuilderPanel.generalGroup}}" stepKey="seePageBuilderVisible"/>
62+
<waitForElementVisible selector="{{PageBuilderPanel.layoutGroup}}" stepKey="seePageBuilderVisible"/>
6363
<dontSee userInput="Enable Advanced CMS" stepKey="dontSeeEnableAdvancedCMSBtn"/>
6464
</actionGroup>
6565
<actionGroup name="verifyPageBuilderVisibleOnStaging">
66-
<scrollTo selector="{{PageBuilderPanel.generalGroup}}" stepKey="scrollToIdentifyPageBuilder"/>
67-
<waitForElementVisible selector="{{PageBuilderPanel.generalGroup}}" stepKey="seePageBuilderVisible"/>
66+
<scrollTo selector="{{PageBuilderPanel.layoutGroup}}" stepKey="scrollToIdentifyPageBuilder"/>
67+
<waitForElementVisible selector="{{PageBuilderPanel.layoutGroup}}" stepKey="seePageBuilderVisible"/>
6868
<dontSee userInput="Enable Advanced CMS" stepKey="dontSeeEnableAdvancedCMSBtn"/>
6969
</actionGroup>
7070
<actionGroup name="verifyPageBuilderNotVisibleOnPage">
7171
<dontSee userInput="Enable Advanced CMS" stepKey="dontSeeEnableAdvancedCMSBtn"/>
72-
<dontSee selector="{{PageBuilderPanel.generalGroup}}" stepKey="seePageBuilderVisible"/>
72+
<dontSee selector="{{PageBuilderPanel.layoutGroup}}" stepKey="seePageBuilderVisible"/>
7373
</actionGroup>
7474
<actionGroup name="setLayout">
7575
<arguments>
@@ -83,7 +83,10 @@
8383
<selectOption selector="{{designSection.LayoutDropdown}}" userInput="{{layoutOption}}" stepKey="selectLayout"/>
8484
</actionGroup>
8585
<actionGroup name="verifyFullWidthLayout">
86-
<executeJS function="return document.querySelector('[data-role=row]').clientWidth" stepKey="rowWidth"/>
86+
<arguments>
87+
<argument name="index" defaultValue="0" type="string"/>
88+
</arguments>
89+
<executeJS function="return document.querySelectorAll('[data-role=row]')[{{index}}].clientWidth" stepKey="rowWidth"/>
8790
<executeJS function="return document.querySelector('[class=page-wrapper]').clientWidth" stepKey="pageWidth"/>
8891
<assertEquals stepKey="assertRowWidth100Percent">
8992
<expectedResult type="variable">pageWidth</expectedResult>
@@ -98,7 +101,7 @@
98101
<click selector="{{PageBuilderCatalog.openPageBuilder}}" stepKey="clickOnPageBuilderBtn" />
99102
<!--See PageBuilder fullsize-->
100103
<comment userInput="See PageBuilder fullsize" stepKey="commentSeePageBuilderFullsize"/>
101-
<waitForElementVisible selector="{{PageBuilderPanel.generalGroup}}" stepKey="waiForPageBuilderVisible" />
104+
<waitForElementVisible selector="{{PageBuilderPanel.layoutGroup}}" stepKey="waiForPageBuilderVisible" />
102105
<seeElement selector="{{PageBuilderStage.stageWrapperFullScreen}}" stepKey="seePageBuilderFullSizeScreen" />
103106
</actionGroup>
104107
</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+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="openPageBuilderForAttribute">
12+
<arguments>
13+
<argument name="attributeCode" type="string"/>
14+
<argument name="section" defaultValue="PageBuilderProductAttribute"/>
15+
</arguments>
16+
<!-- Opening Page Builder for attribute -->
17+
<comment userInput="Opening Page Builder for attribute" stepKey="commentOpeningPageBuilder"/>
18+
<waitForElementVisible selector="{{section.PageBuilderBtn(attributeCode)}}" stepKey="seePagebuilderBtn"/>
19+
<click selector="{{section.PageBuilderBtn(attributeCode)}}" stepKey="enablePageBuilder"/>
20+
<waitForElementVisible selector="{{PageBuilderPanel.layoutGroup}}" stepKey="waiForPageBuilderVisible" />
21+
</actionGroup>
22+
</actionGroups>

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

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,114 @@
5959
<waitForElementVisible selector="{{page.parallaxState(index, parallaxStateValue.value)}}" stepKey="waitForParallaxBackgroundState"/>
6060
<waitForElementVisible selector="{{page.parallaxSpeed(index, parallaxSpeedValue.value)}}" stepKey="waitForParallaxBackgroundSpeed"/>
6161
</actionGroup>
62+
<!-- Validate Contained Row Appearance on stage -->
63+
<actionGroup name="validateContainedRowAppearanceOnStage">
64+
<comment userInput="Increase window size to see varying widths for rows" stepKey="commentResizeWindow"/>
65+
<resizeWindow width="1920" height="1024" stepKey="resizeWindow"/>
66+
<executeJS function="return {{PageBuilderStage.stageWidthJS}}" stepKey="stageWidth"/>
67+
<executeJS function="return {{RowOnStage.rowWidthJS('contained', '0')}}" stepKey="rowWidth"/>
68+
<assertGreaterThan stepKey="assertRowWidthGreaterThanZero">
69+
<expectedResult type="int">0</expectedResult>
70+
<actualResult type="variable">rowWidth</actualResult>
71+
</assertGreaterThan>
72+
<assertLessThan stepKey="assertRowWidthLessThanStage">
73+
<expectedResult type="variable">stageWidth</expectedResult>
74+
<actualResult type="variable">rowWidth</actualResult>
75+
</assertLessThan>
76+
</actionGroup>
77+
<!-- Validate Full Width Row Appearance on stage -->
78+
<actionGroup name="validateFullWidthRowAppearanceOnStage">
79+
<comment userInput="Increase window size to see varying widths for rows" stepKey="commentResizeWindow"/>
80+
<resizeWindow width="1920" height="1024" stepKey="resizeWindow"/>
81+
<executeJS function="return {{PageBuilderStage.stageWidthJS}}" stepKey="stageWidth"/>
82+
<executeJS function="return {{RowOnStage.rowWidthJS('full-width', '0')}}" stepKey="rowWidth"/>
83+
<executeJS function="return parseInt({{RowOnStage.rowH2ChildWidthJS('full-width', '0')}} + {{PageBuilderPaddingPropertyRowDefault.paddingLeft}} + {{PageBuilderPaddingPropertyRowDefault.paddingRight}})" stepKey="rowElementWidth"/>
84+
<assertGreaterThan stepKey="assertRowWidthGreaterThanZero">
85+
<expectedResult type="int">0</expectedResult>
86+
<actualResult type="variable">rowWidth</actualResult>
87+
</assertGreaterThan>
88+
<assertEquals stepKey="assertRowWidthEqualsStage">
89+
<expectedResult type="variable">stageWidth</expectedResult>
90+
<actualResult type="variable">rowWidth</actualResult>
91+
</assertEquals>
92+
<assertGreaterThan stepKey="assertRowWidthGreaterThanContents">
93+
<expectedResult type="variable">rowElementWidth</expectedResult>
94+
<actualResult type="variable">rowWidth</actualResult>
95+
</assertGreaterThan>
96+
</actionGroup>
97+
<!-- Validate Full Bleed Row Appearance on stage -->
98+
<actionGroup name="validateFullBleedRowAppearanceOnStage">
99+
<comment userInput="Increase window size to see varying widths for rows" stepKey="commentResizeWindow"/>
100+
<resizeWindow width="1920" height="1024" stepKey="resizeWindow"/>
101+
<executeJS function="return {{PageBuilderStage.stageWidthJS}}" stepKey="stageWidth"/>
102+
<executeJS function="return {{RowOnStage.rowWidthJS('full-bleed', '0')}}" stepKey="rowWidth"/>
103+
<executeJS function="return parseInt({{RowOnStage.rowH2ChildWidthJS('full-bleed', '0')}} + {{PageBuilderPaddingPropertyRowDefault.paddingLeft}} + {{PageBuilderPaddingPropertyRowDefault.paddingRight}})" stepKey="rowElementWidth"/>
104+
<assertGreaterThan stepKey="assertRowWidthGreaterThanZero">
105+
<expectedResult type="int">0</expectedResult>
106+
<actualResult type="variable">rowWidth</actualResult>
107+
</assertGreaterThan>
108+
<assertEquals stepKey="assertRowWidthEqualsStage">
109+
<expectedResult type="variable">stageWidth</expectedResult>
110+
<actualResult type="variable">rowWidth</actualResult>
111+
</assertEquals>
112+
<assertEquals stepKey="assertRowWidthEqualsContentsPlusPadding">
113+
<expectedResult type="variable">rowElementWidth</expectedResult>
114+
<actualResult type="variable">rowWidth</actualResult>
115+
</assertEquals>
116+
</actionGroup>
117+
<!-- Validate Contained Row Appearance on Storefront -->
118+
<actionGroup name="validateContainedRowAppearanceOnStorefront">
119+
<comment userInput="Increase window size to see varying widths for rows" stepKey="commentResizeWindow"/>
120+
<resizeWindow width="1920" height="1024" stepKey="resizeWindow"/>
121+
<executeJS function="return {{PageBuilderStoreFront.pageWidthJS}}" stepKey="pageWidth"/>
122+
<executeJS function="return {{RowOnStorefront.rowWidthJS('contained', '0')}}" stepKey="rowWidth"/>
123+
<assertGreaterThan stepKey="assertRowWidthGreaterThanZero">
124+
<expectedResult type="int">0</expectedResult>
125+
<actualResult type="variable">rowWidth</actualResult>
126+
</assertGreaterThan>
127+
<assertLessThan stepKey="assertRowWidthLessThanPage">
128+
<expectedResult type="variable">pageWidth</expectedResult>
129+
<actualResult type="variable">rowWidth</actualResult>
130+
</assertLessThan>
131+
</actionGroup>
132+
<!-- Validate Full Width Row Appearance on Storefront -->
133+
<actionGroup name="validateFullWidthRowAppearanceOnStorefront">
134+
<comment userInput="Increase window size to see varying widths for rows" stepKey="commentResizeWindow"/>
135+
<resizeWindow width="1920" height="1024" stepKey="resizeWindow"/>
136+
<executeJS function="return {{PageBuilderStoreFront.pageWidthJS}}" stepKey="pageWidth"/>
137+
<executeJS function="return {{RowOnStorefront.rowWidthJS('full-width', '0')}}" stepKey="rowWidth"/>
138+
<executeJS function="return parseInt({{RowOnStorefront.rowH2ChildWidthJS('full-width', '0')}} + {{PageBuilderPaddingPropertyRowDefault.paddingLeft}} + {{PageBuilderPaddingPropertyRowDefault.paddingRight}})" stepKey="rowElementWidth"/>
139+
<assertGreaterThan stepKey="assertRowWidthGreaterThanZero">
140+
<expectedResult type="int">0</expectedResult>
141+
<actualResult type="variable">rowWidth</actualResult>
142+
</assertGreaterThan>
143+
<assertEquals stepKey="assertRowWidthEqualsPage">
144+
<expectedResult type="variable">pageWidth</expectedResult>
145+
<actualResult type="variable">rowWidth</actualResult>
146+
</assertEquals>
147+
<assertGreaterThan stepKey="assertRowWidthGreaterThanContents">
148+
<expectedResult type="variable">rowElementWidth</expectedResult>
149+
<actualResult type="variable">rowWidth</actualResult>
150+
</assertGreaterThan>
151+
</actionGroup>
152+
<!-- Validate Full Bleed Row Appearance on Storefront -->
153+
<actionGroup name="validateFullBleedRowAppearanceOnStorefront">
154+
<comment userInput="Increase window size to see varying widths for rows" stepKey="commentResizeWindow"/>
155+
<resizeWindow width="1920" height="1024" stepKey="resizeWindow"/>
156+
<executeJS function="return {{PageBuilderStoreFront.pageWidthJS}}" stepKey="pageWidth"/>
157+
<executeJS function="return {{RowOnStorefront.rowWidthJS('full-bleed', '0')}}" stepKey="rowWidth"/>
158+
<executeJS function="return parseInt({{RowOnStorefront.rowH2ChildWidthJS('full-bleed', '0')}} + {{PageBuilderPaddingPropertyRowDefault.paddingLeft}} + {{PageBuilderPaddingPropertyRowDefault.paddingRight}})" stepKey="rowElementWidth"/>
159+
<assertGreaterThan stepKey="assertRowWidthGreaterThanZero">
160+
<expectedResult type="int">0</expectedResult>
161+
<actualResult type="variable">rowWidth</actualResult>
162+
</assertGreaterThan>
163+
<assertEquals stepKey="assertRowWidthEqualsPage">
164+
<expectedResult type="variable">pageWidth</expectedResult>
165+
<actualResult type="variable">rowWidth</actualResult>
166+
</assertEquals>
167+
<assertEquals stepKey="assertRowWidthEqualsContentsPlusPadding">
168+
<expectedResult type="variable">rowElementWidth</expectedResult>
169+
<actualResult type="variable">rowWidth</actualResult>
170+
</assertEquals>
171+
</actionGroup>
62172
</actionGroups>

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/DragAndDropActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<argument name="offsetXCoordinate" defaultValue="null" type="string"/>
4949
<argument name="offsetYCoordinate" defaultValue="null" type="string"/>
5050
</arguments>
51-
<scrollTo selector="{{CmsNewPagePageActionsSection.contentSectionName}}" stepKey="scrollToTopOfStage"/>
51+
<waitForElementVisible time="30" selector="{{PageBuilderPanel.draggableContentTypeInPanel(contentType.name)}}" stepKey="waitForContentTypeInPanel"/>
5252
<dragAndDrop selector1="{{PageBuilderPanel.draggableContentTypeInPanel(contentType.name)}}" selector2="{{PageBuilderStage.contentTypeContainer(containerTargetType.role, containerTargetIndex)}}" x="{{offsetXCoordinate}}" y="{{offsetYCoordinate}}" stepKey="dropContentTypeIntoStage"/>
5353
<waitForPageLoad stepKey="waitForAnimation" time="30"/>
5454
<waitForElementVisible time="10" selector="{{PageBuilderStage.contentTypeInStageByIndex(contentType.role, contentTypeIndex)}}" stepKey="waitForContentTypeInStage" />

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/EditFormActionGroup.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,13 @@
5050
<waitForElementVisible time="5" selector="{{EditPanelForm.editFormSave}}" stepKey="waitForColumnSaveButton" />
5151
<click selector="{{EditPanelForm.editFormSave}}" stepKey="clickSaveColumn"/>
5252
<waitForElementNotVisible time="5" selector="{{EditPanelForm.editForm}}" stepKey="waitForEditFormNotVisible" />
53+
<waitForPageLoad stepKey="waitForSavePanelClose"/>
5354
</actionGroup>
5455
<actionGroup name="expandConfigurationSection">
5556
<arguments>
5657
<argument name="section" defaultValue="AdvancedForm"/>
5758
</arguments>
59+
<waitForPageLoad stepKey="waitForPageToFinishLoading"/>
5860
<waitForElementVisible selector="{{EditPanelForm.editPanelSectionName(section.dataIndex)}}" stepKey="waitForSectionVisible"/>
5961
<conditionalClick selector="{{EditPanelForm.editPanelSectionName(section.dataIndex)}}" dependentSelector="{{EditPanelForm.editPanelSectionExpanded(section.dataIndex)}}" visible="false" stepKey="expandSection"/>
6062
<waitForElementVisible selector="{{EditPanelForm.editPanelSectionExpanded(section.dataIndex)}}" stepKey="waitForSectionExpanded"/>

0 commit comments

Comments
 (0)