Skip to content

Commit 36ad6b7

Browse files
committed
Refactoring the test
1 parent 84b69d1 commit 36ad6b7

File tree

1 file changed

+79
-57
lines changed

1 file changed

+79
-57
lines changed

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

Lines changed: 79 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -40,39 +40,48 @@
4040
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
4141
</after>
4242
<!--Go to bundle product creation page-->
43-
<amOnPage url="{{AdminProductCreatePage.url(BundleProduct.set, BundleProduct.type)}}" stepKey="goToBundleProductCreationPage"/>
44-
<waitForPageLoad stepKey="waitForBundleProductCreatePageToLoad"/>
43+
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToBundleProductCreationPage">
44+
<argument name="attributeSetId" value="{{BundleProduct.set}}"/>
45+
<argument name="productType" value="{{BundleProduct.type}}"/>
46+
</actionGroup>
47+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductCreatePageToLoad"/>
48+
4549

4650
<!-- Add two bundle items -->
47-
<conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenSectionBundleItems"/>
48-
<click selector="{{AdminProductFormBundleSection.addOption}}" stepKey="clickAddOption3"/>
49-
<waitForElementVisible selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" stepKey="waitForBundleOptions"/>
50-
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" userInput="{{BundleProduct.optionTitle1}}" stepKey="fillOptionTitle"/>
51-
<selectOption selector="{{AdminProductFormBundleSection.bundleOptionXInputType('0')}}" userInput="{{BundleProduct.optionInputType1}}" stepKey="selectInputType"/>
52-
<actionGroup ref="AdminClickAddProductToOptionActionGroup" stepKey="clickAddProductsToOption"/>
53-
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions">
54-
<argument name="product" value="$$simpleProduct0$$"/>
51+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="conditionallyOpenSectionBundleItems"/>
52+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickAddOption3"/>
53+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleOptions"/>
54+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillOptionTitle"/>
55+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectInputType"/>
56+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickAddProductsToOption"/>
57+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterBundleProductOptions"/>
58+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectFirstGridRow"/>
59+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterBundleProductOptions2"/>
60+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectFirstGridRow2"/>
61+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickAddSelectedBundleProducts"/>
62+
<actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addBundleOptionWithTwoProducts1">
63+
<argument name="x" value="0"/>
64+
<argument name="n" value="1"/>
65+
<argument name="prodOneSku" value="$$simpleProduct0.sku$$"/>
66+
<argument name="prodTwoSku" value="$$simpleProduct1.sku$$"/>
67+
<argument name="optionTitle" value="{{BundleProduct.optionTitle1}}"/>
68+
<argument name="inputType" value="{{BundleProduct.optionInputType1}}"/>
5569
</actionGroup>
56-
<checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow"/>
57-
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions2">
58-
<argument name="product" value="$$simpleProduct1$$"/>
59-
</actionGroup>
60-
<checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow2"/>
61-
<click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="clickAddSelectedBundleProducts"/>
62-
<!-- Check that Bundle Options initialized with default quantity -->
63-
<grabValueFrom selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" stepKey="grabbedFirstBundleOptionQuantity"/>
64-
<assertEquals stepKey="assertFirstBundleOptionDefaultQuantity">
65-
<expectedResult type="string">1</expectedResult>
66-
<actualResult type="string">$grabbedFirstBundleOptionQuantity</actualResult>
67-
</assertEquals>
68-
<grabValueFrom selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" stepKey="grabbedSecondBundleOptionQuantity"/>
69-
<assertEquals stepKey="assertSecondBundleOptionDefaultQuantity">
70-
<expectedResult type="string">1</expectedResult>
71-
<actualResult type="string">$grabbedSecondBundleOptionQuantity</actualResult>
72-
</assertEquals>
7370

