Skip to content

Commit 42b87e8

Browse files
authored
ENGCOM-9275: Replace repetitive actions with Action Groups in AdminSimpleSetEditRelatedProductsTest #34346
2 parents d33027b + b0f1b53 commit 42b87e8

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

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

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@
6161

6262
<!--Save the product-->
6363
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveButton"/>
64-
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/>
64+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="messageYouSavedTheProductIsShown">
65+
<argument name="message" value="You saved the product."/>
66+
</actionGroup>
6567

6668
<!--Add another related product-->
6769
<actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addRelatedProduct1">
@@ -73,12 +75,17 @@
7375

7476
<!--Save the product-->
7577
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveButtonAfterEdit"/>
76-
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShownAgain"/>
78+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="messageYouSavedTheProductIsShownAgain">
79+
<argument name="message" value="You saved the product."/>
80+
</actionGroup>
7781

7882
<!--See related product in admin-->
79-
<scrollTo selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" stepKey="scrollTo"/>
80-
<conditionalClick selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" dependentSelector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDependent}}" visible="false" stepKey="openDropDownIfClosedRelatedSee"/>
81-
<see selector="{{AdminProductFormRelatedUpSellCrossSellSection.selectedRelatedProduct}}" userInput="$$simpleProduct1.name$$" stepKey="seeRelatedProduct"/>
83+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="scrollTo"/>
84+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openDropDownIfClosedRelatedSee"/>
85+
<actionGroup ref="AssertTextInAdminProductRelatedUpSellCrossSellSectionActionGroup" stepKey="seeRelatedProduct">
86+
<argument name="element" value="AdminProductFormRelatedUpSellCrossSellSection.relatedProductSectionText"/>
87+
<argument name="expectedText" value="$$simpleProduct1.name$$"/>
88+
</actionGroup>
8289

8390
<!--See more related products in admin-->
8491
<actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addRelatedProduct2">
@@ -96,16 +103,24 @@
96103
<actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addRelatedProduct6">
97104
<argument name="sku" value="$$simpleProduct6.sku$$"/>
98105
</actionGroup>
99-
<scrollTo selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" stepKey="scrollTo2"/>
100-
<conditionalClick selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" dependentSelector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDependent}}" visible="false" stepKey="openDropDownIfClosedRelatedSee2"/>
101-
<see selector="{{AdminProductFormRelatedUpSellCrossSellSection.selectedRelatedProduct}}" userInput="$$simpleProduct6.name$$" stepKey="seeSixthRelatedProduct"/>
106+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="scrollTo2"/>
107+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openDropDownIfClosedRelatedSee2"/>
108+
<actionGroup ref="AssertTextInAdminProductRelatedUpSellCrossSellSectionActionGroup" stepKey="seeSixthRelatedProduct">
109+
<argument name="element" value="AdminProductFormRelatedUpSellCrossSellSection.relatedProductSectionText"/>
110+
<argument name="expectedText" value="$$simpleProduct6.name$$"/>
111+
</actionGroup>
112+
102113
<selectOption selector=".admin__collapsible-block-wrapper[data-index='related'] .admin__control-select" userInput="5" stepKey="selectFivePerPage"/>
103114
<waitForPageLoad stepKey="waitForLoadingAfterSelectFivePerPage"/>
104115
<dontSee selector="{{AdminProductFormRelatedUpSellCrossSellSection.selectedRelatedProduct}}" userInput="$$simpleProduct6.name$$" stepKey="dontSeeSixthRelatedProduct"/>
105116

106117
<!--See related product in storefront-->
107-
<amOnPage url="{{SimpleProduct3.urlKey}}.html" stepKey="goToStorefront"/>
108-
<waitForPageLoad stepKey="waitForStorefront"/>
109-
<seeElement selector="{{StorefrontProductRelatedProductsSection.relatedProductName($$simpleProduct1.name$$)}}" stepKey="seeRelatedProductInStorefront"/>
118+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="goToStorefront">
119+
<argument name="productUrl" value="{{SimpleProduct3.urlKey}}"/>
120+
</actionGroup>
121+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForStorefront"/>
122+
<actionGroup ref="StorefrontAssertRelatedProductOnProductPageActionGroup" stepKey="seeRelatedProductInStorefront">
123+
<argument name="productName" value="$$simpleProduct1.name$$"/>
124+
</actionGroup>
110125
</test>
111126
</tests>

0 commit comments

Comments
 (0)