Skip to content

Commit 14f4f0c

Browse files
authored
ENGCOM-9048: Replace repetitive actions with Action Groups in AdminDeleteSimpleProductTest #31963
2 parents 2f80a89 + e1f6b0b commit 14f4f0c

File tree

2 files changed

+39
-8
lines changed

2 files changed

+39
-8
lines changed

app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteSimpleProductTest.xml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,35 @@
3232
<actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteSimpleProductFilteredBySkuAndName">
3333
<argument name="product" value="$$createSimpleProduct$$"/>
3434
</actionGroup>
35-
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="A total of 1 record(s) have been deleted." stepKey="deleteMessage"/>
35+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="deleteMessage">
36+
<argument name="message" value="A total of 1 record(s) have been deleted."/>
37+
</actionGroup>
38+
3639
<!--Verify product on Product Page -->
37-
<amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.custom_attributes[url_key]$$)}}" stepKey="amOnSimpleProductPage"/>
38-
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="Whoops, our bad..." stepKey="seeWhoops"/>
40+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="amOnSimpleProductPage">
41+
<argument name="productUrl" value="$$createSimpleProduct.custom_attributes[url_key]$$"/>
42+
</actionGroup>
43+
<actionGroup ref="StorefrontAssertPageNotFoundErrorOnProductDetailPageActionGroup" stepKey="seeWhoops">
44+
<argument name="product" value="$$createSimpleProduct$$"/>
45+
</actionGroup>
46+
3947
<!-- Search for the product by sku -->
4048
<actionGroup ref="StoreFrontQuickSearchActionGroup" stepKey="searchByCreatedTerm">
4149
<argument name="query" value="$$createSimpleProduct.sku$$"/>
4250
</actionGroup>
4351
<!-- Should not see any search results -->
44-
<dontSee userInput="$$createSimpleProduct.sku$$" selector="{{StorefrontCatalogSearchMainSection.searchResults}}" stepKey="dontSeeProduct"/>
45-
<see selector="{{StorefrontCatalogSearchMainSection.message}}" userInput="Your search returned no results." stepKey="seeCantFindProductOneMessage"/>
52+
<actionGroup ref="AssertStorefrontProductIsMissingOnSearchResultPageActionGroup" stepKey="dontSeeProduct">
53+
<argument name="productSku" value="$$createSimpleProduct.sku$$"/>
54+
</actionGroup>
55+
<actionGroup ref="AssertStorefrontNoResultsMessageOnSearchPageActionGroup" stepKey="seeCantFindProductOneMessage"/>
56+
4657
<!-- Go to the category page that we created in the before block -->
47-
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.custom_attributes[url_key]$$)}}" stepKey="onCategoryPage"/>
58+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="onCategoryPage"/>
4859
<!-- Should not see the product -->
49-
<dontSee userInput="$$createSimpleProduct.name$$" selector="{{StorefrontCategoryMainSection.productsList}}" stepKey="dontSeeProductInCategory"/>
50-
<see selector="{{StorefrontCategoryMainSection.emptyProductMessage}}" userInput="We can't find products matching the selection." stepKey="seeEmptyProductMessage"/>
60+
<actionGroup ref="AssertStorefrontProductAbsentOnCategoryPageActionGroup" stepKey="dontSeeProductInCategory">
61+
<argument name="categoryUrlKey" value="$$createCategory.name$$"/>
62+
<argument name="productName" value="$$createSimpleProduct.name$$"/>
63+
</actionGroup>
64+
<actionGroup ref="AssertStorefrontNoProductsFoundActionGroup" stepKey="seeEmptyProductMessage"/>
5165
</test>
5266
</tests>
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="AssertStorefrontProductIsMissingOnSearchResultPageActionGroup">
12+
<arguments>
13+
<argument name="productSku" type="string"/>
14+
</arguments>
15+
<dontSee selector="{{StorefrontCatalogSearchMainSection.searchResults}}" userInput="{{productSku}}" stepKey="doNotSeeProduct"/>
16+
</actionGroup>
17+
</actionGroups>

0 commit comments

Comments
 (0)