Skip to content

Commit e81d954

Browse files
committed
MC-232: Customer should be able to add the bundle product to the cart
1 parent a77fb6b commit e81d954

File tree

2 files changed

+106
-0
lines changed

2 files changed

+106
-0
lines changed

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Section/StorefrontBundledSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,7 @@
1919
<element name="customizableBundleItemOption" type="text" selector="//div[@class='field choice'][1]//input[@type='checkbox']"/>
2020
<element name="customizableBundleItemOption2" type="text" selector="//div[@class='field choice'][2]//input[@type='checkbox']"/>
2121
<element name="nthOptionDiv" type="block" selector="#product-options-wrapper div.field.option:nth-of-type({{var}})" parameterized="true"/>
22+
<element name="nthItemOptionsTitle" type="text" selector="dl.item-options dt:nth-of-type({{var}})" parameterized="true"/>
23+
<element name="nthItemOptionsValue" type="text" selector="dl.item-options dd:nth-of-type({{var}})" parameterized="true"/>
2224
</section>
2325
</sections>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/StorefrontBundleCartTest.xml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,108 @@
124124
<dontSee selector="{{StorefrontBundledSection.nthOptionDiv('3')}}" userInput="Please select one of the options." stepKey="error19"/>
125125
<dontSee selector="{{StorefrontBundledSection.nthOptionDiv('4')}}" userInput="This is a required field." stepKey="error20"/>
126126
</test>
127+
128+
<test name="StorefrontBundleAddToCartSuccessTest">
129+
<annotations>
130+
<features value="Bundle"/>
131+
<stories value="Bundle product details page"/>
132+
<title value="Customer should be able to add the bundle product to the cart"/>
133+
<description value="Customer should be able to add the bundle product to the cart"/>
134+
<severity value="CRITICAL"/>
135+
<testCaseId value="MC-232"/>
136+
<group value="Bundle"/>
137+
</annotations>
138+
<before>
139+
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
140+
<createData entity="SimpleProduct2" stepKey="simpleProduct1"/>
141+
<createData entity="SimpleProduct2" stepKey="simpleProduct2"/>
142+
</before>
143+
<after>
144+
<amOnPage url="{{AdminLogoutPage.url}}" stepKey="logout"/>
145+
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
146+
<deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/>
147+
</after>
148+
149+
<!-- Start creating a bundle product -->
150+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductList"/>
151+
<waitForPageLoad stepKey="waitForProductList"/>
152+
<actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct">
153+
<argument name="product" value="BundleProduct"/>
154+
</actionGroup>
155+
<actionGroup ref="fillProductNameAndSkuInProductForm" stepKey="fillNameAndSku">
156+
<argument name="product" value="BundleProduct"/>
157+
</actionGroup>
158+
159+
<!-- Add Option One, a "Drop-down" type option -->
160+
<actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts1">
161+
<argument name="x" value="0"/>
162+
<argument name="n" value="1"/>
163+
<argument name="prodOneSku" value="$$simpleProduct1.sku$$"/>
164+
<argument name="prodTwoSku" value="$$simpleProduct2.sku$$"/>
165+
<argument name="optionTitle" value="Option One"/>
166+
<argument name="inputType" value="select"/>
167+
</actionGroup>
168+
169+
<!-- Add Option Two, a "Radio Buttons" type option -->
170+
<actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts2">
171+
<argument name="x" value="1"/>
172+
<argument name="n" value="2"/>
173+
<argument name="prodOneSku" value="$$simpleProduct1.sku$$"/>
174+
<argument name="prodTwoSku" value="$$simpleProduct2.sku$$"/>
175+
<argument name="optionTitle" value="Option Two"/>
176+
<argument name="inputType" value="radio"/>
177+
</actionGroup>
178+
179+
<!-- Add Option Three, a "Checkbox" type option -->
180+
<actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts3">
181+
<argument name="x" value="2"/>
182+
<argument name="n" value="3"/>
183+
<argument name="prodOneSku" value="$$simpleProduct1.sku$$"/>
184+
<argument name="prodTwoSku" value="$$simpleProduct2.sku$$"/>
185+
<argument name="optionTitle" value="Option Three"/>
186+
<argument name="inputType" value="checkbox"/>
187+
</actionGroup>
188+
189+
<!-- Add Option Four, a "Multi Select" type option -->
190+
<actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts4">
191+
<argument name="x" value="3"/>
192+
<argument name="n" value="4"/>
193+
<argument name="prodOneSku" value="$$simpleProduct1.sku$$"/>
194+
<argument name="prodTwoSku" value="$$simpleProduct2.sku$$"/>
195+
<argument name="optionTitle" value="Option Four"/>
196+
<argument name="inputType" value="multi"/>
197+
</actionGroup>
198+
199+
<!-- Save product and go to storefront -->
200+
<actionGroup ref="saveProductForm" stepKey="saveProduct"/>
201+
<amOnPage url="{{BundleProduct.sku}}.html" stepKey="goToStorefront"/>
202+
<waitForPageLoad stepKey="waitForStorefront"/>
203+
<click selector="{{StorefrontBundledSection.addToCart}}" stepKey="clickCustomize"/>
204+
205+
<!-- Select all applicable options -->
206+
<selectOption selector="select.bundle-option-select" userInput="$$simpleProduct1.name$$ +$123.00" stepKey="selectOption1"/>
207+
<click selector="input[type='radio']:nth-of-type(1)" stepKey="selectOption2"/>
208+
<checkOption selector="input[type='checkbox']:nth-of-type(1)" stepKey="selectOption3"/>
209+
<selectOption selector="select[multiple='multiple']" userInput="$$simpleProduct1.name$$ +$123.00" stepKey="selectOption4"/>
210+
211+
<!-- Customize and add the bundle product to our cart -->
212+
<click selector="{{StorefrontBundledSection.addToCartConfigured}}" stepKey="clickAddToCart1"/>
213+
<dontSee selector="{{StorefrontBundledSection.nthOptionDiv('1')}}" userInput="This is a required field." stepKey="validForm1"/>
214+
<dontSee selector="{{StorefrontBundledSection.nthOptionDiv('2')}}" userInput="Please select one of the options." stepKey="validForm2"/>
215+
<dontSee selector="{{StorefrontBundledSection.nthOptionDiv('3')}}" userInput="Please select one of the options." stepKey="validForm3"/>
216+
<dontSee selector="{{StorefrontBundledSection.nthOptionDiv('4')}}" userInput="This is a required field." stepKey="validForm4"/>
217+
<see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{BundleProduct.name}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/>
218+
219+
<!-- Verify cart contents -->
220+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCart"/>
221+
<waitForPageLoad stepKey="waitForCart"/>
222+
<see selector="{{StorefrontBundledSection.nthItemOptionsTitle('1')}}" userInput="Option One" stepKey="seeOption1"/>
223+
<see selector="{{StorefrontBundledSection.nthItemOptionsTitle('2')}}" userInput="Option Two" stepKey="seeOption2"/>
224+
<see selector="{{StorefrontBundledSection.nthItemOptionsTitle('3')}}" userInput="Option Three" stepKey="seeOption3"/>
225+
<see selector="{{StorefrontBundledSection.nthItemOptionsTitle('4')}}" userInput="Option Four" stepKey="seeOption4"/>
226+
<see selector="{{StorefrontBundledSection.nthItemOptionsValue('1')}}" userInput="50 x $$simpleProduct1.name$$ $123.00" stepKey="seeOptionValue1"/>
227+
<see selector="{{StorefrontBundledSection.nthItemOptionsValue('2')}}" userInput="50 x $$simpleProduct1.name$$ $123.00" stepKey="seeOptionValue2"/>
228+
<see selector="{{StorefrontBundledSection.nthItemOptionsValue('3')}}" userInput="50 x $$simpleProduct1.name$$ $123.00" stepKey="seeOptionValue3"/>
229+
<see selector="{{StorefrontBundledSection.nthItemOptionsValue('4')}}" userInput="50 x $$simpleProduct1.name$$ $123.00" stepKey="seeOptionValue4"/>
230+
</test>
127231
</tests>

0 commit comments

Comments
 (0)