74-
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty1"/>
75-
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty2"/>
71+
<!--&lt;!&ndash; Check that Bundle Options initialized with default quantity &ndash;&gt;-->
72+
<!--<grabValueFrom selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" stepKey="grabbedFirstBundleOptionQuantity"/>-->
73+
<!--<assertEquals stepKey="assertFirstBundleOptionDefaultQuantity">-->
74+
<!--<expectedResult type="string">1</expectedResult>-->
75+
<!--<actualResult type="string">$grabbedFirstBundleOptionQuantity</actualResult>-->
76+
<!--</assertEquals>-->
77+
<!--<grabValueFrom selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" stepKey="grabbedSecondBundleOptionQuantity"/>-->
78+
<!--<assertEquals stepKey="assertSecondBundleOptionDefaultQuantity">-->
79+
<!--<expectedResult type="string">1</expectedResult>-->
80+
<!--<actualResult type="string">$grabbedSecondBundleOptionQuantity</actualResult>-->
81+
<!--</assertEquals>-->
82+
83+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillProductDefaultQty1"/>
84+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillProductDefaultQty2"/>
7685

7786
<!--Fill out ancillary data on bundle product-->
7887
<actionGroup ref="AncillaryPrepBundleProductActionGroup" stepKey="createBundledProductForTwoSimpleProducts">
@@ -81,16 +90,20 @@
8190

8291
<!--Save the product-->
8392
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveButton"/>
84-
<see userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/>
93+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="messageYouSavedTheProductIsShown">
94+
<argument name="message" value="You saved the product."/>
95+
</actionGroup>
8596

8697
<!--Checking on admin side-->
8798
<scrollToTopOfPage stepKey="scroll"/>
8899
<conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenSectionBundleItems2"/>
89100
<seeElement stepKey="LookingForBundleItemPresence" selector="{{AdminProductFormBundleSection.listedBundleItem}}"/>
90101

