Skip to content

Commit c1ab666

Browse files
ENGCOM-8587: [MFTF] Refactoring of AdminMassProductPriceUpdateTest #31057
2 parents 95b1233 + fae1c14 commit c1ab666

4 files changed

+109
-53
lines changed
Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
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-
-->
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+
-->
88

9-
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11-
<actionGroup name="AdminCheckProductOnProductGridActionGroup">
12-
<annotations>
13-
<description>Check the checkbox for the product on the Product Grid</description>
14-
</annotations>
15-
<arguments>
16-
<argument name="product" type="entity"/>
17-
</arguments>
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminCheckProductOnProductGridActionGroup">
11+
<annotations>
12+
<description>Check the checkbox for the product on the Product Grid</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="product" type="entity"/>
16+
</arguments>
1817

19-
<checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku(product.sku)}}" stepKey="selectProduct"/>
18+
<checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku(product.sku)}}" stepKey="selectProduct"/>
2019

21-
</actionGroup>
22-
</actionGroups>
20+
</actionGroup>
21+
</actionGroups>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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="AdminSetPriceForMassUpdateActionGroup">
12+
<annotations>
13+
<description>Click the "Change" checkbox for the "Price" field. Set new price.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="price" type="string"/>
17+
</arguments>
18+
19+
<scrollTo stepKey="scrollToPriceCheckBox" selector="{{AdminEditProductAttributesSection.ChangeAttributePriceToggle}}" x="0" y="-160"/>
20+
<click selector="{{AdminEditProductAttributesSection.ChangeAttributePriceToggle}}" stepKey="selectPriceCheckBox"/>
21+
<fillField stepKey="fillPrice" selector="{{AdminEditProductAttributesSection.AttributePrice}}" userInput="{{price}}"/>
22+
23+
</actionGroup>
24+
</actionGroups>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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="AssertAdminProductPriceUpdatedOnEditPageActionGroup" extends="OpenEditProductOnBackendActionGroup">
12+
<annotations>
13+
<description>Validate if Product price is updated on the Product creation/edit page</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="product" type="entity"/>
17+
<argument name="price" type="string"/>
18+
</arguments>
19+
20+
<waitForPageLoad stepKey="waitForProductToLoad"/>
21+
<seeInField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="seeProductName"/>
22+
<seeInField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="seeProductSku"/>
23+
<seeInField selector="{{AdminProductFormSection.productPrice}}" userInput="{{price}}" stepKey="seeProductPrice"/>
24+
</actionGroup>
25+
</actionGroups>

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

Lines changed: 42 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -29,52 +29,60 @@
2929
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
3030
</after>
3131

32-
<!--Open Product Index Page-->
3332
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/>
3433

35-
<!--Search products using keyword -->
36-
<actionGroup ref="SearchProductGridByKeyword2ActionGroup" stepKey="searchByKeyword">
37-
<argument name="keyword" value="Testp"/>
38-
</actionGroup>
34+
<actionGroup ref="ClearFiltersAdminProductGridActionGroup" stepKey="searchByKeyword"/>
3935

40-
<!--Sort Products by ID in descending order-->
4136
<actionGroup ref="SortProductsByIdDescendingActionGroup" stepKey="sortProductsByIdDescending"/>
4237

43-
<!--Select products-->
44-
<checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku($$simpleProduct1.sku$$)}}" stepKey="selectFirstProduct"/>
45-
<checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku($$simpleProduct2.sku$$)}}" stepKey="selectSecondProduct"/>
38+
<actionGroup ref="AdminCheckProductOnProductGridActionGroup" stepKey="selectFirstProduct">
39+
<argument name="product" value="$simpleProduct1$"/>
40+
</actionGroup>
41+
<actionGroup ref="AdminCheckProductOnProductGridActionGroup" stepKey="selectSecondProduct">
42+
<argument name="product" value="$simpleProduct2$"/>
43+
</actionGroup>
44+
45+
<actionGroup ref="AdminClickMassUpdateProductAttributesActionGroup" stepKey="clickDropdown"/>
46+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickChangeStatus"/>
47+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductAttributePageToLoad"/>
4648

