Skip to content

Commit 31fd384

Browse files
authored
ENGCOM-9385: [MFTF] AdminAddBundleItemsTest refactoring #33526
2 parents cc61e6a + 4807bcf commit 31fd384

File tree

1 file changed

+75
-78
lines changed

1 file changed

+75
-78
lines changed

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

Lines changed: 75 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -38,50 +38,46 @@
3838
</actionGroup>
3939
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
4040
</after>
41-
<!--Go to bundle product creation page-->
42-
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToBundleProductCreationPage">
43-
<argument name="attributeSetId" value="{{BundleProduct.set}}"/>
44-
<argument name="productType" value="{{BundleProduct.type}}"/>
45-
</actionGroup>
46-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductCreatePageToLoad"/>
4741

48-
49-
<!-- Add two bundle items -->
42+
<actionGroup ref="AdminOpenCreateBundleProductPageActionGroup" stepKey="goToBundleProductCreationPage"/>
43+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductCreatePageToLoad"/>
5044
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="conditionallyOpenSectionBundleItems"/>
51-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickAddOption3"/>
45+
<actionGroup ref="AdminClickAddOptionOnBundleProductEditPageActionGroup" stepKey="clickAddOption3"/>
5246
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleOptions"/>
53-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillOptionTitle"/>
54-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectInputType"/>
55-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickAddProductsToOption"/>
56-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterBundleProductOptions"/>
57-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectFirstGridRow"/>
58-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterBundleProductOptions2"/>
59-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectFirstGridRow2"/>
60-
<actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="clickAddSelectedBundleProducts">
61-
<argument name="x" value="0"/>
62-
<argument name="n" value="1"/>
63-
<argument name="prodOneSku" value="$$simpleProduct0.sku$$"/>
64-
<argument name="prodTwoSku" value="$$simpleProduct1.sku$$"/>
47+
<actionGroup ref="AdminFillBundleOptionTitleActionGroup" stepKey="fillOptionTitle">
6548
<argument name="optionTitle" value="{{BundleProduct.optionTitle1}}"/>
66-
<argument name="inputType" value="{{BundleProduct.optionInputType1}}"/>
6749
</actionGroup>
68-
69-
<!-- Check that Bundle Options initialized with proper quantity -->
50+
<actionGroup ref="AdminFillBundleOptionTypeActionGroup" stepKey="selectInputType"/>
51+
<actionGroup ref="AdminClickAddProductToOptionByOptionIndexActionGroup" stepKey="clickAddProductsToOption"/>
52+
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions">
53+
<argument name="product" value="$$simpleProduct0$$"/>
54+
</actionGroup>
55+
<actionGroup ref="AdminCheckFirstCheckboxInAddProductsToOptionPanelGridActionGroup" stepKey="selectFirstGridRow"/>
56+
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions2">
57+
<argument name="product" value="$$simpleProduct1$$"/>
58+
</actionGroup>
59+
<actionGroup ref="AdminCheckFirstCheckboxInAddProductsToOptionPanelGridActionGroup" stepKey="selectFirstGridRow2"/>
60+
<actionGroup ref="AdminClickAddSelectedProductsOnAddProductsToOptionPanelActionGroup" stepKey="clickAddSelectedBundleProducts"/>
7061
<grabValueFrom selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" stepKey="grabbedFirstBundleOptionQuantity"/>
7162
<assertEquals stepKey="assertFirstBundleOptionDefaultQuantity">
72-
<expectedResult type="string">50</expectedResult>
63+
<expectedResult type="string">1</expectedResult>
7364
<actualResult type="string">$grabbedFirstBundleOptionQuantity</actualResult>
7465
</assertEquals>
7566
<grabValueFrom selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" stepKey="grabbedSecondBundleOptionQuantity"/>
7667
<assertEquals stepKey="assertSecondBundleOptionDefaultQuantity">
77-
<expectedResult type="string">50</expectedResult>
68+
<expectedResult type="string">1</expectedResult>
7869
<actualResult type="string">$grabbedSecondBundleOptionQuantity</actualResult>
7970
</assertEquals>
80-
81-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillProductDefaultQty1"/>
82-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillProductDefaultQty2"/>
83-
84-
<!--Fill out ancillary data on bundle product-->
71+
<actionGroup ref="AdminFillBundleItemQtyActionGroup" stepKey="fillProductDefaultQty1">
72+
<argument name="optionIndex" value="0"/>
73+
<argument name="productIndex" value="0"/>
74+
<argument name="qty" value="{{BundleProduct.defaultQuantity}}"/>
75+
</actionGroup>
76+
<actionGroup ref="AdminFillBundleItemQtyActionGroup" stepKey="fillProductDefaultQty2">
77+
<argument name="optionIndex" value="0"/>
78+
<argument name="productIndex" value="1"/>
79+
<argument name="qty" value="{{BundleProduct.defaultQuantity}}"/>
80+
</actionGroup>
8581
<actionGroup ref="AncillaryPrepBundleProductActionGroup" stepKey="createBundledProductForTwoSimpleProducts">
8682
<argument name="bundleProduct" value="BundleProduct"/>
8783
</actionGroup>
@@ -92,78 +88,79 @@
9288

