Skip to content

Commit a31355b

Browse files
committed
Merge branch 'develop' into MC-1263
2 parents 11e1978 + 0954b2e commit a31355b

Some content is hidden

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

51 files changed

+1530
-587
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\PageBuilder\Plugin\Result;
10+
11+
use Magento\Framework\App\ResponseInterface;
12+
use Magento\Framework\View\Result\Page as ResultPage;
13+
14+
class Page
15+
{
16+
/**
17+
* @param ResultPage $subject
18+
* @param ResponseInterface $response
19+
* @return array
20+
*/
21+
public function beforeRenderResult(
22+
ResultPage $subject,
23+
ResponseInterface $response
24+
) : array {
25+
// Apply the updated layout handles classes to the body when using our full width variants
26+
if ($subject->getConfig()->getPageLayout() == 'product-full-width'
27+
|| $subject->getConfig()->getPageLayout() == 'cms-full-width'
28+
) {
29+
$subject->getConfig()->addBodyClass('page-layout-1column');
30+
}
31+
if ($subject->getConfig()->getPageLayout() == 'category-full-width') {
32+
$subject->getConfig()->addBodyClass('page-layout-2columns-left');
33+
}
34+
35+
return [$response];
36+
}
37+
}

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,27 @@
7171
<dontSee userInput="Enable Advanced CMS" stepKey="dontSeeEnableAdvancedCMSBtn"/>
7272
<dontSee selector="{{PageBuilderPanel.generalGroup}}" stepKey="seePageBuilderVisible"/>
7373
</actionGroup>
74+
<actionGroup name="setLayout">
75+
<arguments>
76+
<argument name="designSection"/>
77+
<argument name="layoutOption"/>
78+
</arguments>
79+
<waitForElementVisible selector="{{designSection.DesignTab}}" stepKey="waitForDesignTabVisible"/>
80+
<conditionalClick selector="{{designSection.DesignTab}}" dependentSelector="{{designSection.LayoutDropdown}}" visible="false" stepKey="clickOnDesignTab"/>
81+
<waitForPageLoad stepKey="waitForPageLoadDesignTab"/>
82+
<waitForElementVisible selector="{{designSection.LayoutDropdown}}" stepKey="waitForLayoutDropDown" />
83+
<selectOption selector="{{designSection.LayoutDropdown}}" userInput="{{layoutOption}}" stepKey="selectLayout"/>
84+
</actionGroup>
85+
<actionGroup name="verifyFullWidthLayout">
86+
<executeJS function="return document.querySelector('[data-role=row]').clientWidth" stepKey="rowWidth"/>
87+
<executeJS function="return document.querySelector('[class=page-wrapper]').clientWidth" stepKey="pageWidth"/>
88+
<assertEquals stepKey="assertRowWidth100Percent">
89+
<expectedResult type="variable">pageWidth</expectedResult>
90+
<actualResult type="variable">rowWidth</actualResult>
91+
</assertEquals>
92+
<assertGreaterThan stepKey="assertRowWidthGreaterThanZero">
93+
<expectedResult type="int">0</expectedResult>
94+
<actualResult type="variable">rowWidth</actualResult>
95+
</assertGreaterThan>
96+
</actionGroup>
7497
</actionGroups>

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,50 +19,50 @@
1919
<moveMouseOver selector="{{PageBuilderStage.contentTypeInStageByIndex(contentType.role, contentTypeIndex)}}" x="10" y="0" stepKey="onMouseOverContentTypeStage"/>
2020
<waitForPageLoad time="30" stepKey="waitForMouseOverAnimation"/>
2121
<waitForElementVisible time="10" selector="{{PageBuilderContentTypeOptionsMenu.contentTypeOptionsMenuByIndex(contentType.role, contentTypeIndex)}}" stepKey="waitForOptions"/>
22-
<waitForElementVisible selector="{{PageBuilderColumnSection.columnMoveByIndex(contentTypeIndex)}}" stepKey="waitForMoveHandle"/>
23-
<dragAndDrop selector1="{{PageBuilderColumnSection.columnMoveByIndex(contentTypeIndex)}}" selector2="{{PageBuilderStage.contentTypeContainer(contentType.role, containerTargetIndex)}}" stepKey="moveContentTypeIntoContainer"/>
22+
<waitForElementVisible selector="{{ColumnOnBackend.columnMoveByIndex(contentTypeIndex)}}" stepKey="waitForMoveHandle"/>
23+
<dragAndDrop selector1="{{ColumnOnBackend.columnMoveByIndex(contentTypeIndex)}}" selector2="{{PageBuilderStage.contentTypeContainer(contentType.role, containerTargetIndex)}}" stepKey="moveContentTypeIntoContainer"/>
2424
<waitForPageLoad stepKey="waitForDragOperation" />
2525
</actionGroup>
2626
<actionGroup name="openGridSizeForm">
2727
<arguments>
2828
<argument name="index" defaultValue="1" type="string"/>
2929
</arguments>
30-
<waitForElementVisible selector="{{PageBuilderColumnSection.gridSizeButton(index)}}" stepKey="waitForGridSizeButtonVisible" />
31-
<click selector="{{PageBuilderColumnSection.gridSizeButton(index)}}" stepKey="clickGridSizeButton" />
30+
<waitForElementVisible selector="{{ColumnOnBackend.gridSizeButton(index)}}" stepKey="waitForGridSizeButtonVisible" />
31+
<click selector="{{ColumnOnBackend.gridSizeButton(index)}}" stepKey="clickGridSizeButton" />
3232
<waitForPageLoad stepKey="waitForAnimation" />
33-
<waitForElementVisible selector="{{PageBuilderColumnSection.gridSizeInput(index)}}" stepKey="waitForGridVisible" />
33+
<waitForElementVisible selector="{{ColumnOnBackend.gridSizeInput(index)}}" stepKey="waitForGridVisible" />
3434
</actionGroup>
3535
<actionGroup name="closeGridSizeForm">
3636
<arguments>
3737
<argument name="index" defaultValue="1" type="string"/>
3838
</arguments>
39-
<click selector="{{PageBuilderColumnSection.columnX('1')}}" stepKey="clickColumn" />
39+
<click selector="{{ColumnOnBackend.columnX('1')}}" stepKey="clickColumn" />
4040
<waitForPageLoad stepKey="waitForAnimation" />
41-
<waitForElementNotVisible selector="{{PageBuilderColumnSection.gridSizeInput(index)}}" stepKey="waitForGridNotVisible" />
41+
<waitForElementNotVisible selector="{{ColumnOnBackend.gridSizeInput(index)}}" stepKey="waitForGridNotVisible" />
4242
</actionGroup>
4343
<actionGroup name="updateGridSize">
4444
<arguments>
4545
<argument name="index" defaultValue="1" type="string"/>
4646
<argument name="gridSize" defaultValue="12" type="string"/>
4747
</arguments>
48-
<waitForElementVisible selector="{{PageBuilderColumnSection.gridSizeButton(index)}}" stepKey="waitForGridSizeButtonVisible" />
49-
<click selector="{{PageBuilderColumnSection.gridSizeButton(index)}}" stepKey="clickGridSizeButton" />
48+
<waitForElementVisible selector="{{ColumnOnBackend.gridSizeButton(index)}}" stepKey="waitForGridSizeButtonVisible" />
49+
<click selector="{{ColumnOnBackend.gridSizeButton(index)}}" stepKey="clickGridSizeButton" />
5050
<waitForPageLoad stepKey="waitForAnimation" />
51-
<waitForElementVisible selector="{{PageBuilderColumnSection.gridSizeInput(index)}}" stepKey="waitForGridVisible" />
52-
<fillField selector="{{PageBuilderColumnSection.gridSizeInput(index)}}" userInput="{{gridSize}}" stepKey="enterGridSize"/>
53-
<pressKey selector="{{PageBuilderColumnSection.gridSizeInput(index)}}" parameterArray="['su',\Facebook\WebDriver\WebDriverKeys::ENTER]" stepKey="pressKeyEnter"/>
51+
<waitForElementVisible selector="{{ColumnOnBackend.gridSizeInput(index)}}" stepKey="waitForGridVisible" />
52+
<fillField selector="{{ColumnOnBackend.gridSizeInput(index)}}" userInput="{{gridSize}}" stepKey="enterGridSize"/>
53+
<pressKey selector="{{ColumnOnBackend.gridSizeInput(index)}}" parameterArray="['su',\Facebook\WebDriver\WebDriverKeys::ENTER]" stepKey="pressKeyEnter"/>
5454
<waitForPageLoad stepKey="waitForUpdate" />
55-
<waitForElementVisible selector="{{PageBuilderColumnSection.displayLabelGridSize(index, gridSize)}}" stepKey="validateGridSize" />
55+
<waitForElementVisible selector="{{ColumnOnBackend.displayLabelGridSize(index, gridSize)}}" stepKey="validateGridSize" />
5656
</actionGroup>
5757
<actionGroup name="updateGridSizeInvalid">
5858
<arguments>
5959
<argument name="index" defaultValue="1" type="string"/>
6060
<argument name="gridSize" defaultValue="12" type="string"/>
6161
<argument name="errorMessage"/>
6262
</arguments>
63-
<fillField selector="{{PageBuilderColumnSection.gridSizeInput(index)}}" userInput="{{gridSize}}" stepKey="enterGridSize"/>
64-
<click selector="{{PageBuilderColumnSection.columnX(index)}}" stepKey="clickColumn" />
63+
<fillField selector="{{ColumnOnBackend.gridSizeInput(index)}}" userInput="{{gridSize}}" stepKey="enterGridSize"/>
64+
<click selector="{{ColumnOnBackend.columnX(index)}}" stepKey="clickColumn" />
6565
<waitForPageLoad stepKey="waitForAnimation" />
66-
<waitForElementVisible selector="{{PageBuilderColumnSection.gridSizeError(index, errorMessage)}}" stepKey="verifyError"/>
66+
<waitForElementVisible selector="{{ColumnOnBackend.gridSizeError(index, errorMessage)}}" stepKey="verifyError"/>
6767
</actionGroup>
6868
</actionGroups>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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="RestoreLayoutSetting">
12+
<!-- Remove the existing layout update entries, as they can be merged in the wrong order -->
13+
<remove keyForRemoval="selectOneColumn"/>
14+
<remove keyForRemoval="selectNoLayoutUpdates1"/>
15+
<remove keyForRemoval="selectNoLayoutUpdates2"/>
16+
<!-- Set the defaults to those now set by Page Builder -->
17+
<selectOption selector="{{DefaultLayoutsSection.pageLayout}}" userInput="{{PageBuilderFullWidthLayout.cms}}" stepKey="selectCmsFullWidth" after="expandDefaultLayouts"/>
18+
<selectOption selector="{{DefaultLayoutsSection.categoryLayout}}" userInput="{{PageBuilderFullWidthLayout.category}}" stepKey="selectCategoryFullWidth" after="expandDefaultLayouts"/>
19+
<selectOption selector="{{DefaultLayoutsSection.productLayout}}" userInput="{{PageBuilderFullWidthLayout.product}}" stepKey="selectProductFullWidth" after="expandDefaultLayouts"/>
20+
</actionGroup>
21+
</actionGroups>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="PageBuilderFullWidthLayout" type="pagebuild_full_width_layout">
12+
<data key="cms">Page -- Full Width</data>
13+
<data key="category">Category -- Full Width</data>
14+
<data key="product">Product -- Full Width</data>
15+
</entity>
16+
</entities>