91102
<!--Checking on customer side-->
92-
<amOnPage url="{{BundleProduct.urlKey}}.html" stepKey="GoToProductPage"/>
93-
<waitForPageLoad stepKey="waitForBundleProductPageToLoad"/>
103+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="GoToProductPage">
104+
<argument name="productUrl" value="{{BundleProduct.urlKey}}"/>
105+
</actionGroup>
106+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductPageToLoad"/>
94107
<seeElement selector="{{StorefrontBundledSection.customizeProduct}}" stepKey="LookingForAbilityToAddOptions"/>
95108
<click selector="{{StorefrontBundledSection.customizeProduct}}" stepKey="clickButtonToCustomize"/>
96109
<waitForPageLoad stepKey="waitCustomizationDropDown"/>
@@ -99,53 +112,62 @@
99112
<!--Add another bundle option with 2 items-->
100113
<!--Go to bundle product creation page-->
101114
<actionGroup ref="AdminOpenCatalogProductPageActionGroup" stepKey="goToCatalogProductPage"/>
102-
<conditionalClick selector="{{AdminProductFiltersSection.filtersClear}}" dependentSelector="{{AdminProductFiltersSection.filtersClear}}" visible="true" stepKey="ClickOnButtonToRemoveFiltersIfPresent"/>
103-
<waitForPageLoad stepKey="WaitForClear"/>
115+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="ClickOnButtonToRemoveFiltersIfPresent"/>
116+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="WaitForClear"/>
104117
<actionGroup ref="FilterProductGridByNameActionGroup" stepKey="filterBundleProductOptionsDownToName">
105118
<argument name="product" value="BundleProduct"/>
106119
</actionGroup>
107-
<click selector="{{AdminProductFormBundleSection.addOptions}}" stepKey="clickOnBundleProductToEdit"/>
108-
<conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenSectionBundleItemsToEdit"/>
109-
<click selector="{{AdminProductFormBundleSection.addOption}}" stepKey="clickAddOption"/>
110-
<waitForElementVisible selector="{{AdminProductFormBundleSection.bundleOptionXTitle('1')}}" stepKey="waitForBundleOptionsToAppear"/>
111-
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXTitle('1')}}" userInput="{{BundleProduct.optionTitle1}}" stepKey="fillNewestOptionTitle"/>
112-
<selectOption selector="{{AdminProductFormBundleSection.bundleOptionXInputType('1')}}" userInput="{{BundleProduct.optionInputType1}}" stepKey="selectNewInputType"/>
113-
<actionGroup ref="AdminClickAddProductToOptionActionGroup" stepKey="clickAddProductsToNewOption"/>
114-
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterNewBundleProductOptions">
115-
<argument name="product" value="$$simpleProduct2$$"/>
120+
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="clickOnBundleProductToEdit">
121+
<argument name="product" value="BundleProduct"/>
116122
</actionGroup>
117-
<checkOption selector="//div[@class='admin__data-grid-outer-wrap']//tr[@data-repeat-index='0']//input[@type='checkbox']" stepKey="selectNewFirstGridRow"/>
118-
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterNewBundleProductOptions2">
119-
<argument name="product" value="$$simpleProduct3$$"/>
123+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="conditionallyOpenSectionBundleItemsToEdit"/>
124+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickAddOption"/>
125+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleOptionsToAppear"/>
126+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillNewestOptionTitle"/>
127+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectNewInputType"/>
128+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickAddProductsToNewOption"/>
129+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterNewBundleProductOptions"/>
130+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectNewFirstGridRow"/>
131+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterNewBundleProductOptions2"/>
132+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectNewFirstGridRow2"/>
133+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickAddNewSelectedBundleProducts"/>
134+
<actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addBundleOptionWithTwoProducts2">
135+
<argument name="x" value="1"/>
136+
<argument name="n" value="2"/>
137+
<argument name="prodOneSku" value="$$simpleProduct2.sku$$"/>
138+
<argument name="prodTwoSku" value="$$simpleProduct3.sku$$"/>
139+
<argument name="optionTitle" value="{{BundleProduct.optionTitle1}}"/>
140+
<argument name="inputType" value="{{BundleProduct.optionInputType1}}"/>
120141
</actionGroup>
121-
<checkOption selector="{{AdminProductFormBundleSection.firstProductOption}}" stepKey="selectNewFirstGridRow2"/>
122-
<click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="clickAddNewSelectedBundleProducts"/>
142+
123143
<!-- Check that existing Bundle Options do not loose user input quantity values -->
124144
<grabValueFrom selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" stepKey="grabbedFirstBundleOptionQuantityAfterUserInput"/>
125145
<assertEquals stepKey="assertFirstBundleOptionDefaultQuantityAfterUserInput">
126-
<expectedResult type="string">{{BundleProduct.defaultQuantity}}</expectedResult>
146+
<expectedResult type="string">50</expectedResult>
127147
<actualResult type="string">$grabbedFirstBundleOptionQuantityAfterUserInput</actualResult>
128148
</assertEquals>
129149
<grabValueFrom selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" stepKey="grabbedSecondBundleOptionQuantityAfterUserInput"/>
130150
<assertEquals stepKey="assertSecondBundleOptionDefaultQuantityAfterUserInput">
131-
<expectedResult type="string">{{BundleProduct.defaultQuantity}}</expectedResult>
151+
<expectedResult type="string">50</expectedResult>
132152
<actualResult type="string">$grabbedSecondBundleOptionQuantityAfterUserInput</actualResult>
133153
</assertEquals>
134-
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '2')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillNewProductDefaultQty1"/>
135-
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '3')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillNewProductDefaultQty2"/>
136-
154+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillNewProductDefaultQty1"/>
155+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillNewProductDefaultQty2"/>
137156
<!--Save the product-->
138157
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveButtonAgain"/>
139-
<see userInput="You saved the product." stepKey="messageYouSavedTheProductIsShownAgain"/>
158+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="messageYouSavedTheProductIsShownAgain">
159+
<argument name="message" value="You saved the product."/>
160+
</actionGroup>
140161

141162
<!--Checking on admin side-->
142163
<scrollToTopOfPage stepKey="scrollAgain"/>
143164
<conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenNewSectionBundleItems2"/>
144165
<seeElement selector="{{AdminProductFormBundleSection.listedBundleItem2}}" stepKey="LookingForNewBundleItemPresence"/>
145-
146166
<!--Checking on customer side-->
147-
<amOnPage url="{{BundleProduct.urlKey}}.html" stepKey="GoToProductPageAgain"/>
148-
<waitForPageLoad stepKey="waitForBundleProductPageToLoadAgain"/>
167+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="GoToProductPageAgain">
168+
<argument name="productUrl" value="{{BundleProduct.urlKey}}"/>
169+
</actionGroup>
170+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductPageToLoadAgain"/>
149171
<seeElement selector="{{StorefrontBundledSection.customizeProduct}}" stepKey="LookingForAbilityToAddBothOptions"/>
150172
<click selector="{{StorefrontBundledSection.customizeProduct}}" stepKey="clickButtonAgainToCustomize"/>
151173
<waitForPageLoad stepKey="waitForBothCustomizationDropDown"/>

0 commit comments

Comments
 (0)