Skip to content

Commit 3811e43

Browse files
committed
MC-3723: Advanced properties saving when invalid value is specified
- add invalid margins test
1 parent 3e43832 commit 3811e43

File tree

4 files changed

+199
-6
lines changed

4 files changed

+199
-6
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@
1919
<fillField selector="{{AdvancedForm.advancedMarginBottom}}" userInput="{{property.marginBottom}}" stepKey="fillMarginBottomField"/>
2020
<click selector="{{EditPanelForm.panelFieldLabel(property.section, property.fieldName, property.section, property.name)}}" stepKey="clickOnFieldLabel"/>
2121
</actionGroup>
22+
<actionGroup name="fillSlideOutPanelSingleFieldMarginsOrPadding">
23+
<arguments>
24+
<argument name="field" type="string"/>
25+
<argument name="value" type="string"/>
26+
</arguments>
27+
<waitForElement selector="{{AdvancedForm.advancedMarginsOrPaddingField(field)}}" stepKey="waitForElementVisible"/>
28+
<fillField selector="{{AdvancedForm.advancedMarginsOrPaddingField(field)}}" userInput="{{value}}" stepKey="fillFieldMarginOrPadding"/>
29+
</actionGroup>
30+
<actionGroup name="validateMarginsOrPaddingError">
31+
<arguments>
32+
<argument name="property"/>
33+
<argument name="errorMessage" type="string"/>
34+
</arguments>
35+
<waitForElementVisible selector="{{EditPanelForm.panelSectionError(property.section)}}" stepKey="waitForSectionChangedIcon"/>
36+
<see userInput="{{errorMessage}}" selector="{{AdvancedForm.advancedMarginAndPaddingErrorMessage}}" stepKey="waitForErrorMessage"/>
37+
</actionGroup>
2238
<actionGroup name="fillSlideOutPanelFieldPadding">
2339
<arguments>
2440
<argument name="property" defaultValue=""/>

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,14 +379,15 @@
379379
<data key="marginBottom">3</data>
380380
<data key="marginLeft">4</data>
381381
</entity>
382-
<entity name="PageBuilderMarginsPropertyInvalid" type="pagebuilder_margins_property">
382+
<entity name="PageBuilderMarginsProperty_NonNumeric" type="pagebuilder_margins_property">
383383
<data key="name">Margins and Padding</data>
384384
<data key="section">advanced</data>
385385
<data key="fieldName">margins_and_padding</data>
386386
<data key="marginTop">garbage</data>
387387
<data key="marginRight">garbage</data>
388388
<data key="marginBottom">garbage</data>
389389
<data key="marginLeft">garbage</data>
390+
<data key="errorMessage">Please enter a valid number in this field.</data>
390391
</entity>
391392
<entity name="PageBuilderMarginsPropertyRowDefault" type="pagebuilder_margins_property">
392393
<data key="name">Margins and Padding</data>
@@ -558,4 +559,15 @@
558559
<data key="paddingBottom">0</data>
559560
<data key="paddingLeft">0</data>
560561
</entity>
562+
<entity name="PageBuilderAdvancedMarginsAndPaddingBoundaryData" type="pagebuilder_advanced_margins_and_padding_property">
563+
<data key="name">Margins and Padding</data>
564+
<data key="section">advanced</data>
565+
<data key="fieldName">margins_and_padding</data>
566+
<data key="invalidString">garbage</data>
567+
<data key="invalidMin">-1</data>
568+
<data key="invalidMax">1000</data>
569+
<data key="invalidStringError">Please enter a valid number in this field.</data>
570+
<data key="invalidMinError">Please enter a value greater than or equal to 0.</data>
571+
<data key="invalidMaxError">Please enter a value less than or equal to 999.</data>
572+
</entity>
561573
</entities>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
<element name="marginNote" type="input" selector="//div[@data-index='margins_and_padding']//span[.='Margin']"/>
6363
<element name="paddingNote" type="input" selector="//div[@data-index='margins_and_padding']//span[.='Padding']"/>
6464
<element name="advancedMarginsAndPadding" type="input" selector="//input[@name='margins_and_padding']"/>
65+
<element name="advancedMarginsOrPaddingField" type="input" selector="//input[@name='{{arg1}}']" parameterized="true"/>
6566
<element name="advancedMarginTop" type="input" selector="//input[@name='marginTop']"/>
6667
<element name="advancedMarginRight" type="input" selector="//input[@name='marginRight']"/>
6768
<element name="advancedMarginBottom" type="input" selector="//input[@name='marginBottom']"/>
@@ -71,6 +72,7 @@
7172
<element name="advancedPaddingBottom" type="input" selector="//input[@name='paddingBottom']"/>
7273
<element name="advancedPaddingLeft" type="input" selector="//input[@name='paddingLeft']"/>
7374
<element name="advancedMarginAndPaddingPlaceholderText" type="input" selector="//input[@name='{{arg1}}' and @placeholder='{{arg2}}']" parameterized="true"/>
75+
<element name="advancedMarginAndPaddingErrorMessage" type="button" selector="//div[@data-index='margins_and_padding']/descendant::label[not(contains(@style,'display: none;'))][2]"/>
7476
</section>
7577
<section name="ColorPicker">
7678
<element name="panelEmptyColorSwatch" type="button" selector="//div[contains(@class,'_insert_form')]//div[@data-index='{{arg1}}']//div[contains(@class,'admin__field-control')]//input[@name='{{arg2}}']//..//div[contains(@class,'sp-clear-display')]" parameterized="true"/>

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

