Skip to content

Commit ff77637

Browse files
authored
ENGCOM-8918: Replace repetitive actions with Action Groups in AdminSimpleProductTypeSwitchingToConfigurableProductTest and AdminConfigurableProductTypeSwitchingToVirtualProductTest #32282
2 parents c189186 + 8c02248 commit ff77637

File tree

3 files changed

+50
-12
lines changed

3 files changed

+50
-12
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="AdminSelectWeightTypeOnProductFormActionGroup">
12+
<annotations>
13+
<description>Select Weight type on the Admin Products creation/edit page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="weightOption" type="string" defaultValue="This item has no weight"/>
17+
</arguments>
18+
<selectOption selector="{{AdminProductFormSection.productWeightSelect}}" userInput="{{weightOption}}" stepKey="selectWeight"/>
19+
</actionGroup>
20+
</actionGroups>

app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest/AdminConfigurableProductTypeSwitchingToVirtualProductTest.xml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,14 @@
2929
<click selector="{{AdminProductFormConfigurationsSection.removeProductBtn}}" stepKey="clickRemoveOption1"/>
3030
<click selector="{{AdminProductFormConfigurationsSection.actionsBtn('1')}}" stepKey="clickToExpandOption2Actions"/>
3131
<click selector="{{AdminProductFormConfigurationsSection.removeProductBtn}}" stepKey="clickRemoveOption2"/>
32-
<fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{SimpleProduct2.price}}" stepKey="fillProductPrice"/>
33-
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{SimpleProduct2.quantity}}" stepKey="fillProductQty"/>
32+
<actionGroup ref="AdminFillProductPriceFieldAndPressEnterOnProductEditPageActionGroup" stepKey="fillProductPrice">
33+
<argument name="price" value="{{SimpleProduct2.price}}"/>
34+
</actionGroup>
35+
<actionGroup ref="AdminFillProductQtyOnProductFormActionGroup" stepKey="fillProductQty">
36+
<argument name="productQty" value="{{SimpleProduct2.quantity}}"/>
37+
</actionGroup>
3438
<clearField selector="{{AdminProductFormSection.productWeight}}" stepKey="clearWeightField"/>
35-
<selectOption selector="{{AdminProductFormSection.productWeightSelect}}" userInput="This item has no weight" stepKey="selectNoWeight"/>
39+
<actionGroup ref="AdminSelectWeightTypeOnProductFormActionGroup" stepKey="selectNoWeight"/>
3640
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveVirtualProductForm"/>
3741
<!--Assert virtual product on Admin product page grid-->
3842
<comment userInput="Assert virtual product on Admin product page grid" stepKey="commentAssertVirtualProductOnAdmin"/>
@@ -43,8 +47,12 @@
4347
<seeElement selector="{{AdminProductGridSection.productRowByTypeAndName('Virtual Product',$createProduct.name$)}}" stepKey="seeVirtualProductInGrid"/>
4448
<!--Assert virtual product on storefront-->
4549
<comment userInput="Assert virtual product on storefront" stepKey="commentAssertVirtualProductOnStorefront"/>
46-
<amOnPage url="{{StorefrontProductPage.url($createProduct.custom_attributes[url_key]$)}}" stepKey="openVirtualProductPage"/>
47-
<waitForPageLoad stepKey="waitForStorefrontVirtualProductPageLoad"/>
48-
<see userInput="IN STOCK" selector="{{StorefrontProductInfoMainSection.productStockStatus}}" stepKey="assertVirtualProductInStock"/>
50+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openVirtualProductPage">
51+
<argument name="productUrl" value="$createProduct.custom_attributes[url_key]$"/>
52+
</actionGroup>
53+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForStorefrontVirtualProductPageLoad"/>
54+
<actionGroup ref="AssertStorefrontProductStockStatusOnProductPageActionGroup" stepKey="assertVirtualProductInStock">
55+
<argument name="productStockStatus" value="In Stock"/>
56+
</actionGroup>
4957
</test>
5058
</tests>

app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest/AdminSimpleProductTypeSwitchingToConfigurableProductTest.xml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,23 @@
6868
<seeElement selector="{{AdminProductGridSection.productRowByTypeAndName('Configurable Product',$createProduct.name$)}}" stepKey="seeConfigurableProductInGrid"/>
6969
<seeElement selector="{{AdminProductGridSection.productRowByTypeAndName('Simple Product',$createProduct.name$-option1)}}" stepKey="seeSimpleProduct1NameInGrid"/>
7070
<seeElement selector="{{AdminProductGridSection.productRowByTypeAndName('Simple Product',$createProduct.name$-option2)}}" stepKey="seeSimpleProduct2NameInGrid"/>
71+
7172
<!--Assert configurable product on storefront-->
7273
<comment userInput="Assert configurable product on storefront" stepKey="commentAssertConfigProductOnStorefront"/>
73-
<amOnPage url="{{StorefrontProductPage.url($createProduct.custom_attributes[url_key]$)}}" stepKey="openProductPage"/>
74-
<waitForPageLoad stepKey="waitForStorefrontProductPageLoad"/>
75-
<see userInput="IN STOCK" selector="{{StorefrontProductInfoMainSection.productStockStatus}}" stepKey="assertInStock"/>
76-
<click selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="clickAttributeDropDown"/>
77-
<see userInput="option1" stepKey="verifyOption1Exists"/>
78-
<see userInput="option2" stepKey="verifyOption2Exists"/>
74+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage">
75+
<argument name="productUrl" value="$createProduct.custom_attributes[url_key]$"/>
76+
</actionGroup>
77+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForStorefrontProductPageLoad"/>
78+
<actionGroup ref="AssertStorefrontProductStockStatusOnProductPageActionGroup" stepKey="assertInStock">
79+
<argument name="productStockStatus" value="In Stock"/>
80+
</actionGroup>
81+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickAttributeDropDown"/>
82+
<actionGroup ref="AssertStorefrontProductAttributeOptionVisibleActionGroup" stepKey="verifyOption1Exists">
83+
<argument name="productAttributeOption" value="option1"/>
84+
</actionGroup>
85+
<actionGroup ref="AssertStorefrontProductAttributeOptionVisibleActionGroup" stepKey="verifyOption2Exists">
86+
<argument name="productAttributeOption" value="option2"/>
87+
</actionGroup>
88+
7989
</test>
8090
</tests>

0 commit comments

Comments
 (0)