Skip to content

Commit 9d79620

Browse files
ENGCOM-8942: Replace repetitive actions with Action Groups in StorefrontConfigurableProductCantAddToCartTest #32139
- Merge Pull Request #32139 from kate-kyzyma/magento2:Refactoring-StorefrontConfigurableProductCantAddToCartTest - Merged commits: 1. 4cf3922 2. 6010ead 3. c316814
2 parents 7e364fd + c316814 commit 9d79620

File tree

3 files changed

+41
-5
lines changed

3 files changed

+41
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertStorefrontRequiredFieldErrorMessageForProductOptionActionGroup">
12+
<see selector="{{StorefrontProductInfoMainSection.productAttributeOptionsError}}" userInput="This is a required field"
13+
stepKey="seeErrorMessage"/>
14+
</actionGroup>
15+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontClickAddToCartButtonOnProductPageActionGroup" extends="StorefrontClickAddToCartOnProductPageActionGroup">
12+
<annotations>
13+
<description>EXTENDS: StorefrontClickAddToCartOnProductPageActionGroup. Removes 'waitForSuccessMessage'.</description>
14+
</annotations>
15+
<remove keyForRemoval="waitForSuccessMessage"/>
16+
</actionGroup>
17+
</actionGroups>

app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest/StorefrontConfigurableProductCantAddToCartTest.xml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,15 @@
4747
</after>
4848

4949
<!-- Verify not able to add configurable product to cart when no option is selected in storefront product view -->
50-
<amOnPage url="{{_defaultProduct.urlKey}}.html" stepKey="amOnConfigurableProductPage"/>
51-
<waitForPageLoad stepKey="wait"/>
52-
<see userInput="{{_defaultProduct.name}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="seeProductName"/>
50+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="amOnConfigurableProductPage">
51+
<argument name="productUrlKey" value="{{_defaultProduct.urlKey}}"/>
52+
</actionGroup>
53+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="wait"/>
54+
<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="seeProductName">
55+
<argument name="productName" value="{{_defaultProduct.name}}"/>
56+
</actionGroup>
5357
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.AddToCart}}" stepKey="waitForAddToCartVisible"/>
54-
<click selector="{{StorefrontProductInfoMainSection.AddToCart}}" stepKey="clickAddToCart"/>
55-
<see userInput="This is a required field" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsError}}" stepKey="seeError"/>
58+
<actionGroup ref="StorefrontClickAddToCartButtonOnProductPageActionGroup" stepKey="clickAddToCart"/>
59+
<actionGroup ref="AssertStorefrontRequiredFieldErrorMessageForProductOptionActionGroup" stepKey="seeError"/>
5660
</test>
5761
</tests>

0 commit comments

Comments
 (0)