Skip to content

Commit 67f33c4

Browse files
committed
Merge branch 'mftf-cover-notice-bundle' of https://github.com/TomashKhamlai/magento2 into mftf-cover-notice-bundle
2 parents dac1ea5 + 018a9d6 commit 67f33c4

File tree

3 files changed

+125
-0
lines changed

3 files changed

+125
-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: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,5 +141,113 @@
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+
<group value="Catalog"/>
153+
</annotations>
154+
<before>
155+
<!-- Create a Website -->
156+
<createData entity="customWebsite" stepKey="createWebsite"/>
157+
158+
<!-- Create first simple product for a bundle option -->
159+
<createData entity="SimpleProduct2" stepKey="createFirstSimpleProduct"/>
160+
161+
<!-- Create second simple product for a bundle option -->
162+
<createData entity="SimpleProduct2" stepKey="createSecondSimpleProduct"/>
163+
164+
<!-- Login as admin -->
165+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
166+
</before>
167+
<after>
168+
<!-- Delete the simple product -->
169+
<deleteData createDataKey="createFirstSimpleProduct" stepKey="deleteFirstSimpleProduct"/>
170+
171+
<!-- Delete the simple product -->
172+
<deleteData createDataKey="createSecondSimpleProduct" stepKey="deleteSecondSimpleProduct"/>
173+
174+
<!-- Delete a Website -->
175+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite">
176+
<argument name="websiteName" value="Second Website"/>
177+
</actionGroup>
178+
179+
<!-- Log out -->
180+
<actionGroup ref="logout" stepKey="logout"/>
181+
</after>
182+
183+
<!-- Create new bundle product -->
184+
<actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createBundleProduct">
185+
<argument name="productType" value="bundle"/>
186+
</actionGroup>
187+
188+
<!-- Fill all main fields -->
189+
<actionGroup ref="fillMainBundleProductForm" stepKey="fillMainProductFields"/>
190+
191+
<!-- Add first bundle option to the product -->
192+
<actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addFirstBundleOption">
193+
<argument name="x" value="0"/>
194+
<argument name="n" value="1"/>
195+
<argument name="prodOneSku" value="$$createFirstSimpleProduct.sku$$"/>
196+
<argument name="prodTwoSku" value="$$createSecondSimpleProduct.sku$$"/>
197+
<argument name="optionTitle" value="{{RadioButtonsOption.title}}"/>
198+
<argument name="inputType" value="{{RadioButtonsOption.type}}"/>
199+
</actionGroup>
200+
201+
<!-- Add second bundle option to the product -->
202+
<actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addSecondBundleOption">
203+
<argument name="x" value="1"/>
204+
<argument name="n" value="2"/>
205+
<argument name="prodOneSku" value="$$createFirstSimpleProduct.sku$$"/>
206+
<argument name="prodTwoSku" value="$$createSecondSimpleProduct.sku$$"/>
207+
<argument name="optionTitle" value="{{CheckboxOption.title}}"/>
208+
<argument name="inputType" value="{{CheckboxOption.type}}"/>
209+
</actionGroup>
210+
211+
<!-- Add third bundle option to the product -->
212+
<actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addThirdBundleOption">
213+
<argument name="x" value="2"/>
214+
<argument name="n" value="3"/>
215+
<argument name="prodOneSku" value="$$createFirstSimpleProduct.sku$$"/>
216+
<argument name="prodTwoSku" value="$$createSecondSimpleProduct.sku$$"/>
217+
<argument name="optionTitle" value="{{RadioButtonsOption.title}}"/>
218+
<argument name="inputType" value="{{RadioButtonsOption.type}}"/>
219+
</actionGroup>
220+
221+
<!-- Set product in created Website -->
222+
<actionGroup ref="AdminAssignProductInWebsiteActionGroup" stepKey="selectProductInWebsites">
223+
<argument name="website" value="$createWebsite.website[name]$"/>
224+
</actionGroup>
225+
226+
<!-- Save product form -->
227+
<actionGroup ref="saveProductForm" stepKey="saveWithThreeOptions"/>
228+
229+
<!-- Open created product -->
230+
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForSimpleProduct">
231+
<argument name="product" value="BundleProduct"/>
232+
</actionGroup>
233+
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProduct">
234+
<argument name="product" value="BundleProduct"/>
235+
</actionGroup>
236+
237+
<!-- Remove second option -->
238+
<actionGroup ref="deleteBundleOptionByIndex" stepKey="deleteSecondOption">
239+
<argument name="deleteIndex" value="1"/>
240+
</actionGroup>
241+
242+
<!-- Save product form -->
243+
<actionGroup ref="saveProductForm" stepKey="clickSaveProduct"/>
244+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveWithTwoOptions"/>
245+
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="messageYouSavedTheProductIsShown"/>
246+
247+
<!-- Delete created bundle product -->
248+
<actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct">
249+
<argument name="product" value="BundleProduct"/>
250+
</actionGroup>
251+
</test>
144252
</tests>
145253

0 commit comments

Comments
 (0)