Skip to content

[MFTF] Refactoring of AdminMassProductPriceUpdateTest #31057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminCheckProductOnProductGridActionGroup">
<annotations>
<description>Check the checkbox for the product on the Product Grid</description>
</annotations>
<arguments>
<argument name="product" type="entity"/>
</arguments>
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminCheckProductOnProductGridActionGroup">
<annotations>
<description>Check the checkbox for the product on the Product Grid</description>
</annotations>
<arguments>
<argument name="product" type="entity"/>
</arguments>

<checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku(product.sku)}}" stepKey="selectProduct"/>
<checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku(product.sku)}}" stepKey="selectProduct"/>

</actionGroup>
</actionGroups>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminSetPriceForMassUpdateActionGroup">
<annotations>
<description>Click the "Change" checkbox for the "Price" field. Set new price.</description>
</annotations>
<arguments>
<argument name="price" type="string"/>
</arguments>

<scrollTo stepKey="scrollToPriceCheckBox" selector="{{AdminEditProductAttributesSection.ChangeAttributePriceToggle}}" x="0" y="-160"/>
<click selector="{{AdminEditProductAttributesSection.ChangeAttributePriceToggle}}" stepKey="selectPriceCheckBox"/>
<fillField stepKey="fillPrice" selector="{{AdminEditProductAttributesSection.AttributePrice}}" userInput="{{price}}"/>

</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AssertAdminProductPriceUpdatedOnEditPageActionGroup" extends="OpenEditProductOnBackendActionGroup">
<annotations>
<description>Validate if Product price is updated on the Product creation/edit page</description>
</annotations>
<arguments>
<argument name="product" type="entity"/>
<argument name="price" type="string"/>
</arguments>

<waitForPageLoad stepKey="waitForProductToLoad"/>
<seeInField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="seeProductName"/>
<seeInField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="seeProductSku"/>
<seeInField selector="{{AdminProductFormSection.productPrice}}" userInput="{{price}}" stepKey="seeProductPrice"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -29,52 +29,60 @@
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>

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

<!--Search products using keyword -->
<actionGroup ref="SearchProductGridByKeyword2ActionGroup" stepKey="searchByKeyword">
<argument name="keyword" value="Testp"/>
</actionGroup>
<actionGroup ref="ClearFiltersAdminProductGridActionGroup" stepKey="searchByKeyword"/>

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

<!--Select products-->
<checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku($$simpleProduct1.sku$$)}}" stepKey="selectFirstProduct"/>
<checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku($$simpleProduct2.sku$$)}}" stepKey="selectSecondProduct"/>
<actionGroup ref="AdminCheckProductOnProductGridActionGroup" stepKey="selectFirstProduct">
<argument name="product" value="$simpleProduct1$"/>
</actionGroup>
<actionGroup ref="AdminCheckProductOnProductGridActionGroup" stepKey="selectSecondProduct">
<argument name="product" value="$simpleProduct2$"/>
</actionGroup>

<actionGroup ref="AdminClickMassUpdateProductAttributesActionGroup" stepKey="clickDropdown"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickChangeStatus"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductAttributePageToLoad"/>

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

<actionGroup ref="AdminSaveProductsMassAttributesUpdateActionGroup" stepKey="clickOnSaveButton"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForUpdatedProductToSave"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeAttributeUpateSuccessMsg"/>

<!-- Start message queue -->
<actionGroup ref="CliConsumerStartActionGroup" stepKey="startMessageQueueConsumer">
<argument name="consumerName" value="{{AdminProductAttributeUpdateConsumerData.consumerName}}"/>
<argument name="maxMessages" value="{{AdminProductAttributeUpdateConsumerData.messageLimit}}"/>
</actionGroup>
<!-- Run cron -->

<magentoCLI command="cron:run --group=index" stepKey="runCron"/>

<!--Verify product name, sku and updated price-->
<click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$simpleProduct1.sku$$)}}"/>
<waitForPageLoad stepKey="waitForFirstProductToLoad"/>
<seeInField stepKey="seeFirstProductNameInField" selector="{{AdminProductFormSection.productName}}" userInput="$$simpleProduct1.name$$"/>
<seeInField stepKey="seeFirstProductSkuInField" selector="{{AdminProductFormSection.productSku}}" userInput="$$simpleProduct1.sku$$"/>
<seeInField stepKey="seeFirstProductPriceInField" selector="{{AdminProductFormSection.productPrice}}" userInput="90.99"/>
<click stepKey="clickOnBackButton" selector="{{AdminGridMainControls.back}}"/>
<waitForPageLoad stepKey="waitForProductsToLoad"/>
<click stepKey="openSecondProduct" selector="{{AdminProductGridSection.productRowBySku($$simpleProduct2.sku$$)}}"/>
<waitForPageLoad stepKey="waitForSecondProductToLoad"/>
<seeInField stepKey="seeSecondProductNameInField" selector="{{AdminProductFormSection.productName}}" userInput="$$simpleProduct2.name$$"/>
<seeInField stepKey="seeSecondProductSkuInField" selector="{{AdminProductFormSection.productSku}}" userInput="$$simpleProduct2.sku$$"/>
<seeInField stepKey="seeSecondProductPriceInField" selector="{{AdminProductFormSection.productPrice}}" userInput="90.99"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openFirstProduct"/>
<actionGroup ref="AssertAdminProductPriceUpdatedOnEditPageActionGroup" stepKey="waitForFirstProductToLoad">
<argument name="product" value="$$simpleProduct1$$"/>
<argument name="price" value="90.99"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductNameInField"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductSkuInField"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductPriceInField"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnBackButton"/>

<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="waitForProductsToLoad"/>

<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openSecondProduct"/>
<actionGroup ref="AssertAdminProductPriceUpdatedOnEditPageActionGroup" stepKey="waitForSecondProductToLoad">
<argument name="product" value="$$simpleProduct2$$"/>
<argument name="price" value="90.99"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductNameInField"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductSkuInField"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductPriceInField"/>

</test>
</tests>