Skip to content

Commit 8af326a

Browse files
authored
ENGCOM-9323: Replace repetitive actions with Action Groups in AdminSimpleProductSetEditContentTest,AdminCreateAndEditSimpleProductSettingsTest, AdminCreateAndEditVirtualProductSettingsTest and AdminConfigurableProductBulkUpdateTest #34302
2 parents b7b5d58 + f36707a commit 8af326a

10 files changed

+194
-39
lines changed
Lines changed: 17 additions & 0 deletions
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="AdminFillInProductDescriptionActionGroup">
12+
<arguments>
13+
<argument name="description" type="string"/>
14+
</arguments>
15+
<fillField selector="{{AdminProductContentSection.descriptionTextArea}}" userInput="{{description}}" stepKey="fillLongDescription"/>
16+
</actionGroup>
17+
</actionGroups>
Lines changed: 17 additions & 0 deletions
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="AdminFillInProductShortDescriptionActionGroup">
12+
<arguments>
13+
<argument name="shortDescription" type="string"/>
14+
</arguments>
15+
<fillField selector="{{AdminProductContentSection.shortDescriptionTextArea}}" userInput="{{shortDescription}}" stepKey="fillShortDescription"/>
16+
</actionGroup>
17+
</actionGroups>
Lines changed: 15 additions & 0 deletions
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="AdminOpenContentSectionOnProductPageActionGroup">
12+
<scrollTo selector="{{AdminProductContentSection.sectionHeader}}" x="0" y="-100" stepKey="scrollToContentSection"/>
13+
<click selector="{{AdminProductContentSection.sectionHeader}}" stepKey="openContentSection"/>
14+
</actionGroup>
15+
</actionGroups>
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="AssertAdminProductShortDescriptionOnProductEditFormActionGroup">
12+
<arguments>
13+
<argument name="productShortDescription" type="string"/>
14+
</arguments>
15+
<seeInField selector="{{AdminProductContentSection.shortDescriptionTextArea}}" userInput="{{productShortDescription}}" stepKey="seeProductShortDescription"/>
16+
</actionGroup>
17+
</actionGroups>
Lines changed: 17 additions & 0 deletions
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="AssertStorefrontProductDescriptionActionGroup">
12+
<arguments>
13+
<argument name="productDescription" type="string"/>
14+
</arguments>
15+
<see selector="{{StorefrontProductInfoMainSection.productDescription}}" userInput="{{productDescription}}" stepKey="seeLongDescriptionAtStorefront"/>
16+
</actionGroup>
17+
</actionGroups>
Lines changed: 17 additions & 0 deletions
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="AssertStorefrontShortProductDescriptionActionGroup">
12+
<arguments>
13+
<argument name="productShortDescription" type="string"/>
14+
</arguments>
15+
<see selector="{{StorefrontProductInfoMainSection.productShortDescription}}" userInput="{{productShortDescription}}" stepKey="seeShortDescriptionAtStorefront"/>
16+
</actionGroup>
17+
</actionGroups>

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,12 @@
118118
</actionGroup>
119119

120120
<!-- Assert related products at the storefront -->
121-
<seeElement selector="{{StorefrontProductRelatedProductsSection.relatedProductName($$createSecondRelatedProduct.name$$)}}" stepKey="seeSecondRelatedProduct"/>
122-
<seeElement selector="{{StorefrontProductRelatedProductsSection.relatedProductName($$createThirdRelatedProduct.name$$)}}" stepKey="seeThirdRelatedProduct"/>
121+
<actionGroup ref="StorefrontAssertRelatedProductOnProductPageActionGroup" stepKey="seeSecondRelatedProduct">
122+
<argument name="productName" value="$$createSecondRelatedProduct.name$$"/>
123+
</actionGroup>
124+
<actionGroup ref="StorefrontAssertRelatedProductOnProductPageActionGroup" stepKey="seeThirdRelatedProduct">
125+
<argument name="productName" value="$$createThirdRelatedProduct.name$$"/>
126+
</actionGroup>
123127

124128
<!-- Assert product design settings "Layout empty" -->
125129
<seeElement selector="{{StorefrontProductPageDesignSection.layoutEmpty}}" stepKey="seeNewDesignChanges"/>

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

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,15 @@
128128
</actionGroup>
129129

