Skip to content

Commit 4cf3922

Browse files
committed
Refactoring the test
1 parent 2b943ed commit 4cf3922

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
@@ -38,11 +38,15 @@
3838
</after>
3939

4040
<!-- Verify not able to add configurable product to cart when no option is selected in storefront product view -->
41-
<amOnPage url="{{_defaultProduct.urlKey}}.html" stepKey="amOnConfigurableProductPage"/>
42-
<waitForPageLoad stepKey="wait"/>
43-
<see userInput="{{_defaultProduct.name}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="seeProductName"/>
41+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="amOnConfigurableProductPage">
42+
<argument name="productUrlKey" value="{{_defaultProduct.urlKey}}"/>
43+
</actionGroup>
44+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="wait"/>
45+
<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="seeProductName">
46+
<argument name="productName" value="{{_defaultProduct.name}}"/>
47+
</actionGroup>
4448
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.AddToCart}}" stepKey="waitForAddToCartVisible"/>
45-
<click selector="{{StorefrontProductInfoMainSection.AddToCart}}" stepKey="clickAddToCart"/>
46-
<see userInput="This is a required field" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsError}}" stepKey="seeError"/>
49+
<actionGroup ref="StorefrontClickAddToCartButtonOnProductPageActionGroup" stepKey="clickAddToCart"/>
50+
<actionGroup ref="AssertStorefrontRequiredFieldErrorMessageForProductOptionActionGroup" stepKey="seeError"/>
4751
</test>
4852
</tests>

0 commit comments

Comments
 (0)