9389
<scrollToTopOfPage stepKey="scroll"/>
9490
<conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenSectionBundleItems2"/>
95-
<seeElement selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" stepKey="LookingForBundleItemPresence"/>
96-
97-
<!--Checking on customer side-->
98-
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="GoToProductPage">
99-
<argument name="productUrl" value="{{BundleProduct.urlKey}}"/>
91+
<seeElement stepKey="LookingForBundleItemPresence" selector="{{AdminProductFormBundleSection.listedBundleItem}}"/>
92+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="GoToProductPage">
93+
<argument name="productUrlKey" value="{{BundleProduct.urlKey}}"/>
10094
</actionGroup>
10195
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductPageToLoad"/>
102-
<seeElement selector="{{StorefrontBundledSection.customizeProduct}}" stepKey="LookingForAbilityToAddOptions"/>
103-
<click selector="{{StorefrontBundledSection.customizeProduct}}" stepKey="clickButtonToCustomize"/>
104-
<waitForPageLoad stepKey="waitCustomizationDropDown"/>
96+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="LookingForAbilityToAddOptions"/>
97+
98+
<actionGroup ref="StorefrontSelectCustomizeAndAddToTheCartButtonActionGroup" stepKey="clickButtonToCustomize"/>
99+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitCustomizationDropDown"/>
105100
<seeElement selector="{{StorefrontBundledSection.customizableBundleItemOption}}" stepKey="seeBundleItem"/>
106101

