Merge lp:~elopio/ubuntuone-testing/music2 into lp:ubuntuone-testing
- music2
- Merge into trunk
Proposed by
Leo Arias
Status: | Merged |
---|---|
Approved by: | Rick McBride |
Approved revision: | 79 |
Merged at revision: | 69 |
Proposed branch: | lp:~elopio/ubuntuone-testing/music2 |
Merge into: | lp:ubuntuone-testing |
Diff against target: |
434 lines (+224/-35) 9 files modified
ubuntuone/web/tests/sst/README.txt (+7/-2) ubuntuone/web/tests/sst/music/u1webm001_playsong.py (+8/-2) ubuntuone/web/tests/sst/music/u1webm002_selectartist.py (+39/-0) ubuntuone/web/tests/sst/music/u1webm003_selectalbum.py (+38/-0) ubuntuone/web/tests/sst/shared/actions/header.py (+1/-0) ubuntuone/web/tests/sst/shared/actions/music.py (+82/-13) ubuntuone/web/tests/sst/shared/actions/setup.py (+16/-10) ubuntuone/web/tests/sst/shared/actions/sso.py (+8/-8) ubuntuone/web/tests/sst/shared/data/user.py (+25/-0) |
To merge this branch: | bzr merge lp:~elopio/ubuntuone-testing/music2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Rick McBride (community) | Approve | ||
Review via email:
|
Commit message
Added two more music tests.
Made a small adjustment to see if the full name verification after login gets more stable.
Description of the change
Second batch of music 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 | === modified file 'ubuntuone/web/tests/sst/README.txt' | |||
2 | --- ubuntuone/web/tests/sst/README.txt 2011-11-15 06:22:41 +0000 | |||
3 | +++ ubuntuone/web/tests/sst/README.txt 2011-12-19 15:40:32 +0000 | |||
4 | @@ -1,10 +1,15 @@ | |||
5 | 1 | The tests involving login require the user's full name, email and | 1 | The tests involving login require the user's full name, email and |
7 | 2 | password to login to SSO. Create a file ``_passwords.py`` in the ``shared`` | 2 | password to login to SSO. Create a file '_passwords.py' in the 'shared' |
8 | 3 | directory, with the following contents:: | 3 | directory, with the following contents:: |
9 | 4 | 4 | ||
10 | 5 | full_name = My Full Name | 5 | full_name = My Full Name |
11 | 6 | email = 'my.username@canonical.com' | 6 | email = 'my.username@canonical.com' |
12 | 7 | password = 'mypassword' | 7 | password = 'mypassword' |
13 | 8 | 8 | ||
15 | 9 | (``_passwords.py`` is ignored by bazaar so you can't accidentally check it | 9 | ('_passwords.py' is ignored by bazaar so you can't accidentally check it |
16 | 10 | into the repository.) | 10 | into the repository.) |
17 | 11 | |||
18 | 12 | The tests for the web music player require a special account with the | ||
19 | 13 | streaming service and some songs preloaded. The user information for this | ||
20 | 14 | tests should be added to the file '_musicpasswords.py' in the 'music' | ||
21 | 15 | directory. | ||
22 | 11 | 16 | ||
23 | === modified file 'ubuntuone/web/tests/sst/music/u1webm001_playsong.py' | |||
24 | --- ubuntuone/web/tests/sst/music/u1webm001_playsong.py 2011-12-13 23:35:07 +0000 | |||
25 | +++ ubuntuone/web/tests/sst/music/u1webm001_playsong.py 2011-12-19 15:40:32 +0000 | |||
26 | @@ -23,9 +23,15 @@ | |||
27 | 23 | import actions.setup as setup_actions | 23 | import actions.setup as setup_actions |
28 | 24 | import actions.music as music_actions | 24 | import actions.music as music_actions |
29 | 25 | from data.song import Song | 25 | from data.song import Song |
30 | 26 | from data.user import User | ||
31 | 27 | try: | ||
32 | 28 | from _musicpasswords import full_name, email, password | ||
33 | 29 | except: | ||
34 | 30 | skip('Try adding a _musicpasswords.py file to the music folder if you ' \ | ||
35 | 31 | 'expect this to work. Read the README.txt file ;)') | ||
36 | 26 | 32 | ||
39 | 27 | skip('Not ready for unattended execution.') | 33 | test_user = User(full_name, email, password) |
40 | 28 | setup_actions.setup() | 34 | setup_actions.setup(user=test_user) |
41 | 29 | music_actions.open() | 35 | music_actions.open() |
42 | 30 | song = Song('gentle marimba', 'Alastair Cameron', 'Free Film Music (cameronmusic.co.uk)') | 36 | song = Song('gentle marimba', 'Alastair Cameron', 'Free Film Music (cameronmusic.co.uk)') |
43 | 31 | music_actions.play_song(song) | 37 | music_actions.play_song(song) |
44 | 32 | 38 | ||
45 | === added file 'ubuntuone/web/tests/sst/music/u1webm002_selectartist.py' | |||
46 | --- ubuntuone/web/tests/sst/music/u1webm002_selectartist.py 1970-01-01 00:00:00 +0000 | |||
47 | +++ ubuntuone/web/tests/sst/music/u1webm002_selectartist.py 2011-12-19 15:40:32 +0000 | |||
48 | @@ -0,0 +1,39 @@ | |||
49 | 1 | # -*- coding: utf-8 -*- | ||
50 | 2 | |||
51 | 3 | # Copyright 2011 Canonical Ltd. | ||
52 | 4 | # | ||
53 | 5 | # This program is free software: you can redistribute it and/or modify it | ||
54 | 6 | # under the terms of the GNU General Public License version 3, as published | ||
55 | 7 | # by the Free Software Foundation. | ||
56 | 8 | # | ||
57 | 9 | # This program is distributed in the hope that it will be useful, but | ||
58 | 10 | # WITHOUT ANY WARRANTY; without even the implied warranties of | ||
59 | 11 | # MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
60 | 12 | # PURPOSE. See the GNU General Public License for more details. | ||
61 | 13 | # | ||
62 | 14 | # You should have received a copy of the GNU General Public License along | ||
63 | 15 | # with this program. If not, see <http://www.gnu.org/licenses/>. | ||
64 | 16 | |||
65 | 17 | """Test case u1webm-002 Select artist. | ||
66 | 18 | Select an artist on the Ubuntu One web music player. | ||
67 | 19 | |||
68 | 20 | """ | ||
69 | 21 | |||
70 | 22 | from sst.actions import * | ||
71 | 23 | import actions.setup as setup_actions | ||
72 | 24 | import actions.music as music_actions | ||
73 | 25 | from data.song import Song | ||
74 | 26 | from data.user import User | ||
75 | 27 | try: | ||
76 | 28 | from _musicpasswords import full_name, email, password | ||
77 | 29 | except: | ||
78 | 30 | skip('Try adding a _musicpasswords.py file to the music folder if you ' \ | ||
79 | 31 | 'expect this to work. Read the README.txt file ;)') | ||
80 | 32 | |||
81 | 33 | test_user = User(full_name, email, password) | ||
82 | 34 | setup_actions.setup(user=test_user) | ||
83 | 35 | music_actions.open() | ||
84 | 36 | artist = 'Alastair Cameron' | ||
85 | 37 | album = 'Free Film Music (cameronmusic.co.uk)' | ||
86 | 38 | music_actions.select_artist(artist) | ||
87 | 39 | music_actions.assert_artist_albums(artist, [album]) | ||
88 | 0 | 40 | ||
89 | === added file 'ubuntuone/web/tests/sst/music/u1webm003_selectalbum.py' | |||
90 | --- ubuntuone/web/tests/sst/music/u1webm003_selectalbum.py 1970-01-01 00:00:00 +0000 | |||
91 | +++ ubuntuone/web/tests/sst/music/u1webm003_selectalbum.py 2011-12-19 15:40:32 +0000 | |||
92 | @@ -0,0 +1,38 @@ | |||
93 | 1 | # -*- coding: utf-8 -*- | ||
94 | 2 | |||
95 | 3 | # Copyright 2011 Canonical Ltd. | ||
96 | 4 | # | ||
97 | 5 | # This program is free software: you can redistribute it and/or modify it | ||
98 | 6 | # under the terms of the GNU General Public License version 3, as published | ||
99 | 7 | # by the Free Software Foundation. | ||
100 | 8 | # | ||
101 | 9 | # This program is distributed in the hope that it will be useful, but | ||
102 | 10 | # WITHOUT ANY WARRANTY; without even the implied warranties of | ||
103 | 11 | # MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
104 | 12 | # PURPOSE. See the GNU General Public License for more details. | ||
105 | 13 | # | ||
106 | 14 | # You should have received a copy of the GNU General Public License along | ||
107 | 15 | # with this program. If not, see <http://www.gnu.org/licenses/>. | ||
108 | 16 | |||
109 | 17 | """Test case u1webm-003 Select album. | ||
110 | 18 | Select an album on the Ubuntu One web music player. | ||
111 | 19 | |||
112 | 20 | """ | ||
113 | 21 | |||
114 | 22 | from sst.actions import * | ||
115 | 23 | import actions.setup as setup_actions | ||
116 | 24 | import actions.music as music_actions | ||
117 | 25 | from data.song import Song | ||
118 | 26 | from data.user import User | ||
119 | 27 | try: | ||
120 | 28 | from _musicpasswords import full_name, email, password | ||
121 | 29 | except: | ||
122 | 30 | skip('Try adding a _musicpasswords.py file to the music folder if you ' \ | ||
123 | 31 | 'expect this to work. Read the README.txt file ;)') | ||
124 | 32 | |||
125 | 33 | test_user = User(full_name, email, password) | ||
126 | 34 | setup_actions.setup(user=test_user) | ||
127 | 35 | music_actions.open() | ||
128 | 36 | song = Song('gentle marimba', 'Alastair Cameron', 'Free Film Music (cameronmusic.co.uk)') | ||
129 | 37 | music_actions.select_album(song.album) | ||
130 | 38 | music_actions.assert_album_songs(song.artist, song.album, [song.title]) | ||
131 | 0 | 39 | ||
132 | === modified file 'ubuntuone/web/tests/sst/shared/actions/header.py' | |||
133 | --- ubuntuone/web/tests/sst/shared/actions/header.py 2011-12-09 18:19:11 +0000 | |||
134 | +++ ubuntuone/web/tests/sst/shared/actions/header.py 2011-12-19 15:40:32 +0000 | |||
135 | @@ -30,6 +30,7 @@ | |||
136 | 30 | _get_logout_link() | 30 | _get_logout_link() |
137 | 31 | 31 | ||
138 | 32 | def _assert_full_name(full_name): | 32 | def _assert_full_name(full_name): |
139 | 33 | wait_for(exists_element, id='ac-status') | ||
140 | 33 | welcome_element = get_element_by_css('#ac-status > span') | 34 | welcome_element = get_element_by_css('#ac-status > span') |
141 | 34 | assert_text(welcome_element, 'Welcome %s' % full_name[:40]) | 35 | assert_text(welcome_element, 'Welcome %s' % full_name[:40]) |
142 | 35 | 36 | ||
143 | 36 | 37 | ||
144 | === modified file 'ubuntuone/web/tests/sst/shared/actions/music.py' | |||
145 | --- ubuntuone/web/tests/sst/shared/actions/music.py 2011-12-13 23:34:06 +0000 | |||
146 | +++ ubuntuone/web/tests/sst/shared/actions/music.py 2011-12-19 15:40:32 +0000 | |||
147 | @@ -17,8 +17,7 @@ | |||
148 | 17 | """Actions for the Music page of the Ubuntu One website.""" | 17 | """Actions for the Music page of the Ubuntu One website.""" |
149 | 18 | 18 | ||
150 | 19 | from sst.actions import * | 19 | from sst.actions import * |
153 | 20 | from loading import * | 20 | from data.song import Song |
152 | 21 | import urlparse | ||
154 | 22 | 21 | ||
155 | 23 | def open(): | 22 | def open(): |
156 | 24 | """Open the music page and assert it's title.""" | 23 | """Open the music page and assert it's title.""" |
157 | @@ -34,7 +33,7 @@ | |||
158 | 34 | 33 | ||
159 | 35 | def assert_page_title(): | 34 | def assert_page_title(): |
160 | 36 | """Assert that the title of the page is the expected.""" | 35 | """Assert that the title of the page is the expected.""" |
162 | 37 | assert_title(u'Ubuntu One : Music Streaming') | 36 | assert_title(u'Ubuntu One : Music') |
163 | 38 | 37 | ||
164 | 39 | def play_song(song): | 38 | def play_song(song): |
165 | 40 | _open_songs() | 39 | _open_songs() |
166 | @@ -46,7 +45,7 @@ | |||
167 | 46 | 'td.c1 > button' \ | 45 | 'td.c1 > button' \ |
168 | 47 | % identifier) | 46 | % identifier) |
169 | 48 | click_button(song_play_button) | 47 | click_button(song_play_button) |
171 | 49 | assert not song_play_button.assert_displayed() | 48 | assert not song_play_button.is_displayed() |
172 | 50 | 49 | ||
173 | 51 | def assert_songs_added_to_queue(songs_list): | 50 | def assert_songs_added_to_queue(songs_list): |
174 | 52 | number_of_songs = len(songs_list) | 51 | number_of_songs = len(songs_list) |
175 | @@ -65,7 +64,7 @@ | |||
176 | 65 | _assert_message_content(message_content) | 64 | _assert_message_content(message_content) |
177 | 66 | 65 | ||
178 | 67 | def _assert_message_displayed(): | 66 | def _assert_message_displayed(): |
180 | 68 | assert _get_message_element().assert_displayed() | 67 | assert _get_message_element().is_displayed() |
181 | 69 | 68 | ||
182 | 70 | def _assert_message_content(message_content): | 69 | def _assert_message_content(message_content): |
183 | 71 | assert _get_message_element().text == message_content | 70 | assert _get_message_element().text == message_content |
184 | @@ -83,12 +82,12 @@ | |||
185 | 83 | set_checkbox_value(song_checkbox, True) | 82 | set_checkbox_value(song_checkbox, True) |
186 | 84 | 83 | ||
187 | 85 | def _open_songs(): | 84 | def _open_songs(): |
189 | 86 | if not _is_songs_opened(): | 85 | if not _is_songs_open(): |
190 | 87 | songs_element = _get_songs_element() | 86 | songs_element = _get_songs_element() |
191 | 88 | click_element(songs_element) | 87 | click_element(songs_element) |
192 | 89 | _wait_for_action_to_complete() | 88 | _wait_for_action_to_complete() |
193 | 90 | 89 | ||
195 | 91 | def _is_songs_opened(): | 90 | def _is_songs_open(): |
196 | 92 | songs_element = _get_songs_element() | 91 | songs_element = _get_songs_element() |
197 | 93 | return _is_active(songs_element) | 92 | return _is_active(songs_element) |
198 | 94 | 93 | ||
199 | @@ -110,12 +109,12 @@ | |||
200 | 110 | assert expected_title == player_title_element.text | 109 | assert expected_title == player_title_element.text |
201 | 111 | 110 | ||
202 | 112 | def assert_player_playing(): | 111 | def assert_player_playing(): |
205 | 113 | assert _get_stop_button().assert_displayed() | 112 | assert _get_stop_button().is_displayed() |
206 | 114 | assert not _get_play_button().assert_displayed() | 113 | assert not _get_play_button().is_displayed() |
207 | 115 | 114 | ||
208 | 116 | def assert_player_paused(): | 115 | def assert_player_paused(): |
211 | 117 | assert not _get_stop_button().assert_displayed() | 116 | assert not _get_stop_button().is_displayed() |
212 | 118 | assert _get_play_button().assert_displayed() | 117 | assert _get_play_button().is_displayed() |
213 | 119 | 118 | ||
214 | 120 | def _get_stop_button(): | 119 | def _get_stop_button(): |
215 | 121 | return get_element_by_css('#stop') | 120 | return get_element_by_css('#stop') |
216 | @@ -142,6 +141,9 @@ | |||
217 | 142 | 141 | ||
218 | 143 | def assert_song_in_queue(song): | 142 | def assert_song_in_queue(song): |
219 | 144 | _open_now_playing() | 143 | _open_now_playing() |
220 | 144 | _assert_song(song) | ||
221 | 145 | |||
222 | 146 | def _assert_song(song): | ||
223 | 145 | song_row_xpath = '//tr[contains(@class, "song-listing")]/' \ | 147 | song_row_xpath = '//tr[contains(@class, "song-listing")]/' \ |
224 | 146 | 'td[text()="%(title)s"]/../td[text()="%(artist)s"]/../' \ | 148 | 'td[text()="%(title)s"]/../td[text()="%(artist)s"]/../' \ |
225 | 147 | 'td[text()="%(album)s"]/..' % {'title': song.title, | 149 | 'td[text()="%(album)s"]/..' % {'title': song.title, |
226 | @@ -150,10 +152,10 @@ | |||
227 | 150 | get_element_by_xpath(song_row_xpath) | 152 | get_element_by_xpath(song_row_xpath) |
228 | 151 | 153 | ||
229 | 152 | def _open_now_playing(): | 154 | def _open_now_playing(): |
231 | 153 | if not _is_now_playing_opened(): | 155 | if not _is_now_playing_open(): |
232 | 154 | click_element(_get_now_playing_element()) | 156 | click_element(_get_now_playing_element()) |
233 | 155 | 157 | ||
235 | 156 | def _is_now_playing_opened(): | 158 | def _is_now_playing_open(): |
236 | 157 | now_playing_element = _get_now_playing_element() | 159 | now_playing_element = _get_now_playing_element() |
237 | 158 | return _is_active(now_playing_element) | 160 | return _is_active(now_playing_element) |
238 | 159 | 161 | ||
239 | @@ -175,3 +177,70 @@ | |||
240 | 175 | sleep(3) | 177 | sleep(3) |
241 | 176 | waiting_bar = get_element_by_css('.loading-view > .indicator') | 178 | waiting_bar = get_element_by_css('.loading-view > .indicator') |
242 | 177 | wait_for(fails, assert_displayed, waiting_bar) | 179 | wait_for(fails, assert_displayed, waiting_bar) |
243 | 180 | |||
244 | 181 | def select_artist(artist): | ||
245 | 182 | _open_artists() | ||
246 | 183 | _click_artist(artist) | ||
247 | 184 | |||
248 | 185 | def _open_artists(): | ||
249 | 186 | if not _is_artists_open(): | ||
250 | 187 | click_element(_get_artists_element()) | ||
251 | 188 | |||
252 | 189 | def _is_artists_open(): | ||
253 | 190 | artists_element = _get_artists_element() | ||
254 | 191 | return _is_active(artists_element) | ||
255 | 192 | |||
256 | 193 | def _get_artists_element(): | ||
257 | 194 | return get_element(css_class='artists') | ||
258 | 195 | |||
259 | 196 | def _click_artist(artist): | ||
260 | 197 | artist_link_xpath = '//a[@data-u1m-artistid and text()="{0}"]' \ | ||
261 | 198 | .format(artist) | ||
262 | 199 | artist_link = get_element_by_xpath(artist_link_xpath) | ||
263 | 200 | artist_link.click() | ||
264 | 201 | _wait_for_action_to_complete() | ||
265 | 202 | |||
266 | 203 | def assert_artist_albums(artist, albums_list): | ||
267 | 204 | _assert_albums_view_title('{0} albums'.format(artist)) | ||
268 | 205 | for album in albums_list: | ||
269 | 206 | _assert_album(album) | ||
270 | 207 | |||
271 | 208 | def _assert_albums_view_title(title): | ||
272 | 209 | view_title = get_element_by_css('#album-view > h2') | ||
273 | 210 | assert_text(view_title, title) | ||
274 | 211 | |||
275 | 212 | def _assert_album(album): | ||
276 | 213 | _get_album_link(album) | ||
277 | 214 | |||
278 | 215 | def _get_album_link(album): | ||
279 | 216 | album_link_xpath = '//a[@data-u1m-albumid and text()="{0}"]' \ | ||
280 | 217 | .format(album) | ||
281 | 218 | return get_element_by_xpath(album_link_xpath) | ||
282 | 219 | |||
283 | 220 | def select_album(album): | ||
284 | 221 | _open_albums() | ||
285 | 222 | _click_album(album) | ||
286 | 223 | |||
287 | 224 | def _open_albums(): | ||
288 | 225 | if not _is_albums_open(): | ||
289 | 226 | click_element(_get_albums_element()) | ||
290 | 227 | |||
291 | 228 | def _is_albums_open(): | ||
292 | 229 | albums_element = _get_albums_element() | ||
293 | 230 | return _is_active(albums_element) | ||
294 | 231 | |||
295 | 232 | def _get_albums_element(): | ||
296 | 233 | return get_element(css_class='albums') | ||
297 | 234 | |||
298 | 235 | def _click_album(album): | ||
299 | 236 | _get_album_link(album).click() | ||
300 | 237 | _wait_for_action_to_complete() | ||
301 | 238 | |||
302 | 239 | def assert_album_songs(artist, album, songs_title_list): | ||
303 | 240 | _assert_songs_view_title('{0} by {1}'.format(album, artist)) | ||
304 | 241 | for song_title in songs_title_list: | ||
305 | 242 | _assert_song(Song(artist, album, song_title)) | ||
306 | 243 | |||
307 | 244 | def _assert_songs_view_title(title): | ||
308 | 245 | view_title = get_element_by_css('#song-view > h2') | ||
309 | 246 | assert_text(view_title, title) | ||
310 | 178 | 247 | ||
311 | === modified file 'ubuntuone/web/tests/sst/shared/actions/setup.py' | |||
312 | --- ubuntuone/web/tests/sst/shared/actions/setup.py 2011-12-13 23:05:13 +0000 | |||
313 | +++ ubuntuone/web/tests/sst/shared/actions/setup.py 2011-12-19 15:40:32 +0000 | |||
314 | @@ -18,6 +18,7 @@ | |||
315 | 18 | 18 | ||
316 | 19 | from sst.actions import * | 19 | from sst.actions import * |
317 | 20 | from config import * | 20 | from config import * |
318 | 21 | from data.user import User | ||
319 | 21 | import actions.header as header_actions | 22 | import actions.header as header_actions |
320 | 22 | import actions.sso as sso_actions | 23 | import actions.sso as sso_actions |
321 | 23 | import actions.services as services_actions | 24 | import actions.services as services_actions |
322 | @@ -31,7 +32,7 @@ | |||
323 | 31 | 'expect this to work. Read the README.txt file ;)') | 32 | 'expect this to work. Read the README.txt file ;)') |
324 | 32 | 33 | ||
325 | 33 | 34 | ||
327 | 34 | def setup(new_user=False): | 35 | def setup(new_user=False, user=None): |
328 | 35 | """Log in to the Ubuntu One website. Optionally, you can create a new user. | 36 | """Log in to the Ubuntu One website. Optionally, you can create a new user. |
329 | 36 | 37 | ||
330 | 37 | After calling setup, the browser will be in the Dashboard ready to | 38 | After calling setup, the browser will be in the Dashboard ready to |
331 | @@ -46,21 +47,26 @@ | |||
332 | 46 | go_to() | 47 | go_to() |
333 | 47 | wait_for(assert_title, 'Ubuntu One : Home') | 48 | wait_for(assert_title, 'Ubuntu One : Home') |
334 | 48 | header_actions.click_login_or_sign_up() | 49 | header_actions.click_login_or_sign_up() |
337 | 49 | user_name = full_name | 50 | test_user = user |
336 | 50 | user_email = email | ||
338 | 51 | if new_user: | 51 | if new_user: |
344 | 52 | user_uuid = str(uuid.uuid1()) | 52 | if user is None: |
345 | 53 | user_name = 'Test user ' + user_uuid | 53 | user_uuid = str(uuid.uuid1()) |
346 | 54 | user_email = user_uuid + '@' + IMAP_SERVER | 54 | user_name = 'Test user ' + user_uuid |
347 | 55 | sso_actions.create_new_account(user_name, user_email, 'Hola123*') | 55 | user_email = user_uuid + '@' + IMAP_SERVER |
348 | 56 | confirmation_code = mail.get_confirmation_code_for_address(user_email) | 56 | user_password = 'Hola123*' |
349 | 57 | test_user = User(user_name, user_email, user_password) | ||
350 | 58 | sso_actions.create_new_account(test_user) | ||
351 | 59 | confirmation_code = \ | ||
352 | 60 | mail.get_confirmation_code_for_address(test_user.email) | ||
353 | 57 | sso_actions.confirm_email(confirmation_code) | 61 | sso_actions.confirm_email(confirmation_code) |
354 | 58 | else: | 62 | else: |
356 | 59 | sso_actions.login(user_email, password) | 63 | if user is None: |
357 | 64 | test_user = User(full_name, email, password) | ||
358 | 65 | sso_actions.login(test_user) | ||
359 | 60 | if new_user: | 66 | if new_user: |
360 | 61 | services_actions.agree_and_subscribe_to_free_plan() | 67 | services_actions.agree_and_subscribe_to_free_plan() |
361 | 62 | header_actions.assert_login(user_name) | ||
362 | 63 | dashboard_actions.wait_for_page_to_load() | 68 | dashboard_actions.wait_for_page_to_load() |
363 | 69 | header_actions.assert_login(test_user.full_name) | ||
364 | 64 | 70 | ||
365 | 65 | def get_base_url(): | 71 | def get_base_url(): |
366 | 66 | base_url = None | 72 | base_url = None |
367 | 67 | 73 | ||
368 | === modified file 'ubuntuone/web/tests/sst/shared/actions/sso.py' | |||
369 | --- ubuntuone/web/tests/sst/shared/actions/sso.py 2011-12-13 20:11:54 +0000 | |||
370 | +++ ubuntuone/web/tests/sst/shared/actions/sso.py 2011-12-19 15:40:32 +0000 | |||
371 | @@ -23,7 +23,7 @@ | |||
372 | 23 | from sst.actions import * | 23 | from sst.actions import * |
373 | 24 | from actions.setup import get_base_url | 24 | from actions.setup import get_base_url |
374 | 25 | 25 | ||
376 | 26 | def login(email, password): | 26 | def login(user): |
377 | 27 | """Log in to Ubuntu One website. | 27 | """Log in to Ubuntu One website. |
378 | 28 | 28 | ||
379 | 29 | Keyword arguments: | 29 | Keyword arguments: |
380 | @@ -35,17 +35,17 @@ | |||
381 | 35 | switch_to_window() | 35 | switch_to_window() |
382 | 36 | assert_textfield('id_email') | 36 | assert_textfield('id_email') |
383 | 37 | assert_textfield('id_password') | 37 | assert_textfield('id_password') |
386 | 38 | write_textfield('id_email', email) | 38 | write_textfield('id_email', user.email) |
387 | 39 | write_textfield('id_password', password) | 39 | write_textfield('id_password', user.password) |
388 | 40 | click_button(get_element(css_class='btn', name='continue'), wait=False) | 40 | click_button(get_element(css_class='btn', name='continue'), wait=False) |
389 | 41 | 41 | ||
391 | 42 | def create_new_account(full_name, email, password): | 42 | def create_new_account(user): |
392 | 43 | click_link(get_element(href='+new_account')) | 43 | click_link(get_element(href='+new_account')) |
393 | 44 | wait_for(assert_title, 'Create account') | 44 | wait_for(assert_title, 'Create account') |
398 | 45 | write_textfield('id_displayname', full_name) | 45 | write_textfield('id_displayname', user.full_name) |
399 | 46 | write_textfield('id_email', email) | 46 | write_textfield('id_email', user.email) |
400 | 47 | write_textfield('id_password', password) | 47 | write_textfield('id_password', user.password) |
401 | 48 | write_textfield('id_passwordconfirm', password) | 48 | write_textfield('id_passwordconfirm', user.password) |
402 | 49 | click_button(get_element(name='continue')) | 49 | click_button(get_element(name='continue')) |
403 | 50 | 50 | ||
404 | 51 | def confirm_email(confirmation_code): | 51 | def confirm_email(confirmation_code): |
405 | 52 | 52 | ||
406 | === added file 'ubuntuone/web/tests/sst/shared/data/user.py' | |||
407 | --- ubuntuone/web/tests/sst/shared/data/user.py 1970-01-01 00:00:00 +0000 | |||
408 | +++ ubuntuone/web/tests/sst/shared/data/user.py 2011-12-19 15:40:32 +0000 | |||
409 | @@ -0,0 +1,25 @@ | |||
410 | 1 | # -*- coding: utf-8 -*- | ||
411 | 2 | |||
412 | 3 | # Copyright 2011 Canonical Ltd. | ||
413 | 4 | # | ||
414 | 5 | # This program is free software: you can redistribute it and/or modify it | ||
415 | 6 | # under the terms of the GNU General Public License version 3, as published | ||
416 | 7 | # by the Free Software Foundation. | ||
417 | 8 | # | ||
418 | 9 | # This program is distributed in the hope that it will be useful, but | ||
419 | 10 | # WITHOUT ANY WARRANTY; without even the implied warranties of | ||
420 | 11 | # MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
421 | 12 | # PURPOSE. See the GNU General Public License for more details. | ||
422 | 13 | # | ||
423 | 14 | # You should have received a copy of the GNU General Public License along | ||
424 | 15 | # with this program. If not, see <http://www.gnu.org/licenses/>. | ||
425 | 16 | |||
426 | 17 | """Data class for a User.""" | ||
427 | 18 | |||
428 | 19 | class User: | ||
429 | 20 | "Class for User information." | ||
430 | 21 | |||
431 | 22 | def __init__(self, full_name, email, password): | ||
432 | 23 | self.full_name = full_name | ||
433 | 24 | self.email = email | ||
434 | 25 | self.password = password |
+1