Skip to content

Commit 5640870

Browse files
ENGCOM-6234: Cover an issue with removing bundle options #25466
2 parents f6e955d + 2d3cdff commit 5640870

File tree

3 files changed

+128
-0
lines changed

3 files changed

+128
-0
lines changed

app/code/Magento/Bundle/Test/Mftf/ActionGroup/CreateBundleProductActionGroup.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,17 @@
146146
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '4')}}" userInput="2" stepKey="fillQuantity5" after="fillQuantity4"/>
147147
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '5')}}" userInput="2" stepKey="fillQuantity6" after="fillQuantity5"/>
148148
</actionGroup>
149+
150+
<actionGroup name="deleteBundleOptionByIndex">
151+
<annotations>
152+
<description>Requires Navigation to Product Creation page. Removes any Bundle Option by index specified in arguments. 'deleteIndex' refers to Bundle option number.</description>
153+
</annotations>
154+
<arguments>
155+
<argument name="deleteIndex" type="string"/>
156+
</arguments>
157+
158+
<conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenSectionBundleItems"/>
159+
<scrollTo selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" stepKey="scrollUpABit"/>
160+
<click selector="{{AdminProductFormBundleSection.deleteOption(deleteIndex)}}" stepKey="clickDeleteOption"/>
161+
</actionGroup>
149162
</actionGroups>