130130
<!-- Edit Content to the product -->
131-
<scrollTo selector="{{AdminProductContentSection.sectionHeader}}" x="0" y="-100" stepKey="scrollToContentTab"/>
132-
<click selector="{{AdminProductContentSection.sectionHeader}}" stepKey="openContentTab"/>
133-
<fillField selector="{{AdminProductContentSection.descriptionTextArea}}" userInput="EDIT ~ {{ApiProductDescription.value}} ~ EDIT" stepKey="editLongDescription"/>
134-
<fillField selector="{{AdminProductContentSection.shortDescriptionTextArea}}" userInput="EDIT ~ {{ApiProductShortDescription.value}} ~ EDIT" stepKey="editShortDescription"/>
131+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="scrollToContentTab"/>
132+
<actionGroup ref="AdminOpenContentSectionOnProductPageActionGroup" stepKey="openContentTab"/>
133+
<actionGroup ref="AdminFillInProductDescriptionActionGroup" stepKey="editLongDescription">
134+
<argument name="description" value="EDIT ~ {{ApiProductDescription.value}} ~ EDIT"/>
135+
</actionGroup>
136+
<actionGroup ref="AdminFillInProductShortDescriptionActionGroup" stepKey="editShortDescription">
137+
<argument name="shortDescription" value="EDIT ~ {{ApiProductShortDescription.value}} ~ EDIT"/>
138+
</actionGroup>
139+
135140

136141
<!-- Edit product Search Engine Optimization settings -->
137142
<actionGroup ref="AdminChangeProductSEOSettingsActionGroup" stepKey="editProductSEOSettings">
@@ -170,13 +175,23 @@
170175
</actionGroup>
171176

172177
<!-- Assert three related products at the storefront -->
173-
<seeElement selector="{{StorefrontProductRelatedProductsSection.relatedProductName($$createThirdRelatedProduct.name$$)}}" stepKey="seeFirstRelatedProduct"/>
174-
<seeElement selector="{{StorefrontProductRelatedProductsSection.relatedProductName($$createSecondRelatedProduct.name$$)}}" stepKey="seeSecondRelatedProduct"/>
175-
<seeElement selector="{{StorefrontProductRelatedProductsSection.relatedProductName($$createThirdRelatedProduct.name$$)}}" stepKey="seeThirdRelatedProduct"/>
178+
<actionGroup ref="StorefrontAssertRelatedProductOnProductPageActionGroup" stepKey="seeFirstRelatedProduct">
179+
<argument name="productName" value="$$createThirdRelatedProduct.name$$"/>
180+
</actionGroup>
181+
<actionGroup ref="StorefrontAssertRelatedProductOnProductPageActionGroup" stepKey="seeSecondRelatedProduct">
182+
<argument name="productName" value="$$createSecondRelatedProduct.name$$"/>
183+
</actionGroup>
184+
<actionGroup ref="StorefrontAssertRelatedProductOnProductPageActionGroup" stepKey="seeThirdRelatedProduct">
185+
<argument name="productName" value="$$createThirdRelatedProduct.name$$"/>
186+
</actionGroup>
176187

177188
<!-- Assert product content -->
178-
<see selector="{{StorefrontProductInfoMainSection.productDescription}}" userInput="EDIT ~ {{ApiProductDescription.value}} ~ EDIT" stepKey="seeEditedLongDescriptionStorefront"/>
179-
<see selector="{{StorefrontProductInfoMainSection.productShortDescription}}" userInput="EDIT ~ {{ApiProductShortDescription.value}} ~ EDIT" stepKey="seeEditedShortDescriptionStorefront"/>
189+
<actionGroup ref="AssertStorefrontProductDescriptionActionGroup" stepKey="seeEditedLongDescriptionStorefront">
190+
<argument name="productDescription" value="EDIT ~ {{ApiProductDescription.value}} ~ EDIT"/>
191+
</actionGroup>
192+
<actionGroup ref="AssertStorefrontShortProductDescriptionActionGroup" stepKey="seeEditedShortDescriptionStorefront">
193+
<argument name="productShortDescription" value="EDIT ~ {{ApiProductShortDescription.value}} ~ EDIT"/>
194+
</actionGroup>
180195

181196
<!-- Assert product design settings "right bar is present at product page with 2 columns" -->
182197
<seeElement selector="{{StorefrontProductPageDesignSection.layoutTwoColumnsRight}}" stepKey="seeNewDesignChanges"/>

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

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,35 +44,57 @@
4444

