Merge lp:~elopio/ubuntuone-testing/redesign into lp:~rmcbride/ubuntuone-testing/sst-services-page
- redesign
- Merge into sst-services-page
Proposed by
Leo Arias
Status: | Merged |
---|---|
Approved by: | Rick McBride |
Approved revision: | 44 |
Merge reported by: | Rick McBride |
Merged at revision: | not available |
Proposed branch: | lp:~elopio/ubuntuone-testing/redesign |
Merge into: | lp:~rmcbride/ubuntuone-testing/sst-services-page |
Prerequisite: | lp:~elopio/ubuntuone-testing/u1web |
Diff against target: |
886 lines (+496/-225) 13 files modified
ubuntuone/web/qa/tests/payments/u1webp-001.py (+14/-33) ubuntuone/web/qa/tests/payments/u1webp-002.py (+13/-35) ubuntuone/web/qa/tests/payments/u1webp-003.py (+12/-25) ubuntuone/web/qa/tests/services/u1webse-001.py (+5/-23) ubuntuone/web/qa/tests/services/u1webse-002.py (+8/-17) ubuntuone/web/qa/tests/services/u1webse-003.py (+8/-18) ubuntuone/web/qa/tests/services/u1webse-004.py (+14/-29) ubuntuone/web/qa/tests/services/u1webse-005.py (+9/-22) ubuntuone/web/qa/tests/services/u1webse-006.py (+9/-23) ubuntuone/web/qa/tests/shared/actions/__init__.py (+1/-0) ubuntuone/web/qa/tests/shared/actions/payment.py (+203/-0) ubuntuone/web/qa/tests/shared/actions/payment_confirmed.py (+62/-0) ubuntuone/web/qa/tests/shared/actions/services.py (+138/-0) |
To merge this branch: | bzr merge lp:~elopio/ubuntuone-testing/redesign |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Rick McBride | Approve | ||
Review via email:
|
Commit message
Separated actions from tests and moved actions to shared folder.
Description of the change
Some structure changes to separate actions from tests.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === renamed directory 'qa' => 'ubuntuone' |
2 | === renamed directory 'qa/selenium' => 'ubuntuone/web' |
3 | === added directory 'ubuntuone/web/qa' |
4 | === added directory 'ubuntuone/web/qa/tests' |
5 | === added directory 'ubuntuone/web/qa/tests/payments' |
6 | === renamed file 'qa/selenium/services/u1webp-001.py' => 'ubuntuone/web/qa/tests/payments/u1webp-001.py' |
7 | --- qa/selenium/services/u1webp-001.py 2011-09-16 15:25:04 +0000 |
8 | +++ ubuntuone/web/qa/tests/payments/u1webp-001.py 2011-09-16 15:25:04 +0000 |
9 | @@ -1,46 +1,27 @@ |
10 | from sst.actions import * |
11 | -from additional._actions import * |
12 | +from _actions import * |
13 | try: |
14 | from _passwords import username, password |
15 | except: |
16 | print "try adding a _passwords.py file if you expect this to work ;)" |
17 | -from additional.config import base_url |
18 | +from config import base_url |
19 | from datetime import date |
20 | +import actions.services as services_actions |
21 | +import actions.payment as payment_actions |
22 | +import actions.paymet_confirmed as payment_confirmed_actions |
23 | |
24 | set_base_url(base_url) |
25 | login(username, password) |
26 | title_is(u'Ubuntu One : Dashboard') |
27 | -goto('/services/') |
28 | -title_is(u'Ubuntu One : Services') |
29 | -radio_select('ms2') |
30 | -button_click(get_elements(css_class='buy-now', |
31 | - text='Buy now and go to checkout')[0]) |
32 | -title_is(u'Ubuntu One : Checkout') |
33 | -textfield_write('id_street', 'Test Street') |
34 | -textfield_write('id_city', 'Test City') |
35 | -textfield_write('id_state', 'Test Region') |
36 | -textfield_write('id_postal', '12345') |
37 | -set_select('id_country', 'United States') |
38 | -set_select('id_card_type', 'Visa') |
39 | -textfield_write('id_card_holder', 'Test name') |
40 | -textfield_write('id_card_number', '4111111111111111') |
41 | -textfield_write('id_card_ccv', '123') |
42 | -set_select('id_card_expiration_0', '10') |
43 | -set_select('id_card_expiration_1', '2015') |
44 | -button_click(get_element(css_class='cta', value='Purchase')) |
45 | -title_is(u'Ubuntu One : Confirm Payment Details') |
46 | -link_click(get_element(css_class='cta', href='confirmed')) |
47 | -title_is(u'Ubuntu One : Confirm Payment Details') |
48 | -get_element(tag='h1', text='Payment Processed') |
49 | -today = date.today() |
50 | -next_month = today.replace(month = today.month + 1) |
51 | -#get_element(tag='dt', css_class='purchase_details' |
52 | -# text='Expires: %(next_month)s' |
53 | -# % {'next_month': next_month.strftime('%B %-d, %Y')}) |
54 | -get_element(tag='p', css_class='explanation', |
55 | - text='Your card will automatically be billed $39.99 annually') |
56 | -get_element(tag='dd', text='AUTHORISED') |
57 | -link_click(get_element(tag='a', text='View your account')) |
58 | +services_actions.open() |
59 | +services_actions.buy_music_streaming_yearly() |
60 | +payment_actions.assert_title() |
61 | +payment_actions.place_order_with_valid_card() |
62 | +payment_actions.confirm_payment_details() |
63 | +payment_confirmed_actions.assert_processed_payment('annually', 1, 39.99, |
64 | + trial=True) |
65 | +payment_confirmed_actions.view_account() |
66 | +# TODO move this to the account actions module. |
67 | get_element(tag='span', text='29 trial days left') |
68 | get_element(tag='p', text='You are subscribed yearly') |
69 | get_element(tag='span', text='See my subscription') |
70 | |
71 | === renamed file 'qa/selenium/services/u1webp-002.py' => 'ubuntuone/web/qa/tests/payments/u1webp-002.py' |
72 | --- qa/selenium/services/u1webp-002.py 2011-09-16 15:25:04 +0000 |
73 | +++ ubuntuone/web/qa/tests/payments/u1webp-002.py 2011-09-16 15:25:04 +0000 |
74 | @@ -1,46 +1,24 @@ |
75 | from sst.actions import * |
76 | -from additional._actions import * |
77 | +from _actions import * |
78 | try: |
79 | from _passwords import username, password |
80 | except: |
81 | print "try adding a _passwords.py file if you expect this to work ;)" |
82 | -from additional.config import base_url |
83 | -from datetime import date |
84 | +from config import base_url |
85 | +import actions.services as services_actions |
86 | +import actions.payment as payment_actions |
87 | +import actions.payment_confirmed as payment_confirmed_actions |
88 | |
89 | set_base_url(base_url) |
90 | login(username, password) |
91 | title_is(u'Ubuntu One : Dashboard') |
92 | -goto('/services/') |
93 | -title_is(u'Ubuntu One : Services') |
94 | -textfield_write('qty', '5') |
95 | -radio_select('st1') |
96 | -button_click(get_elements(css_class='buy-now', |
97 | - text='Buy now and go to checkout')[1]) |
98 | -title_is(u'Ubuntu One : Checkout') |
99 | -textfield_write('id_street', 'Test Street') |
100 | -textfield_write('id_city', 'Test City') |
101 | -textfield_write('id_state', 'Test Region') |
102 | -textfield_write('id_postal', '12345') |
103 | -set_select('id_country', 'United States') |
104 | -set_select('id_card_type', 'American Express') |
105 | -textfield_write('id_card_holder', 'Test name') |
106 | -textfield_write('id_card_number', '343434343434343') |
107 | -textfield_write('id_card_ccv', '123') |
108 | -set_select('id_card_expiration_0', '10') |
109 | -set_select('id_card_expiration_1', '2015') |
110 | -button_click(get_element(css_class='cta', value='Purchase')) |
111 | -title_is(u'Ubuntu One : Confirm Payment Details') |
112 | -link_click(get_element(css_class='cta', href='confirmed')) |
113 | -title_is(u'Ubuntu One : Confirm Payment Details') |
114 | -get_element(tag='h1', text='Payment Processed') |
115 | -today = date.today() |
116 | -next_month = today.replace(month = today.month + 1) |
117 | -#get_element(tag='dt', css_class='purchase_details' |
118 | -# text='Expires: %(next_month)s' |
119 | -# % {'next_month': next_month.strftime('%B %-d, %Y')}) |
120 | -get_element(tag='p', css_class='explanation', |
121 | - text='Your card will automatically be billed $14.95 monthly') |
122 | -get_element(tag='dd', text='AUTHORISED') |
123 | -link_click(get_element(tag='a', text='View your account')) |
124 | +services_actions.open() |
125 | +services_actions.buy_extra_storage() |
126 | +payment_actions.assert_title() |
127 | +payment_actions.place_order_with_valid_card() |
128 | +payment_confirmed_actions.assert_title() |
129 | +payment_confirmed_actions.assert_processed_payment('annually', 29.99, 29.99) |
130 | +payment_confirmed_actions.view_account() |
131 | +# TODO move this to the module account actions. |
132 | get_element(tag='span', text='5GB with Ubuntu One Free') |
133 | get_element(tag='span', text='100GB from storage add-on') |
134 | |
135 | === renamed file 'qa/selenium/services/u1webp-003.py' => 'ubuntuone/web/qa/tests/payments/u1webp-003.py' |
136 | --- qa/selenium/services/u1webp-003.py 2011-09-16 15:25:04 +0000 |
137 | +++ ubuntuone/web/qa/tests/payments/u1webp-003.py 2011-09-16 15:25:04 +0000 |
138 | @@ -1,34 +1,21 @@ |
139 | from sst.actions import * |
140 | -from additional._actions import * |
141 | +from _actions import * |
142 | try: |
143 | from _passwords import username, password |
144 | except: |
145 | print "try adding a _passwords.py file if you expect this to work ;)" |
146 | -from additional.config import base_url |
147 | +from config import base_url |
148 | +import actions.services as services_actions |
149 | +import actions.payment as payment_actions |
150 | +import actions.payment_confirmed as payment_confirmed_actions |
151 | |
152 | set_base_url(base_url) |
153 | login(username, password) |
154 | title_is(u'Ubuntu One : Dashboard') |
155 | -goto('/services/') |
156 | -title_is(u'Ubuntu One : Services') |
157 | -radio_select('ms2') |
158 | -button_click(get_elements(css_class='buy-now', |
159 | - text='Buy now and go to checkout')[0]) |
160 | -title_is(u'Ubuntu One : Checkout') |
161 | -textfield_write('id_street', 'Test Street') |
162 | -textfield_write('id_city', 'Test City') |
163 | -textfield_write('id_state', 'Test Region') |
164 | -textfield_write('id_postal', '12345') |
165 | -set_select('id_country', 'United States') |
166 | -set_select('id_card_type', 'Visa') |
167 | -textfield_write('id_card_holder', 'REFUSED') |
168 | -textfield_write('id_card_number', '4111111111111111') |
169 | -textfield_write('id_card_ccv', '123') |
170 | -set_select('id_card_expiration_0', '10') |
171 | -set_select('id_card_expiration_1', '2015') |
172 | -button_click(get_element(css_class='cta', value='Purchase')) |
173 | -title_is(u'Ubuntu One : Confirm Payment Details') |
174 | -link_click(get_element(css_class='cta', href='confirmed')) |
175 | -title_is(u'Ubuntu One : Confirm Payment Details') |
176 | -get_element(tag='h1', text='Your Payment Failed') |
177 | -get_element(tag='a', text='fill out the details here', href='/payment/') |
178 | +services_actions.open() |
179 | +services_actions.buy_music_streaming() |
180 | +payment_actions.assert_title() |
181 | +payment_actions.place_order_with_refused_card() |
182 | +payment_actions.confirm_payment_details() |
183 | +payment_confirmed_actions.assert_title() |
184 | +payment_confirmed_actions.assert_failed_payment() |
185 | |
186 | === renamed directory 'qa/selenium/services' => 'ubuntuone/web/qa/tests/services' |
187 | === modified file 'ubuntuone/web/qa/tests/services/u1webse-001.py' |
188 | --- qa/selenium/services/u1webse-001.py 2011-09-16 15:25:04 +0000 |
189 | +++ ubuntuone/web/qa/tests/services/u1webse-001.py 2011-09-16 15:25:04 +0000 |
190 | @@ -1,32 +1,14 @@ |
191 | from sst.actions import * |
192 | -from additional._actions import * |
193 | +from _actions import * |
194 | try: |
195 | from _passwords import username, password |
196 | except: |
197 | print "try adding a _passwords.py file if you expect this to work ;)" |
198 | -from additional.config import base_url |
199 | +from config import base_url |
200 | +import actions.services as services_actions |
201 | |
202 | set_base_url(base_url) |
203 | login(username, password) |
204 | title_is(u'Ubuntu One : Dashboard') |
205 | -goto('/services/') |
206 | -get_element(tag='h1', text='Free') |
207 | -get_element(tag='li', text='File sync across platforms') |
208 | -get_element(tag='li', text='Share folders and files') |
209 | -get_element(tag='li', text='Access on your mobile') |
210 | -# TODO there are two Music Streaming elements. We should use xpath to be |
211 | -# sure that we are on the right section. |
212 | -#get_element(tag='h1', text='Music Streaming') |
213 | -get_element(css_class='try-free', text='Try for FREE') |
214 | -get_element(tag='li', text='Music streaming on your mobile') |
215 | -get_element(tag='li', text='20 GB of Storage built in') |
216 | -get_element(tag='li', text='Listen offline on Android') |
217 | -get_element(tag='li', |
218 | - text='$3.99 / month or $39.99 / year') |
219 | -get_element(tag='h1', text='Storage') |
220 | -get_element(tag='li', text='20 GB') |
221 | -get_element(tag='li', text='$2.99 / month') |
222 | -get_element(tag='li', text='or $29.99 / year') |
223 | -get_element(tag='h1', text='Discount') |
224 | -get_element(tag='p', text='Two months free on Music Streaming and Storage ' \ |
225 | - 'when you sign up for 12 months') |
226 | +services_actions.open() |
227 | +services_actions.assert_services_information() |
228 | |
229 | === modified file 'ubuntuone/web/qa/tests/services/u1webse-002.py' |
230 | --- qa/selenium/services/u1webse-002.py 2011-09-16 15:25:04 +0000 |
231 | +++ ubuntuone/web/qa/tests/services/u1webse-002.py 2011-09-16 15:25:04 +0000 |
232 | @@ -1,26 +1,17 @@ |
233 | from sst.actions import * |
234 | -from additional._actions import * |
235 | +from _actions import * |
236 | try: |
237 | from _passwords import username, password |
238 | except: |
239 | print "try adding a _passwords.py file if you expect this to work ;)" |
240 | -from additional.config import base_url |
241 | +from config import base_url |
242 | +import actions.services as services_actions |
243 | +import actions.payment as payment_actions |
244 | |
245 | set_base_url(base_url) |
246 | login(username, password) |
247 | title_is(u'Ubuntu One : Dashboard') |
248 | -goto('/services/') |
249 | -title_is(u'Ubuntu One : Services') |
250 | -radio_select('ms1') |
251 | -button_click(get_elements(css_class='buy-now', |
252 | - text='Buy now and go to checkout')[0]) |
253 | -title_is(u'Ubuntu One : Checkout') |
254 | -get_element(tag='h1', text='New Subscription') |
255 | -get_element(css_class='price', text='$3.99') |
256 | -get_element(tag='span', css_class='price', text='$3.99') |
257 | -today = date.today() |
258 | -next_month = today.replace(month = today.month + 1) |
259 | -get_element(tag='p', text='This is a trial subscription which will expire ' \ |
260 | - '%(next_month)s afterwhich your card ' \ |
261 | - 'will automatically be billed $3.99 monthly' |
262 | - % {'next_month': next_month.strftime('%B %-d, %Y')}) |
263 | +services_actions.open() |
264 | +services_actions.buy_music_streaming_monthly() |
265 | +payment_actions.assert_title() |
266 | +payment_actions.assert_monthly_music_streaming_subscription() |
267 | |
268 | === modified file 'ubuntuone/web/qa/tests/services/u1webse-003.py' |
269 | --- qa/selenium/services/u1webse-003.py 2011-09-16 15:25:04 +0000 |
270 | +++ ubuntuone/web/qa/tests/services/u1webse-003.py 2011-09-16 15:25:04 +0000 |
271 | @@ -1,27 +1,17 @@ |
272 | from sst.actions import * |
273 | -from additional._actions import * |
274 | +from _actions import * |
275 | try: |
276 | from _passwords import username, password |
277 | except: |
278 | print "try adding a _passwords.py file if you expect this to work ;)" |
279 | -from additional.config import base_url |
280 | -from datetime import date |
281 | +from config import base_url |
282 | +import actions.services as services_actions |
283 | +import actions.payment as payment_actions |
284 | |
285 | set_base_url(base_url) |
286 | login(username, password) |
287 | title_is(u'Ubuntu One : Dashboard') |
288 | -goto('/services/') |
289 | -title_is(u'Ubuntu One : Services') |
290 | -radio_select('ms2') |
291 | -button_click(get_elements(css_class='buy-now', |
292 | - text='Buy now and go to checkout')[0]) |
293 | -title_is(u'Ubuntu One : Checkout') |
294 | -get_element(tag='h1', text='New Subscription') |
295 | -get_element(css_class='price', text='$39.99') |
296 | -get_element(tag='span', css_class='price', text='$39.99') |
297 | -today = date.today() |
298 | -next_month = today.replace(month = today.month + 1) |
299 | -get_element(tag='p', text='This is a trial subscription which will expire ' \ |
300 | - '%(next_month)s afterwhich your card ' \ |
301 | - 'will automatically be billed $39.99 annually' |
302 | - % {'next_month': next_month.strftime('%B %-d, %Y')}) |
303 | +services_actions.open() |
304 | +services_actions.buy_music_streaming_yearly() |
305 | +payment_actions.assert_title() |
306 | +payment_actions.assert_annually_music_streaming_subscription() |
307 | |
308 | === modified file 'ubuntuone/web/qa/tests/services/u1webse-004.py' |
309 | --- qa/selenium/services/u1webse-004.py 2011-09-16 15:25:04 +0000 |
310 | +++ ubuntuone/web/qa/tests/services/u1webse-004.py 2011-09-16 15:25:04 +0000 |
311 | @@ -1,42 +1,27 @@ |
312 | from sst.actions import * |
313 | -from additional._actions import * |
314 | +from _actions import * |
315 | try: |
316 | from _passwords import username, password |
317 | except: |
318 | print "try adding a _passwords.py file if you expect this to work ;)" |
319 | -from additional.config import base_url |
320 | - |
321 | -def assert_storage(quantity): |
322 | - """ |
323 | - Asert the storage quantity selected and its space and price. |
324 | - |
325 | - Keyword arguments: |
326 | - quantity -- The expected storage quantity. |
327 | - """ |
328 | - text_is('qty', str(quantity)) |
329 | - text_is('storage-gb', '%sGB' % (quantity * 20)) |
330 | - monthly_price = quantity * 2.99 |
331 | - text_is('storage-monthly-price', '$%s' % monthly_price) |
332 | - annual_price = quantity * 29.99 |
333 | - text_is('storage-annual-price', '$%s' % annual_price) |
334 | - |
335 | +from config import base_url |
336 | +import actions.services as services_actions |
337 | |
338 | set_base_url(base_url) |
339 | login(username, password) |
340 | title_is(u'Ubuntu One : Dashboard') |
341 | -goto('/services/') |
342 | -title_is(u'Ubuntu One : Services') |
343 | -assert_storage(1) |
344 | -button_click('plus_qty') |
345 | -assert_storage(2) |
346 | -button_click('minus_qty') |
347 | +services_actions.open() |
348 | +services_actions.assert_storage(1) |
349 | +services_actions.increase_storage_quantity() |
350 | +services_actions.assert_storage(2) |
351 | +services_actions.decrease_storage_quantity() |
352 | for quantity in range(2, 11): |
353 | - button_click('plus_qty') |
354 | - assert_storage(quantity) |
355 | + services_actions.increase_storage_quantity() |
356 | + services_actions.assert_storage(quantity) |
357 | for quantity in range(9, 4, -1): |
358 | - button_click('minus_qty') |
359 | - assert_storage(quantity) |
360 | -textfield_write('qty', '25') |
361 | + services_actions.decrease_storage_quantity() |
362 | + services_actions.assert_storage(quantity) |
363 | +services_actions.set_storage_quantity('25') |
364 | # Move the focus out of the textfield. |
365 | click('storage-gb') |
366 | -assert_storage(25) |
367 | +services_actions.assert_storage(25) |
368 | |
369 | === modified file 'ubuntuone/web/qa/tests/services/u1webse-005.py' |
370 | --- qa/selenium/services/u1webse-005.py 2011-09-16 15:25:04 +0000 |
371 | +++ ubuntuone/web/qa/tests/services/u1webse-005.py 2011-09-16 15:25:04 +0000 |
372 | @@ -1,31 +1,18 @@ |
373 | from sst.actions import * |
374 | -from additional._actions import * |
375 | +from _actions import * |
376 | try: |
377 | from _passwords import username, password |
378 | except: |
379 | print "try adding a _passwords.py file if you expect this to work ;)" |
380 | -from additional.config import base_url |
381 | -from datetime import date |
382 | +from config import base_url |
383 | +import actions.services as services_actions |
384 | +import actions.payment as payment_actions |
385 | |
386 | set_base_url(base_url) |
387 | login(username, password) |
388 | title_is(u'Ubuntu One : Dashboard') |
389 | -goto('/services/') |
390 | -title_is(u'Ubuntu One : Services') |
391 | -textfield_write('qty', '5') |
392 | -radio_select('st1') |
393 | -button_click(get_elements(css_class='buy-now', |
394 | - text='Buy now and go to checkout')[1]) |
395 | -title_is(u'Ubuntu One : Checkout') |
396 | -get_element(tag='h1', text='Subscription Change') |
397 | -get_element(tag='p', text='5 x 20-Pack with 20 GB (monthly)') |
398 | -get_element(tag='strong', text='Monthly') |
399 | -get_element(css_class='price', text='$2.99') |
400 | -get_element(tag='span', css_class='price', text='$14.95') |
401 | -today = date.today() |
402 | -next_month = today.replace(month = today.month + 1) |
403 | -get_element(tag='p', text='This payment will cover the period from ' \ |
404 | - '%(today)s to %(next_month)s afterwhich your card ' \ |
405 | - 'will automatically be billed $14.95 monthly' |
406 | - % {'today': today.strftime('%B %-d, %Y'), |
407 | - 'next_month': next_month.strftime('%B %-d, %Y')}) |
408 | +services_actions.open() |
409 | +services_actions.set_storage_quantity(5) |
410 | +services_actions.buy_extra_storage_monthly() |
411 | +payment_actions.assert_title() |
412 | +payment_actions.assert_monthly_extra_storage_subscription(5) |
413 | |
414 | === modified file 'ubuntuone/web/qa/tests/services/u1webse-006.py' |
415 | --- qa/selenium/services/u1webse-006.py 2011-09-16 15:25:04 +0000 |
416 | +++ ubuntuone/web/qa/tests/services/u1webse-006.py 2011-09-16 15:25:04 +0000 |
417 | @@ -1,32 +1,18 @@ |
418 | from sst.actions import * |
419 | -from additional._actions import * |
420 | +from _actions import * |
421 | try: |
422 | from _passwords import username, password |
423 | except: |
424 | print "try adding a _passwords.py file if you expect this to work ;)" |
425 | -from additional.config import base_url |
426 | -from datetime import date |
427 | +from config import base_url |
428 | +import actions.services as services_actions |
429 | +import actions.payment as payment_actions |
430 | |
431 | set_base_url(base_url) |
432 | login(username, password) |
433 | title_is(u'Ubuntu One : Dashboard') |
434 | -goto('/services/') |
435 | -title_is(u'Ubuntu One : Services') |
436 | - |
437 | -textfield_write('qty', '5') |
438 | -radio_select('st2') |
439 | -button_click(get_elements(css_class='buy-now', |
440 | - text='Buy now and go to checkout')[1]) |
441 | -title_is(u'Ubuntu One : Checkout') |
442 | -get_element(tag='h1', text='Subscription Change') |
443 | -get_element(tag='p', text='5 x 20-Pack with 20 GB (yearly)') |
444 | -get_element(tag='strong', text='Yearly') |
445 | -get_element(css_class='price', text='$29.99') |
446 | -get_element(tag='span', css_class='price', text='$149.95') |
447 | -today = date.today() |
448 | -next_year = today.replace(year = today.year + 1, day = today.day + 1) |
449 | -get_element(tag='p', text='This payment will cover the period from ' \ |
450 | - '%(today)s to %(next_year)s afterwhich your card ' \ |
451 | - 'will automatically be billed $149.95 annually' \ |
452 | - % {'today': today.strftime('%B %-d, %Y'), |
453 | - 'next_year': next_year.strftime('%B %-d, %Y')}) |
454 | +services_actions.open() |
455 | +services_actions.set_storage_quantity(5) |
456 | +services_actions.buy_extra_storage_yearly() |
457 | +payment_actions.assert_title() |
458 | +payment_actions.assert_annually_extra_storage_subscription(5) |
459 | |
460 | === renamed directory 'qa/selenium/services/additional' => 'ubuntuone/web/qa/tests/shared' |
461 | === added directory 'ubuntuone/web/qa/tests/shared/actions' |
462 | === added file 'ubuntuone/web/qa/tests/shared/actions/__init__.py' |
463 | --- ubuntuone/web/qa/tests/shared/actions/__init__.py 1970-01-01 00:00:00 +0000 |
464 | +++ ubuntuone/web/qa/tests/shared/actions/__init__.py 2011-09-16 15:25:04 +0000 |
465 | @@ -0,0 +1,1 @@ |
466 | + |
467 | |
468 | === added file 'ubuntuone/web/qa/tests/shared/actions/payment.py' |
469 | --- ubuntuone/web/qa/tests/shared/actions/payment.py 1970-01-01 00:00:00 +0000 |
470 | +++ ubuntuone/web/qa/tests/shared/actions/payment.py 2011-09-16 15:25:04 +0000 |
471 | @@ -0,0 +1,203 @@ |
472 | +# -*- coding: utf-8 -*- |
473 | + |
474 | +# Authors: |
475 | +# Leo Arias <leo.arias@canonical.com> |
476 | +# |
477 | +# Copyright 2011 Canonical Ltd. |
478 | +# |
479 | +# This program is free software: you can redistribute it and/or modify it |
480 | +# under the terms of the GNU General Public License version 3, as published |
481 | +# by the Free Software Foundation. |
482 | +# |
483 | +# This program is distributed in the hope that it will be useful, but |
484 | +# WITHOUT ANY WARRANTY; without even the implied warranties of |
485 | +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
486 | +# PURPOSE. See the GNU General Public License for more details. |
487 | +# |
488 | +# You should have received a copy of the GNU General Public License along |
489 | +# with this program. If not, see <http://www.gnu.org/licenses/>. |
490 | + |
491 | +"""Actions for the Payments page of the Ubuntu One website.""" |
492 | + |
493 | +from datetime import date |
494 | +from sst.actions import * |
495 | + |
496 | +def assert_title(): |
497 | + """Assert that the title of the page is the expected.""" |
498 | + title_is(u'Ubuntu One : Checkout') |
499 | + |
500 | +def assert_music_streaming_subscription(period): |
501 | + """Assert that the information of the new music streaming subscription |
502 | + is the expected. |
503 | + |
504 | + Keyword arguments: |
505 | + period -- The period of the subscription. |
506 | + It can be 'monthly' or 'annually'. |
507 | + |
508 | + """ |
509 | + if period == 'monthly': |
510 | + price = '$3.99' |
511 | + elif period == 'annually': |
512 | + price = '$39.99' |
513 | + else: |
514 | + # TODO throw an error. |
515 | + pass |
516 | + get_element(tag='h1', text='New Subscription') |
517 | + get_element(css_class='price', text=price) |
518 | + get_element(tag='span', css_class='price', text=price) |
519 | + today = date.today() |
520 | + next_month = today.replace(month = today.month + 1) |
521 | + get_element(tag='p', text='This is a trial subscription which will ' \ |
522 | + 'expire %(next_month)s afterwhich your card ' \ |
523 | + 'will automatically be billed %(price) %(period)' |
524 | + % {'next_month': |
525 | + next_month.strftime('%B %-d, %Y'), |
526 | + 'price': price, 'period': period}) |
527 | + |
528 | +def assert_monthly_music_streaming_subscription(): |
529 | + """Assert that the information of the new monthly music streaming |
530 | + subscription is the expected. |
531 | + |
532 | + """ |
533 | + assert_music_streaming_subscription('monthly') |
534 | + |
535 | +def assert_annually_music_streaming_subscription(): |
536 | + """Assert that the information of the new yearly music streaming |
537 | + subscription is the expected. |
538 | + |
539 | + """ |
540 | + assert_music_streaming_subscription('annually') |
541 | + |
542 | +def assert_extra_storage_subscription(period, quantity): |
543 | + """Assert that the information of the new extra storage subscription |
544 | + is the expected. |
545 | + |
546 | + Keyword arguments: |
547 | + period -- The period of the subscription. |
548 | + It can be 'monthly' or 'annually'. |
549 | + quantity -- The quantity of extra storage to buy. |
550 | + |
551 | + """ |
552 | + today = date.today() |
553 | + if period == 'monthly': |
554 | + price_per_add_on = 2.99 |
555 | + period_alternate = period |
556 | + period_end = today.replace(month = today.month + 1) |
557 | + elif period == 'annually': |
558 | + price_per_add_on = 29.99 |
559 | + period_alternate = 'yearly' |
560 | + period_end = today.replace(year = today.year + 1) |
561 | + else: |
562 | + # TODO throw an error. |
563 | + pass |
564 | + price_per_period = quantity * price_per_add_on |
565 | + get_element(tag='h1', text='Subscription Change') |
566 | + get_element(tag='p', text='%(quantity)d x 20-Pack with 20 GB (%(period)s)' |
567 | + % {'quantity': quantity, |
568 | + 'period': period_alternate}) |
569 | + get_element(tag='strong', text=period_alternate.capitalize()) |
570 | + get_element(css_class='price', text='$' + str(price_per_add_on)) |
571 | + get_element(tag='span', css_class='price', |
572 | + text='$' + str(price_per_period)) |
573 | + get_element(tag='p', text='This payment will cover the period from ' \ |
574 | + '%(today)s to %(period_end)s afterwhich your ' \ |
575 | + 'card will automatically be billed $%(price)s ' \ |
576 | + '%(period)s' |
577 | + % {'today': today.strftime('%B %-d, %Y'), |
578 | + 'period_end': |
579 | + period_end.strftime('%B %-d, %Y'), |
580 | + 'price': str(price_per_period), |
581 | + 'period': period}) |
582 | + |
583 | +def assert_monthly_extra_storage_subscription(quantity): |
584 | + """Assert that the information of the new extra storage subscription is |
585 | + the expected. |
586 | + |
587 | + Keyword arguments: |
588 | + quantity -- The quantity of extra storage to buy. |
589 | + |
590 | + """ |
591 | + assert_extra_storage_subscription('monthly', quantity) |
592 | + |
593 | +def assert_annually_extra_storage_subscription(quantity): |
594 | + """Assert that the information of the new extra storage subscription is |
595 | + the expected. |
596 | + |
597 | + Keyword arguments: |
598 | + quantity -- The quantity of extra storage to buy. |
599 | + |
600 | + """ |
601 | + assert_extra_storage_subscription('annually', quantity) |
602 | + |
603 | +def set_billing_address(street='Test Street', city='Test City', |
604 | + state='Test State', postal_code='12345', |
605 | + country='United States'): |
606 | + """Set the billing address information. |
607 | + |
608 | + Keyword arguments: |
609 | + street -- The street of the address (default 'Test Street'). |
610 | + city -- The city of the address (default 'Test City'). |
611 | + state -- The state or region of the address (default 'Test State'). |
612 | + postal_code -- The postal code of the address (default '12345'). |
613 | + country -- The country of the address (default 'United States'). |
614 | + |
615 | + """ |
616 | + textfield_write('id_street', street) |
617 | + textfield_write('id_city', city) |
618 | + textfield_write('id_state', state) |
619 | + textfield_write('id_postal', postal_code) |
620 | + set_select('id_country', country) |
621 | + |
622 | +def set_credit_card_details(card_type='Visa', name='Test Name', |
623 | + number='4111111111111111', ccv='123', |
624 | + expiration_month='10', expiration_year='2015'): |
625 | + """Set the credit card information. |
626 | + |
627 | + Default value are a valid credit card for payments on the staging |
628 | + environment. |
629 | + |
630 | + Keyword arguments: |
631 | + card_type -- The type of the credit card (default 'Visa') |
632 | + name -- The name on the card (default 'Test Name') |
633 | + number -- The credit card number (default '4111111111111111') |
634 | + ccv -- The CCV number of the credit card (default '123') |
635 | + expiration_month -- The month of expiration (default '10') |
636 | + expiration_year -- The year of expiration (default '2015') |
637 | + |
638 | + """ |
639 | + set_select('id_card_type', card_type) |
640 | + textfield_write('id_card_holder', name) |
641 | + textfield_write('id_card_number', number) |
642 | + textfield_write('id_card_ccv', ccv) |
643 | + set_select('id_card_expiration_0', expiration_month) |
644 | + set_select('id_card_expiration_1', expiration_year) |
645 | + |
646 | +def place_order_with_valid_card(): |
647 | + """Place the order with a credit card that will be accepted on the |
648 | + staging environment. |
649 | + |
650 | + """ |
651 | + set_billing_address() |
652 | + set_credit_card_details() |
653 | + agree_and_place_order() |
654 | + |
655 | +def place_order_with_refused_card(): |
656 | + """Place the order with a credit card that will be refused on the |
657 | + staging environment. |
658 | + |
659 | + """ |
660 | + set_billing_address() |
661 | + set_credit_card_details(name='REFUSED') |
662 | + agree_and_place_order() |
663 | + |
664 | + |
665 | +def agree_and_place_order(): |
666 | + """Click the button to agree with the terms and conditions and place |
667 | + the order. |
668 | + |
669 | + """ |
670 | + button_click(get_element(css_class='cta', value='Purchase')) |
671 | + |
672 | +def confirm_payment_details(): |
673 | + title_is(u'Ubuntu One : Confirm Payment Details') |
674 | + link_click(get_element(css_class='cta', href='confirmed')) |
675 | |
676 | === added file 'ubuntuone/web/qa/tests/shared/actions/payment_confirmed.py' |
677 | --- ubuntuone/web/qa/tests/shared/actions/payment_confirmed.py 1970-01-01 00:00:00 +0000 |
678 | +++ ubuntuone/web/qa/tests/shared/actions/payment_confirmed.py 2011-09-16 15:25:04 +0000 |
679 | @@ -0,0 +1,62 @@ |
680 | +# -*- coding: utf-8 -*- |
681 | + |
682 | +# Authors: |
683 | +# Leo Arias <leo.arias@canonical.com> |
684 | +# |
685 | +# Copyright 2011 Canonical Ltd. |
686 | +# |
687 | +# This program is free software: you can redistribute it and/or modify it |
688 | +# under the terms of the GNU General Public License version 3, as published |
689 | +# by the Free Software Foundation. |
690 | +# |
691 | +# This program is distributed in the hope that it will be useful, but |
692 | +# WITHOUT ANY WARRANTY; without even the implied warranties of |
693 | +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
694 | +# PURPOSE. See the GNU General Public License for more details. |
695 | +# |
696 | +# You should have received a copy of the GNU General Public License along |
697 | +# with this program. If not, see <http://www.gnu.org/licenses/>. |
698 | + |
699 | +"""Actions for the Payment Confirmed page of the Ubuntu One website.""" |
700 | + |
701 | +from sst.actions import * |
702 | + |
703 | +def assert_title(): |
704 | + """Assert that the title of the page is the expected.""" |
705 | + title_is(u'Ubuntu One : Confirm Payment Details') |
706 | + |
707 | +def assert_failed_payment(): |
708 | + """Assert that the payment failed.""" |
709 | + get_element(tag='h1', text='Your Payment Failed') |
710 | + get_element(tag='a', text='fill out the details here', href='/payment/') |
711 | + |
712 | +def assert_processed_payment(period, paid, price, trial=False): |
713 | + """Assert that the payment was processed. |
714 | + |
715 | + Keyword arguments: |
716 | + period -- The period of the service paid. |
717 | + paid -- The paid amount. |
718 | + price -- The price of the service, per period. |
719 | + trial -- Indicates if the service paid has a trial period |
720 | + (default False). |
721 | + |
722 | + """ |
723 | + get_element(tag='h1', text='Payment Processed') |
724 | + today = date.today() |
725 | + if trial or period == 'monthly': |
726 | + expire_date = today.replace(month = today.month + 1) |
727 | + elif period == 'annually': |
728 | + expire_date = today.replace(year = today.year + 1) |
729 | + # TODO assert the paid amount. |
730 | + # TODO assert payments in euros. |
731 | + get_element(tag='dt', css_class='purchase_details' |
732 | + text='Expires: %(expire_date)s' |
733 | + % {'expire_date': expire_date.strftime('%B %-d, %Y')}) |
734 | + get_element(tag='p', css_class='explanation', |
735 | + text='Your card will automatically be billed $%(price)s ' \ |
736 | + '%(period)s' % {'price': str(price), 'period': period}) |
737 | + get_element(tag='dd', text='AUTHORISED') |
738 | + |
739 | +def view_account(): |
740 | + """Go to the account information page.""" |
741 | + link_click(get_element(tag='a', text='View your account')) |
742 | |
743 | === added file 'ubuntuone/web/qa/tests/shared/actions/services.py' |
744 | --- ubuntuone/web/qa/tests/shared/actions/services.py 1970-01-01 00:00:00 +0000 |
745 | +++ ubuntuone/web/qa/tests/shared/actions/services.py 2011-09-16 15:25:04 +0000 |
746 | @@ -0,0 +1,138 @@ |
747 | +# -*- coding: utf-8 -*- |
748 | + |
749 | +# Authors: |
750 | +# Rick McBride <rick.mcbride@canonical.com> |
751 | +# Leo Arias <leo.arias@canonical.com> |
752 | +# |
753 | +# Copyright 2011 Canonical Ltd. |
754 | +# |
755 | +# This program is free software: you can redistribute it and/or modify it |
756 | +# under the terms of the GNU General Public License version 3, as published |
757 | +# by the Free Software Foundation. |
758 | +# |
759 | +# This program is distributed in the hope that it will be useful, but |
760 | +# WITHOUT ANY WARRANTY; without even the implied warranties of |
761 | +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
762 | +# PURPOSE. See the GNU General Public License for more details. |
763 | +# |
764 | +# You should have received a copy of the GNU General Public License along |
765 | +# with this program. If not, see <http://www.gnu.org/licenses/>. |
766 | + |
767 | +"""Actions for the Services page of the Ubuntu One website.""" |
768 | + |
769 | +from sst.actions import * |
770 | + |
771 | +def open(): |
772 | + """Open the services page and assert it's title.""" |
773 | + goto('/services/') |
774 | + assert_title() |
775 | + |
776 | +def assert_title(): |
777 | + """Assert that the title of the page is the expected.""" |
778 | + title_is(u'Ubuntu One : Services') |
779 | + |
780 | +def assert_services_information(): |
781 | + """Assert that the information about the services is the expected.""" |
782 | + assert_free_service_information() |
783 | + assert_music_streaming_service_information() |
784 | + assert_storage_service_information() |
785 | + assert_discount_information() |
786 | + |
787 | +def assert_free_service_information(): |
788 | + """Assert that the information about the free service is the expected.""" |
789 | + get_element(tag='h1', text='Free') |
790 | + get_element(tag='li', text='File sync across platforms') |
791 | + get_element(tag='li', text='Share folders and files') |
792 | + get_element(tag='li', text='Access on your mobile') |
793 | + |
794 | +def assert_music_streaming_service_information(): |
795 | + """Assert that the information about the music streaming service is |
796 | + the expected. |
797 | + |
798 | + """ |
799 | + # TODO there are two Music Streaming elements. We should use xpath to be |
800 | + # sure that we are on the right section. |
801 | + #get_element(tag='h1', text='Music Streaming') |
802 | + get_element(css_class='try-free', text='Try for FREE') |
803 | + get_element(tag='li', text='Music streaming on your mobile') |
804 | + get_element(tag='li', text='20 GB of Storage built in') |
805 | + get_element(tag='li', text='Listen offline on Android') |
806 | + get_element(tag='li', text='$3.99 / month or $39.99 / year') |
807 | + |
808 | +def assert_storage_service_information(): |
809 | + """Assert that the information about the storage service is the |
810 | + expected. |
811 | + |
812 | + """ |
813 | + get_element(tag='h1', text='Storage') |
814 | + get_element(tag='li', text='20 GB') |
815 | + get_element(tag='li', text='$2.99 / month') |
816 | + get_element(tag='li', text='or $29.99 / year') |
817 | + |
818 | +def assert_discount_information(): |
819 | + """Assert that the yearly discount information is the expected.""" |
820 | + get_element(tag='h1', text='Discount') |
821 | + get_element(tag='p', text='Two months free on Music Streaming and Storage ' |
822 | + 'when you sign up for 12 months') |
823 | + |
824 | +def buy_music_streaming_monthly(): |
825 | + """Buy the monthly music streaming service.""" |
826 | + radio_select('ms1') |
827 | + button_click(get_elements(css_class='buy-now', |
828 | + text='Buy now and go to checkout')[0]) |
829 | + |
830 | +def buy_music_streaming_yearly(): |
831 | + """Buy the yearly music streaming service.""" |
832 | + radio_select('ms2') |
833 | + buy_music_streaming() |
834 | + |
835 | +def buy_music_streaming(): |
836 | + """Click the button to buy the music streaming service.""" |
837 | + button_click(get_elements(css_class='buy-now', |
838 | + text='Buy now and go to checkout')[0]) |
839 | + |
840 | +def assert_storage(quantity): |
841 | + """Asert the storage quantity selected and its space and price. |
842 | + |
843 | + Keyword arguments: |
844 | + quantity -- The expected storage quantity. |
845 | + |
846 | + """ |
847 | + text_is('qty', str(quantity)) |
848 | + text_is('storage-gb', '%sGB' % (quantity * 20)) |
849 | + monthly_price = quantity * 2.99 |
850 | + text_is('storage-monthly-price', '$%s' % monthly_price) |
851 | + annual_price = quantity * 29.99 |
852 | + text_is('storage-annual-price', '$%s' % annual_price) |
853 | + |
854 | +def increase_storage_quantity(): |
855 | + """Click the button that increases the storage quantity to buy.""" |
856 | + button_click('plus_qty') |
857 | + |
858 | +def decrease_storage_quantity(): |
859 | + """Click the button that decreases the storage quantity to buy.""" |
860 | + button_click('minus_qty') |
861 | + |
862 | +def set_storage_quantity(quantity): |
863 | + """Set the storage quantity to buy. |
864 | + |
865 | + Keyword arguments: |
866 | + quantity -- The quantity to buy. |
867 | + |
868 | + """ |
869 | + textfield_write('qty', str(quantity)) |
870 | + |
871 | +def buy_extra_storage_monthly(): |
872 | + """Buy the monthly extra storage service.""" |
873 | + radio_select('st1') |
874 | + buy_extra_storage() |
875 | + |
876 | +def buy_extra_storage_yearly(): |
877 | + """Buy the yearly extra storage service.""" |
878 | + radio_select('st2') |
879 | + buy_extra_storage() |
880 | + |
881 | +def buy_extra_storage(): |
882 | + """Click the button to buy extra storage.""" |
883 | + button_click(get_elements(css_class='buy-now', |
884 | + text='Buy now and go to checkout')[1]) |
885 | |
886 | === renamed directory 'qa/selenium/smoketest' => 'ubuntuone/web/qa/tests/smoketest' |
Looks great!