Skip to content

Commit

Permalink
Refactoring some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kate-kyzyma committed Oct 21, 2021
1 parent ac88ad9 commit 2d2a20a
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?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="AssertStorefrontProductAttributeOptionNotVisibleActionGroup">
<arguments>
<argument name="productAttributeOption" type="string"/>
</arguments>
<dontSee selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" userInput="{{productAttributeOption}}" stepKey="doNotSeeProductAttributeOption"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,21 @@
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="saveProduct"/>

<!-- Verify that the added option is present in the storefront -->
<amOnPage url="{{StorefrontProductPage.url(_defaultProduct.urlKey)}}" stepKey="amOnStorefrontPage"/>
<waitForPageLoad stepKey="waitForStorefrontPage"/>
<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"/>
<see selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" userInput="{{colorProductAttribute4.name}}" stepKey="seeInDropDown4"/>
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="amOnStorefrontPage">
<argument name="productUrlKey" value="{{_defaultProduct.urlKey}}"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForStorefrontPage"/>
<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>
<actionGroup ref="AssertStorefrontProductAttributeOptionVisibleActionGroup" stepKey="seeInDropDown4">
<argument name="productAttributeOption" value="{{colorProductAttribute4.name}}"/>
</actionGroup>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,16 @@
</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>

<!--go to admin and disable an option-->
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
Expand All @@ -91,9 +97,15 @@
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSave"/>

<!--check storefront for one option-->
<amOnPage url="$$createConfigProduct.custom_attributes[url_key]$$.html" stepKey="amOnStorefront2"/>
<waitForPageLoad stepKey="wait4"/>
<dontSee selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" userInput="option1" stepKey="dontSeeOption1InStorefront"/>
<see selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" userInput="option2" stepKey="seeOption2Again"/>
<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"/>
<actionGroup ref="AssertStorefrontProductAttributeOptionNotVisibleActionGroup" stepKey="dontSeeOption1InStorefront">
<argument name="productAttributeOption" value="option1"/>
</actionGroup>
<actionGroup ref="AssertStorefrontProductAttributeOptionVisibleActionGroup" stepKey="seeOption2Again">
<argument name="productAttributeOption" value="option2"/>
</actionGroup>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@
<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"/>
<actionGroup ref="AssertStorefrontProductAttributeOptionNotVisibleActionGroup" stepKey="dontSeeOption1InStorefront">
<argument name="productAttributeOption" value="option1"/>
</actionGroup>
<actionGroup ref="AssertStorefrontProductAttributeOptionVisibleActionGroup" stepKey="seeOption2Again">
<argument name="productAttributeOption" value="option2"/>
</actionGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,21 @@
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="saveProduct"/>

<!-- Verify that the removed option is not present in the storefront -->
<amOnPage url="{{StorefrontProductPage.url(_defaultProduct.urlKey)}}" stepKey="amOnStorefrontPage"/>
<waitForPageLoad stepKey="waitForStorefrontPage"/>
<dontSee 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"/>
<!--<amOnPage url="{{StorefrontProductPage.url(_defaultProduct.urlKey)}}" stepKey="amOnStorefrontPage"/>-->
<!--<waitForPageLoad stepKey="waitForStorefrontPage"/>-->
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="amOnStorefrontPage">
<argument name="productUrlKey" value="{{_defaultProduct.urlKey}}"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForStorefrontPage"/>
<!--<dontSee selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" userInput="{{colorProductAttribute1.name}}" stepKey="seeInDropDown1"/>-->
<actionGroup ref="AssertStorefrontProductAttributeOptionNotVisibleActionGroup" 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 2d2a20a

Please sign in to comment.