Skip to content

Commit 18d3e66

Browse files
authored
Merge pull request #126 from magento-obsessive-owls/cms-team-1-delivery
[CMS Team 1] Background Attributes, Hide Content
2 parents 3099e75 + 94a8507 commit 18d3e66

File tree

162 files changed

+6450
-2363
lines changed

Some content is hidden

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

162 files changed

+6450
-2363
lines changed

app/code/Magento/PageBuilder/Model/Stage/Config.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ class Config
8585
* @param \Magento\PageBuilder\Model\Wysiwyg\InlineEditingSupportedAdapterList $inlineEditingChecker
8686
* @param \Magento\PageBuilder\Model\WidgetInitializerConfig $widgetInitializerConfig
8787
* @param array $data
88+
*
89+
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
8890
*/
8991
public function __construct(
9092
\Magento\PageBuilder\Model\ConfigInterface $config,
@@ -161,22 +163,24 @@ private function getContentTypes()
161163
}
162164

163165
/**
164-
* Flatten the content type data
166+
* Flatten the content type
165167
*
166-
* @param $name
167-
* @param $contentType
168+
* @param string $name
169+
* @param array $contentType
168170
*
169171
* @return array
170172
*
171173
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
172174
*/
173-
private function flattenContentTypeData($name, $contentType)
175+
private function flattenContentTypeData(string $name, array $contentType)
174176
{
175177
return [
176178
'name' => $name,
177179
'label' => $contentType['label'],
178180
'icon' => $contentType['icon'],
179181
'form' => $contentType['form'],
182+
'is_hideable' =>
183+
isset($contentType['is_hideable']) && $contentType['is_hideable'] === 'false' ? false : true,
180184
'contentType' => '',
181185
'group' => $contentType['group'] ?? 'general',
182186
'fields' => $this->uiComponentConfig->getFields($contentType['form']),

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,44 @@
6363
<waitForElementVisible selector="{{section.backgroundRepeat(index, backgroundRepeat.styleValue)}}" stepKey="waitForBackgroundRepeat"/>
6464
<waitForElementVisible selector="{{section.backgroundAttachment(index, backgroundAttachment.value)}}" stepKey="waitForBackgroundAttachment"/>
6565
</actionGroup>
66+
<actionGroup name="validateBackgroundAttributes">
67+
<arguments>
68+
<argument name="section"/>
69+
<argument name="backgroundImage"/>
70+
<argument name="backgroundColor"/>
71+
<argument name="backgroundPosition" defaultValue="PageBuilderBackgroundPosition_Default"/>
72+
<argument name="backgroundSize" defaultValue="PageBuilderBackgroundSize_Default"/>
73+
<argument name="backgroundRepeat" defaultValue="PageBuilderBackgroundRepeat_Default"/>
74+
<argument name="backgroundAttachment" defaultValue="PageBuilderBackgroundAttachment_Default"/>
75+
<argument name="index" defaultValue="1" type="string"/>
76+
</arguments>
77+
<comment userInput="validateBackgroundAttributes" stepKey="comment"/>
78+
<waitForElementVisible selector="{{section.base(index)}}" stepKey="waitForBaseElement"/>
79+
<waitForElementVisible selector="{{section.backgroundColor(index, backgroundColor.rgb)}}" stepKey="waitForBackgroundColor"/>
80+
<waitForElementVisible selector="{{section.backgroundImage(index, backgroundImage.fileName)}}" stepKey="waitForBackgroundImage"/>
81+
<waitForElementVisible selector="{{section.backgroundPosition(index, backgroundPosition.styleValue)}}" stepKey="waitForBackgroundPosition"/>
82+
<waitForElementVisible selector="{{section.backgroundSize(index, backgroundSize.value)}}" stepKey="waitForBackgroundSize"/>
83+
<waitForElementVisible selector="{{section.backgroundRepeat(index, backgroundRepeat.styleValue)}}" stepKey="waitForBackgroundRepeat"/>
84+
<waitForElementVisible selector="{{section.backgroundAttachment(index, backgroundAttachment.value)}}" stepKey="waitForBackgroundAttachment"/>
85+
</actionGroup>
86+
<actionGroup name="validateMobileBackgroundAttributesWithNoImageOrColor">
87+
<arguments>
88+
<argument name="section"/>
89+
<argument name="mobileBackgroundPosition" defaultValue="PageBuilderBackgroundPosition_Default"/>
90+
<argument name="mobileBackgroundSize" defaultValue="PageBuilderBackgroundSize_Default"/>
91+
<argument name="mobileBackgroundRepeat" defaultValue="PageBuilderBackgroundRepeat_Default"/>
92+
<argument name="mobileBackgroundAttachment" defaultValue="PageBuilderBackgroundAttachment_Default"/>
93+
<argument name="index" defaultValue="1" type="string"/>
94+
</arguments>
95+
<comment userInput="validateMobileBackgroundAttributesWithNoImageOrColor" stepKey="comment"/>
96+
<waitForElementVisible selector="{{section.base(index)}}" stepKey="waitForBaseElement"/>
97+
<waitForElementVisible selector="{{section.noMobileBackgroundColor(index)}}" stepKey="waitForBackgroundColor"/>
98+
<waitForElementVisible selector="{{section.noMobileBackgroundImage(index)}}" stepKey="waitForBackgroundImage"/>
99+
<waitForElementVisible selector="{{section.mobileBackgroundPosition(index, mobileBackgroundPosition.styleValue)}}" stepKey="waitForBackgroundPosition"/>
100+
<waitForElementVisible selector="{{section.mobileBackgroundSize(index, mobileBackgroundSize.value)}}" stepKey="waitForBackgroundSize"/>
101+
<waitForElementVisible selector="{{section.mobileBackgroundRepeat(index, mobileBackgroundRepeat.styleValue)}}" stepKey="waitForBackgroundRepeat"/>
102+
<waitForElementVisible selector="{{section.mobileBackgroundAttachment(index, mobileBackgroundAttachment.value)}}" stepKey="waitForBackgroundAttachment"/>
103+
</actionGroup>
66104
<actionGroup name="validateMobileBackgroundAttributes">
67105
<arguments>
68106
<argument name="section"/>

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,9 @@
5151
<argument name="headingAlignment" defaultValue="PageBuilderHeadingAlignmentProperty_left"/>
5252
</arguments>
5353
<comment userInput="Click outside heading editable area" stepKey="commentClickOutside"/>
54-
<waitForPageLoad stepKey="waitForAnimation1" time="30"/>
55-
<seeElement selector="{{HeadingOnStage.headingTypeToolbar(index, headingType.toolbar)}}" stepKey="seeHeadingTypeToolbar"/>
56-
<seeElement selector="{{HeadingOnStage.headingTextAlignToolbar(index, headingAlignment.toolbar)}}" stepKey="seeHeadingAlignmentToolbar"/>
5754
<moveMouseOver selector="{{PageBuilderPanel.searchPanel}}" stepKey="moveMouseOutsideLiveEdit"/>
5855
<click selector="{{PageBuilderPanel.searchPanel}}" stepKey="clickOutsideLiveEdit"/>
59-
<waitForPageLoad stepKey="waitForAnimation2" time="30"/>
56+
<waitForPageLoad stepKey="waitForAnimation2"/>
6057
<dontSeeElement selector="{{HeadingOnStage.headingTypeToolbar(index, headingType.toolbar)}}" stepKey="dontSeeHeadingTypeToolbar"/>
6158
<dontSeeElement selector="{{HeadingOnStage.headingTextAlignToolbar(index, headingAlignment.toolbar)}}" stepKey="dontSeeHeadingAlignmentToolbar"/>
6259
</actionGroup>
@@ -111,7 +108,7 @@
111108
<argument name="borderWidth" defaultValue="PageBuilderAdvancedBorderWidthPropertyDefault"/>
112109
<argument name="index" defaultValue="1" type="string"/>
113110
</arguments>
114-
<waitForElementVisible selector="{{page.base(headingType.value, index)}}" stepKey="waitForElementVisible"/>
111+
<waitForElementVisible selector="{{page.baseByTagName(headingType.value, index)}}" stepKey="waitForElementVisible"/>
115112
<waitForElementVisible selector="{{page.noAlignment(headingType.value, index)}}" stepKey="waitForAlignmentVisible"/>
116113
<waitForElementVisible selector="{{page.border(headingType.value, index, border.value)}}" stepKey="waitForBorderVisible"/>
117114
<waitForElementVisible selector="{{page.noBorderColor(headingType.value, index)}}" stepKey="waitForBorderColorVisible"/>
@@ -135,7 +132,7 @@
135132
<argument name="padding" defaultValue="PageBuilderPaddingPropertyDefault"/>
136133
<argument name="index" defaultValue="1" type="string"/>
137134
</arguments>
138-
<waitForElementVisible selector="{{page.base(headingType.value, index)}}" stepKey="waitForElementVisible"/>
135+
<waitForElementVisible selector="{{page.baseByTagName(headingType.value, index)}}" stepKey="waitForElementVisible"/>
139136
<waitForElementVisible selector="{{page.alignment(headingType.value, index, alignment.value)}}" stepKey="waitForAlignmentVisible"/>
140137
<waitForElementVisible selector="{{page.border(headingType.value, index, border.value)}}" stepKey="waitForBorderVisible"/>
141138
<waitForElementVisible selector="{{page.borderColor(headingType.value, index, borderColor.rbg)}}" stepKey="waitForBorderColorVisible"/>
@@ -154,8 +151,8 @@
154151
<argument name="borderWidth" defaultValue="PageBuilderAdvancedBorderWidthPropertyDefault"/>
155152
<argument name="index" defaultValue="1" type="string"/>
156153
</arguments>
157-
<waitForElement selector="{{page.base(headingType.value, index)}}" stepKey="waitForElement"/>
158-
<dontSeeElement selector="{{page.base(headingType.value, index)}}" stepKey="dontSeeElement"/>
154+
<waitForElement selector="{{page.baseByTagName(headingType.value, index)}}" stepKey="waitForElement"/>
155+
<dontSeeElement selector="{{page.baseByTagName(headingType.value, index)}}" stepKey="dontSeeElement"/>
159156
<waitForElement selector="{{page.noAlignment(headingType.value, index)}}" stepKey="waitForAlignment"/>
160157
<dontSeeElement selector="{{page.noAlignment(headingType.value, index)}}" stepKey="dontSeeAlignment"/>
161158
<waitForElement selector="{{page.border(headingType.value, index, border.value)}}" stepKey="waitForBorder"/>

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,28 @@
3737
<waitForElementVisible selector="{{ImageOnConfigurationPanel.imageName(property.value)}}" stepKey="seeImageNameOnPreview"/>
3838
<waitForElementVisible selector="{{ImageOnConfigurationPanel.imageSource(property.fileName)}}" stepKey="seeMainImageSource"/>
3939
</actionGroup>
40+
<actionGroup name="validateImage">
41+
<arguments>
42+
<argument name="section"/>
43+
<argument name="pageNamePrefix" defaultValue="admin" type="string"/>
44+
<argument name="image"/>
45+
<argument name="index" defaultValue="1" type="string"/>
46+
</arguments>
47+
<comment userInput="validateImage" stepKey="comment"/>
48+
<waitForElementVisible selector="{{section.base(index)}}" stepKey="waitForBaseElement"/>
49+
<waitForElementVisible selector="{{section.imageSourceByIndex(index, image.fileName)}}" stepKey="waitForImage"/>
50+
<grabAttributeFrom selector="{{section.imageSourceByIndex(index, image.fileName)}}" userInput="src" stepKey="contentTypeSrc"/>
51+
<!-- Grab base URL -->
52+
<comment userInput="Grab base URL" stepKey="commentGrabBaseUrl"/>
53+
<executeJS function="return '{{pageNamePrefix}}'" stepKey="pageNamePrefix"/>
54+
<grabFromCurrentUrl regex="/(^.+(?=\/$pageNamePrefix))/" stepKey="baseURL"/>
55+
<!-- Convert all characters in string variables to regex friendly strings -->
56+
<comment userInput="Convert all characters in string variables to regex friendly strings" stepKey="commentConvert"/>
57+
<executeJS function="return '{$baseURL}'.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\\\^\\$\|]/g, '\\\\$&amp;')" stepKey="regexBaseURL"/>
58+
<executeJS function="return '{{image.path}}'.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\\\^\\$\|]/g, '\\\\$&amp;')" stepKey="regexFilePath"/>
59+
<assertRegExp stepKey="assertImageContainsFileInformation">
60+
<expectedResult type="string">/{$regexBaseURL}\/pub\/media.*{$regexFilePath}.*\/{{image.fileName}}(_\d+)?\.{{image.extension}}/</expectedResult>
61+
<actualResult type="variable">$contentTypeSrc</actualResult>
62+
</assertRegExp>
63+
</actionGroup>
4064
</actionGroups>

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,22 @@
5555
<waitForElementVisible time="10" selector="{{PageBuilderStage.contentTypeInStageByIndex(contentType.role, contentTypeIndex)}}" stepKey="waitForContentTypeInStage" />
5656
<waitForPageLoad stepKey="waitForToolbarsToLoad" time="30"/>
5757
</actionGroup>
58+
<actionGroup name="dragContentTypeToHiddenContainer">
59+
<arguments>
60+
<argument name="contentType"/>
61+
<argument name="contentTypeIndex" defaultValue="1" type="string"/>
62+
<argument name="containerTargetType"/>
63+
<argument name="containerTargetIndex" defaultValue="1" type="string"/>
64+
<argument name="offsetXCoordinate" defaultValue="null" type="string"/>
65+
<argument name="offsetYCoordinate" defaultValue="null" type="string"/>
66+
</arguments>
67+
<click selector="{{PageBuilderPanel.searchPanel}}" stepKey="lostFocus"/>
68+
<waitForElementVisible time="30" selector="{{PageBuilderPanel.draggableContentTypeInPanel(contentType.name)}}" stepKey="waitForContentTypeInPanel"/>
69+
<dragAndDrop selector1="{{PageBuilderPanel.draggableContentTypeInPanel(contentType.name)}}" selector2="{{PageBuilderStage.contentTypeContainer(containerTargetType.role, containerTargetIndex)}}" x="{{offsetXCoordinate}}" y="{{offsetYCoordinate}}" stepKey="dropContentTypeIntoStage"/>
70+
<waitForPageLoad stepKey="waitForAnimation" time="30"/>
71+
<waitForElementNotVisible time="10" selector="{{PageBuilderStage.contentTypeInStageByIndex(contentType.role, contentTypeIndex)}}" stepKey="waitForContentTypeNotOnStage" />
72+
<dontSeeElementInDOM selector="{{PageBuilderStage.contentTypeInStageByIndex(contentType.role, contentTypeIndex)}}" stepKey="dontSeeElementInContainer" />
73+
</actionGroup>
5874
<actionGroup name="dragContentTypeToContainerAndExpectEditPanel">
5975
<arguments>
6076
<argument name="contentType"/>
@@ -126,6 +142,7 @@
126142
<argument name="containerOffsetXCoordinate" defaultValue="null" type="string"/>
127143
<argument name="containerOffsetYCoordinate" defaultValue="null" type="string"/>
128144
</arguments>
145+
<comment userInput="moveContentTypeToContainer" stepKey="comment"/>
129146
<waitForElementVisible time="20" selector="{{PageBuilderStage.contentTypeInStageByIndex(contentType.role, contentTypeIndex)}}" stepKey="waitForContentTypeInStageVisible"/>
130147
<moveMouseOver selector="{{PageBuilderStage.contentTypeInStageByIndex(contentType.role, contentTypeIndex)}}" x="{{offsetXCoordinate}}" y="{{offsetYCoordinate}}" stepKey="onMouseOverContentTypeStage"/>
131148
<waitForPageLoad time="30" stepKey="waitForAnimation"/>
@@ -135,6 +152,13 @@
135152
<waitForPageLoad time="30" stepKey="waitForStageToLoad"/>
136153
<waitForElementVisible time="30" selector="{{PageBuilderStage.contentTypeInStageByIndex(contentType.role, contentTypeIndex)}}" stepKey="waitForContentTypeInStage"/>
137154
</actionGroup>
155+
<actionGroup name="cannotMoveContentTypeToContainer" extends="moveContentTypeToContainer">
156+
<arguments>
157+
<argument name="positionInContainer" defaultValue="1" type="string"/>
158+
</arguments>
159+
<comment userInput="cannotMoveContentTypeToContainer" stepKey="comment"/>
160+
<dontSeeElementInDOM selector="{{PageBuilderStage.contentTypeInsideContainerStage(containerTargetType.role, containerTargetIndex, positionInContainer, contentType.role, contentTypeIndex)}}" stepKey="dontSeeContentTypeInContainer" after="waitForContentTypeInStage"/>
161+
</actionGroup>
138162
<actionGroup name="dragContentTypeNextToExistingContentType">
139163
<arguments>
140164
<argument name="contentType" defaultValue=""/>

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@
88

99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="validateLayoutStylesNoHeight">
12+
<arguments>
13+
<argument name="page"/>
14+
<argument name="index" defaultValue="1" type="string"/>
15+
<argument name="verticalAlignContainer" defaultValue="PageBuilderVerticalAlignmentPropertyTop"/>
16+
</arguments>
17+
<waitForElement selector="{{page.container(index)}}" stepKey="waitForVerticalAlignContainer"/>
18+
<seeElement selector="{{page.noMinHeight(index)}}" stepKey="dontSeeStyle"/>
19+
<seeElement selector="{{page.containerStyle(index, verticalAlignContainer.style)}}" stepKey="seeVerticalAlignmentStyle"/>
20+
</actionGroup>
1121
<!-- Validate All Layout Styles -->
1222
<actionGroup name="validateLayoutStylesWithAllUpdated">
1323
<arguments>
@@ -16,7 +26,7 @@
1626
<argument name="minHeight" defaultValue="PageBuilderMinHeightProperty_Empty"/>
1727
<argument name="verticalAlignContainer" defaultValue="PageBuilderVerticalAlignmentPropertyCenter"/>
1828
</arguments>
19-
<waitForElementVisible selector="{{page.base(index)}}" stepKey="waitForRow"/>
29+
<waitForElementVisible selector="{{page.base(index)}}" stepKey="waitForContentType"/>
2030
<waitForElementVisible selector="{{page.minHeight(index, minHeight.value)}}" stepKey="waitForMinHeight"/>
2131
<waitForElementVisible selector="{{page.verticalAlignContainer(index, verticalAlignContainer.value)}}" stepKey="waitForVerticalAlignContainer"/>
2232
</actionGroup>

0 commit comments

Comments
 (0)