Skip to content

Commit f9d19ee

Browse files
committed
MFTF test refactor
1 parent 4ad1005 commit f9d19ee

File tree

3 files changed

+41
-18
lines changed

3 files changed

+41
-18
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2011 Adobe
5+
* All Rights Reserved.
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="StorefrontValidateThreeGroupedProductQtyErrorMessageActionGroup">
12+
<annotations>
13+
<description>Validates Child Products Quantities Input Error Messages are displaying</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="firstProductIndex" type="string" defaultValue="1"/>
17+
<argument name="secondProductIndex" type="string" defaultValue="2"/>
18+
<argument name="thirdProductIndex" type="string" defaultValue="3"/>
19+
</arguments>
20+
<dontSeeElement selector="{{StorefrontProductInfoMainSection.groupedProductsAssociatedProductQuantityMageError(firstProductIndex)}}" stepKey="checkingInputValidationErrorMessageForFirstProduct"/>
21+
<seeElement selector="{{StorefrontProductInfoMainSection.groupedProductsAssociatedProductQuantityMageError(secondProductIndex)}}" stepKey="checkingInputValidationErrorMessageForSecondProduct"/>
22+
<dontSeeElement selector="{{StorefrontProductInfoMainSection.groupedProductsAssociatedProductQuantityMageError(thirdProductIndex)}}" stepKey="checkingInputValidationErrorMessageForThirdProduct"/>
23+
</actionGroup>
24+
</actionGroups>

app/code/Magento/GroupedProduct/Test/Mftf/Section/StorefrontProductInfoMainSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<element name="groupedProductsAssociatedProductName" type="text" parameterized="true" selector="#super-product-table tbody tr:nth-of-type({{index}}) .product-item-name"/>
1515
<element name="groupedProductsAssociatedProductPrice" type="text" parameterized="true" selector="#super-product-table tbody tr:nth-of-type({{index}}) .price"/>
1616
<element name="groupedProductsAssociatedProductQuantity" type="input" parameterized="true" selector="#super-product-table tbody tr:nth-of-type({{index}}) input.qty"/>
17+
<element name="groupedProductsAssociatedProductQuantityMageError" type="input" parameterized="true" selector="#super-product-table tr:nth-of-type({{index}}) input.mage-error"/>
1718
<element name="groupedProductOptions" type="input" selector="//td//strong[text()='{{productName}}']" parameterized="true"/>
1819
</section>
1920
</sections>

app/code/Magento/GroupedProduct/Test/Mftf/Test/ValidateGroupedProductQuantityInputErrorTest.xml renamed to app/code/Magento/GroupedProduct/Test/Mftf/Test/StoreFrontValidateGroupedProductQuantityInputErrorMessageTest.xml

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11-
<test name="ValidateGroupedProductQuantityInputErrorTest">
11+
<test name="StoreFrontValidateGroupedProductQuantityInputErrorMessageTest">
1212
<annotations>
1313
<features value="GroupedProduct"/>
1414
<stories value="Verify grouped product qty validation message in Storefront"/>
@@ -21,6 +21,7 @@
2121
<before>
2222
<createData entity="ApiProductWithDescription" stepKey="simple1"/>
2323
<createData entity="ApiProductWithDescription" stepKey="simple2"/>
24+
<createData entity="ApiProductWithDescription" stepKey="simple3"/>
2425
<createData entity="ApiGroupedProduct" stepKey="product"/>
2526
<createData entity="OneSimpleProductLink" stepKey="addProductOne">
2627
<requiredEntity createDataKey="product"/>
@@ -30,32 +31,29 @@
3031
<requiredEntity createDataKey="product"/>
3132
<requiredEntity createDataKey="simple2"/>
3233
</updateData>
34+
<updateData entity="OneMoreSimpleProductLink" createDataKey="addProductOne" stepKey="addProductThree">
35+
<requiredEntity createDataKey="product"/>
36+
<requiredEntity createDataKey="simple3"/>
37+
</updateData>
3338
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="runIndex">
3439
<argument name="indices" value=""/>
3540
</actionGroup>
36-
<actionGroup ref="CliCacheFlushActionGroup" stepKey="clearCache">
37-
<argument name="tags" value=""/>
38-
</actionGroup>
3941
</before>
4042
<after>
4143
<deleteData createDataKey="simple1" stepKey="deleteSimple1"/>
4244
<deleteData createDataKey="simple2" stepKey="deleteSimple2"/>
45+
<deleteData createDataKey="simple3" stepKey="deleteSimple3"/>
4346
<deleteData createDataKey="product" stepKey="deleteGroupedProduct"/>
44-
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="runIndex">
45-
<argument name="indices" value=""/>
46-
</actionGroup>
47-
<actionGroup ref="CliCacheFlushActionGroup" stepKey="clearCache">
48-
<argument name="tags" value=""/>
49-
</actionGroup>
5047
</after>
51-
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductStorefront">
52-
<argument name="productUrl" value="$$product.custom_attributes[url_key]$$"/>
48+
<actionGroup ref="StorefrontAddThreeGroupedProductToTheCartActionGroup" stepKey="enterSimpleProductsQty">
49+
<argument name="urlKey" value="$$product.custom_attributes[url_key]$$" />
50+
<argument name="product1" value="$simple1.name$"/>
51+
<argument name="product2" value="$simple2.name$"/>
52+
<argument name="product3" value="$simple3.name$"/>
53+
<argument name="qty1" value="10"/>
54+
<argument name="qty2" value="-10"/>
55+
<argument name="qty3" value="5"/>
5356
</actionGroup>
54-
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.groupedProductsTableAllRows}}" stepKey="waitForGroupedProductRows"/>
55-
<fillField selector="#super-product-table tbody tr:nth-child(1) input.qty" userInput="-10" stepKey="fillTheFirstProductQuantity"/>
56-
<fillField selector="#super-product-table tbody tr:nth-child(2) input.qty" userInput="10" stepKey="fillTheSecondProductQuantity"/>
57-
<click selector="{{StorefrontProductPageSection.addToCartBtn}}" stepKey="clickOnAddToCartButton"/>
58-
<seeElement selector="#super-product-table tbody tr:nth-child(1) input.mage-error" stepKey="checkingInputValidationErrorForFirstProduct"/>
59-
<dontSeeElement selector="#super-product-table tbody tr:nth-child(2) input.mage-error" stepKey="checkingInputValidationErrorForSecondProduct"/>
57+
<actionGroup ref="StorefrontValidateThreeGroupedProductQtyErrorMessageActionGroup" stepKey="verifyQtyInputErrorMessage" />
6058
</test>
6159
</tests>

0 commit comments

Comments
 (0)