Lines changed: 168 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,20 +1739,183 @@
17391739
<argument name="index" value="3"/>
17401740
</actionGroup>
17411741
</test>
1742+
<test name="AdvancedConfigurationInvalidMargins">
1743+
<annotations>
1744+
<features value="PageBuilder"/>
1745+
<stories value="Advanced Configuration"/>
1746+
<title value="Invalid - Margins"/>
1747+
<description value="A user cannot add an invalid value for margins"/>
1748+
<severity value="MAJOR"/>
1749+
<useCaseId value="MAGETWO-83415"/>
1750+
<testCaseId value="MC-4195"/>
1751+
<group value="pagebuilder"/>
1752+
<group value="pagebuilder-advancedConfig"/>
1753+
</annotations>
1754+
<before>
1755+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
1756+
<actionGroup ref="navigateToAPageWithPageBuilder" stepKey="navigateToAPageWithPageBuilder"/>
1757+
<actionGroup ref="switchToPageBuilderStage" stepKey="switchToPageBuilderStage"/>
1758+
</before>
1759+
<after>
1760+
<actionGroup ref="logout" stepKey="logout"/>
1761+
</after>
1762+
<actionGroup ref="addPageBuilderPageTitle" stepKey="enterPageTitle">
1763+
<argument name="contentType" value="PageBuilderTextContentType"/>
1764+
</actionGroup>
1765+
<actionGroup ref="expandPageBuilderPanelGroup" stepKey="expandPageBuilderPanelGroup">
1766+
<argument name="group" value="PageBuilderTextContentType"/>
1767+
</actionGroup>
1768+
<!-- Add Text to Stage -->
1769+
<comment userInput="Add Text to Stage" stepKey="commentAddTextToStage"/>
1770+
<actionGroup ref="dragContentTypeToContainer" stepKey="dragTextIntoStage">
1771+
<argument name="contentType" value="PageBuilderTextContentType"/>
1772+
<argument name="containerTargetType" value="PageBuilderRowContentType"/>
1773+
<argument name="containerTargetIndex" value="1"/>
1774+
<argument name="contentTypeIndex" value="1"/>
1775+
</actionGroup>
1776+
<click selector="{{PageBuilderPanel.searchPanel}}" stepKey="unFocusEditor"/>
1777+
<actionGroup ref="openPageBuilderEditPanelByIndex" stepKey="openEditMenuOnStage">
1778+
<argument name="contentType" value="PageBuilderTextContentType"/>
1779+
<argument name="contentTypeIndex" value="1"/>
1780+
</actionGroup>
1781+
<actionGroup ref="addTextToTinyMCE" stepKey="enterText">
1782+
<argument name="property" value="PageBuilderTextProperty"/>
1783+
</actionGroup>
1784+
<!-- Add Invalid Margin: NonNumeric - Margin Top -->
1785+
<comment userInput="Add Invalid Margin: NonNumeric - Margin Top" stepKey="commentNonNumericMarginTop"/>
1786+
<actionGroup ref="fillSlideOutPanelSingleFieldMarginsOrPadding" stepKey="fillNonNumericMarginTop">
1787+
<argument name="field" value="marginTop"/>
1788+
<argument name="value" value="{{PageBuilderAdvancedMarginsAndPaddingBoundaryData.invalidString}}"/>
1789+
</actionGroup>
1790+
<actionGroup ref="validateMarginsOrPaddingError" stepKey="validateErrorNonNumericMarginTop">
1791+
<argument name="property" value="PageBuilderAdvancedMarginsAndPaddingBoundaryData"/>
1792+
<argument name="errorMessage" value="{{PageBuilderAdvancedMarginsAndPaddingBoundaryData.invalidStringError}}"/>
1793+
</actionGroup>
1794+
<actionGroup ref="fillSlideOutPanelSingleFieldMarginsOrPadding" stepKey="clearNonNumericMarginTop">
1795+
<argument name="field" value="marginTop"/>
1796+
<argument name="value" value=""/>
1797+
</actionGroup>
1798+
<!-- Add Invalid Margin: NonNumeric - Margin Right -->
1799+
<comment userInput="Add Invalid Margin: NonNumeric - Margin Right" stepKey="commentNonNumericMarginRight"/>
1800+
<actionGroup ref="fillSlideOutPanelSingleFieldMarginsOrPadding" stepKey="fillNonNumericMarginRight">
1801+
<argument name="field" value="marginRight"/>
1802+
<argument name="value" value="{{PageBuilderAdvancedMarginsAndPaddingBoundaryData.invalidString}}"/>
1803+
</actionGroup>
1804+
<actionGroup ref="validateMarginsOrPaddingError" stepKey="validateErrorNonNumericMarginRight">
1805+
<argument name="property" value="PageBuilderAdvancedMarginsAndPaddingBoundaryData"/>
1806+
<argument name="errorMessage" value="{{PageBuilderAdvancedMarginsAndPaddingBoundaryData.invalidStringError}}"/>
1807+
</actionGroup>
1808+
<actionGroup ref="fillSlideOutPanelSingleFieldMarginsOrPadding" stepKey="clearNonNumericMarginRight">
1809+
<argument name="field" value="marginRight"/>
1810+
<argument name="value" value=""/>
1811+
</actionGroup>
1812+
<!-- Add Invalid Margin: NonNumeric - Margin Bottom -->
1813+
<comment userInput="Add Invalid Margin: NonNumeric - Margin Bottom" stepKey="commentNonNumericMarginBottom"/>
1814+
<actionGroup ref="fillSlideOutPanelSingleFieldMarginsOrPadding" stepKey="fillNonNumericMarginBottom">
1815+
<argument name="field" value="marginBottom"/>
1816+
<argument name="value" value="{{PageBuilderAdvancedMarginsAndPaddingBoundaryData.invalidString}}"/>
1817+
</actionGroup>
1818+
<actionGroup ref="validateMarginsOrPaddingError" stepKey="validateErrorNonNumericMarginBottom">
1819+
<argument name="property" value="PageBuilderAdvancedMarginsAndPaddingBoundaryData"/>
1820+
<argument name="errorMessage" value="{{PageBuilderAdvancedMarginsAndPaddingBoundaryData.invalidStringError}}"/>
1821+
</actionGroup>
1822+
<actionGroup ref="fillSlideOutPanelSingleFieldMarginsOrPadding" stepKey="clearNonNumericMarginBottom">
1823+
<argument name="field" value="marginBottom"/>
1824+
<argument name="value" value=""/>
1825+
</actionGroup>
1826+
<!-- Add Invalid Margin: NonNumeric - Margin Left -->
1827+
<comment userInput="Add Invalid Margin: NonNumeric - Margin Left" stepKey="commentNonNumericMarginLeft"/>
1828+
<actionGroup ref="fillSlideOutPanelSingleFieldMarginsOrPadding" stepKey="fillNonNumericMarginLeft">
1829+
<argument name="field" value="marginLeft"/>
1830+
<argument name="value" value="{{PageBuilderAdvancedMarginsAndPaddingBoundaryData.invalidString}}"/>
1831+
</actionGroup>
1832+
<actionGroup ref="validateMarginsOrPaddingError" stepKey="validateErrorNonNumericMarginLeft">
1833+
<argument name="property" value="PageBuilderAdvancedMarginsAndPaddingBoundaryData"/>
1834+
<argument name="errorMessage" value="{{PageBuilderAdvancedMarginsAndPaddingBoundaryData.invalidStringError}}"/>
1835+
</actionGroup>
1836+
<actionGroup ref="fillSlideOutPanelSingleFieldMarginsOrPadding" stepKey="clearNonNumericMarginLeft">
1837+
<argument name="field" value="marginLeft"/>
1838+
<argument name="value" value=""/>
1839+
</actionGroup>
1840+
<!-- Add Invalid Margin: Invalid Min - Margin Top -->
1841+
<comment userInput="Add Invalid Margin: Invalid Min - Margin Top" stepKey="commentInvalidMinMarginTop"/>
1842+
<actionGroup ref="fillSlideOutPanelSingleFieldMarginsOrPadding" stepKey="fillInvalidMinMarginTop">
1843+
<argument name="field" value="marginTop"/>
1844+
<argument name="value" value="{{PageBuilderAdvancedMarginsAndPaddingBoundaryData.invalidMin}}"/>
1845+
</actionGroup>
1846+
<actionGroup ref="validateMarginsOrPaddingError" stepKey="validateErrorInvalidMinMarginTop">
1847+
<argument name="property" value="PageBuilderAdvancedMarginsAndPaddingBoundaryData"/>
1848+
<argument name="errorMessage" value="{{PageBuilderAdvancedMarginsAndPaddingBoundaryData.invalidMinError}}"/>
1849+
</actionGroup>
1850+
<actionGroup ref="fillSlideOutPanelSingleFieldMarginsOrPadding" stepKey="clearInvalidMinMarginTop">
1851+
<argument name="field" value="marginTop"/>
1852+
<argument name="value" value=""/>
1853+
</actionGroup>
1854+
<!-- Add Invalid Margin: Invalid Min - Margin Right -->
1855+
<comment userInput="Add Invalid Margin: Invalid Min - Margin Right" stepKey="commentInvalidMinMarginRight"/>
1856+
<actionGroup ref="fillSlideOutPanelSingleFieldMarginsOrPadding" stepKey="fillInvalidMinMarginRight">
1857+
<argument name="field" value="marginRight"/>
1858+
<argument name="value" value="{{PageBuilderAdvancedMarginsAndPaddingBoundaryData.invalidMin}}"/>
1859+
</actionGroup>
1860+
<actionGroup ref="validateMarginsOrPaddingError" stepKey="validateErrorInvalidMinMarginRight">
1861+
<argument name="property" value="PageBuilderAdvancedMarginsAndPaddingBoundaryData"/>
1862+
<argument name="errorMessage" value="{{PageBuilderAdvancedMarginsAndPaddingBoundaryData.invalidMinError}}"/>
1863+
</actionGroup>
1864+
<actionGroup ref="fillSlideOutPanelSingleFieldMarginsOrPadding" stepKey="clearInvalidMinMarginRight">
1865+
<argument name="field" value="marginRight"/>
1866+
<argument name="value" value=""/>
1867+
</actionGroup>
1868+
<!-- Add Invalid Margin: Invalid Min - Margin Bottom -->
1869+
<comment userInput="Add Invalid Margin: Invalid Min - Margin Bottom" stepKey="commentInvalidMinMarginBottom"/>
1870+
<actionGroup ref="fillSlideOutPanelSingleFieldMarginsOrPadding" stepKey="fillInvalidMinMarginBottom">
1871+
<argument name="field" value="marginBottom"/>
1872+
<argument name="value" value="{{PageBuilderAdvancedMarginsAndPaddingBoundaryData.invalidMin}}"/>
1873+
</actionGroup>
1874+
<actionGroup ref="validateMarginsOrPaddingError" stepKey="validateErrorInvalidMinMarginBottom">
1875+
<argument name="property" value="PageBuilderAdvancedMarginsAndPaddingBoundaryData"/>
1876+
<argument name="errorMessage" value="{{PageBuilderAdvancedMarginsAndPaddingBoundaryData.invalidMinError}}"/>
1877+
</actionGroup>
1878+
<actionGroup ref="fillSlideOutPanelSingleFieldMarginsOrPadding" stepKey="clearInvalidMinMarginBottom">
1879+
<argument name="field" value="marginBottom"/>
1880+
<argument name="value" value=""/>
1881+
</actionGroup>
1882+
<!-- Add Invalid Margin: Invalid Min - Margin Left -->
1883+
<comment userInput="Add Invalid Margin: Invalid Min - Margin Left" stepKey="commentInvalidMinMarginLeft"/>
1884+
<actionGroup ref="fillSlideOutPanelSingleFieldMarginsOrPadding" stepKey="fillInvalidMinMarginLeft">
1885+
<argument name="field" value="marginLeft"/>
1886+
<argument name="value" value="{{PageBuilderAdvancedMarginsAndPaddingBoundaryData.invalidMin}}"/>
1887+
</actionGroup>
1888+
<actionGroup ref="validateMarginsOrPaddingError" stepKey="validateErrorInvalidMinMarginLeft">
1889+
<argument name="property" value="PageBuilderAdvancedMarginsAndPaddingBoundaryData"/>
1890+
<argument name="errorMessage" value="{{PageBuilderAdvancedMarginsAndPaddingBoundaryData.invalidMinError}}"/>
1891+
</actionGroup>
1892+
<actionGroup ref="fillSlideOutPanelSingleFieldMarginsOrPadding" stepKey="clearInvalidMinMarginLeft">
1893+
<argument name="field" value="marginLeft"/>
1894+
<argument name="value" value=""/>
1895+
</actionGroup>
1896+
<!-- User can recover after invalid input -->
1897+
<comment userInput="User can recover after invalid input" stepKey="commentCanRecover"/>
1898+
<actionGroup ref="fillSlideOutPanelFieldMargins" stepKey="enterMargins">
1899+
<argument name="property" value="PageBuilderMarginsPropertyDefault"/>
1900+
</actionGroup>
1901+
<actionGroup ref="saveEditPanelSettings" stepKey="saveEditPanelSettings"/>
1902+
<actionGroup ref="validateAdvancedStyleWithNoAlignment" stepKey="validateStage">
1903+
<argument name="page" value="TextOnStage"/>
1904+
<argument name="margin" value="PageBuilderMarginsPropertyDefault"/>
1905+
<argument name="index" value="1"/>
1906+
</actionGroup>
1907+
</test>
17421908
<test name="AdvancedConfigurationFunctionalMargins">
17431909
<annotations>
17441910
<features value="PageBuilder"/>
17451911
<stories value="Advanced Configuration"/>
17461912
<title value="Functional - Margins"/>
17471913
<description value="Tests that the Margin attributes functions as expected on Stage and Storefront for Text"/>
1748-
<severity value="CRITICAL"/>
1914+
<severity value="MAJOR"/>
17491915
<useCaseId value="MAGETWO-83415"/>
17501916
<testCaseId value="MC-2606"/>
17511917
<group value="pagebuilder"/>
17521918
<group value="pagebuilder-advancedConfig"/>
1753-
<skip>
1754-
<issueId value="MC-3723"/>
1755-
</skip>
17561919
</annotations>
17571920
<before>
17581921
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
@@ -1879,7 +2042,7 @@
18792042
<argument name="property" value="PageBuilderTextProperty"/>
18802043
</actionGroup>
18812044
<actionGroup ref="fillSlideOutPanelFieldMargins" stepKey="enterMargins5">
1882-
<argument name="property" value="PageBuilderMarginsPropertyInvalid"/>
2045+
<argument name="property" value="PageBuilderMarginsProperty_NonNumeric"/>
18832046
</actionGroup>
18842047
<actionGroup ref="saveEditPanelSettings" stepKey="saveEditPanelSettings5"/>
18852048
<!-- Stage: Check Margins: Empty -->

0 commit comments

Comments
 (0)