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 1fa7fb1 commit eb772c1
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 26 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 @@ -61,35 +61,84 @@
<!-- assert color configurations on the admin create product page -->
<dontSee selector="{{AdminProductFormConfigurationsSection.variationLabel}}" stepKey="seeLabelNotVisible"/>
<seeNumberOfElements selector="{{AdminProductFormConfigurationsSection.currentVariationsRows}}" userInput="3" stepKey="seeNumberOfRows"/>
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsNameCells}}" userInput="{{colorProductAttribute1.name}}" stepKey="seeAttributeName1InField"/>
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsNameCells}}" userInput="{{colorProductAttribute2.name}}" stepKey="seeAttributeName2InField"/>
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsNameCells}}" userInput="{{colorProductAttribute3.name}}" stepKey="seeAttributeName3InField"/>
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsSkuCells}}" userInput="{{colorProductAttribute1.name}}" stepKey="seeAttributeSku1InField"/>
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsSkuCells}}" userInput="{{colorProductAttribute2.name}}" stepKey="seeAttributeSku2InField"/>
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsSkuCells}}" userInput="{{colorProductAttribute3.name}}" stepKey="seeAttributeSku3InField"/>
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsPriceCells}}" userInput="{{colorProductAttribute1.price}}" stepKey="seeUniquePrice1InField"/>
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsPriceCells}}" userInput="{{colorProductAttribute2.price}}" stepKey="seeUniquePrice2InField"/>
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsPriceCells}}" userInput="{{colorProductAttribute3.price}}" stepKey="seeUniquePrice3InField"/>
<see selector="{{AdminProductFormConfigurationsSection.currentVariationsQuantityCells}}" userInput="{{colorProductAttribute.attribute_quantity}}" stepKey="seeQuantityInField"/>
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeAttributeName1InField">
<argument name="attribute" value="name_container"/>
<argument name="value" value="{{colorProductAttribute1.name}}"/>
</actionGroup>
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeAttributeName2InField">
<argument name="attribute" value="name_container"/>
<argument name="value" value="{{colorProductAttribute2.name}}"/>
</actionGroup>
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeAttributeName3InField">
<argument name="attribute" value="name_container"/>
<argument name="value" value="{{colorProductAttribute3.name}}"/>
</actionGroup>
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeAttributeSku1InField">
<argument name="attribute" value="sku_container"/>
<argument name="value" value="{{colorProductAttribute1.name}}"/>
</actionGroup>
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeAttributeSku2InField">
<argument name="attribute" value="sku_container"/>
<argument name="value" value="{{colorProductAttribute2.name}}"/>
</actionGroup>
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeAttributeSku3InField">
<argument name="attribute" value="sku_container"/>
<argument name="value" value="{{colorProductAttribute3.name}}"/>
</actionGroup>
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeUniquePrice1InField">
<argument name="attribute" value="price_container"/>
<argument name="value" value="{{colorProductAttribute1.price}}"/>
</actionGroup>
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeUniquePrice2InField">
<argument name="attribute" value="price_container"/>
<argument name="value" value="{{colorProductAttribute2.price}}"/>
</actionGroup>
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeUniquePrice3InField">
<argument name="attribute" value="price_container"/>
<argument name="value" value="{{colorProductAttribute3.price}}"/>
</actionGroup>
<actionGroup ref="AssertAdminChildProductDataOnParentProductEditPageActionGroup" stepKey="seeQuantityInField">
<argument name="attribute" value="quantity_container"/>
<argument name="value" value="{{colorProductAttribute.attribute_quantity}}"/>
</actionGroup>

<!-- assert storefront category list page -->
<amOnPage url="/" stepKey="amOnStorefront"/>
<waitForPageLoad stepKey="waitForPageLoad3"/>
<click userInput="$$createCategory.name$$" stepKey="clickOnCategoryName"/>
<waitForPageLoad stepKey="waitForPageLoad4"/>
<see userInput="{{_defaultProduct.name}}" stepKey="assertProductPresent"/>
<see userInput="{{colorProductAttribute1.price}}" stepKey="assertProductPricePresent"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="amOnStorefront"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageLoad3"/>
<actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="clickOnCategoryName">
<argument name="categoryName" value="$$createCategory.name$$"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageLoad4"/>
<actionGroup ref="AssertStorefrontProductIsPresentOnCategoryPageActionGroup" stepKey="assertProductPresent">
<argument name="productName" value="{{_defaultProduct.name}}"/>
</actionGroup>
<actionGroup ref="StorefrontAssertProductPriceOnCategoryPageActionGroup" stepKey="assertProductPricePresent">
<argument name="productName" value="{{_defaultProduct.name}}"/>
<argument name="productPrice" value="{{colorProductAttribute1.price}}"/>
</actionGroup>

<!-- assert storefront product details page -->
<click userInput="{{_defaultProduct.name}}" stepKey="clickOnProductName"/>
<waitForPageLoad stepKey="waitForPageLoad5"/>
<seeInTitle userInput="{{_defaultProduct.name}}" stepKey="assertProductNameTitle"/>
<see userInput="{{_defaultProduct.name}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="assertProductName"/>
<see userInput="{{colorProductAttribute1.price}}" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="assertProductPrice"/>
<see userInput="{{_defaultProduct.sku}}" selector="{{StorefrontProductInfoMainSection.productSku}}" stepKey="assertProductSku"/>
<see selector="{{StorefrontProductInfoMainSection.productAttributeTitle1}}" userInput="{{colorProductAttribute.default_label}}" stepKey="seeColorAttributeName1"/>
<see selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" userInput="{{colorProductAttribute1.name}}" stepKey="seeInDropDown1"/>
<see selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" userInput="{{colorProductAttribute2.name}}" stepKey="seeInDropDown2"/>
<see selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" userInput="{{colorProductAttribute3.name}}" stepKey="seeInDropDown3"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnProductName"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageLoad5"/>
<actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageActionGroup" stepKey="assertProductNameTitle">
<argument name="product" value="_defaultProduct"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="assertProductName"/>
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="assertProductPrice">
<argument name="productPrice" value="{{colorProductAttribute1.price}}"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="assertProductSku"/>
<actionGroup ref="AssertStorefrontProductAttributeLabelVisibleActionGroup" stepKey="seeColorAttributeName1">
<argument name="productAttributeLabel" value="{{colorProductAttribute.default_label}}"/>
</actionGroup>
<actionGroup ref="AssertStorefrontProductAttributeOptionVisibleActionGroup" stepKey="seeInDropDown1">
<argument name="productAttributeOption" value="{{colorProductAttribute1.name}}"/>
</actionGroup>
<actionGroup ref="AssertStorefrontProductAttributeOptionVisibleActionGroup" stepKey="seeInDropDown2">
<argument name="productAttributeOption" value="{{colorProductAttribute2.name}}"/>
</actionGroup>
<actionGroup ref="AssertStorefrontProductAttributeOptionVisibleActionGroup" stepKey="seeInDropDown3">
<argument name="productAttributeOption" value="{{colorProductAttribute3.name}}"/>
</actionGroup>
</test>
</tests>

0 comments on commit eb772c1

Please sign in to comment.