-
Notifications
You must be signed in to change notification settings - Fork 9.3k
/
StorefrontBundleCartTest.xml
231 lines (209 loc) · 14.8 KB
/
StorefrontBundleCartTest.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="StorefrontBundleCartTest">
<annotations>
<features value="Bundle"/>
<stories value="Bundle product details page"/>
<title value="Customer should not be able to add a Bundle Product to the cart without selecting options"/>
<description value="Customer should not be able to add a Bundle Product to the cart without selecting options"/>
<severity value="CRITICAL"/>
<testCaseId value="MC-233"/>
<group value="Bundle"/>
</annotations>
<before>
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
<createData entity="SimpleProduct2" stepKey="simpleProduct1"/>
<createData entity="SimpleProduct2" stepKey="simpleProduct2"/>
</before>
<after>
<amOnPage url="{{AdminLogoutPage.url}}" stepKey="logout"/>
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
<deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/>
</after>
<!-- Start creating a bundle product -->
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductList"/>
<waitForPageLoad stepKey="waitForProductList"/>
<actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct">
<argument name="product" value="BundleProduct"/>
</actionGroup>
<actionGroup ref="fillProductNameAndSkuInProductForm" stepKey="fillNameAndSku">
<argument name="product" value="BundleProduct"/>
</actionGroup>
<!-- Add Option One, a "Drop-down" type option -->
<actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts1">
<argument name="x" value="0"/>
<argument name="n" value="1"/>
<argument name="prodOneSku" value="$$simpleProduct1.sku$$"/>
<argument name="prodTwoSku" value="$$simpleProduct2.sku$$"/>
<argument name="optionTitle" value="Option One"/>
<argument name="inputType" value="select"/>
</actionGroup>
<!-- Add Option Two, a "Radio Buttons" type option -->
<actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts2">
<argument name="x" value="1"/>
<argument name="n" value="2"/>
<argument name="prodOneSku" value="$$simpleProduct1.sku$$"/>
<argument name="prodTwoSku" value="$$simpleProduct2.sku$$"/>
<argument name="optionTitle" value="Option Two"/>
<argument name="inputType" value="radio"/>
</actionGroup>
<!-- Add Option Three, a "Checkbox" type option -->
<actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts3">
<argument name="x" value="2"/>
<argument name="n" value="3"/>
<argument name="prodOneSku" value="$$simpleProduct1.sku$$"/>
<argument name="prodTwoSku" value="$$simpleProduct2.sku$$"/>
<argument name="optionTitle" value="Option Three"/>
<argument name="inputType" value="checkbox"/>
</actionGroup>
<!-- Add Option Four, a "Multi Select" type option -->
<actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts4">
<argument name="x" value="3"/>
<argument name="n" value="4"/>
<argument name="prodOneSku" value="$$simpleProduct1.sku$$"/>
<argument name="prodTwoSku" value="$$simpleProduct2.sku$$"/>
<argument name="optionTitle" value="Option Four"/>
<argument name="inputType" value="multi"/>
</actionGroup>
<!-- Save product and go to storefront -->
<actionGroup ref="saveProductForm" stepKey="saveProduct"/>
<amOnPage url="{{BundleProduct.sku}}.html" stepKey="goToStorefront"/>
<waitForPageLoad stepKey="waitForStorefront"/>
<click selector="{{StorefrontBundledSection.addToCart}}" stepKey="clickCustomize"/>
<!-- See validation errors for all 4 options -->
<click selector="{{StorefrontBundledSection.addToCartConfigured}}" stepKey="clickAddToCart1"/>
<see selector="{{StorefrontBundledSection.nthOptionDiv('1')}}" userInput="This is a required field." stepKey="error1"/>
<see selector="{{StorefrontBundledSection.nthOptionDiv('2')}}" userInput="Please select one of the options." stepKey="error2"/>
<see selector="{{StorefrontBundledSection.nthOptionDiv('3')}}" userInput="Please select one of the options." stepKey="error3"/>
<see selector="{{StorefrontBundledSection.nthOptionDiv('4')}}" userInput="This is a required field." stepKey="error4"/>
<!-- Fill option 1, see validation errors for 3 other options -->
<selectOption selector="select.bundle-option-select" userInput="$$simpleProduct1.name$$ +$123.00" stepKey="selectOption1"/>
<click selector="{{StorefrontBundledSection.addToCartConfigured}}" stepKey="clickAddToCart2"/>
<dontSee selector="{{StorefrontBundledSection.nthOptionDiv('1')}}" userInput="This is a required field." stepKey="error5"/>
<see selector="{{StorefrontBundledSection.nthOptionDiv('2')}}" userInput="Please select one of the options." stepKey="error6"/>
<see selector="{{StorefrontBundledSection.nthOptionDiv('3')}}" userInput="Please select one of the options." stepKey="error7"/>
<see selector="{{StorefrontBundledSection.nthOptionDiv('4')}}" userInput="This is a required field." stepKey="error8"/>
<!-- Fill option 2, see validation errors for 2 other options -->
<click selector="input[type='radio']:nth-of-type(1)" stepKey="selectOption2"/>
<click selector="{{StorefrontBundledSection.addToCartConfigured}}" stepKey="clickAddToCart3"/>
<dontSee selector="{{StorefrontBundledSection.nthOptionDiv('1')}}" userInput="This is a required field." stepKey="error9"/>
<dontSee selector="{{StorefrontBundledSection.nthOptionDiv('2')}}" userInput="Please select one of the options." stepKey="error10"/>
<see selector="{{StorefrontBundledSection.nthOptionDiv('3')}}" userInput="Please select one of the options." stepKey="error11"/>
<see selector="{{StorefrontBundledSection.nthOptionDiv('4')}}" userInput="This is a required field." stepKey="error12"/>
<!-- Fill option 3, see validation errors for 1 other options -->
<checkOption selector="input[type='checkbox']:nth-of-type(1)" stepKey="selectOption3"/>
<click selector="{{StorefrontBundledSection.addToCartConfigured}}" stepKey="clickAddToCart4"/>
<dontSee selector="{{StorefrontBundledSection.nthOptionDiv('1')}}" userInput="This is a required field." stepKey="error13"/>
<dontSee selector="{{StorefrontBundledSection.nthOptionDiv('2')}}" userInput="Please select one of the options." stepKey="error14"/>
<dontSee selector="{{StorefrontBundledSection.nthOptionDiv('3')}}" userInput="Please select one of the options." stepKey="error15"/>
<see selector="{{StorefrontBundledSection.nthOptionDiv('4')}}" userInput="This is a required field." stepKey="error16"/>
<!-- Fill option 4, dont see any validation errors -->
<selectOption selector="select[multiple='multiple']" userInput="$$simpleProduct1.name$$ +$123.00" stepKey="selectOption4"/>
<click selector="{{StorefrontBundledSection.addToCartConfigured}}" stepKey="clickAddToCart5"/>
<dontSee selector="{{StorefrontBundledSection.nthOptionDiv('1')}}" userInput="This is a required field." stepKey="error17"/>
<dontSee selector="{{StorefrontBundledSection.nthOptionDiv('2')}}" userInput="Please select one of the options." stepKey="error18"/>
<dontSee selector="{{StorefrontBundledSection.nthOptionDiv('3')}}" userInput="Please select one of the options." stepKey="error19"/>
<dontSee selector="{{StorefrontBundledSection.nthOptionDiv('4')}}" userInput="This is a required field." stepKey="error20"/>
</test>
<test name="StorefrontBundleAddToCartSuccessTest">
<annotations>
<features value="Bundle"/>
<stories value="Bundle product details page"/>
<title value="Customer should be able to add the bundle product to the cart"/>
<description value="Customer should be able to add the bundle product to the cart"/>
<severity value="CRITICAL"/>
<testCaseId value="MC-232"/>
<group value="Bundle"/>
</annotations>
<before>
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
<createData entity="SimpleProduct2" stepKey="simpleProduct1"/>
<createData entity="SimpleProduct2" stepKey="simpleProduct2"/>
</before>
<after>
<amOnPage url="{{AdminLogoutPage.url}}" stepKey="logout"/>
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
<deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/>
</after>
<!-- Start creating a bundle product -->
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductList"/>
<waitForPageLoad stepKey="waitForProductList"/>
<actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct">
<argument name="product" value="BundleProduct"/>
</actionGroup>
<actionGroup ref="fillProductNameAndSkuInProductForm" stepKey="fillNameAndSku">
<argument name="product" value="BundleProduct"/>
</actionGroup>
<!-- Add Option One, a "Drop-down" type option -->
<actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts1">
<argument name="x" value="0"/>
<argument name="n" value="1"/>
<argument name="prodOneSku" value="$$simpleProduct1.sku$$"/>
<argument name="prodTwoSku" value="$$simpleProduct2.sku$$"/>
<argument name="optionTitle" value="Option One"/>
<argument name="inputType" value="select"/>
</actionGroup>
<!-- Add Option Two, a "Radio Buttons" type option -->
<actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts2">
<argument name="x" value="1"/>
<argument name="n" value="2"/>
<argument name="prodOneSku" value="$$simpleProduct1.sku$$"/>
<argument name="prodTwoSku" value="$$simpleProduct2.sku$$"/>
<argument name="optionTitle" value="Option Two"/>
<argument name="inputType" value="radio"/>
</actionGroup>
<!-- Add Option Three, a "Checkbox" type option -->
<actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts3">
<argument name="x" value="2"/>
<argument name="n" value="3"/>
<argument name="prodOneSku" value="$$simpleProduct1.sku$$"/>
<argument name="prodTwoSku" value="$$simpleProduct2.sku$$"/>
<argument name="optionTitle" value="Option Three"/>
<argument name="inputType" value="checkbox"/>
</actionGroup>
<!-- Add Option Four, a "Multi Select" type option -->
<actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts4">
<argument name="x" value="3"/>
<argument name="n" value="4"/>
<argument name="prodOneSku" value="$$simpleProduct1.sku$$"/>
<argument name="prodTwoSku" value="$$simpleProduct2.sku$$"/>
<argument name="optionTitle" value="Option Four"/>
<argument name="inputType" value="multi"/>
</actionGroup>
<!-- Save product and go to storefront -->
<actionGroup ref="saveProductForm" stepKey="saveProduct"/>
<amOnPage url="{{BundleProduct.sku}}.html" stepKey="goToStorefront"/>
<waitForPageLoad stepKey="waitForStorefront"/>
<click selector="{{StorefrontBundledSection.addToCart}}" stepKey="clickCustomize"/>
<!-- Select all applicable options -->
<selectOption selector="select.bundle-option-select" userInput="$$simpleProduct1.name$$ +$123.00" stepKey="selectOption1"/>
<click selector="input[type='radio']:nth-of-type(1)" stepKey="selectOption2"/>
<checkOption selector="input[type='checkbox']:nth-of-type(1)" stepKey="selectOption3"/>
<selectOption selector="select[multiple='multiple']" userInput="$$simpleProduct1.name$$ +$123.00" stepKey="selectOption4"/>
<!-- Customize and add the bundle product to our cart -->
<click selector="{{StorefrontBundledSection.addToCartConfigured}}" stepKey="clickAddToCart1"/>
<dontSee selector="{{StorefrontBundledSection.nthOptionDiv('1')}}" userInput="This is a required field." stepKey="validForm1"/>
<dontSee selector="{{StorefrontBundledSection.nthOptionDiv('2')}}" userInput="Please select one of the options." stepKey="validForm2"/>
<dontSee selector="{{StorefrontBundledSection.nthOptionDiv('3')}}" userInput="Please select one of the options." stepKey="validForm3"/>
<dontSee selector="{{StorefrontBundledSection.nthOptionDiv('4')}}" userInput="This is a required field." stepKey="validForm4"/>
<see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{BundleProduct.name}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/>
<!-- Verify cart contents -->
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCart"/>
<waitForPageLoad stepKey="waitForCart"/>
<see selector="{{StorefrontBundledSection.nthItemOptionsTitle('1')}}" userInput="Option One" stepKey="seeOption1"/>
<see selector="{{StorefrontBundledSection.nthItemOptionsTitle('2')}}" userInput="Option Two" stepKey="seeOption2"/>
<see selector="{{StorefrontBundledSection.nthItemOptionsTitle('3')}}" userInput="Option Three" stepKey="seeOption3"/>
<see selector="{{StorefrontBundledSection.nthItemOptionsTitle('4')}}" userInput="Option Four" stepKey="seeOption4"/>
<see selector="{{StorefrontBundledSection.nthItemOptionsValue('1')}}" userInput="50 x $$simpleProduct1.name$$ $123.00" stepKey="seeOptionValue1"/>
<see selector="{{StorefrontBundledSection.nthItemOptionsValue('2')}}" userInput="50 x $$simpleProduct1.name$$ $123.00" stepKey="seeOptionValue2"/>
<see selector="{{StorefrontBundledSection.nthItemOptionsValue('3')}}" userInput="50 x $$simpleProduct1.name$$ $123.00" stepKey="seeOptionValue3"/>
<see selector="{{StorefrontBundledSection.nthItemOptionsValue('4')}}" userInput="50 x $$simpleProduct1.name$$ $123.00" stepKey="seeOptionValue4"/>
</test>
</tests>