Skip to content

Commit 0bdf1f0

Browse files
ENGCOM-8704: Replace repetitive actions with Action Groups in AdminDeleteConfigurableChildProductsTest #31791
2 parents 28ce05f + 5f0ab2a commit 0bdf1f0

File tree

3 files changed

+74
-18
lines changed

3 files changed

+74
-18
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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="AssertStorefrontProductAttributeLabelVisibleActionGroup">
12+
<arguments>
13+
<argument name="productAttributeLabel" type="string"/>
14+
</arguments>
15+
<see selector="{{StorefrontProductInfoMainSection.productAttributeTitle1}}" userInput="{{productAttributeLabel}}" stepKey="seeProductAttributeLabel"/>
16+
</actionGroup>
17+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteConfigurableChildProductsTest.xml

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,31 @@
8787
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
8888
</after>
8989
<!--Open Product in Store Front Page -->
90-
<amOnPage url="$$createConfigProduct.custom_attributes[url_key]$$.html" stepKey="openProductInStoreFront"/>
91-
<waitForPageLoad stepKey="waitForProductToLoad"/>
90+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductInStoreFront">
91+
<argument name="product" value="$createConfigProduct$"/>
92+
</actionGroup>
93+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductToLoad"/>
94+
9295
<!--Verify Product is visible and In Stock -->
93-
<seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="seeCategoryInFrontPage"/>
94-
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="$$createConfigProduct.name$$" stepKey="seeProductNameInStoreFront"/>
95-
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigProduct.price$$" stepKey="seeProductPriceInStoreFront"/>
96+
<actionGroup ref="StorefrontAssertCategoryNameIsShownInMenuActionGroup" stepKey="seeCategoryInFrontPage">
97+
<argument name="categoryName" value="$$createCategory.name$$"/>
98+
</actionGroup>
99+
<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="seeProductNameInStoreFront">
100+
<argument name="productName" value="$$createConfigProduct.name$$"/>
101+
</actionGroup>
102+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeProductPriceInStoreFront">
103+
<argument name="productPrice" value="$$createConfigChildProduct1.price$$"/>
104+
</actionGroup>
96105
<actionGroup ref="StorefrontAssertProductSkuOnProductPageActionGroup" stepKey="seeProductSkuInStoreFront">
97106
<argument name="productSku" value="$$createConfigProduct.sku$$"/>
98107
</actionGroup>
99-
<see selector="{{StorefrontProductInfoMainSection.productStockStatus}}" userInput="In Stock" stepKey="seeProductStatusInStoreFront"/>
100-
<see selector="{{StorefrontProductInfoMainSection.productAttributeTitle1}}" userInput="$$createConfigProductAttribute.default_value$$" stepKey="seeProductAttributeLabel"/>
101-
<seeElement selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" stepKey="seeProductAttributeOptions"/>
108+
<actionGroup ref="AssertStorefrontProductStockStatusOnProductPageActionGroup" stepKey="seeProductStatusInStoreFront">
109+
<argument name="productStockStatus" value="In Stock"/>
110+
</actionGroup>
111+
<actionGroup ref="AssertStorefrontProductAttributeLabelVisibleActionGroup" stepKey="seeProductAttributeLabel">
112+
<argument name="productAttributeLabel" value="$$createConfigProductAttribute.default_value$$"/>
113+
</actionGroup>
114+
<actionGroup ref="AssertStorefrontProductOptionsDropDownVisibleActionGroup" stepKey="seeProductAttributeOptions"/>
102115
<!-- Delete Child products -->
103116
<actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteFirstChildProduct">
104117
<argument name="sku" value="$$createConfigChildProduct1.sku$$"/>
@@ -107,21 +120,32 @@
107120
<argument name="sku" value="$$createConfigChildProduct2.sku$$"/>
108121
</actionGroup>
109122
<!--Verify product is not visible in category store front page -->
110-
<amOnPage url="$$createCategory.custom_attributes[url_key]$$.html" stepKey="openCategoryStoreFrontPage"/>
111-
<waitForPageLoad stepKey="waitForCategoryPageToLoad"/>
112-
<seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="seeCategoryInStoreFrontPage"/>
113-
<click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="clickOnCategory"/>
114-
<dontSee selector="{{StorefrontCategoryMainSection.productName}}" userInput="$$createConfigProduct.name$$" stepKey="dontSeeProductInCategoryPage"/>
123+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openCategoryStoreFrontPage"/>
124+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForCategoryPageToLoad"/>
125+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeCategoryInStoreFrontPage"/>
126+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnCategory"/>
127+
<actionGroup ref="AssertStorefrontProductAbsentOnCategoryPageActionGroup" stepKey="dontSeeProductInCategoryPage">
128+
<argument name="categoryUrlKey" value="$$createCategory.name$$"/>
129+
<argument name="productName" value="$$createConfigProduct.name$$"/>
130+
</actionGroup>
115131
<!--Open Product Store Front Page and Verify Product is Out Of Stock -->
116-
<amOnPage url="$$createConfigProduct.custom_attributes[url_key]$$.html" stepKey="openProductInStoreFront1"/>
117-
<waitForPageLoad stepKey="waitForProductToLoad1"/>
118-
<seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="seeCategoryInFrontPage1"/>
119-
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="$$createConfigProduct.name$$" stepKey="seeProductNameInStoreFront1"/>
132+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductInStoreFront1">
133+
<argument name="product" value="$createConfigProduct$"/>
134+
</actionGroup>
135+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductToLoad1"/>
136+
<actionGroup ref="StorefrontAssertCategoryNameIsShownInMenuActionGroup" stepKey="seeCategoryInFrontPage1">
137+
<argument name="categoryName" value="$$createCategory.name$$"/>
138+
</actionGroup>
139+
<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="seeProductNameInStoreFront1">
140+
<argument name="productName" value="$$createConfigProduct.name$$"/>
141+
</actionGroup>
120142
<dontSee selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigProduct.price$$" stepKey="dontSeeProductPriceInStoreFront"/>
121143
<actionGroup ref="StorefrontAssertProductSkuOnProductPageActionGroup" stepKey="seeProductSkuInStoreFront1">
122144
<argument name="productSku" value="$$createConfigProduct.sku$$"/>
123145
</actionGroup>
124-
<see selector="{{StorefrontProductInfoMainSection.productStockStatus}}" userInput="OUT OF STOCK" stepKey="seeProductStatusInStoreFront1"/>
146+
<actionGroup ref="AssertStorefrontProductStockStatusOnProductPageActionGroup" stepKey="seeProductStatusInStoreFront1">
147+
<argument name="productStockStatus" value="OUT OF STOCK"/>
148+
</actionGroup>
125149
<dontSee selector="{{StorefrontProductInfoMainSection.productAttributeTitle1}}" userInput="$$createConfigProductAttribute.default_value$$" stepKey="dontSeeProductAttributeLabel"/>
126150
<dontSeeElement selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" stepKey="dontSeeProductAttributeOptions"/>
127151
</test>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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="AssertStorefrontProductOptionsDropDownVisibleActionGroup">
12+
13+
<seeElement selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" stepKey="seeProductOptionsDropDown"/>
14+
</actionGroup>
15+
</actionGroups>

0 commit comments

Comments
 (0)