107102
<actionGroup ref="AdminOpenCatalogProductPageActionGroup" stepKey="goToCatalogProductPage"/>
108-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="ClickOnButtonToRemoveFiltersIfPresent"/>
103+
<actionGroup ref="AdminClearFiltersActionGroup" stepKey="ClickOnButtonToRemoveFiltersIfPresent"/>
109104
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="WaitForClear"/>
110105
<actionGroup ref="FilterProductGridByNameActionGroup" stepKey="filterBundleProductOptionsDownToName">
111106
<argument name="product" value="BundleProduct"/>
112107
</actionGroup>
113-
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="clickOnBundleProductToEdit">
114-
<argument name="product" value="BundleProduct"/>
115-
</actionGroup>
108+
<actionGroup ref="OpenProductForEditByClickingRowXColumnYInProductGridActionGroup" stepKey="clickOnBundleProductToEdit"/>
116109
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="conditionallyOpenSectionBundleItemsToEdit"/>
117-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickAddOption"/>
110+
<actionGroup ref="AdminClickAddOptionOnBundleProductEditPageActionGroup" stepKey="clickAddOption"/>
118111
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleOptionsToAppear"/>
119-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillNewestOptionTitle"/>
120-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectNewInputType"/>
121-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickAddProductsToNewOption"/>
122-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterNewBundleProductOptions"/>
123-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectNewFirstGridRow"/>
124-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterNewBundleProductOptions2"/>
125-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectNewFirstGridRow2"/>
126-
<actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="clickAddNewSelectedBundleProducts">
127-
<argument name="x" value="1"/>
128-
<argument name="n" value="2"/>
129-
<argument name="prodOneSku" value="$$simpleProduct2.sku$$"/>
130-
<argument name="prodTwoSku" value="$$simpleProduct3.sku$$"/>
131-
<argument name="optionTitle" value="{{BundleProduct.optionTitle1}}"/>
132-
<argument name="inputType" value="{{BundleProduct.optionInputType1}}"/>
112+
<actionGroup ref="AdminFillBundleOptionTitleActionGroup" stepKey="fillNewestOptionTitle">
113+
<argument name="optionTitle" value="{{BundleProduct.optionTitle1}}_new"/>
114+
<argument name="index" value="1"/>
133115
</actionGroup>
134-
135-
<!-- Check that existing Bundle Options do not loose user input quantity values -->
116+
<actionGroup ref="AdminFillBundleOptionTypeActionGroup" stepKey="selectNewInputType">
117+
<argument name="optionIndex" value="1"/>
118+
</actionGroup>
119+
<actionGroup ref="AdminClickAddProductToOptionByOptionIndexActionGroup" stepKey="clickAddProductsToNewOption">
120+
<argument name="optionIndex" value="2"/>
121+
</actionGroup>
122+
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterNewBundleProductOptions">
123+
<argument name="product" value="$$simpleProduct2$$"/>
124+
</actionGroup>
125+
<actionGroup ref="AdminCheckFirstCheckboxInAddProductsToOptionPanelGridActionGroup" stepKey="selectNewFirstGridRow"/>
126+
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterNewBundleProductOptions2">
127+
<argument name="product" value="$$simpleProduct3$$"/>
128+
</actionGroup>
129+
<actionGroup ref="AdminCheckFirstCheckboxInAddProductsToOptionPanelGridActionGroup" stepKey="selectNewFirstGridRow2"/>
130+
<actionGroup ref="AdminClickAddSelectedProductsOnAddProductsToOptionPanelActionGroup" stepKey="clickAddNewSelectedBundleProducts"/>
136131
<grabValueFrom selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" stepKey="grabbedFirstBundleOptionQuantityAfterUserInput"/>
137132
<assertEquals stepKey="assertFirstBundleOptionDefaultQuantityAfterUserInput">
138-
<expectedResult type="string">50</expectedResult>
133+
<expectedResult type="string">{{BundleProduct.defaultQuantity}}</expectedResult>
139134
<actualResult type="string">$grabbedFirstBundleOptionQuantityAfterUserInput</actualResult>
140135
</assertEquals>
141136
<grabValueFrom selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" stepKey="grabbedSecondBundleOptionQuantityAfterUserInput"/>
142137
<assertEquals stepKey="assertSecondBundleOptionDefaultQuantityAfterUserInput">
143-
<expectedResult type="string">50</expectedResult>
138+
<expectedResult type="string">{{BundleProduct.defaultQuantity}}</expectedResult>
144139
<actualResult type="string">$grabbedSecondBundleOptionQuantityAfterUserInput</actualResult>
145140
</assertEquals>
146-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillNewProductDefaultQty1"/>
147-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillNewProductDefaultQty2"/>
148-
<!--Save the product-->
149-
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveButtonAgain"/>
150-
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="messageYouSavedTheProductIsShownAgain">
151-
<argument name="message" value="You saved the product."/>
141+
<actionGroup ref="AdminFillBundleItemQtyActionGroup" stepKey="fillNewProductDefaultQty1">
142+
<argument name="optionIndex" value="1"/>
143+
<argument name="productIndex" value="0"/>
144+
<argument name="qty" value="{{BundleProduct.defaultQuantity}}"/>
152145
</actionGroup>
153-
154-
<!--Checking on admin side-->
146+
<actionGroup ref="AdminFillBundleItemQtyActionGroup" stepKey="fillNewProductDefaultQty2">
147+
<argument name="optionIndex" value="1"/>
148+
<argument name="productIndex" value="1"/>
149+
<argument name="qty" value="{{BundleProduct.defaultQuantity}}"/>
150+
</actionGroup>
151+
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveButtonAgain"/>
152+
<see userInput="You saved the product." stepKey="messageYouSavedTheProductIsShownAgain"/>
155153
<scrollToTopOfPage stepKey="scrollAgain"/>
156-
<conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenNewSectionBundleItems2"/>
157-
<seeElement selector="{{AdminProductFormBundleSection.bundleOptionXTitle('1')}}" stepKey="LookingForNewBundleItemPresence"/>
154+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="conditionallyOpenNewSectionBundleItems2"/>
155+
<see userInput="$$simpleProduct2.sku$$" selector="{{AdminProductFormBundleSection.bundleItem}}" stepKey="LookingForNewBundleItemPresence"/>
158156

159-
<!--Checking on customer side-->
160-
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="GoToProductPageAgain">
161-
<argument name="productUrl" value="{{BundleProduct.urlKey}}"/>
157+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="GoToProductPageAgain">
158+
<argument name="productUrlKey" value="{{BundleProduct.urlKey}}"/>
162159
</actionGroup>
163160
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductPageToLoadAgain"/>
164-
<seeElement selector="{{StorefrontBundledSection.customizeProduct}}" stepKey="LookingForAbilityToAddBothOptions"/>
165-
<click selector="{{StorefrontBundledSection.customizeProduct}}" stepKey="clickButtonAgainToCustomize"/>
166-
<waitForPageLoad stepKey="waitForBothCustomizationDropDown"/>
161+
<actionGroup ref="StorefrontSelectCustomizeAndAddToTheCartButtonActionGroup" stepKey="LookingForAbilityToAddBothOptions"/>
162+
<actionGroup ref="StorefrontSelectCustomizeAndAddToTheCartButtonActionGroup" stepKey="clickButtonAgainToCustomize"/>
163+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBothCustomizationDropDown"/>
167164
<seeElement selector="{{StorefrontBundledSection.customizableBundleItemOption2}}" stepKey="seeBundleItems"/>
168165
</test>
169166
</tests>

0 commit comments

Comments
 (0)