47-
<!-- Update product price-->
48-
<click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickDropdown"/>
49-
<click selector="{{AdminProductGridSection.bulkActionOption('Update attributes')}}" stepKey="clickChangeStatus"/>
50-
<waitForPageLoad stepKey="waitForProductAttributePageToLoad"/>
51-
<scrollTo stepKey="scrollToPriceCheckBox" selector="{{AdminEditProductAttributesSection.ChangeAttributePriceToggle}}" x="0" y="-160"/>
52-
<click selector="{{AdminEditProductAttributesSection.ChangeAttributePriceToggle}}" stepKey="selectPriceCheckBox"/>
53-
<fillField stepKey="fillPrice" selector="{{AdminEditProductAttributesSection.AttributePrice}}" userInput="90.99"/>
54-
<click stepKey="clickOnSaveButton" selector="{{AdminEditProductAttributesSection.Save}}"/>
55-
<waitForPageLoad stepKey="waitForUpdatedProductToSave" />
56-
<see selector="{{AdminProductMessagesSection.successMessage}}" userInput="Message is added to queue" stepKey="seeAttributeUpateSuccessMsg"/>
49+
<actionGroup ref="AdminSetPriceForMassUpdateActionGroup" stepKey="scrollToPriceCheckBox">
50+
<argument name="price" value="90.99"/>
51+
</actionGroup>
52+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectPriceCheckBox"/>
53+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillPrice"/>
54+
55+
<actionGroup ref="AdminSaveProductsMassAttributesUpdateActionGroup" stepKey="clickOnSaveButton"/>
56+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForUpdatedProductToSave"/>
57+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeAttributeUpateSuccessMsg"/>
5758

58-
<!-- Start message queue -->
5959
<actionGroup ref="CliConsumerStartActionGroup" stepKey="startMessageQueueConsumer">
6060
<argument name="consumerName" value="{{AdminProductAttributeUpdateConsumerData.consumerName}}"/>
6161
<argument name="maxMessages" value="{{AdminProductAttributeUpdateConsumerData.messageLimit}}"/>
6262
</actionGroup>
63-
<!-- Run cron -->
63+
6464
<magentoCLI command="cron:run --group=index" stepKey="runCron"/>
6565

66-
<!--Verify product name, sku and updated price-->
67-
<click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$simpleProduct1.sku$$)}}"/>
68-
<waitForPageLoad stepKey="waitForFirstProductToLoad"/>
69-
<seeInField stepKey="seeFirstProductNameInField" selector="{{AdminProductFormSection.productName}}" userInput="$$simpleProduct1.name$$"/>
70-
<seeInField stepKey="seeFirstProductSkuInField" selector="{{AdminProductFormSection.productSku}}" userInput="$$simpleProduct1.sku$$"/>
71-
<seeInField stepKey="seeFirstProductPriceInField" selector="{{AdminProductFormSection.productPrice}}" userInput="90.99"/>
72-
<click stepKey="clickOnBackButton" selector="{{AdminGridMainControls.back}}"/>
73-
<waitForPageLoad stepKey="waitForProductsToLoad"/>
74-
<click stepKey="openSecondProduct" selector="{{AdminProductGridSection.productRowBySku($$simpleProduct2.sku$$)}}"/>
75-
<waitForPageLoad stepKey="waitForSecondProductToLoad"/>
76-
<seeInField stepKey="seeSecondProductNameInField" selector="{{AdminProductFormSection.productName}}" userInput="$$simpleProduct2.name$$"/>
77-
<seeInField stepKey="seeSecondProductSkuInField" selector="{{AdminProductFormSection.productSku}}" userInput="$$simpleProduct2.sku$$"/>
78-
<seeInField stepKey="seeSecondProductPriceInField" selector="{{AdminProductFormSection.productPrice}}" userInput="90.99"/>
66+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openFirstProduct"/>
67+
<actionGroup ref="AssertAdminProductPriceUpdatedOnEditPageActionGroup" stepKey="waitForFirstProductToLoad">
68+
<argument name="product" value="$$simpleProduct1$$"/>
69+
<argument name="price" value="90.99"/>
70+
</actionGroup>
71+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductNameInField"/>
72+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductSkuInField"/>
73+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductPriceInField"/>
74+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnBackButton"/>
75+
76+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="waitForProductsToLoad"/>
77+
78+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openSecondProduct"/>
79+
<actionGroup ref="AssertAdminProductPriceUpdatedOnEditPageActionGroup" stepKey="waitForSecondProductToLoad">
80+
<argument name="product" value="$$simpleProduct2$$"/>
81+
<argument name="price" value="90.99"/>
82+
</actionGroup>
83+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductNameInField"/>
84+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductSkuInField"/>
85+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductPriceInField"/>
86+
7987
</test>
8088
</tests>

0 commit comments

Comments
 (0)