Skip to content

Commit 6c7a5d4

Browse files
added functional test for bundle product validation
1 parent e224442 commit 6c7a5d4

5 files changed

+119
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertStorefrontBundleValidationCountActionGroup">
12+
<annotations>
13+
<description>Check if it exists validation message box on page and their number</description>
14+
</annotations>
15+
16+
<waitForPageLoad stepKey="waitForPageLoad"/>
17+
<seeElement selector="{{StorefrontBundledSection.validationMessageBox}}" stepKey="seeErrorBox"/>
18+
<seeNumberOfElements selector="{{StorefrontBundledSection.validationMessageBox}}" userInput="1" stepKey="seeOneErrorBox"/>
19+
</actionGroup>
20+
</actionGroups>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertStorefrontBundleValidationMessageActionGroup">
12+
<annotations>
13+
<description>Check error message in validation message box</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="message" type="string"/>
17+
</arguments>
18+
19+
<waitForPageLoad stepKey="waitForPageLoad"/>
20+
<see selector="{{StorefrontBundledSection.validationMessageBox}}" userInput="{{message}}" stepKey="seeErrorHoldMessage"/>
21+
</actionGroup>
22+
</actionGroups>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontAddToTheCartButtonActionGroup">
12+
<annotations>
13+
<description>Clicks 'Add to Cart' on a Storefront Bundled Product page.</description>
14+
</annotations>
15+
16+
<waitForPageLoad stepKey="waitForPageLoad"/>
17+
<waitForElementVisible selector="{{StorefrontBundleProductActionSection.addToCartButton}}" stepKey="waitForAddToCartButton"/>
18+
<click selector="{{StorefrontBundleProductActionSection.addToCartButton}}" stepKey="clickOnAddToCartButton"/>
19+
</actionGroup>
20+
</actionGroups>

app/code/Magento/Bundle/Test/Mftf/Section/StorefrontBundledSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@
3838
<element name="currencyTrigger" type="select" selector="#switcher-currency-trigger" timeout="30"/>
3939
<element name="currency" type="select" selector="//a[text()='{{arg}}']" parameterized="true"/>
4040
<element name="multiSelectOption" type="select" selector="//div[@class='field option required']//select"/>
41+
<element name="validationMessageBox" type="block" selector="#validation-message-box"/>
4142
</section>
4243
</sections>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontBundleCheckBoxOptionValidationTest">
12+
<annotations>
13+
<features value="Bundle"/>
14+
<stories value="Bundle product validation before add to cart"/>
15+
<title value="Customer should be able to see only one validation message for checkbox option group"/>
16+
<description value="Customer should be able to see only one validation message for checkbox option group"/>
17+
<severity value="MINOR"/>
18+
<group value="Bundle"/>
19+
</annotations>
20+
<before>
21+
<createData entity="ApiProductWithDescription" stepKey="simpleProduct1" before="bundleProduct"/>
22+
<createData entity="ApiProductWithDescription" stepKey="simpleProduct2" after="simpleProduct1"/>
23+
<createData entity="ApiBundleProduct" stepKey="bundleProduct"/>
24+
<createData entity="CheckboxOption" stepKey="checkboxBundleOption">
25+
<requiredEntity createDataKey="bundleProduct"/>
26+
</createData>
27+
<createData entity="ApiBundleLink" stepKey="createBundleLink1">
28+
<requiredEntity createDataKey="bundleProduct"/>
29+
<requiredEntity createDataKey="checkboxBundleOption"/>
30+
<requiredEntity createDataKey="simpleProduct1"/>
31+
<field key="qty">2</field>
32+
</createData>
33+
<createData entity="ApiBundleLink" stepKey="createBundleLink2">
34+
<requiredEntity createDataKey="bundleProduct"/>
35+
<requiredEntity createDataKey="checkboxBundleOption"/>
36+
<requiredEntity createDataKey="simpleProduct2"/>
37+
<field key="qty">4</field>
38+
</createData>
39+
<magentoCLI command="indexer:reindex" arguments="cataloginventory_stock" stepKey="reindex"/>
40+
</before>
41+
<after>
42+
<deleteData createDataKey="bundleProduct" stepKey="deleteBundleProduct"/>
43+
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
44+
<deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/>
45+
</after>
46+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductStorefront">
47+
<argument name="productUrl" value="$$bundleProduct.custom_attributes[url_key]$$"/>
48+
</actionGroup>
49+
<actionGroup ref="StorefrontSelectCustomizeAndAddToTheCartButtonActionGroup" stepKey="customizeBundleProduct"/>
50+
<actionGroup ref="StorefrontAddToTheCartButtonActionGroup" stepKey="addToCartBundleProduct"/>
51+
<actionGroup ref="AssertStorefrontBundleValidationCountActionGroup" stepKey="assertBundleValidationCount"/>
52+
<actionGroup ref="AssertStorefrontBundleValidationMessageActionGroup" stepKey="assertBundleValidationMessage">
53+
<argument name="message" value="Please select one of the options."/>
54+
</actionGroup>
55+
</test>
56+
</tests>

0 commit comments

Comments
 (0)