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