app/code/Magento/PageBuilder/Test/Mftf/Page/PageBuilderCmsPage.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
<section name="CmsPagesPageActionsSection"/>
1515
<section name="PageBuilderRowSection"/>
1616
<section name="AdminPageBuilderHeaderSection"/>
17-
<section name="ColumnsOnFrontend"/>
18-
<section name="PageBuilderColumnSection"/>
17+
<section name="ColumnOnFrontend"/>
18+
<section name="ColumnOnBackend"/>
1919
<section name="PageBuilderBlockSection"/>
2020
<section name="PageBuilderBannerSection"/>
2121
<section name="PageBuilderNewsletterSection"/>

app/code/Magento/PageBuilder/Test/Mftf/Section/PageBuilderColumnSection.xml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11-
<section name="PageBuilderColumnSection">
11+
<section name="ColumnOnBackend">
12+
<element name="base" type="button" selector="(//div[contains(@class,'pagebuilder-column') and contains(@class,'pagebuilder-content-type')])[{{arg1}}]" parameterized="true"/>
1213
<element name="allColumns" type="text" selector="//div[contains(@class, 'pagebuilder-content-type') and contains(@class, 'pagebuilder-column')]"/>
1314
<element name="default" type="button" selector="(//div[contains(@class,'pagebuilder-content-type') and contains(@class,'pagebuilder-column')])[{{arg1}}][@style='border: {{arg2}}; border-radius: {{arg3}}px; margin: {{arg4}}px; padding: {{arg5}}px; width: {{arg6}}; background-size: {{arg7}}; background-repeat: {{arg8}}; background-attachment: {{arg9}}; align-self: {{arg10}};']" parameterized="true"/>
1415
<element name="empty" type="button" selector="(//div[contains(@class,'empty-container')]//div[contains(@class,'element-children') and contains(@class,'column-container')])[{{arg1}}]" parameterized="true"/>
@@ -29,8 +30,18 @@
2930
<element name="gridSizeTooltip" type="button" selector="(//div[contains(@class, 'pagebuilder-column-group')])[{{arg1}}]/descendant::div[contains(@class, 'grid-panel-tooltip')][1]" parameterized="true"/>
3031
<element name="gridSizeTooltipWithMax" type="button" selector="(//div[contains(@class, 'pagebuilder-column-group')])[{{arg1}}]/descendant::div[contains(@class, 'grid-panel-tooltip')][1]//span//p//span[text()='{{arg2}}']" parameterized="true"/>
3132
<element name="gridSizeError" type="button" selector="(//div[contains(@class, 'pagebuilder-column-group')])[{{arg1}}]/descendant::div[contains(@class, 'admin__field-error') and contains(text(), '{{arg2}}')]" parameterized="true"/>
33+
<!-- Background Configuration -->
34+
<element name="backgroundPosition" type="button" selector="(//div[contains(@class,'pagebuilder-column') and contains(@class,'pagebuilder-content-type')])[{{arg1}}][contains(@style,'background-position: {{arg2}};')]" parameterized="true"/>
35+
<element name="backgroundSize" type="button" selector="(//div[contains(@class,'pagebuilder-column') and contains(@class,'pagebuilder-content-type')])[{{arg1}}][contains(@style,'background-size: {{arg2}};')]" parameterized="true"/>
36+
<element name="backgroundRepeat" type="button" selector="(//div[contains(@class,'pagebuilder-column') and contains(@class,'pagebuilder-content-type')])[{{arg1}}][contains(@style,'background-repeat: {{arg2}};')]" parameterized="true"/>
37+
<element name="backgroundAttachment" type="button" selector="(//div[contains(@class,'pagebuilder-column') and contains(@class,'pagebuilder-content-type')])[{{arg1}}][contains(@style,'background-attachment: {{arg2}};')]" parameterized="true"/>
38+
<element name="backgroundColor" type="button" selector="(//div[contains(@class,'pagebuilder-column') and contains(@class,'pagebuilder-content-type')])[{{arg1}}][contains(@style,'background-color: {{arg2}};')]" parameterized="true"/>
39+
<element name="noBackgroundColor" type="button" selector="(//div[contains(@class,'pagebuilder-column') and contains(@class,'pagebuilder-content-type')])[{{arg1}}][not(contains(@style,'background-color:'))]" parameterized="true"/>
40+
<element name="backgroundImage" type="button" selector="(//div[contains(@class,'pagebuilder-column') and contains(@class,'pagebuilder-content-type')])[{{arg1}}][contains(@style,'background-image: url(') and contains(@style,'{{arg2}}')]" parameterized="true"/>
41+
<element name="noBackgroundImage" type="button" selector="(//div[contains(@class,'pagebuilder-column') and contains(@class,'pagebuilder-content-type')])[{{arg1}}][not(contains(@style,'background-image:'))]" parameterized="true"/>
3242
</section>
33-
<section name="ColumnsOnFrontend">
43+
<section name="ColumnOnFrontend">
44+
<element name="base" type="block" selector="(//div[@data-role='column'])[{{arg1}}]" parameterized="true"/>
3445
<element name="columnGroup" type="block" selector=".pagebuilder-column-group"/>
3546
<element name="allColumns" type="block" selector="(//div[@data-role='column'])"/>
3647
<element name="columnX" type="block" selector="[data-role=column]:nth-child({{arg1}})" parameterized="true"/>
@@ -69,5 +80,15 @@
6980
<element name="columnMargin" type="button" selector="[data-role='column']:first-child[style*='margin: 5px;']"/>
7081
<element name="columnPadding" type="button" selector="[data-role='column']:first-child[style*='padding: 5px;']"/>
7182
<element name="columnClass" type="button" selector="[data-role='column']:first-child.first-class.second-class.third-class"/>
83+
<!-- Background Configuration -->
84+
<element name="backgroundPosition" type="button" selector="(//div[@data-role='column'])[{{arg1}}][contains(@style,'background-position: {{arg2}};')]" parameterized="true"/>
85+
<element name="backgroundSize" type="button" selector="(//div[@data-role='column'])[{{arg1}}][contains(@style,'background-size: {{arg2}};')]" parameterized="true"/>
86+
<element name="backgroundRepeat" type="button" selector="(//div[@data-role='column'])[{{arg1}}][contains(@style,'background-repeat: {{arg2}};')]" parameterized="true"/>
87+
<element name="backgroundAttachment" type="button" selector="(//div[@data-role='column'])[{{arg1}}][contains(@style,'background-attachment: {{arg2}};')]" parameterized="true"/>
88+
<element name="backgroundColor" type="button" selector="(//div[@data-role='column'])[{{arg1}}][contains(@style,'background-color: {{arg2}};')]" parameterized="true"/>
89+
<element name="noBackgroundColor" type="button" selector="(//div[@data-role='column'])[{{arg1}}][not(contains(@style,'background-color:'))]" parameterized="true"/>
90+
<element name="backgroundImage" type="button" selector="(//div[@data-role='column'])[{{arg1}}][contains(@style,'background-image: url(') and contains(@style,'{{arg2}}')]" parameterized="true"/>
91+
<element name="noBackgroundImage" type="button" selector="(//div[@data-role='column'])[{{arg1}}][not(contains(@style,'background-image:'))]" parameterized="true"/>
92+
<element name="backgroundMobileImage" type="button" selector="(//div[@data-role='column'])[{{arg1}}][contains(@style,'background-image: url(') and contains(@style,'{{arg2}}')]" parameterized="true"/>
7293
</section>
7394
</sections>

0 commit comments

Comments
 (0)