Skip to content

Commit eb772c1

Browse files
committed
Refactoring the test
1 parent 1fa7fb1 commit eb772c1

File tree

3 files changed

+98
-26
lines changed

3 files changed

+98
-26
lines changed
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="AssertAdminChildProductDataOnParentProductEditPageActionGroup">
12+
<annotations>
13+
<description>Verify the proper child product data (name, sku, price) is shown on the Configurable Product edit page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="attribute" type="string"/>
17+
<argument name="value" type="string"/>
18+
</arguments>
19+
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsCells(attribute)}}" userInput="{{value}}"
20+
stepKey="seeChildProductData"/>
21+
</actionGroup>
22+
</actionGroups>

app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminProductFormConfigurationsSection/AdminProductFormConfigurationsSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<element name="currentVariationsPriceCells" type="textarea" selector=".admin__control-fields[data-index='price_container']"/>
1818
<element name="currentVariationsQuantityCells" type="textarea" selector=".admin__control-fields[data-index='quantity_container']"/>
1919
<element name="currentVariationsAttributesCells" type="textarea" selector=".admin__control-fields[data-index='attributes']"/>
20+
<element name="currentVariationsCells" type="textarea" selector=".admin__control-fields[data-index='{{var}}']" parameterized="true"/>
2021
<element name="currentVariationsStatusCells" type="textarea" selector="._no-header[data-index='status']"/>
2122
<element name="currentVariationsAllRows" type="text" selector="[data-index=configurable-matrix] .data-row"/>
2223
<element name="currentVariationsProductImage" type="text" parameterized="true" selector="[data-index=configurable-matrix] .data-row:nth-of-type({{index}}) td[data-index=thumbnail_image_container] img"/>

app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductCreateTest/AdminConfigurableProductCreateTest.xml

Lines changed: 75 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -61,35 +61,84 @@
6161
<!-- assert color configurations on the admin create product page -->
6262
<dontSee selector="{{AdminProductFormConfigurationsSection.variationLabel}}" stepKey="seeLabelNotVisible"/>
6363
<seeNumberOfElements selector="{{AdminProductFormConfigurationsSection.currentVariationsRows}}" userInput="3" stepKey="seeNumberOfRows"/>
64-
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsNameCells}}" userInput="{{colorProductAttribute1.name}}" stepKey="seeAttributeName1InField"/>
65-
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsNameCells}}" userInput="{{colorProductAttribute2.name}}" stepKey="seeAttributeName2InField"/>
66-
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsNameCells}}" userInput="{{colorProductAttribute3.name}}" stepKey="seeAttributeName3InField"/>
67-
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsSkuCells}}" userInput="{{colorProductAttribute1.name}}" stepKey="seeAttributeSku1InField"/>
68-
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsSkuCells}}" userInput="{{colorProductAttribute2.name}}" stepKey="seeAttributeSku2InField"/>
69-
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsSkuCells}}" userInput="{{colorProductAttribute3.name}}" stepKey="seeAttributeSku3InField"/>
70-
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsPriceCells}}" userInput="{{colorProductAttribute1.price}}" stepKey="seeUniquePrice1InField"/>
71-
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsPriceCells}}" userInput="{{colorProductAttribute2.price}}" stepKey="seeUniquePrice2InField"/>
72-
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsPriceCells}}" userInput="{{colorProductAttribute3.price}}" stepKey="seeUniquePrice3InField"/>
73-
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsQuantityCells}}" userInput="{{colorProductAttribute.attribute_quantity}}" stepKey="seeQuantityInField"/>
64+
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeAttributeName1InField">
65+
<argument name="attribute" value="name_container"/>
66+
<argument name="value" value="{{colorProductAttribute1.name}}"/>
67+
</actionGroup>
68+
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeAttributeName2InField">
69+
<argument name="attribute" value="name_container"/>
70+
<argument name="value" value="{{colorProductAttribute2.name}}"/>
71+
</actionGroup>
72+
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeAttributeName3InField">
73+
<argument name="attribute" value="name_container"/>
74+
<argument name="value" value="{{colorProductAttribute3.name}}"/>
75+
</actionGroup>
76+
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeAttributeSku1InField">
77+
<argument name="attribute" value="sku_container"/>
78+
<argument name="value" value="{{colorProductAttribute1.name}}"/>
79+
</actionGroup>
80+
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeAttributeSku2InField">
81+
<argument name="attribute" value="sku_container"/>
82+
<argument name="value" value="{{colorProductAttribute2.name}}"/>
83+
</actionGroup>
84+
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeAttributeSku3InField">
85+
<argument name="attribute" value="sku_container"/>
86+
<argument name="value" value="{{colorProductAttribute3.name}}"/>
87+
</actionGroup>
88+
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeUniquePrice1InField">
89+
<argument name="attribute" value="price_container"/>
90+
<argument name="value" value="{{colorProductAttribute1.price}}"/>
91+
</actionGroup>
92+
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeUniquePrice2InField">
93+
<argument name="attribute" value="price_container"/>
94+
<argument name="value" value="{{colorProductAttribute2.price}}"/>
95+
</actionGroup>
96+
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeUniquePrice3InField">
97+
<argument name="attribute" value="price_container"/>
98+
<argument name="value" value="{{colorProductAttribute3.price}}"/>
99+
</actionGroup>
100+
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeQuantityInField">
101+
<argument name="attribute" value="quantity_container"/>
102+
<argument name="value" value="{{colorProductAttribute.attribute_quantity}}"/>
103+
</actionGroup>
74104

