Skip to content

Commit b946355

Browse files
committed
Merge branch 'MC-4280-block-vertical-align-row' into cms-team-1-delivery
2 parents 0a7e189 + ba4c138 commit b946355

File tree

5 files changed

+122
-1
lines changed

5 files changed

+122
-1
lines changed

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,29 @@
3636
<seeElement selector="{{BlockOnStage.title(index,block.title)}}" stepKey="seeOptionMenuTitle"/>
3737
<see selector="{{BlockOnStage.content(index)}}" userInput="{{block.content}}" stepKey="seeBlockContentOnStage"/>
3838
</actionGroup>
39+
<actionGroup name="verifyVerticalAlignmentBottomInBlock">
40+
<arguments>
41+
<argument name="block" defaultValue="BlockOnStorefront"/>
42+
<argument name="container"/>
43+
<argument name="content"/>
44+
<argument name="minHeight"/>
45+
<argument name="padding"/>
46+
<argument name="index" defaultValue="1" type="string"/>
47+
<!-- Remove storefrontBugOffset when MC-5079 is resolved -->
48+
<argument name="storefrontBugOffset" defaultValue="0" type="string"/>
49+
</arguments>
50+
<executeJS function="return document.querySelectorAll('{{block.baseCSS}} {{container.baseCSS}}')[{{index}}-1].clientHeight;" stepKey="containerHeight"/>
51+
<executeJS function="return {$containerHeight}-{{storefrontBugOffset}}" stepKey="minusBugOffset"/>
52+
<assertGreaterThanOrEqual stepKey="assertContainerHeightGreaterThanOrEqualMinHeight">
53+
<expectedResult type="string">{{minHeight}}</expectedResult>
54+
<actualResult type="variable">minusBugOffset</actualResult>
55+
</assertGreaterThanOrEqual>
56+
<executeJS function="return document.querySelectorAll('{{block.baseCSS}} {{container.baseCSS}}')[{{index}}-1].getBoundingClientRect().bottom-{{padding.paddingBottom}}" stepKey="containerBottomPositionMinusPadding"/>
57+
<executeJS function="return document.querySelectorAll('{{block.baseCSS}} {{content.baseCSS}}')[{{index}}-1].getBoundingClientRect().bottom" stepKey="contentBottomPosition"/>
58+
<executeJS function="return Math.round(({$containerBottomPositionMinusPadding}/{$contentBottomPosition})*100)/100" stepKey="bottomPositionRatio"/>
59+
<assertEquals stepKey="assertBottomPositionRatio">
60+
<expectedResult type="int">1</expectedResult>
61+
<actualResult type="variable">bottomPositionRatio</actualResult>
62+
</assertEquals>
63+
</actionGroup>
3964
</actionGroups>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@
4343
<element name="selectBlockBtn" type="button" selector="(//div[contains(@class,'pagebuilder-block')]//button/span[text()='Select Block'])"/>
4444
</section>
4545
<section name="BlockOnStorefront">
46+
<element name="ancestor" type="text" selector="[ancestor::div[@data-role='block']]"/>
4647
<element name="html" type="text" selector="(//div[@data-role='html'])[{{arg1}}]//a[contains(@class,'pagebuilder-button-primary')]" parameterized="true"/>
4748
<element name="base" type="text" selector="(//div[@data-role='block'])[{{arg1}}]" parameterized="true"/>
49+
<element name="baseCSS" type="text" selector="[data-role=block]"/>
4850
<element name="hidden" type="text" selector="(//div[@data-role='block'])[{{arg1}}][contains(@style, 'display: none')]" parameterized="true"/>
4951
<element name="notHidden" type="text" selector="(//div[@data-role='block'])[{{arg1}}][not(contains(@style, 'display: none'))]" parameterized="true"/>
5052
<element name="hr" type="button" selector="(//div[@data-role='block'])[{{arg1}}]/hr" parameterized="true"/>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
</section>
2929
<section name="HtmlOnStorefront">
3030
<element name="base" type="text" selector="(//div[@data-role='html'])[{{arg1}}]" parameterized="true"/>
31+
<element name="baseCSS" type="text" selector="[data-role=html]"/>
3132
<element name="hidden" type="text" selector="(//div[@data-role='html'])[{{arg1}}][contains(@style, 'display: none')]" parameterized="true"/>
3233
<element name="notHidden" type="text" selector="(//div[@data-role='html'])[{{arg1}}][not(contains(@style, 'display: none'))]" parameterized="true"/>
3334
<element name="html" type="text" selector="(//div[@data-role='html'])[{{arg1}}]{{arg2}}" parameterized="true"/>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,12 @@
7373
</section>
7474
<section name="RowOnStorefront">
7575
<element name="base" type="text" selector="(//div[@data-role='row'])[{{arg1}}]/div" parameterized="true"/>
76+
<element name="baseCSS" type="text" selector="[data-role=row]"/>
7677
<element name="baseJS" type="text" selector="document.querySelectorAll('[data-role=row] > div')[{{arg1}} - 1]" parameterized="true"/>
7778
<element name="hidden" type="text" selector="(//div[@data-role='row'])[{{arg1}}][contains(@style, 'display: none')]" parameterized="true"/>
7879
<element name="notHidden" type="text" selector="(//div[@data-role='row'])[{{arg1}}][not(contains(@style, 'display: none'))]" parameterized="true"/>
7980
<element name="computedWidth" type="text" selector="parseInt(window.getComputedStyle(document.querySelector('[data-role=row]')).width)"/>
80-
<element name="rowStyle" type="button" selector="(//div[@data-role='row'])[{{arg1}}]/div[contains(@style, '{{arg2}}')]" parameterized="true"/>
81+
<element name="rowStyle" type="button" selector="(//div[@data-role='row'])[{{arg1}}]//div[@data-element='inner'][contains(@style, '{{arg2}}')]" parameterized="true"/>
8182
<element name="rowWidthJS" type="text" selector="document.querySelectorAll('[data-appearance=\'{{arg1}}\']')[{{arg2}}].clientWidth" parameterized="true"/>
8283
<element name="rowH2ChildWidthJS" type="text" selector="document.querySelectorAll('div[data-appearance~=\'{{arg1}}\'] h2')[{{arg2}}].clientWidth" parameterized="true"/>
8384
<element name="appearance" type="text" selector="(//div[@data-role='row'])[{{arg1}}][@data-appearance='{{arg2}}']" parameterized="true"/>