4545
<!--Add content-->
4646
<!--A generic scroll scrolls past this element, in doing this it fails to execute certain actions on the element and others below it. By scrolling slightly above it it resolves this issue.-->
47-
<scrollTo selector="{{AdminProductContentSection.sectionHeader}}" x="0" y="-100" stepKey="scrollTo"/>
48-
<click selector="{{AdminProductContentSection.sectionHeader}}" stepKey="openDescriptionDropDown"/>
49-
<fillField selector="{{AdminProductContentSection.descriptionTextArea}}" userInput="This is the long description" stepKey="fillLongDescription"/>
50-
<fillField selector="{{AdminProductContentSection.shortDescriptionTextArea}}" userInput="This is the short description" stepKey="fillShortDescription"/>
47+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="scrollTo"/>
48+
<actionGroup ref="AdminOpenContentSectionOnProductPageActionGroup" stepKey="openDescriptionDropDown"/>
49+
<actionGroup ref="AdminFillInProductDescriptionActionGroup" stepKey="fillLongDescription">
50+
<argument name="description" value="This is the long description"/>
51+
</actionGroup>
52+
<actionGroup ref="AdminFillInProductShortDescriptionActionGroup" stepKey="fillShortDescription">
53+
<argument name="shortDescription" value="This is the short description"/>
54+
</actionGroup>
5155

5256
<!--save the product-->
5357
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveButton"/>
54-
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/>
58+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="messageYouSavedTheProductIsShown">
59+
<argument name="message" value="You saved the product."/>
60+
</actionGroup>
5561

5662
<!--Edit content-->
57-
<click selector="{{AdminProductContentSection.sectionHeader}}" stepKey="openDescriptionDropDownEdit"/>
58-
<scrollTo selector="{{AdminProductContentSection.sectionHeader}}" stepKey="scrollToEdit"/>
59-
<fillField selector="{{AdminProductContentSection.descriptionTextArea}}" userInput="EDIT ~ This is the long description ~ EDIT" stepKey="editLongDescription"/>
60-
<fillField selector="{{AdminProductContentSection.shortDescriptionTextArea}}" userInput="EDIT ~ This is the short description ~ EDIT" stepKey="editShortDescription"/>
63+
<actionGroup ref="AdminOpenContentSectionOnProductPageActionGroup" stepKey="openDescriptionDropDownEdit"/>
64+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="scrollToEdit"/>
65+
<actionGroup ref="AdminFillInProductDescriptionActionGroup" stepKey="editLongDescription">
66+
<argument name="description" value="EDIT ~ This is the long description ~ EDIT"/>
67+
</actionGroup>
68+
<actionGroup ref="AdminFillInProductShortDescriptionActionGroup" stepKey="editShortDescription">
69+
<argument name="shortDescription" value="EDIT ~ This is the short description ~ EDIT"/>
70+
</actionGroup>
6171

6272
<!--save the product-->
6373
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveButtonAfterEdit"/>
64-
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShownAgain"/>
74+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="messageYouSavedTheProductIsShownAgain">
75+
<argument name="message" value="You saved the product."/>
76+
</actionGroup>
6577

6678
<!--Checking content admin-->
67-
<click selector="{{AdminProductContentSection.sectionHeader}}" stepKey="openDescriptionDropDownAgain"/>
68-
<scrollTo selector="{{AdminProductContentSection.sectionHeader}}" stepKey="scrollToAgain"/>
69-
<seeInField selector="{{AdminProductContentSection.descriptionTextArea}}" userInput="EDIT ~ This is the long description ~ EDIT" stepKey="seeLongDescriptionAdmin"/>
70-
<seeInField selector="{{AdminProductContentSection.shortDescriptionTextArea}}" userInput="EDIT ~ This is the short description ~ EDIT" stepKey="seeShortDescriptionAdmin"/>
79+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openDescriptionDropDownAgain"/>
80+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="scrollToAgain"/>
81+
<actionGroup ref="AssertProductDescriptionInProductEditFormActionGroup" stepKey="seeLongDescriptionAdmin">
82+
<argument name="productDescription" value="EDIT ~ This is the long description ~ EDIT"/>
83+
</actionGroup>
84+
<actionGroup ref="AssertAdminProductShortDescriptionOnProductEditFormActionGroup" stepKey="seeShortDescriptionAdmin">
85+
<argument name="productShortDescription" value="EDIT ~ This is the short description ~ EDIT"/>
86+
</actionGroup>
7187

