Skip to content

Replace repetitive actions with Action Groups in AdminConfigurableProductRemoveAnOptionTest #32465

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?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="AssertAdminChildProductDataOnParentProductEditPageActionGroup">
<annotations>
<description>Verify the proper child product data (name, sku, price) is shown on the Configurable Product edit page.</description>
</annotations>
<arguments>
<argument name="attribute" type="string"/>
<argument name="value" type="string"/>
</arguments>
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsCells(attribute)}}" userInput="{{value}}"
stepKey="seeChildProductData"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<element name="currentVariationsPriceCells" type="textarea" selector=".admin__control-fields[data-index='price_container']"/>
<element name="currentVariationsQuantityCells" type="textarea" selector=".admin__control-fields[data-index='quantity_container']"/>
<element name="currentVariationsAttributesCells" type="textarea" selector=".admin__control-fields[data-index='attributes']"/>
<element name="currentVariationsCells" type="textarea" selector=".admin__control-fields[data-index='{{var}}']" parameterized="true"/>
<element name="currentVariationsStatusCells" type="textarea" selector="._no-header[data-index='status']"/>
<element name="currentVariationsAllRows" type="text" selector="[data-index=configurable-matrix] .data-row"/>
<element name="currentVariationsProductImage" type="text" parameterized="true" selector="[data-index=configurable-matrix] .data-row:nth-of-type({{index}}) td[data-index=thumbnail_image_container] img"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,31 @@
</after>

<!--check storefront for both options-->
<amOnPage url="$$createConfigProduct.custom_attributes[url_key]$$.html" stepKey="amOnStorefront1"/>
<waitForPageLoad stepKey="wait1"/>
<see selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" userInput="option1" stepKey="seeOption1Storefront"/>
<see selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" userInput="option2" stepKey="seeOption2Storefront"/>
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="amOnStorefront1">
<argument name="product" value="$createConfigProduct$"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="wait1"/>
<actionGroup ref="AssertStorefrontProductAttributeOptionVisibleActionGroup" stepKey="seeOption1Storefront">
<argument name="productAttributeOption" value="option1"/>
</actionGroup>
<actionGroup ref="AssertStorefrontProductAttributeOptionVisibleActionGroup" stepKey="seeOption2Storefront">
<argument name="productAttributeOption" value="option2"/>
</actionGroup>

<!--check admin for both options-->
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToEditPage">
<argument name="productId" value="$$createConfigProduct.id$$"/>
</actionGroup>
<waitForPageLoad stepKey="wait2"/>
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsNameCells}}" userInput="$$createConfigChildProduct1.name$$" stepKey="seeOption1Admin"/>
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsNameCells}}" userInput="$$createConfigChildProduct2.name$$" stepKey="seeOption2Admin"/>
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeOption1Admin">
<argument name="attribute" value="name_container"/>
<argument name="value" value="$$createConfigChildProduct1.name$$"/>
</actionGroup>
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeOption2Admin">
<argument name="attribute" value="name_container"/>
<argument name="value" value="$$createConfigChildProduct2.name$$"/>
</actionGroup>

<!--remove an option-->
<click selector="{{AdminProductFormConfigurationsSection.actionsBtn('1')}}" stepKey="clickToExpandActions"/>
Expand All @@ -98,9 +110,13 @@
<dontSee selector="{{AdminProductFormConfigurationsSection.currentVariationsNameCells}}" userInput="$$createConfigChildProduct1.name$$" stepKey="dontSeeOption1Admin"/>

<!--check storefront for one option-->
<amOnPage url="$$createConfigProduct.custom_attributes[url_key]$$.html" stepKey="amOnStorefront2"/>
<waitForPageLoad stepKey="wait4"/>
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="amOnStorefront2">
<argument name="product" value="$createConfigProduct$"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="wait4"/>
<dontSee selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" userInput="option1" stepKey="dontSeeOption1InStorefront"/>
<see selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" userInput="option2" stepKey="seeOption2Again"/>
<actionGroup ref="AssertStorefrontProductAttributeOptionVisibleActionGroup" stepKey="seeOption2Again">
<argument name="productAttributeOption" value="option2"/>
</actionGroup>
</test>
</tests>