75105
<!-- assert storefront category list page -->
76-
<amOnPage url="/" stepKey="amOnStorefront"/>
77-
<waitForPageLoad stepKey="waitForPageLoad3"/>
78-
<click userInput="$$createCategory.name$$" stepKey="clickOnCategoryName"/>
79-
<waitForPageLoad stepKey="waitForPageLoad4"/>
80-
<see userInput="{{_defaultProduct.name}}" stepKey="assertProductPresent"/>
81-
<see userInput="{{colorProductAttribute1.price}}" stepKey="assertProductPricePresent"/>
106+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="amOnStorefront"/>
107+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageLoad3"/>
108+
<actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="clickOnCategoryName">
109+
<argument name="categoryName" value="$$createCategory.name$$"/>
110+
</actionGroup>
111+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageLoad4"/>
112+
<actionGroup ref="AssertStorefrontProductIsPresentOnCategoryPageActionGroup" stepKey="assertProductPresent">
113+
<argument name="productName" value="{{_defaultProduct.name}}"/>
114+
</actionGroup>
115+
<actionGroup ref="StorefrontAssertProductPriceOnCategoryPageActionGroup" stepKey="assertProductPricePresent">
116+
<argument name="productName" value="{{_defaultProduct.name}}"/>
117+
<argument name="productPrice" value="{{colorProductAttribute1.price}}"/>
118+
</actionGroup>
82119

83120
<!-- assert storefront product details page -->
84-
<click userInput="{{_defaultProduct.name}}" stepKey="clickOnProductName"/>
85-
<waitForPageLoad stepKey="waitForPageLoad5"/>
86-
<seeInTitle userInput="{{_defaultProduct.name}}" stepKey="assertProductNameTitle"/>
87-
<see userInput="{{_defaultProduct.name}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="assertProductName"/>
88-
<see userInput="{{colorProductAttribute1.price}}" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="assertProductPrice"/>
89-
<see userInput="{{_defaultProduct.sku}}" selector="{{StorefrontProductInfoMainSection.productSku}}" stepKey="assertProductSku"/>
90-
<see selector="{{StorefrontProductInfoMainSection.productAttributeTitle1}}" userInput="{{colorProductAttribute.default_label}}" stepKey="seeColorAttributeName1"/>
91-
<see selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" userInput="{{colorProductAttribute1.name}}" stepKey="seeInDropDown1"/>
92-
<see selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" userInput="{{colorProductAttribute2.name}}" stepKey="seeInDropDown2"/>
93-
<see selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" userInput="{{colorProductAttribute3.name}}" stepKey="seeInDropDown3"/>
121+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnProductName"/>
122+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageLoad5"/>
123+
<actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageActionGroup" stepKey="assertProductNameTitle">
124+
<argument name="product" value="_defaultProduct"/>
125+
</actionGroup>
126+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="assertProductName"/>
127+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="assertProductPrice">
128+
<argument name="productPrice" value="{{colorProductAttribute1.price}}"/>
129+
</actionGroup>
130+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="assertProductSku"/>
131+
<actionGroup ref="AssertStorefrontProductAttributeLabelVisibleActionGroup" stepKey="seeColorAttributeName1">
132+
<argument name="productAttributeLabel" value="{{colorProductAttribute.default_label}}"/>
133+
</actionGroup>
134+
<actionGroup ref="AssertStorefrontProductAttributeOptionVisibleActionGroup" stepKey="seeInDropDown1">
135+
<argument name="productAttributeOption" value="{{colorProductAttribute1.name}}"/>
136+
</actionGroup>
137+
<actionGroup ref="AssertStorefrontProductAttributeOptionVisibleActionGroup" stepKey="seeInDropDown2">
138+
<argument name="productAttributeOption" value="{{colorProductAttribute2.name}}"/>
139+
</actionGroup>
140+
<actionGroup ref="AssertStorefrontProductAttributeOptionVisibleActionGroup" stepKey="seeInDropDown3">
141+
<argument name="productAttributeOption" value="{{colorProductAttribute3.name}}"/>
142+
</actionGroup>
94143
</test>
95144
</tests>

0 commit comments

Comments
 (0)