7288
<!--Checking content storefront-->
73-
<amOnPage url="{{SimpleProduct.urlKey}}.html" stepKey="goToStorefront"/>
74-
<waitForPageLoad stepKey="waitForStorefront"/>
75-
<see selector="{{StorefrontProductInfoMainSection.productDescription}}" userInput="EDIT ~ This is the long description ~ EDIT" stepKey="seeLongDescriptionStorefront"/>
76-
<see selector="{{StorefrontProductInfoMainSection.productShortDescription}}" userInput="EDIT ~ This is the short description ~ EDIT" stepKey="seeShortDescriptionStorefront"/>
89+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="goToStorefront">
90+
<argument name="productUrl" value="{{SimpleProduct.urlKey}}"/>
91+
</actionGroup>
92+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForStorefront"/>
93+
<actionGroup ref="AssertStorefrontProductDescriptionActionGroup" stepKey="seeLongDescriptionStorefront">
94+
<argument name="productDescription" value="EDIT ~ This is the long description ~ EDIT"/>
95+
</actionGroup>
96+
<actionGroup ref="AssertStorefrontShortProductDescriptionActionGroup" stepKey="seeShortDescriptionStorefront">
97+
<argument name="productShortDescription" value="EDIT ~ This is the short description ~ EDIT"/>
98+
</actionGroup>
7799
</test>
78100
</tests>

app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest/AdminConfigurableProductBulkUpdateTest.xml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@
6161
<fillField selector="{{AdminUpdateAttributesSection.description}}" userInput="MFTF automation!" stepKey="fillDescription"/>
6262
<click selector="{{AdminEditProductAttributesSection.Save}}" stepKey="clickSave"/>
6363
<waitForElementVisible selector="{{AdminProductMessagesSection.successMessage}}" time="60" stepKey="waitForSuccessMessage"/>
64-
<see selector="{{AdminProductMessagesSection.successMessage}}" userInput="Message is added to queue" stepKey="seeAttributeUpdateSuccessMsg"/>
64+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="seeAttributeUpdateSuccessMsg">
65+
<argument name="message" value="Message is added to queue"/>
66+
</actionGroup>
6567

6668
<!-- Apply changes -->
6769
<actionGroup ref="CliConsumerStartActionGroup" stepKey="startMessageQueue">
@@ -70,14 +72,26 @@
7072
</actionGroup>
7173

7274
<!-- Check storefront for description -->
73-
<amOnPage url="{{StorefrontProductPage.url($$createProduct1.custom_attributes[url_key]$$)}}" stepKey="goToFirstProductPageOnStorefront"/>
74-
<waitForPageLoad stepKey="waitForFirstProductPageLoad"/>
75-
<see selector="{{StorefrontProductInfoMainSection.productDescription}}" userInput="MFTF automation!" stepKey="seeFirstDescription"/>
76-
<amOnPage url="{{StorefrontProductPage.url($$createProduct2.custom_attributes[url_key]$$)}}" stepKey="goToSecondProductPageOnStorefront"/>
77-
<waitForPageLoad stepKey="waitForSecondProductPageLoad"/>
78-
<see selector="{{StorefrontProductInfoMainSection.productDescription}}" userInput="MFTF automation!" stepKey="seeSecondDescription"/>
79-
<amOnPage url="{{StorefrontProductPage.url($$createProduct3.custom_attributes[url_key]$$)}}" stepKey="goToThirdProductPageOnStorefront"/>
80-
<waitForPageLoad stepKey="waitForThirdProductPageLoad"/>
81-
<see selector="{{StorefrontProductInfoMainSection.productDescription}}" userInput="MFTF automation!" stepKey="seeThirdDescription"/>
75+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="goToFirstProductPageOnStorefront">
76+
<argument name="product" value="$createProduct1$"/>
77+
</actionGroup>
78+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForFirstProductPageLoad"/>
79+
<actionGroup ref="AssertStorefrontProductDescriptionActionGroup" stepKey="seeFirstDescription">
80+
<argument name="productDescription" value="MFTF automation!"/>
81+
</actionGroup>
82+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="goToSecondProductPageOnStorefront">
83+
<argument name="product" value="$createProduct2$"/>
84+
</actionGroup>
85+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForSecondProductPageLoad"/>
86+
<actionGroup ref="AssertStorefrontProductDescriptionActionGroup" stepKey="seeSecondDescription">
87+
<argument name="productDescription" value="MFTF automation!"/>
88+
</actionGroup>
89+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="goToThirdProductPageOnStorefront">
90+
<argument name="product" value="$createProduct3$"/>
91+
</actionGroup>
92+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForThirdProductPageLoad"/>
93+
<actionGroup ref="AssertStorefrontProductDescriptionActionGroup" stepKey="seeThirdDescription">
94+
<argument name="productDescription" value="MFTF automation!"/>
95+
</actionGroup>
8296
</test>
8397
</tests>

0 commit comments

Comments
 (0)