Skip to content

Commit 3831d41

Browse files
committed
Refactoring the test
1 parent c998238 commit 3831d41

File tree

3 files changed

+49
-10
lines changed

3 files changed

+49
-10
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/AdminConfigurableProductUpdateTest/AdminConfigurableProductRemoveAnOptionTest.xml

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,35 @@
7171
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
7272

7373
<!-- Reindex invalidated indices after product attribute has been created/deleted -->
74-
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
74+
<!--<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>-->
7575
</after>
7676

7777
<!--check storefront for both options-->
78-
<amOnPage url="$$createConfigProduct.sku$$.html" stepKey="amOnStorefront1"/>
79-
<waitForPageLoad stepKey="wait1"/>
80-
<see selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" userInput="option1" stepKey="seeOption1Storefront"/>
81-
<see selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" userInput="option2" stepKey="seeOption2Storefront"/>
78+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="amOnStorefront1">
79+
<argument name="product" value="$createConfigProduct$"/>
80+
</actionGroup>
81+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="wait1"/>
82+
<actionGroup ref="AssertStorefrontProductAttributeOptionVisibleActionGroup" stepKey="seeOption1Storefront">
83+
<argument name="productAttributeOption" value="option1"/>
84+
</actionGroup>
85+
<actionGroup ref="AssertStorefrontProductAttributeOptionVisibleActionGroup" stepKey="seeOption2Storefront">
86+
<argument name="productAttributeOption" value="option2"/>
87+
</actionGroup>
8288

8389
<!--check admin for both options-->
8490
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
8591
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToEditPage">
8692
<argument name="productId" value="$$createConfigProduct.id$$"/>
8793
</actionGroup>
8894
<waitForPageLoad stepKey="wait2"/>
89-
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsNameCells}}" userInput="$$createConfigChildProduct1.name$$" stepKey="seeOption1Admin"/>
90-
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsNameCells}}" userInput="$$createConfigChildProduct2.name$$" stepKey="seeOption2Admin"/>
95+
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeOption1Admin">
96+
<argument name="attribute" value="name_container"/>
97+
<argument name="value" value="$$createConfigChildProduct1.name$$"/>
98+
</actionGroup>
99+
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeOption2Admin">
100+
<argument name="attribute" value="name_container"/>
101+
<argument name="value" value="$$createConfigChildProduct2.name$$"/>
102+
</actionGroup>
91103

92104
<!--remove an option-->
93105
<click selector="{{AdminProductFormConfigurationsSection.actionsBtn('1')}}" stepKey="clickToExpandActions"/>
@@ -98,9 +110,13 @@
98110
<dontSee selector="{{AdminProductFormConfigurationsSection.currentVariationsNameCells}}" userInput="$$createConfigChildProduct1.name$$" stepKey="dontSeeOption1Admin"/>
99111

100112
<!--check storefront for one option-->
101-
<amOnPage url="$$createConfigProduct.sku$$.html" stepKey="amOnStorefront2"/>
102-
<waitForPageLoad stepKey="wait4"/>
113+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="amOnStorefront2">
114+
<argument name="product" value="$createConfigProduct$"/>
115+
</actionGroup>
116+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="wait4"/>
103117
<dontSee selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" userInput="option1" stepKey="dontSeeOption1InStorefront"/>
104-
<see selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" userInput="option2" stepKey="seeOption2Again"/>
118+
<actionGroup ref="AssertStorefrontProductAttributeOptionVisibleActionGroup" stepKey="seeOption2Again">
119+
<argument name="productAttributeOption" value="option2"/>
120+
</actionGroup>
105121
</test>
106122
</tests>

0 commit comments

Comments
 (0)