app/code/Magento/PageBuilder/Test/Mftf/Test/AdminPageBuilderBlockTest.xml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,4 +1107,96 @@
11071107
<dontSeeElementInDOM selector="{{BlockOnStorefront.hidden('1')}}" stepKey="dontSeeHiddenElement"/>
11081108
<seeElement selector="{{BlockOnStorefront.base('1')}}" stepKey="waitForContentTypeVisible" />
11091109
</test>
1110+
<test name="BlockRowContentIsVerticallyAligned">
1111+
<annotations>
1112+
<features value="PageBuilder"/>
1113+
<stories value="Block"/>
1114+
<title value="Row Content Can Be Vertically Aligned In Block"/>
1115+
<description value="A user can vertically align row contents in a Block"/>
1116+
<severity value="CRITICAL"/>
1117+
<useCaseId value="MC-4280"/>
1118+
<testCaseId value="MC-5061"/>
1119+
<group value="pagebuilder"/>
1120+
<group value="pagebuilder-block"/>
1121+
<group value="pagebuilder-row"/>
1122+
</annotations>
1123+
<before>
1124+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin" />
1125+
<createData entity="_defaultBlock" stepKey="createPreReqBlock" />
1126+
<actionGroup ref="navigateToCreatedCMSBlockPage" stepKey="navigateToCreatedCMSBlockPage">
1127+
<argument name="CMSBlockPage" value="$$createPreReqBlock$$" />
1128+
</actionGroup>
1129+
</before>
1130+
<after>
1131+
<deleteData createDataKey="createPreReqBlock" stepKey="deletePreReqBlock" />
1132+
<actionGroup ref="logout" stepKey="logout"/>
1133+
</after>
1134+
<!-- Edit Block and configure Row - Vertical Align Bottom -->
1135+
<comment userInput="Edit Block and configure row vertical align bottom" stepKey="commentConfigureRowVerticalAlignBottom"/>
1136+
<actionGroup ref="openPageBuilderEditPanel" stepKey="openEditMenuOnStage">
1137+
<argument name="contentType" value="PageBuilderRowContentType"/>
1138+
</actionGroup>
1139+
<actionGroup ref="fillSlideOutPanelField" stepKey="enterMinHeightProperty">
1140+
<argument name="property" value="PageBuilderMinHeightProperty_500"/>
1141+
</actionGroup>
1142+
<actionGroup ref="chooseVisualSelectOption" stepKey="enterVerticalAlignmentBottomProperty">
1143+
<argument name="property" value="PageBuilderVerticalAlignmentPropertyBottom"/>
1144+
</actionGroup>
1145+
<actionGroup ref="saveEditPanelSettings" stepKey="saveEditPanelSettingsInBlock"/>
1146+
<click selector="{{CmsNewBlockBlockActionsSection.savePage}}" stepKey="saveBlock"/>
1147+
<waitForPageLoad time="30" stepKey="waitForStageToLoad"/>
1148+
<!-- Go to CMS Page and choose Block -->
1149+
<comment userInput="Go to CMS Page and choose Block" stepKey="commentGoToCMSPage"/>
1150+
<actionGroup ref="navigateToAPageWithPageBuilder" stepKey="navigateToAPageWithPageBuilder"/>
1151+
<actionGroup ref="switchToPageBuilderStage" stepKey="switchToPageBuilderStage"/>
1152+
<actionGroup ref="addPageBuilderPageTitle" stepKey="enterPageTitle1">
1153+
<argument name="contentType" value="PageBuilderBlockContentType"/>
1154+
</actionGroup>
1155+
<actionGroup ref="expandPageBuilderPanelGroup" stepKey="expandGroupAddContent">
1156+
<argument name="group" value="PageBuilderBlockContentType"/>
1157+
</actionGroup>
1158+
<actionGroup ref="dragContentTypeToStageAndExpectEditPanel" stepKey="dragBlockIntoStage">
1159+
<argument name="contentType" value="PageBuilderBlockContentType"/>
1160+
</actionGroup>
1161+
<actionGroup ref="searchBlockInGrid" stepKey="searchBlockInGrid">
1162+
<argument name="block" value="$$createPreReqBlock$$"/>
1163+
</actionGroup>
1164+
<actionGroup ref="saveEditPanelSettings" stepKey="saveEditPanelSettings"/>
1165+
<!-- Verify Vertical Alignment On Stage - Before Save -->
1166+
<comment userInput="Verify min height and vertical alignment on stage before save" stepKey="commentVerifyMinHeightAndVerticalAlignmentOnStageBeforeSave"/>
1167+
<seeElement selector="({{RowOnStorefront.rowStyle('1', PageBuilderMinHeightProperty_500.style)}}{{BlockOnStorefront.ancestor}})[1]" stepKey="seeRowMinHeightBeforeSave"/>
1168+
<seeElement selector="({{RowOnStorefront.rowStyle('1', PageBuilderVerticalAlignmentPropertyBottom.style)}}{{BlockOnStorefront.ancestor}})[1]" stepKey="seeRowVerticalAlignmentBottomBeforeSave"/>
1169+
<actionGroup ref="verifyVerticalAlignmentBottomInBlock" stepKey="verifyBottomAlignmentBeforeSave">
1170+
<argument name="container" value="RowOnStorefront"/>
1171+
<argument name="content" value="HtmlOnStorefront"/>
1172+
<argument name="padding" value="PageBuilderPaddingProperty10"/>
1173+
<argument name="minHeight" value="PageBuilderMinHeightProperty_500.value"/>
1174+
</actionGroup>
1175+
<actionGroup ref="saveAndContinueEditCmsPage" stepKey="saveAndContinueEditCmsPage"/>
1176+
<actionGroup ref="switchToPageBuilderStage" stepKey="switchToPageBuilderStageAfterSave"/>
1177+
<!-- Verify Vertical Alignment On Stage - After Save -->
1178+
<comment userInput="Verify min height and vertical alignment on stage after save" stepKey="commentVerifyMinHeightAndVerticalAlignmentOnStageAfterSave"/>
1179+
<seeElement selector="({{RowOnStorefront.rowStyle('1', PageBuilderMinHeightProperty_500.style)}}{{BlockOnStorefront.ancestor}})[1]" stepKey="seeRowMinHeightAfterSave"/>
1180+
<seeElement selector="({{RowOnStorefront.rowStyle('1', PageBuilderVerticalAlignmentPropertyBottom.style)}}{{BlockOnStorefront.ancestor}})[1]" stepKey="seeRowVerticalAlignmentBottomAfterSave"/>
1181+
<actionGroup ref="verifyVerticalAlignmentBottomInBlock" stepKey="verifyBottomAlignmentAfterSave">
1182+
<argument name="container" value="RowOnStorefront"/>
1183+
<argument name="content" value="HtmlOnStorefront"/>
1184+
<argument name="padding" value="PageBuilderPaddingProperty10"/>
1185+
<argument name="minHeight" value="PageBuilderMinHeightProperty_500.value"/>
1186+
</actionGroup>
1187+
<!-- Verify Min Height and Vertical Alignment In Storefront -->
1188+
<comment userInput="Verify min height and vertical alignment in storefront" stepKey="commentVerifyMinHeightAndVerticalAlignmentInStorefront"/>
1189+
<actionGroup ref="navigateToStoreFront" stepKey="navigateToStoreFront">
1190+
<argument name="contentType" value="PageBuilderBlockContentType"/>
1191+
</actionGroup>
1192+
<seeElement selector="({{RowOnStorefront.rowStyle('1', PageBuilderMinHeightProperty_500.style)}}{{BlockOnStorefront.ancestor}})[1]" stepKey="seeRowMinHeightStorefront"/>
1193+
<seeElement selector="({{RowOnStorefront.rowStyle('1', PageBuilderVerticalAlignmentPropertyBottom.style)}}{{BlockOnStorefront.ancestor}})[1]" stepKey="seeRowVerticalAlignmentBottomStorefront"/>
1194+
<actionGroup ref="verifyVerticalAlignmentBottomInBlock" stepKey="verifyBottomAlignmentStorefront">
1195+
<argument name="container" value="RowOnStorefront"/>
1196+
<argument name="content" value="HtmlOnStorefront"/>
1197+
<argument name="padding" value="PageBuilderPaddingProperty10"/>
1198+
<argument name="minHeight" value="PageBuilderMinHeightProperty_500.value"/>
1199+
<argument name="storefrontBugOffset" value="20"/>
1200+
</actionGroup>
1201+
</test>
11101202
</tests>

0 commit comments

Comments
 (0)