app/code/Magento/Bundle/Test/Mftf/Section/AdminProductFormBundleSection.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
<element name="currentBundleOption" type="text" selector="//div[@data-index='bundle-items']//div[contains(@class, 'admin__collapsible-title')]/span"/>
4747
<!--AddingAnOption-->
4848
<element name="addOptions" type="button" selector="//tr[@data-repeat-index='0']//td[4]" timeout="30"/>
49+
<!--DragAnOption -->
50+
<element name="dragOption" type="block" selector="//tr[{{dragIndex}}]//div[contains(@class, 'draggable-handle')]" timeout="30" parameterized="true"/>
51+
<!--DeleteAnOption -->
52+
<element name="deleteOption" type="button" selector="//tr[{{deleteIndex}}]//button[@data-index='delete_button']" timeout="30" parameterized="true"/>
4953
<!--SEODropdownTab-->
5054
<element name="seoDropdown" type="button" selector="//div[@data-index='search-engine-optimization']"/>
5155
<element name="seoDependent" type="button" selector="//div[@data-index='search-engine-optimization']//div[contains(@class, '_show')]"/>

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

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,5 +141,116 @@
141141
<argument name="websiteName" value="$createWebsite.website[name]$"/>
142142
</actionGroup>
143143
</test>
144+
<test name="AdminCreateAndEditBundleProductOptionsNegativeTest">
145+
<annotations>
146+
<features value="Bundle"/>
147+
<stories value="Modify bundle product in Admin"/>
148+
<title value="Admin should be able to remove any bundle option a bundle product"/>
149+
<description value="Admin should be able to set/edit other product information when creating/editing a bundle product"/>
150+
<severity value="MAJOR"/>
151+
<testCaseId value="MC-224"/>
152+
<skip>
153+
<issueId value="https://github.com/magento/magento2/issues/25468"/>
154+
</skip>
155+
<group value="Catalog"/>
156+
</annotations>
157+
<before>
158+
<!-- Create a Website -->
159+
<createData entity="customWebsite" stepKey="createWebsite"/>
160+
161+
<!-- Create first simple product for a bundle option -->
162+
<createData entity="SimpleProduct2" stepKey="createFirstSimpleProduct"/>
163+
164+
<!-- Create second simple product for a bundle option -->
165+
<createData entity="SimpleProduct2" stepKey="createSecondSimpleProduct"/>
166+
167+
<!-- Login as admin -->
168+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
169+
</before>
170+
<after>
171+
<!-- Delete the simple product -->
172+
<deleteData createDataKey="createFirstSimpleProduct" stepKey="deleteFirstSimpleProduct"/>
173+
174+
<!-- Delete the simple product -->
175+
<deleteData createDataKey="createSecondSimpleProduct" stepKey="deleteSecondSimpleProduct"/>
176+
177+
<!-- Delete a Website -->
178+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite">
179+
<argument name="websiteName" value="Second Website"/>
180+
</actionGroup>
181+
182+
<!-- Log out -->
183+
<actionGroup ref="logout" stepKey="logout"/>
184+
</after>
185+
186+
<!-- Create new bundle product -->
187+
<actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createBundleProduct">
188+
<argument name="productType" value="bundle"/>
189+
</actionGroup>
190+
191+
<!-- Fill all main fields -->
192+
<actionGroup ref="fillMainBundleProductForm" stepKey="fillMainProductFields"/>
193+
194+
<!-- Add first bundle option to the product -->
195+
<actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addFirstBundleOption">
196+
<argument name="x" value="0"/>
197+
<argument name="n" value="1"/>
198+
<argument name="prodOneSku" value="$$createFirstSimpleProduct.sku$$"/>
199+
<argument name="prodTwoSku" value="$$createSecondSimpleProduct.sku$$"/>
200+
<argument name="optionTitle" value="{{RadioButtonsOption.title}}"/>
201+
<argument name="inputType" value="{{RadioButtonsOption.type}}"/>
202+
</actionGroup>
203+
204+
<!-- Add second bundle option to the product -->
205+
<actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addSecondBundleOption">
206+
<argument name="x" value="1"/>
207+
<argument name="n" value="2"/>
208+
<argument name="prodOneSku" value="$$createFirstSimpleProduct.sku$$"/>
209+
<argument name="prodTwoSku" value="$$createSecondSimpleProduct.sku$$"/>
210+
<argument name="optionTitle" value="{{CheckboxOption.title}}"/>
211+
<argument name="inputType" value="{{CheckboxOption.type}}"/>
212+
</actionGroup>
213+
214+
<!-- Add third bundle option to the product -->
215+
<actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addThirdBundleOption">
216+
<argument name="x" value="2"/>
217+
<argument name="n" value="3"/>
218+
<argument name="prodOneSku" value="$$createFirstSimpleProduct.sku$$"/>
219+
<argument name="prodTwoSku" value="$$createSecondSimpleProduct.sku$$"/>
220+
<argument name="optionTitle" value="{{RadioButtonsOption.title}}"/>
221+
<argument name="inputType" value="{{RadioButtonsOption.type}}"/>
222+
</actionGroup>
223+
224+
<!-- Set product in created Website -->
225+
<actionGroup ref="AdminAssignProductInWebsiteActionGroup" stepKey="selectProductInWebsites">
226+
<argument name="website" value="$createWebsite.website[name]$"/>
227+
</actionGroup>
228+
229+
<!-- Save product form -->
230+
<actionGroup ref="saveProductForm" stepKey="saveWithThreeOptions"/>
231+
232+
<!-- Open created product -->
233+
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForSimpleProduct">
234+
<argument name="product" value="BundleProduct"/>
235+
</actionGroup>
236+
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProduct">
237+
<argument name="product" value="BundleProduct"/>
238+
</actionGroup>
239+
240+
<!-- Remove second option -->
241+
<actionGroup ref="deleteBundleOptionByIndex" stepKey="deleteSecondOption">
242+
<argument name="deleteIndex" value="1"/>
243+
</actionGroup>
244+
245+
<!-- Save product form -->
246+
<actionGroup ref="saveProductForm" stepKey="clickSaveProduct"/>
247+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveWithTwoOptions"/>
248+
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="messageYouSavedTheProductIsShown"/>
249+
250+
<!-- Delete created bundle product -->
251+
<actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct">
252+
<argument name="product" value="BundleProduct"/>
253+
</actionGroup>
254+
</test>
144255
</tests>
145256

0 commit comments

Comments
 (0)