Skip to content

Commit d4d9a8e

Browse files
authored
ENGCOM-9222: Replace repetitive actions with Action Groups in AdminProductBundleCreationTest #34076
2 parents 897222c + 08e7739 commit d4d9a8e

File tree

1 file changed

+36
-23
lines changed

1 file changed

+36
-23
lines changed

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

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,34 @@
3636
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
3737
</after>
3838
<!-- go to bundle product creation page-->
39-
<amOnPage url="{{AdminProductCreatePage.url(BundleProduct.set, BundleProduct.type)}}" stepKey="goToBundleProductCreationPage" />
40-
<waitForPageLoad stepKey="waitForBundleProductCreatePageToLoad"/>
4139

42-
<!-- Add two bundle items -->
43-
<conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenSectionBundleItems"/>
44-
<click selector="{{AdminProductFormBundleSection.addOption}}" stepKey="clickAddOption3"/>
45-
<waitForElementVisible selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" stepKey="waitForBundleOptions"/>
46-
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" userInput="{{BundleProduct.optionTitle1}}" stepKey="fillOptionTitle"/>
47-
<selectOption selector="{{AdminProductFormBundleSection.bundleOptionXInputType('0')}}" userInput="{{BundleProduct.optionInputType1}}" stepKey="selectInputType"/>
48-
<actionGroup ref="AdminClickAddProductToOptionActionGroup" stepKey="clickAddProductsToOption"/>
49-
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions">
50-
<argument name="product" value="$$simpleProduct1$$"/>
40+
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToBundleProductCreationPage">
41+
<argument name="attributeSetId" value="{{BundleProduct.set}}"/>
42+
<argument name="productType" value="{{BundleProduct.type}}"/>
5143
</actionGroup>
52-
<checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow"/>
53-
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions2">
54-
<argument name="product" value="$$simpleProduct2$$"/>
44+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductCreatePageToLoad"/>
45+
46+
<!-- Add two bundle items -->
47+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="conditionallyOpenSectionBundleItems"/>
48+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickAddOption3"/>
49+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleOptions"/>
50+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillOptionTitle"/>
51+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectInputType"/>
52+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickAddProductsToOption"/>
53+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterBundleProductOptions"/>
54+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectFirstGridRow"/>
55+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterBundleProductOptions2"/>
56+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectFirstGridRow2"/>
57+
<actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="clickAddSelectedBundleProducts">
58+
<argument name="x" value="0"/>
59+
<argument name="n" value="1"/>
60+
<argument name="prodOneSku" value="$$simpleProduct1.sku$$"/>
61+
<argument name="prodTwoSku" value="$$simpleProduct2.sku$$"/>
62+
<argument name="optionTitle" value="{{BundleProduct.optionTitle1}}"/>
63+
<argument name="inputType" value="{{BundleProduct.optionInputType1}}"/>
5564
</actionGroup>
56-
<checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow2"/>
57-
<click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="clickAddSelectedBundleProducts"/>
58-
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty1"/>
59-
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty2"/>
65+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillProductDefaultQty1"/>
66+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillProductDefaultQty2"/>
6067

6168
<!--Create a bundle product with ancillary data-->
6269
<actionGroup ref="CreateBasicBundleProductActionGroup" stepKey="createBundledProduct">
@@ -65,13 +72,19 @@
6572

6673
<!--save the product/published by default-->
6774
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveButton"/>
68-
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="messageYouSavedTheProductIsShown"/>
75+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="messageYouSavedTheProductIsShown">
76+
<argument name="message" value="You saved the product."/>
77+
</actionGroup>
6978

7079
<!-- go to page-->
71-
<amOnPage url="{{BundleProduct.urlKey}}.html" stepKey="GoToProductPage"/>
72-
7380
<!--Test Assertion - on correct page/page has been published-->
74-
<waitForPageLoad stepKey="waitForBundleProductPageToLoad"/>
75-
<seeElement stepKey="LookingForNameOfProduct" selector="{{StorefrontBundledSection.bundleProductName}}"/>
81+
82+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="GoToProductPage">
83+
<argument name="productUrl" value="{{BundleProduct.urlKey}}"/>
84+
</actionGroup>
85+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductPageToLoad"/>
86+
<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="LookingForNameOfProduct">
87+
<argument name="productName" value="{{BundleProduct.name}}"/>
88+
</actionGroup>
7689
</test>
7790
</tests>

0 commit comments

Comments
 (0)