Skip to content

Commit 3febc69

Browse files
ENGCOM-8751: Replace repetitive actions with Action Groups in AdminDeleteGroupedProductTest #31918
- Merge Pull Request #31918 from kate-kyzyma/magento2:Refactoring-AdminDeleteGroupedProductTest - Merged commits: 1. 3764387 2. 195e051 3. 2a6a6fe 4. ededa03 5. 51b55dd 6. e68e736 7. 7e71e5c
2 parents 9941d17 + 7e71e5c commit 3febc69

File tree

3 files changed

+56
-9
lines changed

3 files changed

+56
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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="AssertStorefrontNoResultsMessageOnSearchPageActionGroup">
12+
<annotations>
13+
<description>Check if search returned no results</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="message" type="string" defaultValue="Your search returned no results."/>
17+
</arguments>
18+
<see selector="{{StorefrontMessagesSection.noticeMessage}}" userInput="{{message}}" stepKey="seeNoSearchResultsMessage"/>
19+
</actionGroup>
20+
</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="AssertStorefrontProductNotOnSearchPageActionGroup">
12+
<arguments>
13+
<argument name="productSku" type="string"/>
14+
</arguments>
15+
<dontSee selector="{{StorefrontCatalogSearchMainSection.searchResults}}" userInput="{{productSku}}" stepKey="doNotSeeProduct"/>
16+
</actionGroup>
17+
</actionGroups>

app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminDeleteGroupedProductTest.xml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,31 @@
3737
<argument name="product" value="$$createGroupedProduct$$"/>
3838
</actionGroup>
3939
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
40-
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="A total of 1 record(s) have been deleted." stepKey="deleteMessage"/>
40+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="deleteMessage">
41+
<argument name="message" value="A total of 1 record(s) have been deleted."/>
42+
</actionGroup>
4143
<!--Verify product on Product Page -->
42-
<amOnPage url="{{StorefrontProductPage.url($$createGroupedProduct.name$$)}}" stepKey="amOnGroupedProductPage"/>
43-
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="Whoops, our bad..." stepKey="seeWhoops"/>
44+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="amOnGroupedProductPage">
45+
<argument name="productUrl" value="$$createGroupedProduct.custom_attributes[url_key]$$"/>
46+
</actionGroup>
47+
<actionGroup ref="StorefrontAssertPageNotFoundErrorOnProductDetailPageActionGroup" stepKey="seeWhoops">
48+
<argument name="product" value="$$createGroupedProduct$$"/>
49+
</actionGroup>
4450
<!--Search for the product by sku-->
4551
<actionGroup ref="StoreFrontQuickSearchActionGroup" stepKey="searchByCreatedTerm">
4652
<argument name="query" value="$$createGroupedProduct.sku$$"/>
4753
</actionGroup>
4854
<!-- Should not see any search results -->
49-
<dontSee userInput="$$createGroupedProduct.sku$$" selector="{{StorefrontCatalogSearchMainSection.searchResults}}" stepKey="dontSeeProduct"/>
50-
<see selector="{{StorefrontCatalogSearchMainSection.message}}" userInput="Your search returned no results." stepKey="seeCantFindProductOneMessage"/>
55+
<actionGroup ref="AssertStorefrontProductNotOnSearchPageActionGroup" stepKey="dontSeeProduct">
56+
<argument name="productSku" value="$$createGroupedProduct.sku$$"/>
57+
</actionGroup>
58+
<actionGroup ref="AssertStorefrontNoResultsMessageOnSearchPageActionGroup" stepKey="seeCantFindProductOneMessage"/>
5159
<!-- Go to the category page that we created in the before block -->
52-
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/>
53-
<!-- Should not see the product -->
54-
<dontSee userInput="$$createGroupedProduct.name$$" selector="{{StorefrontCategoryMainSection.productsList}}" stepKey="dontSeeProductInCategory"/>
55-
<see selector="{{StorefrontCategoryMainSection.emptyProductMessage}}" userInput="We can't find products matching the selection." stepKey="seeEmptyProductMessage"/>
60+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="onCategoryPage"/>
61+
<actionGroup ref="AssertStorefrontProductAbsentOnCategoryPageActionGroup" stepKey="dontSeeProductInCategory">
62+
<argument name="categoryUrlKey" value="$$createCategory.name$$"/>
63+
<argument name="productName" value="$$createGroupedProduct.name$$"/>
64+
</actionGroup>
65+
<actionGroup ref="AssertStorefrontNoProductsFoundActionGroup" stepKey="seeEmptyProductMessage"/>
5666
</test>
5767
</tests>

0 commit comments

Comments
 (0)