Merge lp:~rmcbride/ubuntuone-testing/sst-services-page into lp:ubuntuone-testing

Proposed by Rick McBride
Status: Merged
Approved by: Rick McBride
Approved revision: 33
Merged at revision: 27
Proposed branch: lp:~rmcbride/ubuntuone-testing/sst-services-page
Merge into: lp:ubuntuone-testing
Diff against target: 741 lines (+633/-2)
18 files modified
ubuntuone/web/qa/tests/payments/u1webp-001.py (+28/-0)
ubuntuone/web/qa/tests/payments/u1webp-002.py (+24/-0)
ubuntuone/web/qa/tests/payments/u1webp-003.py (+21/-0)
ubuntuone/web/qa/tests/services/README.txt (+9/-0)
ubuntuone/web/qa/tests/services/u1webs-002.py (+13/-0)
ubuntuone/web/qa/tests/services/u1webse-001.py (+14/-0)
ubuntuone/web/qa/tests/services/u1webse-002.py (+17/-0)
ubuntuone/web/qa/tests/services/u1webse-003.py (+17/-0)
ubuntuone/web/qa/tests/services/u1webse-004.py (+27/-0)
ubuntuone/web/qa/tests/services/u1webse-005.py (+18/-0)
ubuntuone/web/qa/tests/services/u1webse-006.py (+18/-0)
ubuntuone/web/qa/tests/shared/_actions.py (+19/-0)
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)
ubuntuone/web/qa/tests/shared/config.py (+2/-0)
ubuntuone/web/qa/tests/smoketest/README.txt (+2/-2)
To merge this branch: bzr merge lp:~rmcbride/ubuntuone-testing/sst-services-page
Reviewer Review Type Date Requested Status
Leo Arias (community) Approve
Review via email: mp+75772@code.launchpad.net

Commit message

Adds testing for services page. contain's Leo's additions to re-org the SST tests, and additional page tests.

Description of the change

Adds testing for services page. contain's Leo's additions to re-org the SST tests, and additional page tests.

To post a comment you must log in.
Revision history for this message
Leo Arias (elopio) wrote :

Thanks for the review and the merge, Rick.

review: Approve

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

Subscribers

People subscribed via source and target branches