Skip to content

Commit a6d28bc

Browse files
committed
Refactoring AdminMassDeleteBundleProductsTest
1 parent 220b556 commit a6d28bc

File tree

3 files changed

+60
-16
lines changed

3 files changed

+60
-16
lines changed

app/code/Magento/Bundle/Test/Mftf/Test/AdminMassDeleteBundleProductsTest.xml

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@
3737
</after>
3838

3939
<!--Go to bundle product creation page-->
40-
<amOnPage url="{{AdminProductCreatePage.url(BundleProduct.set, BundleProduct.type)}}" stepKey="goToBundleProductCreationPage" />
41-
<waitForPageLoad stepKey="waitForBundleProductCreatePageToLoad"/>
40+
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToBundleProductCreationPage">
41+
<argument name="attributeSetId" value="{{BundleProduct.set}}"/>
42+
<argument name="productType" value="{{BundleProduct.type}}"/>
43+
</actionGroup>
44+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductCreatePageToLoad"/>
4245

4346
<!--Create bundle product-->
4447
<conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenSectionBundleItems"/>
@@ -66,12 +69,17 @@
6669

6770
<!--Save the product-->
6871
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveButton"/>
69-
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="messageYouSavedTheProductIsShown"/>
72+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="messageYouSavedTheProductIsShown">
73+
<argument name="message" value="You saved the product."/>
74+
</actionGroup>
7075

7176
<!--Creating Second bundle product-->
7277
<!--Go to bundle product creation page-->
73-
<amOnPage url="{{AdminProductCreatePage.url(BundleProduct.set, BundleProduct.type)}}" stepKey="goToBundleProductCreationPage2" />
74-
<waitForPageLoad stepKey="waitForBundleProductCreatePageToLoad2"/>
78+
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToBundleProductCreationPage2">
79+
<argument name="attributeSetId" value="{{BundleProduct.set}}"/>
80+
<argument name="productType" value="{{BundleProduct.type}}"/>
81+
</actionGroup>
82+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductCreatePageToLoad2"/>
7583

7684
<!--Create bundle product 2-->
7785
<conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenSectionBundleItems2"/>
@@ -104,7 +112,9 @@
104112

105113
<!--Save the product-->
106114
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveButton2"/>
107-
<see userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown2"/>
115+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="messageYouSavedTheProductIsShown2">
116+
<argument name="message" value="You saved the product."/>
117+
</actionGroup>
108118

109119
<!--Mass delete bundle products-->
110120
<!--Clear Filters-->
@@ -117,19 +127,30 @@
117127
<actionGroup ref="AdminDeleteAllProductsFromGridActionGroup" stepKey="selectAndDeleteProducts"/>
118128

119129
<!--Locating delete message-->
120-
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="deleteMessage"/>
130+
<!--<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="deleteMessage"/>-->
131+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="deleteMessage">
132+
<argument name="message" value="A total of 2 record(s) have been deleted."/>
133+
</actionGroup>
121134

122135
<!--Clear Cache - resets products according to enabled/disabled view-->
123136
<actionGroup ref="ClearPageCacheActionGroup" stepKey="ClearPageCaches"/>
124137

125138
<!--Testing deletion of products-->
126-
<amOnPage url="{{BundleProduct.urlKey}}.html" stepKey="GoToProductPageAgain"/>
127-
<waitForPageLoad stepKey="WaitForProductPageToLoadToShowElement"/>
128-
<dontSeeElement stepKey="LookingForNameOfProduct" selector="{{StorefrontBundledSection.bundleProductName}}"/>
129-
<seeElement stepKey="LookingForPageNotFoundMessage" selector="{{StorefrontBundledSection.pageNotFound}}"/>
130-
<amOnPage url="{{BundleProduct.urlKey2}}.html" stepKey="GoToProductPageAgain2"/>
131-
<waitForPageLoad stepKey="WaitForProductPageToLoadToShowElement2"/>
132-
<dontSeeElement stepKey="LookingForNameOfProduct2" selector="{{StorefrontBundledSection.bundleProductName}}"/>
133-
<seeElement stepKey="LookingForPageNotFoundMessage2" selector="{{StorefrontBundledSection.pageNotFound}}"/>
139+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="GoToProductPageAgain">
140+
<argument name="productUrl" value="{{BundleProduct.urlKey}}"/>
141+
</actionGroup>
142+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="WaitForProductPageToLoadToShowElement"/>
143+
<actionGroup ref="StorefrontAssertProductNameIsNotShownOnProductPageActionGroup" stepKey="LookingForNameOfProduct">
144+
<argument name="productName" value="{{BundleProduct.name}}"/>
145+
</actionGroup>
146+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="LookingForPageNotFoundMessage"/>
147+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="GoToProductPageAgain2">
148+
<argument name="productUrl" value="{{BundleProduct.urlKey2}}"/>
149+
</actionGroup>
150+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="WaitForProductPageToLoadToShowElement2"/>
151+
<actionGroup ref="StorefrontAssertProductNameIsNotShownOnProductPageActionGroup" stepKey="LookingForNameOfProduct2">
152+
<argument name="productName" value="{{BundleProduct.name2}}"/>
153+
</actionGroup>
154+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="LookingForPageNotFoundMessage2"/>
134155
</test>
135156
</tests>

app/code/Magento/Bundle/Test/Mftf/Test/EnableDisableBundleProductStatusTest.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@
100100
<argument name="productUrl" value="{{BundleProduct.urlKey}}"/>
101101
</actionGroup>
102102
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="WaitForProductPageToLoadToShowElement"/>
103-
<dontSeeElement stepKey="LookingForNameOfProductTwo" selector="{{StorefrontBundledSection.bundleProductName}}"/>
103+
<actionGroup ref="StorefrontAssertProductNameIsNotShownOnProductPageActionGroup" stepKey="LookingForNameOfProductTwo">
104+
<argument name="productName" value="{{BundleProduct.name}}"/>
105+
</actionGroup>
104106
</test>
105107
</tests>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="StorefrontAssertProductNameIsNotShownOnProductPageActionGroup">
11+
<annotations>
12+
<description>Validate that the provided Product Name is not shown on the product page. We may see 404 page</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="productName"/>
16+
</arguments>
17+
18+
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="Whoops, our bad..." stepKey="assert404Page"/>
19+
<dontSee selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{productName}}" stepKey="dontSeeProductName"/>
20+
</actionGroup>
21+
</actionGroups>

0 commit comments

Comments
 (0)