Skip to content

Commit

Permalink
Refactoring the test
Browse files Browse the repository at this point in the history
  • Loading branch information
kate-kyzyma committed Mar 12, 2021
1 parent c998238 commit 3831d41
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 10 deletions.
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 @@ -71,23 +71,35 @@
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>

<!-- Reindex invalidated indices after product attribute has been created/deleted -->
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
<!--<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>-->
</after>

<!--check storefront for both options-->
<amOnPage url="$$createConfigProduct.sku$$.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.sku$$.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>

0 comments on commit 3831d41

Please sign in to comment.