Skip to content

Commit 1d178a9

Browse files
committed
Refactoring AdminNavigateMultipleUpSellProductsTest
1 parent 5734ca9 commit 1d178a9

File tree

2 files changed

+84
-45
lines changed

2 files changed

+84
-45
lines changed
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+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontAssertUpSellProductOnProductPageActionGroup">
12+
<annotations>
13+
<description>Validates that the provided Product Name is present in Up Sell block on Product details page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="productName" type="string" defaultValue="{{_defaultProduct.name}}"/>
17+
</arguments>
18+
19+
<see selector="{{StorefrontProductUpSellProductsSection.upSellProducts}}" userInput="{{productName}}" stepKey="seeUpSellProduct"/>
20+
</actionGroup>
21+
</actionGroups>

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

Lines changed: 63 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -102,82 +102,100 @@
102102
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findCreatedProduct">
103103
<argument name="product" value="$$createSimpleProduct$$"/>
104104
</actionGroup>
105-
<click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/>
106-
<waitForPageLoad stepKey="waitForProductToLoad"/>
105+
<actionGroup ref="AdminProductGridSectionClickFirstRowActionGroup" stepKey="openFirstProduct"/>
106+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductToLoad"/>
107107

108108
<!--Add SimpleProduct1 and ConfigProduct as Up sell products-->
109-
<click stepKey="clickOnRelatedProducts" selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedProductsHeader}}"/>
110-
<click stepKey="clickOnAddUpSellProducts" selector="{{AdminProductFormRelatedUpSellCrossSellSection.addUpSellProduct}}"/>
111-
<actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterProduct">
109+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnRelatedProducts"/>
110+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnAddUpSellProducts"/>
111+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterProduct"/>
112+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForTheProductToLoad"/>
113+
<actionGroup ref="AddUpSellProductBySkuActionGroup" stepKey="selectTheSimpleProduct2">
112114
<argument name="sku" value="$$createSimpleProduct1.sku$$"/>
113115
</actionGroup>
114-
<waitForPageLoad stepKey="waitForTheProductToLoad"/>
115-
<checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="selectTheSimpleProduct2"/>
116-
<click stepKey="addSelectedProduct" selector="{{AdminAddRelatedProductsModalSection.AddUpSellProductsButton}}"/>
117-
<waitForPageLoad stepKey="waitForProductToBeAdded"/>
118-
<click stepKey="clickOnAddUpSellProductsButton" selector="{{AdminProductFormRelatedUpSellCrossSellSection.addUpSellProduct}}"/>
119-
<actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterConfigurableProduct">
116+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="addSelectedProduct"/>
117+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductToBeAdded"/>
118+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnAddUpSellProductsButton"/>
119+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterConfigurableProduct"/>
120+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForTheConfigProductToLoad"/>
121+
<actionGroup ref="AddUpSellProductBySkuActionGroup" stepKey="selectTheConfigProduct">
120122
<argument name="sku" value="$$createConfigProduct.sku$$"/>
121123
</actionGroup>
122-
<waitForPageLoad stepKey="waitForTheConfigProductToLoad"/>
123-
<checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="selectTheConfigProduct"/>
124-
<click stepKey="addSelectedProductButton" selector="{{AdminAddRelatedProductsModalSection.AddUpSellProductsButton}}"/>
125-
<waitForPageLoad stepKey="waitForConfigProductToBeAdded"/>
126-
<click stepKey="clickOnRelatedProducts1" selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedProductsHeader}}"/>
127-
<click stepKey="clickOnSaveButton" selector="{{AdminProductFormActionSection.saveButton}}"/>
128-
<waitForPageLoad stepKey="waitForLoading1"/>
129-
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/>
124+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="addSelectedProductButton"/>
125+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForConfigProductToBeAdded"/>
126+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnRelatedProducts1"/>
127+
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickOnSaveButton"/>
128+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForLoading1"/>
129+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="messageYouSavedTheProductIsShown">
130+
<argument name="message" value="You saved the product."/>
131+
</actionGroup>
130132

131133
<!--Go to Product Index Page -->
132-
<click stepKey="clickOnBackButton" selector="{{AdminGridMainControls.back}}"/>
133-
<waitForPageLoad stepKey="waitForProductsToBeLoaded"/>
134+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="clickOnBackButton"/>
135+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductsToBeLoaded"/>
134136

135137
<!--Select Configurable Product-->
136138
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findConfigProduct">
137139
<argument name="product" value="$$createConfigProduct$$"/>
138140
</actionGroup>
139-
<click stepKey="openConfigProduct" selector="{{AdminProductGridSection.productRowBySku($$createConfigProduct.sku$$)}}"/>
140-
<waitForPageLoad stepKey="waitForConfigProductToLoad"/>
141+
<actionGroup ref="AdminProductGridSectionClickFirstRowActionGroup" stepKey="openConfigProduct"/>
142+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForConfigProductToLoad"/>
141143

