Skip to content

Commit 15b48e9

Browse files
ENGCOM-9232: Replace repetitive actions with Action Groups in StorefrontConfigurableProductGridViewTest and StorefrontConfigurableProductListViewTest #34051
- Merge Pull Request #34051 from kate-kyzyma/magento2:Refactoring-StorefrontConfigurableProductGridViewTest - Merged commits: 1. 1c35574 2. 2742d83
2 parents 177254d + 2742d83 commit 15b48e9

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest/StorefrontConfigurableProductGridViewTest.xml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,18 @@
4949
</after>
5050

5151
<!-- Verify the storefront category grid view -->
52-
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.custom_attributes[url_key]$$)}}" stepKey="amOnCategoryPage1"/>
53-
<waitForPageLoad stepKey="wait1"/>
52+
<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="amOnCategoryPage1">
53+
<argument name="category" value="$$createCategory$$"/>
54+
</actionGroup>
55+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="wait1"/>
5456
<seeElement selector="{{StorefrontCategoryMainSection.productImage}}" stepKey="seePhoto"/>
55-
<see selector="{{StorefrontCategoryMainSection.productLink}}" userInput="{{_defaultProduct.name}}" stepKey="seeName"/>
57+
<actionGroup ref="AssertStorefrontProductIsPresentOnCategoryPageActionGroup" stepKey="seeName">
58+
<argument name="productName" value="{{_defaultProduct.name}}"/>
59+
</actionGroup>
5660
<seeElement selector="{{StorefrontCategoryMainSection.productLinkByHref(_defaultProduct.urlKey)}}" stepKey="seeNameLink"/>
57-
<see selector="{{StorefrontCategoryMainSection.productPrice}}" userInput="{{colorProductAttribute1.price}}" stepKey="seePrice"/>
61+
<actionGroup ref="StorefrontAssertProductPriceOnCategoryPageActionGroup" stepKey="seePrice">
62+
<argument name="productName" value="{{_defaultProduct.name}}"/>
63+
<argument name="productPrice" value="{{colorProductAttribute1.price}}"/>
64+
</actionGroup>
5865
</test>
5966
</tests>

app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest/StorefrontConfigurableProductListViewTest.xml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,20 @@
5959
</after>
6060

6161
<!-- Verify storefront category list view -->
62-
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.custom_attributes[url_key]$$)}}" stepKey="amOnCategoryPage1"/>
63-
<waitForPageLoad stepKey="wait1"/>
64-
<click selector="{{StorefrontCategoryMainSection.modeListButton}}" stepKey="clickListView"/>
62+
<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="amOnCategoryPage1">
63+
<argument name="category" value="$$createCategory$$"/>
64+
</actionGroup>
65+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="wait1"/>
66+
<actionGroup ref="StorefrontSwitchCategoryViewToListModeActionGroup" stepKey="clickListView"/>
6567
<waitForPageLoad stepKey="wait2"/>
6668
<seeElement selector="{{StorefrontCategoryMainSection.productImage}}" stepKey="seePhoto"/>
67-
<see selector="{{StorefrontCategoryMainSection.productLink}}" userInput="{{_defaultProduct.name}}" stepKey="seeName"/>
69+
<actionGroup ref="AssertStorefrontProductIsPresentOnCategoryPageActionGroup" stepKey="seeName">
70+
<argument name="productName" value="{{_defaultProduct.name}}"/>
71+
</actionGroup>
6872
<seeElement selector="{{StorefrontCategoryMainSection.productLinkByHref(_defaultProduct.urlKey)}}" stepKey="seeNameLink"/>
69-
<see selector="{{StorefrontCategoryMainSection.productPrice}}" userInput="{{colorProductAttribute1.price}}" stepKey="seePrice"/>
73+
<actionGroup ref="StorefrontAssertProductPriceOnCategoryPageActionGroup" stepKey="seePrice">
74+
<argument name="productName" value="{{_defaultProduct.name}}"/>
75+
<argument name="productPrice" value="{{colorProductAttribute1.price}}"/>
76+
</actionGroup>
7077
</test>
7178
</tests>

0 commit comments

Comments
 (0)