Skip to content

Commit 4ecf177

Browse files
committed
MC-13769: Add Missing P0-P1 MFTF Tests For PageBuilder On CMS Block - Render Content Through Block
- Fixing tests rendered through block (block, html, video, map, dynamic block) - Updating/Adding supporting data, sections, action groups
1 parent fea0398 commit 4ecf177

File tree

4 files changed

+89
-72
lines changed

4 files changed

+89
-72
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,4 +424,19 @@
424424
<actionGroup name="validateAdvancedStyleWithNoAlignmentMapWithErrorOverlay" extends="validateAdvancedStyleWithNoAlignmentNotVisible">
425425
<waitForElementVisible selector="{{page.warningMessageLink(index)}}" stepKey="dontSeeElement"/>
426426
</actionGroup>
427+
<actionGroup name="validateMapHeight">
428+
<arguments>
429+
<argument name="section" defaultValue="MapOnStage"/>
430+
<argument name="height" defaultValue="PageBuilderMapHeightDefaultProperty"/>
431+
<argument name="index" defaultValue="1" type="string"/>
432+
<argument name="acceptableOffset" defaultValue="2" type="string"/>
433+
</arguments>
434+
<seeElement selector="{{section.height(index, height.value)}}" stepKey="seeMapHeight"/>
435+
<executeJS function="return document.querySelectorAll('{{section.baseCSS}}')[{{index}}-1].getBoundingClientRect().height" stepKey="actualMapHeight"/>
436+
<executeJS function="return Math.abs({$actualMapHeight}-{{height.value}})" stepKey="mapHeightDifference"/>
437+
<assertLessThanOrEqual stepKey="assertMapHeightAcceptable">
438+
<expectedResult type="int">{{acceptableOffset}}</expectedResult>
439+
<actualResult type="variable">mapHeightDifference</actualResult>
440+
</assertLessThanOrEqual>
441+
</actionGroup>
427442
</actionGroups>

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
<argument name="index" defaultValue="1" type="string"/>
1515
<argument name="url" defaultValue=""/>
1616
<argument name="width" defaultValue=""/>
17+
<!-- This is 2 because the width and the height may both have fractions that could round by a maximum of 1 for each which makes the maximum 2-->
18+
<argument name="acceptableOffset" defaultValue="2" type="string"/>
1719
</arguments>
1820
<waitForPageLoad stepKey="waitForPageLoad"/>
1921
<waitForElementVisible selector="{{page.base(index)}}" stepKey="waitForElement"/>
@@ -24,8 +26,7 @@
2426
<executeJS function="return window.actualHeight = parseInt(getComputedStyle(document.evaluate(&quot;{{page.iframe(index)}}&quot;,document.body).iterateNext()).height)" stepKey="actualHeight"/>
2527
<executeJS function="return Math.abs(window.calculatedHeight - window.actualHeight)" stepKey="ratioDifference"/>
2628
<assertLessThanOrEqual stepKey="assertRatio">
27-
<!-- This is 2 because the width and the height may both have fractions that could round by a maximum of 1 for each which makes the maximum 2-->
28-
<expectedResult type="int">2</expectedResult>
29+
<expectedResult type="int">{{acceptableOffset}}</expectedResult>
2930
<actualResult type="variable">ratioDifference</actualResult>
3031
</assertLessThanOrEqual>
3132
</actionGroup>
@@ -34,6 +35,8 @@
3435
<argument name="page" defaultValue=""/>
3536
<argument name="index" defaultValue="1" type="string"/>
3637
<argument name="url" defaultValue=""/>
38+
<!-- This is 2 because the width and the height may both have fractions that could round by a maximum of 1 for each which makes the maximum 2-->
39+
<argument name="acceptableOffset" defaultValue="2" type="string"/>
3740
</arguments>
3841
<waitForElementVisible selector="{{page.base(index)}}" stepKey="waitForElement"/>
3942
<waitForElementVisible selector="{{page.source(index, url.renderedValue)}}" stepKey="waitForUrl"/>
@@ -43,8 +46,7 @@
4346
<executeJS function="return window.actualHeight = parseInt(getComputedStyle(document.evaluate(&quot;{{page.iframe(index)}}&quot;,document.body).iterateNext()).height)" stepKey="actualHeight"/>
4447
<executeJS function="return Math.abs(window.calculatedHeight - window.actualHeight)" stepKey="ratioDifference"/>
4548
<assertLessThanOrEqual stepKey="assertRatio">
46-
<!-- This is 2 because the width and the height may both have fractions that could round by a maximum of 1 for each which makes the maximum 2-->
47-
<expectedResult type="int">2</expectedResult>
49+
<expectedResult type="int">{{acceptableOffset}}</expectedResult>
4850
<actualResult type="variable">ratioDifference</actualResult>
4951
</assertLessThanOrEqual>
5052
</actionGroup>

app/code/Magento/PageBuilder/Test/Mftf/Data/HtmlData.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<data key="value">&lt;a class=&quot;pagebuilder-button-primary&quot; onclick=&quot;location.href = 'https://google.com';&quot;&gt;&lt;span&gt;Test Button&lt;/span&gt;&lt;/a&gt;</data>
2525
<data key="selector">[contains(text(), 'a class="pagebuilder-button-primary"')]</data>
2626
<data key="selectorOnFrontend">//a[@class='pagebuilder-button-primary' and @onclick=&quot;location.href = 'https://google.com';&quot;]//span[.='Test Button']</data>
27+
<data key="url">https://www.google.com/</data>
2728
</entity>
2829
<entity name="PageBuilderHtmlPropertyButtonDuplicate" type="pagebuilder_html_property">
2930
<data key="name">HTML</data>

0 commit comments

Comments
 (0)