142144
<!--Add SimpleProduct1 as Up Sell Product-->
143-
<click stepKey="clickOnRelatedProductsHeader" selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedProductsHeader}}"/>
144-
<click stepKey="clickOnAddUpSellProductsButton1" selector="{{AdminProductFormRelatedUpSellCrossSellSection.addUpSellProduct}}"/>
145-
<actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterSimpleProduct2">
145+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnRelatedProductsHeader"/>
146+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnAddUpSellProductsButton1"/>
147+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterSimpleProduct2"/>
148+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForTheSimpleProduct2ToBeLoaded"/>
149+
<actionGroup ref="AddUpSellProductBySkuActionGroup" stepKey="selectSimpleProduct1">
146150
<argument name="sku" value="$$createSimpleProduct1.sku$$"/>
147151
</actionGroup>
148-
<waitForPageLoad stepKey="waitForTheSimpleProduct2ToBeLoaded"/>
149-
<checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="selectSimpleProduct1"/>
150-
<click stepKey="addSimpleProduct2" selector="{{AdminAddRelatedProductsModalSection.AddUpSellProductsButton}}"/>
151-
<waitForPageLoad stepKey="waitForSimpleProductToBeAdded"/>
152-
<scrollTo selector="{{AdminProductFormActionSection.saveButton}}" stepKey="scrollToTheSaveButton"/>
153-
<click stepKey="clickOnSaveButton1" selector="{{AdminProductFormActionSection.saveButton}}"/>
154-
<waitForPageLoad stepKey="waitForLoading2"/>
155-
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown1"/>
156-
<waitForPageLoad stepKey="waitForUpdatesTobeSaved1"/>
152+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="addSimpleProduct2"/>
153+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForSimpleProductToBeAdded"/>
154+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="scrollToTheSaveButton"/>
155+
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickOnSaveButton1"/>
156+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForLoading2"/>
157+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="messageYouSavedTheProductIsShown1">
158+
<argument name="message" value="You saved the product."/>
159+
</actionGroup>
160+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForUpdatesTobeSaved1"/>
157161

158162
<!--Go to SimpleProduct store front page-->
159-
<amOnPage url="$$createSimpleProduct.custom_attributes[url_key]$$.html" stepKey="goToSimpleProductFrontPage"/>
160-
<waitForPageLoad stepKey="waitForProduct"/>
161-
<see stepKey="seeProductName" userInput="$$createSimpleProduct.name$$" selector="{{StorefrontProductInfoMainSection.productName}}"/>
163+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="goToSimpleProductFrontPage">
164+
<argument name="product" value="$$createSimpleProduct$$"/>
165+
</actionGroup>
166+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProduct"/>
167+
<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="seeProductName">
168+
<argument name="productName" value="$$createSimpleProduct.name$$"/>
169+
</actionGroup>
162170
<scrollTo stepKey="scrollToTheUpSellHeading" selector="{{StorefrontProductUpSellProductsSection.upSellHeading}}"/>
163171

164172
<!--Verify Up Sell Products displayed in SimpleProduct page-->
165173
<see stepKey="seeTheUpSellHeading" selector="{{StorefrontProductUpSellProductsSection.upSellHeading}}" userInput="We found other products you might like!"/>
166-
<see stepKey="seeSimpleProduct1" selector="{{StorefrontProductUpSellProductsSection.upSellProducts}}" userInput="$$createSimpleProduct1.name$$"/>
167-
<see stepKey="seeConfigProduct" selector="{{StorefrontProductUpSellProductsSection.upSellProducts}}" userInput="$$createConfigProduct.name$$"/>
174+
<actionGroup ref="StorefrontAssertUpSellProductOnProductPageActionGroup" stepKey="seeSimpleProduct1">
175+
<argument name="productName" value="$$createSimpleProduct1.name$$"/>
176+
</actionGroup>
177+
<actionGroup ref="StorefrontAssertUpSellProductOnProductPageActionGroup" stepKey="seeConfigProduct">
178+
<argument name="productName" value="$$createConfigProduct.name$$"/>
179+
</actionGroup>
168180

169181
<!--Go to Config Product store front page-->
170-
<amOnPage url="$$createConfigProduct.custom_attributes[url_key]$$.html" stepKey="goToConfigProductFrontPage"/>
171-
<waitForPageLoad stepKey="waitForConfigProductToBeLoaded"/>
182+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="goToConfigProductFrontPage">
183+
<argument name="product" value="$$createConfigProduct$$"/>
184+
</actionGroup>
185+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForConfigProductToBeLoaded"/>
172186
<scrollTo stepKey="scrollToTheUpSellHeading1" selector="{{StorefrontProductUpSellProductsSection.upSellHeading}}"/>
173187

174188
<!--Verify Up Sell Products displayed in ConfigProduct page-->
175189
<see stepKey="seeTheUpSellHeading1" selector="{{StorefrontProductUpSellProductsSection.upSellHeading}}" userInput="We found other products you might like!"/>
176-
<see stepKey="seeSimpleProduct2" selector="{{StorefrontProductUpSellProductsSection.upSellProducts}}" userInput="$$createSimpleProduct1.name$$"/>
190+
<actionGroup ref="StorefrontAssertUpSellProductOnProductPageActionGroup" stepKey="seeSimpleProduct2">
191+
<argument name="productName" value="$$createSimpleProduct1.name$$"/>
192+
</actionGroup>
177193

178194
<!--Go to SimpleProduct1 store front page-->
179-
<amOnPage url="$$createSimpleProduct1.custom_attributes[url_key]$$.html" stepKey="goToSimpleProduct1FrontPage"/>
180-
<waitForPageLoad stepKey="waitForSimpleProduct1ToBeLoaded"/>
195+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="goToSimpleProduct1FrontPage">
196+
<argument name="product" value="$$createSimpleProduct1$$"/>
197+
</actionGroup>
198+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForSimpleProduct1ToBeLoaded"/>
181199

182200
<!--Verify No Up Sell Products displayed in SimplProduct1 page-->
183201
<dontSee stepKey="dontSeeTheUpSellHeading1" selector="{{StorefrontProductUpSellProductsSection.upSellHeading}}" userInput="We found other products you might like!"/>

0 commit comments

Comments
 (0)