Merge lp:~ahayzen/music-app/ap-helper-refactor-003 into lp:music-app/trusty
- ap-helper-refactor-003
- Merge into trusty
Status: | Merged |
---|---|
Approved by: | Victor Thompson |
Approved revision: | 611 |
Merged at revision: | 619 |
Proposed branch: | lp:~ahayzen/music-app/ap-helper-refactor-003 |
Merge into: | lp:music-app/trusty |
Diff against target: |
1459 lines (+438/-434) 11 files modified
MusicAlbums.qml (+2/-0) MusicArtists.qml (+2/-0) MusicNowPlaying.qml (+3/-3) MusicPlaylists.qml (+5/-4) MusicTracks.qml (+1/-1) MusicaddtoPlaylist.qml (+3/-3) common/AlbumsPage.qml (+26/-25) common/SongsPage.qml (+3/-2) music-app.qml (+28/-27) tests/autopilot/music_app/__init__.py (+216/-209) tests/autopilot/music_app/tests/test_music.py (+149/-160) |
To merge this branch: | bzr merge lp:~ahayzen/music-app/ap-helper-refactor-003 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Nicholas Skaggs (community) | Approve | ||
Victor Thompson | Approve | ||
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Review via email: mp+232655@code.launchpad.net |
Commit message
* Create helpers MusicAlbums MusicArtists MusicTracks MusicPlaylists AlbumsPage MusicaddtoPlaylist SongsPage ListItemWithActions
* Add seek_to to toolbar helper
* Remove unused methods in MainView
Description of the change
* Create helpers MusicAlbums MusicArtists MusicTracks MusicPlaylists AlbumsPage MusicaddtoPlaylist SongsPage ListItemWithActions
* Add seek_to to toolbar helper
* Remove unused methods in MainView
Sorry for the huge diff, there were some old methods that used many sections so was easier to convert it all in one hit. Note I hope in the next mp to do a review of test_music.py this mp is mainly concentrating on the helpers and not the tests themselves.
- 607. By Andrew Hayzen
-
* Fix for pep8
- 608. By Andrew Hayzen
-
* Add code comment
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
Victor Thompson (vthompson) wrote : | # |
I've reviewed most of the QML changes. I have 2 inline comments thus far.
I'll try to get to the rest tomorrow. If not, I might not be able to review until Tuesday.
Andrew Hayzen (ahayzen) wrote : | # |
#blocked bug 1363314
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:608
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Andrew Hayzen (ahayzen) wrote : | # |
#unblocked
- 609. By Andrew Hayzen
-
* Change to use artistLabel
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:609
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Victor Thompson (vthompson) wrote : | # |
1) Repeated inline comment: Could we please spell "dialogue" with the same spelling as is used by the component?
2) Additional inline comment: Please fix spelling mistake in "swaped"
I'll try to finish my review of the tests tonight.
Andrew Hayzen (ahayzen) wrote : | # |
#blocked bug 1365247 (mediascanner2 db schema change)
Victor Thompson (vthompson) wrote : | # |
Two inline comments:
1. I'd prefer it that these describe their intent of being the first item. Perhaps name them first_album, first_track, first_artist, etc.
2. Shouldn't you use "track_index" (or first_track) here? Note: there are numerous other instances, both where you could use the variables you introduced and others that still use a magic "0" number. Search for "(0)" to find most of them. We should be consistent.
- 610. By Andrew Hayzen
-
* Fix for spelling issues
- 611. By Andrew Hayzen
-
* Merge of trunk
Victor Thompson (vthompson) wrote : | # |
My last comment is being satisfied in another branch[1] that tidies things up a bit.
[1] https:/
Andrew Hayzen (ahayzen) wrote : | # |
#unblocked
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:611
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Victor Thompson (vthompson) wrote : | # |
LGTM! Balloons, could you do a final review? If you can, please also note the branch Andrew has as a follow-on to these changes. [1]
[1] https:/
Nicholas Skaggs (nskaggs) wrote : | # |
LGTM as well, this is a lot of churn, and we can always tweak once it's done. I trust you :-)
My one request is to look at the number of wait_select's you are using and make sure you really need a wait_select. If the test fails without a wait, look to figure out why before tossing one in there :-)
Preview Diff
1 | === modified file 'MusicAlbums.qml' |
2 | --- MusicAlbums.qml 2014-08-21 19:32:12 +0000 |
3 | +++ MusicAlbums.qml 2014-09-04 23:02:29 +0000 |
4 | @@ -31,6 +31,7 @@ |
5 | |
6 | MusicPage { |
7 | id: mainpage |
8 | + objectName: "albumsPage" |
9 | title: i18n.tr("Albums") |
10 | |
11 | // TODO: This ListView is empty and causes the header to get painted with the desired background color because the |
12 | @@ -72,6 +73,7 @@ |
13 | |
14 | id: albumItem |
15 | height: albumlist.cellHeight - units.gu(1) |
16 | + objectName: "albumsPageGridItem" + index |
17 | width: albumlist.cellHeight - units.gu(1) |
18 | anchors.margins: units.gu(1) |
19 | |
20 | |
21 | === modified file 'MusicArtists.qml' |
22 | --- MusicArtists.qml 2014-08-21 19:32:12 +0000 |
23 | +++ MusicArtists.qml 2014-09-04 23:02:29 +0000 |
24 | @@ -33,6 +33,7 @@ |
25 | |
26 | MusicPage { |
27 | id: mainpage |
28 | + objectName: "artistsPage" |
29 | title: i18n.tr("Artists") |
30 | |
31 | ListView { |
32 | @@ -52,6 +53,7 @@ |
33 | |
34 | ListItem.Standard { |
35 | id: track |
36 | + objectName: "artistsPageListItem" + index |
37 | height: styleMusic.common.itemHeight |
38 | |
39 | AlbumsModel { |
40 | |
41 | === modified file 'MusicNowPlaying.qml' |
42 | --- MusicNowPlaying.qml 2014-09-03 23:39:52 +0000 |
43 | +++ MusicNowPlaying.qml 2014-09-04 23:02:29 +0000 |
44 | @@ -275,7 +275,7 @@ |
45 | } |
46 | Label { |
47 | id: nowPlayingArtist |
48 | - objectName: "nowplayingartist" |
49 | + objectName: "artistLabel" |
50 | color: styleMusic.nowPlaying.labelSecondaryColor |
51 | elide: Text.ElideRight |
52 | height: units.gu(1) |
53 | @@ -287,7 +287,7 @@ |
54 | } |
55 | Label { |
56 | id: nowPlayingTitle |
57 | - objectName: "nowplayingtitle" |
58 | + objectName: "titleLabel" |
59 | color: styleMusic.common.white |
60 | elide: Text.ElideRight |
61 | height: units.gu(1) |
62 | @@ -299,7 +299,7 @@ |
63 | } |
64 | Label { |
65 | id: nowPlayingAlbum |
66 | - objectName: "nowplayingalbum" |
67 | + objectName: "albumLabel" |
68 | color: styleMusic.nowPlaying.labelSecondaryColor |
69 | elide: Text.ElideRight |
70 | height: units.gu(1) |
71 | |
72 | === modified file 'MusicPlaylists.qml' |
73 | --- MusicPlaylists.qml 2014-08-21 20:13:31 +0000 |
74 | +++ MusicPlaylists.qml 2014-09-04 23:02:29 +0000 |
75 | @@ -32,6 +32,7 @@ |
76 | // page for the playlists |
77 | MusicPage { |
78 | id: listspage |
79 | + objectName: "playlistsPage" |
80 | // TRANSLATORS: this is the name of the playlists page shown in the tab header. |
81 | // Remember to keep the translation short to fit the screen width |
82 | title: i18n.tr("Playlists") |
83 | @@ -58,7 +59,7 @@ |
84 | Component { |
85 | id: editPlaylistDialog |
86 | Dialog { |
87 | - id: dialogueEditPlaylist |
88 | + id: dialogEditPlaylist |
89 | // TRANSLATORS: this is a title of a dialog with a prompt to rename a playlist |
90 | title: i18n.tr("Change name") |
91 | text: i18n.tr("Enter the new name of the playlist.") |
92 | @@ -85,7 +86,7 @@ |
93 | if (Playlists.renamePlaylist(oldPlaylistName, playlistName.text) === true) { |
94 | playlistModel.filterPlaylists() |
95 | |
96 | - PopupUtils.close(dialogueEditPlaylist) |
97 | + PopupUtils.close(dialogEditPlaylist) |
98 | |
99 | if (inPlaylist) { |
100 | playlistInfoLabel.text = playlistName.text |
101 | @@ -103,7 +104,7 @@ |
102 | Button { |
103 | text: i18n.tr("Cancel") |
104 | color: styleMusic.dialog.cancelButtonColor |
105 | - onClicked: PopupUtils.close(dialogueEditPlaylist) |
106 | + onClicked: PopupUtils.close(dialogEditPlaylist) |
107 | } |
108 | } |
109 | } |
110 | @@ -114,7 +115,7 @@ |
111 | |
112 | ListView { |
113 | id: playlistslist |
114 | - objectName: "playlistslist" |
115 | + objectName: "playlistsListView" |
116 | anchors.fill: parent |
117 | anchors.bottomMargin: musicToolbar.mouseAreaOffset + musicToolbar.minimizedHeight |
118 | model: playlistModel.model |
119 | |
120 | === modified file 'MusicTracks.qml' |
121 | --- MusicTracks.qml 2014-08-21 20:13:31 +0000 |
122 | +++ MusicTracks.qml 2014-09-04 23:02:29 +0000 |
123 | @@ -57,7 +57,7 @@ |
124 | ListItemWithActions { |
125 | id: track |
126 | color: "transparent" |
127 | - objectName: "tracksTabListItem" + index |
128 | + objectName: "tracksPageListItem" + index |
129 | width: parent.width |
130 | height: styleMusic.common.itemHeight |
131 | |
132 | |
133 | === modified file 'MusicaddtoPlaylist.qml' |
134 | --- MusicaddtoPlaylist.qml 2014-08-21 19:32:12 +0000 |
135 | +++ MusicaddtoPlaylist.qml 2014-09-04 23:02:29 +0000 |
136 | @@ -44,7 +44,7 @@ |
137 | tools: ToolbarItems { |
138 | ToolbarButton { |
139 | action: Action { |
140 | - objectName: "newplaylistButton" |
141 | + objectName: "newPlaylistButton" |
142 | text: i18n.tr("New playlist") |
143 | iconName: "add" |
144 | onTriggered: { |
145 | @@ -71,11 +71,11 @@ |
146 | clip: true |
147 | height: parent.width |
148 | model: playlistModel.model |
149 | - objectName: "addtoplaylistview" |
150 | + objectName: "addToPlaylistListView" |
151 | width: parent.width |
152 | delegate: ListItem.Standard { |
153 | id: playlist |
154 | - objectName: "playlist" |
155 | + objectName: "addToPlaylistListItem" + index |
156 | height: styleMusic.common.itemHeight |
157 | |
158 | property string name: model.name |
159 | |
160 | === modified file 'common/AlbumsPage.qml' |
161 | --- common/AlbumsPage.qml 2014-08-21 20:13:31 +0000 |
162 | +++ common/AlbumsPage.qml 2014-09-04 23:02:29 +0000 |
163 | @@ -29,6 +29,7 @@ |
164 | MusicPage { |
165 | id: albumStackPage |
166 | anchors.bottomMargin: units.gu(.5) |
167 | + objectName: "albumsArtistPage" |
168 | visible: false |
169 | |
170 | property string artist: "" |
171 | @@ -113,6 +114,7 @@ |
172 | } |
173 | Label { |
174 | id: artistLabel |
175 | + objectName: "artistLabel" |
176 | anchors { |
177 | left: parent.left |
178 | leftMargin: units.gu(1) |
179 | @@ -227,6 +229,7 @@ |
180 | |
181 | ListItem.Standard { |
182 | id: albumInfo |
183 | + objectName: "albumsArtistListItem" + index |
184 | width: parent.width |
185 | height: units.gu(20) |
186 | |
187 | @@ -244,6 +247,29 @@ |
188 | onItemAdded: year = item.text |
189 | } |
190 | |
191 | + MouseArea { |
192 | + anchors.fill: parent |
193 | + onClicked: { |
194 | + if (focus == false) { |
195 | + focus = true |
196 | + } |
197 | + |
198 | + songsPage.album = model.title; |
199 | + |
200 | + songsPage.line1 = model.artist |
201 | + songsPage.line2 = model.title |
202 | + songsPage.isAlbum = true |
203 | + songsPage.covers = [{author: model.artist, album: model.title}] |
204 | + songsPage.genre = undefined |
205 | + songsPage.title = i18n.tr("Album") |
206 | + |
207 | + mainPageStack.push(songsPage) |
208 | + } |
209 | + |
210 | + // TODO: If http://pad.lv/1354753 is fixed to expose whether the Shape should appear pressed, update this as well. |
211 | + onPressedChanged: albumImage.pressed = pressed |
212 | + } |
213 | + |
214 | CoverRow { |
215 | id: albumImage |
216 | anchors { |
217 | @@ -255,36 +281,11 @@ |
218 | count: 1 |
219 | size: parent.height |
220 | covers: [{author: model.artist, album: model.title}] |
221 | - objectName: "artistpage-albumcover" |
222 | spacing: units.gu(2) |
223 | - |
224 | - MouseArea { |
225 | - anchors.fill: parent |
226 | - onClicked: { |
227 | - if (focus == false) { |
228 | - focus = true |
229 | - } |
230 | - |
231 | - songsPage.album = model.title; |
232 | - |
233 | - songsPage.line1 = model.artist |
234 | - songsPage.line2 = model.title |
235 | - songsPage.isAlbum = true |
236 | - songsPage.covers = [{author: model.artist, album: model.title}] |
237 | - songsPage.genre = undefined |
238 | - songsPage.title = i18n.tr("Album") |
239 | - |
240 | - mainPageStack.push(songsPage) |
241 | - } |
242 | - |
243 | - // TODO: If http://pad.lv/1354753 is fixed to expose whether the Shape should appear pressed, update this as well. |
244 | - onPressedChanged: albumImage.pressed = pressed |
245 | - } |
246 | } |
247 | |
248 | Label { |
249 | id: albumArtist |
250 | - objectName: "artistpage-albumartist" |
251 | wrapMode: Text.NoWrap |
252 | maximumLineCount: 1 |
253 | fontSize: "small" |
254 | |
255 | === modified file 'common/SongsPage.qml' |
256 | --- common/SongsPage.qml 2014-08-21 20:13:31 +0000 |
257 | +++ common/SongsPage.qml 2014-09-04 23:02:29 +0000 |
258 | @@ -30,6 +30,7 @@ |
259 | MusicPage { |
260 | id: songStackPage |
261 | anchors.bottomMargin: units.gu(.5) |
262 | + objectName: "songsPage" |
263 | visible: false |
264 | |
265 | property string line1: "" |
266 | @@ -77,7 +78,7 @@ |
267 | |
268 | Label { |
269 | id: albumArtist |
270 | - objectName: "songspage-albumartist" |
271 | + objectName: "songsPageHeaderAlbumArtist" |
272 | wrapMode: Text.NoWrap |
273 | maximumLineCount: 1 |
274 | fontSize: "small" |
275 | @@ -215,7 +216,7 @@ |
276 | ListItemWithActions { |
277 | id: track |
278 | color: "transparent" |
279 | - objectName: "songspage-track" |
280 | + objectName: "songsPageListItem" + index |
281 | iconFrame: false |
282 | progression: false |
283 | height: styleMusic.common.itemHeight |
284 | |
285 | === modified file 'music-app.qml' |
286 | --- music-app.qml 2014-09-01 16:46:15 +0000 |
287 | +++ music-app.qml 2014-09-04 23:02:29 +0000 |
288 | @@ -292,8 +292,8 @@ |
289 | importItems = activeTransfer.items; |
290 | |
291 | // Assumes only 1 file to import for now |
292 | - //var dialogue = PopupUtils.open(contentHubImport, mainView) |
293 | - //dialogue.contentItem = importItems[0]; |
294 | + //var dialog = PopupUtils.open(contentHubImport, mainView) |
295 | + //dialog.contentItem = importItems[0]; |
296 | |
297 | var url = importItems[0].url.toString() |
298 | console.debug("Triggered content-hub import for item", url) |
299 | @@ -302,13 +302,13 @@ |
300 | var out = contentHub.importFile(importItems[0], path) |
301 | |
302 | if (out === true) { |
303 | - contentHubWaitForFile.dialogue = PopupUtils.open(contentHubWait, mainView) |
304 | + contentHubWaitForFile.dialog = PopupUtils.open(contentHubWait, mainView) |
305 | contentHubWaitForFile.searchPath = contentHub.searchPath; |
306 | contentHubWaitForFile.start(); |
307 | } |
308 | else { |
309 | - var errorDialogue = PopupUtils.open(contentHubError, mainView) |
310 | - errorDialogue.errorText = out |
311 | + var errordialog = PopupUtils.open(contentHubError, mainView) |
312 | + errordialog.errorText = out |
313 | } |
314 | } |
315 | } |
316 | @@ -364,7 +364,7 @@ |
317 | triggeredOnStart: false |
318 | repeat: true |
319 | |
320 | - property var dialogue: null |
321 | + property var dialog: null |
322 | property string searchPath |
323 | property int count: 0 |
324 | |
325 | @@ -372,7 +372,7 @@ |
326 | count = 0; |
327 | stop(); |
328 | |
329 | - PopupUtils.close(dialogue) |
330 | + PopupUtils.close(dialog) |
331 | } |
332 | |
333 | onTriggered: { |
334 | @@ -404,7 +404,7 @@ |
335 | Component { |
336 | id: contentHubWait |
337 | Dialog { |
338 | - id: dialogueContentHubWait |
339 | + id: dialogContentHubWait |
340 | |
341 | LoadingSpinnerComponent { |
342 | anchors { |
343 | @@ -419,7 +419,7 @@ |
344 | Component { |
345 | id: contentHubError |
346 | Dialog { |
347 | - id: dialogueContentHubError |
348 | + id: dialogContentHubError |
349 | |
350 | property alias errorText: errorLabel.text |
351 | |
352 | @@ -430,7 +430,7 @@ |
353 | |
354 | Button { |
355 | text: i18n.tr("OK") |
356 | - onClicked: PopupUtils.close(dialogueContentHubError) |
357 | + onClicked: PopupUtils.close(dialogContentHubError) |
358 | } |
359 | } |
360 | } |
361 | @@ -438,7 +438,7 @@ |
362 | Component { |
363 | id: contentHubNotFound |
364 | Dialog { |
365 | - id: dialogueContentHubNotFound |
366 | + id: dialogContentHubNotFound |
367 | |
368 | Label { |
369 | color: styleMusic.common.black |
370 | @@ -448,16 +448,16 @@ |
371 | Button { |
372 | text: i18n.tr("Wait") |
373 | onClicked: { |
374 | - PopupUtils.close(dialogueContentHubNotFound) |
375 | + PopupUtils.close(dialogContentHubNotFound) |
376 | |
377 | - contentHubWaitForFile.dialogue = PopupUtils.open(contentHubWait, mainView) |
378 | + contentHubWaitForFile.dialog = PopupUtils.open(contentHubWait, mainView) |
379 | contentHubWaitForFile.start(); |
380 | } |
381 | } |
382 | |
383 | Button { |
384 | text: i18n.tr("Cancel") |
385 | - onClicked: PopupUtils.close(dialogueContentHubNotFound) |
386 | + onClicked: PopupUtils.close(dialogContentHubNotFound) |
387 | } |
388 | } |
389 | } |
390 | @@ -465,7 +465,7 @@ |
391 | Component { |
392 | id: contentHubImport |
393 | Dialog { |
394 | - id: dialogueContentHubImport |
395 | + id: dialogContentHubImport |
396 | title: i18n.tr("Import") |
397 | text: i18n.tr("Target destination") |
398 | |
399 | @@ -490,9 +490,9 @@ |
400 | var out = contentHub.importFile(contentItem, pathField.text.toString()) |
401 | |
402 | if (out === true) { |
403 | - PopupUtils.close(dialogueContentHubImport) |
404 | + PopupUtils.close(dialogContentHubImport) |
405 | |
406 | - contentHubWaitForFile.dialogue = PopupUtils.open(contentHubWait, mainView) |
407 | + contentHubWaitForFile.dialog = PopupUtils.open(contentHubWait, mainView) |
408 | contentHubWaitForFile.searchPath = contentHub.searchPath; |
409 | contentHubWaitForFile.start(); |
410 | } |
411 | @@ -506,7 +506,7 @@ |
412 | Button { |
413 | text: i18n.tr("Cancel") |
414 | color: styleMusic.dialog.buttonColor |
415 | - onClicked: PopupUtils.close(dialogueContentHubImport) |
416 | + onClicked: PopupUtils.close(dialogContentHubImport) |
417 | } |
418 | } |
419 | } |
420 | @@ -935,12 +935,13 @@ |
421 | Component { |
422 | id: newPlaylistDialog |
423 | Dialog { |
424 | - id: dialogueNewPlaylist |
425 | + id: dialogNewPlaylist |
426 | + objectName: "dialogNewPlaylist" |
427 | title: i18n.tr("New Playlist") |
428 | text: i18n.tr("Name your playlist.") |
429 | TextField { |
430 | id: playlistName |
431 | - objectName: "playlistnameTextfield" |
432 | + objectName: "playlistNameTextField" |
433 | placeholderText: i18n.tr("Name") |
434 | inputMethodHints: Qt.ImhNoPredictiveText |
435 | } |
436 | @@ -953,7 +954,7 @@ |
437 | Button { |
438 | text: i18n.tr("Create") |
439 | color: styleMusic.dialog.confirmButtonColor |
440 | - objectName: "newPlaylistDialog_createButton" |
441 | + objectName: "newPlaylistDialogCreateButton" |
442 | onClicked: { |
443 | newplaylistoutput.visible = false // make sure its hidden now if there was an error last time |
444 | if (playlistName.text.length > 0) { // make sure something is acually inputed |
445 | @@ -962,7 +963,7 @@ |
446 | |
447 | playlistModel.filterPlaylists(); // reload model |
448 | |
449 | - PopupUtils.close(dialogueNewPlaylist) |
450 | + PopupUtils.close(dialogNewPlaylist) |
451 | } |
452 | else { |
453 | console.debug("Debug: Playlist already exists") |
454 | @@ -980,7 +981,7 @@ |
455 | Button { |
456 | text: i18n.tr("Cancel") |
457 | color: styleMusic.dialog.cancelButtonColor |
458 | - onClicked: PopupUtils.close(dialogueNewPlaylist) |
459 | + onClicked: PopupUtils.close(dialogNewPlaylist) |
460 | } |
461 | } |
462 | } |
463 | @@ -1008,7 +1009,7 @@ |
464 | property bool loading: false |
465 | property var model: [recentModel, albumTracksModel] |
466 | id: startTab |
467 | - objectName: "starttab" |
468 | + objectName: "startTab" |
469 | anchors.fill: parent |
470 | title: page.title |
471 | |
472 | @@ -1025,7 +1026,7 @@ |
473 | property bool loading: false |
474 | property var model: [] |
475 | id: artistsTab |
476 | - objectName: "artiststab" |
477 | + objectName: "artistsTab" |
478 | anchors.fill: parent |
479 | title: page.title |
480 | |
481 | @@ -1042,7 +1043,7 @@ |
482 | property bool loading: false |
483 | property var model: [] |
484 | id: albumsTab |
485 | - objectName: "albumstab" |
486 | + objectName: "albumsTab" |
487 | anchors.fill: parent |
488 | title: page.title |
489 | |
490 | @@ -1077,7 +1078,7 @@ |
491 | property bool loading: false |
492 | property var model: [playlistModel, albumTracksModel] |
493 | id: playlistTab |
494 | - objectName: "playlisttab" |
495 | + objectName: "playlistsTab" |
496 | anchors.fill: parent |
497 | title: page.title |
498 | |
499 | |
500 | === modified file 'tests/autopilot/music_app/__init__.py' |
501 | --- tests/autopilot/music_app/__init__.py 2014-08-22 23:41:29 +0000 |
502 | +++ tests/autopilot/music_app/__init__.py 2014-09-04 23:02:29 +0000 |
503 | @@ -6,8 +6,7 @@ |
504 | # by the Free Software Foundation. |
505 | |
506 | """music-app tests and emulators - top level package.""" |
507 | -import ubuntuuitoolkit |
508 | -from time import sleep |
509 | +from ubuntuuitoolkit import MainView, UbuntuUIToolkitCustomProxyObjectBase |
510 | |
511 | |
512 | class MusicAppException(Exception): |
513 | @@ -30,13 +29,46 @@ |
514 | self.main_view = self.app.wait_select_single(MainView) |
515 | self.player = self.app.select_single(Player, objectName='player') |
516 | |
517 | + def get_add_to_playlist_page(self): |
518 | + return self.app.wait_select_single(Page11, |
519 | + objectName="addToPlaylistPage") |
520 | + |
521 | + def get_albums_page(self): |
522 | + self.main_view.switch_to_tab('albumsTab') |
523 | + |
524 | + return self.main_view.wait_select_single( |
525 | + Page11, objectName='albumsPage') |
526 | + |
527 | + def get_albums_artist_page(self): |
528 | + return self.main_view.wait_select_single( |
529 | + AlbumsPage, objectName='albumsArtistPage') |
530 | + |
531 | + def get_artists_page(self): |
532 | + self.main_view.switch_to_tab('artistsTab') |
533 | + |
534 | + return self.main_view.wait_select_single( |
535 | + Page11, objectName='artistsPage') |
536 | + |
537 | + def get_new_playlist_dialog(self): |
538 | + return self.main_view.wait_select_single( |
539 | + Dialog, objectName="dialogNewPlaylist") |
540 | + |
541 | def get_now_playing_page(self): |
542 | return self.app.wait_select_single(MusicNowPlaying, |
543 | objectName="nowPlayingPage") |
544 | |
545 | + def get_playlists_page(self): |
546 | + self.main_view.switch_to_tab('playlistsTab') |
547 | + |
548 | + return self.main_view.wait_select_single( |
549 | + MusicPlaylists, objectName='playlistsPage') |
550 | + |
551 | + def get_songs_page(self): |
552 | + return self.app.wait_select_single(SongsPage, objectName="songsPage") |
553 | + |
554 | def get_toolbar(self): |
555 | - return self.app.select_single(MusicToolbar, |
556 | - objectName="musicToolbarObject") |
557 | + return self.app.wait_select_single(MusicToolbar, |
558 | + objectName="musicToolbarObject") |
559 | |
560 | def get_tracks_page(self): |
561 | """Open the Tracks tab. |
562 | @@ -46,7 +78,7 @@ |
563 | """ |
564 | self.main_view.switch_to_tab('tracksTab') |
565 | |
566 | - return self.main_view.select_single( |
567 | + return self.main_view.wait_select_single( |
568 | Page11, objectName='tracksPage') |
569 | |
570 | @property |
571 | @@ -68,7 +100,7 @@ |
572 | self.get_now_playing_page().visible.wait_for(True) |
573 | |
574 | |
575 | -class Page(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
576 | +class Page(UbuntuUIToolkitCustomProxyObjectBase): |
577 | """Autopilot helper for Pages.""" |
578 | def __init__(self, *args): |
579 | super(Page, self).__init__(*args) |
580 | @@ -82,18 +114,94 @@ |
581 | super(Page, self).__init__(*args) |
582 | |
583 | |
584 | -# FIXME: Represents MusicTracks related to bug 1341671 and bug 1337004 |
585 | -class Page11(MusicPage): |
586 | +class MusicAlbums(MusicPage): |
587 | + """ Autopilot helper for the albums page """ |
588 | + def __init__(self, *args): |
589 | + super(MusicPage, self).__init__(*args) |
590 | + |
591 | + self.visible.wait_for(True) |
592 | + |
593 | + @click_object |
594 | + def click_album(self, i): |
595 | + return (self.wait_select_single("*", |
596 | + objectName="albumsPageGridItem" + str(i))) |
597 | + |
598 | + |
599 | +class MusicArtists(MusicPage): |
600 | + """ Autopilot helper for the artists page """ |
601 | + def __init__(self, *args): |
602 | + super(MusicPage, self).__init__(*args) |
603 | + |
604 | + self.visible.wait_for(True) |
605 | + |
606 | + @click_object |
607 | + def click_artist(self, i): |
608 | + return (self.wait_select_single("Standard", |
609 | + objectName="artistsPageListItem" + str(i))) |
610 | + |
611 | + |
612 | +class MusicTracks(MusicPage): |
613 | """ Autopilot helper for the tracks page """ |
614 | def __init__(self, *args): |
615 | super(MusicPage, self).__init__(*args) |
616 | |
617 | + self.visible.wait_for(True) |
618 | + |
619 | def get_track(self, i): |
620 | - return (self.wait_select_single("ListItemWithActions", |
621 | - objectName="tracksTabListItem" + str(i))) |
622 | - |
623 | - |
624 | -class Player(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
625 | + return (self.wait_select_single(ListItemWithActions, |
626 | + objectName="tracksPageListItem" + str(i))) |
627 | + |
628 | + |
629 | +class MusicPlaylists(MusicPage): |
630 | + """ Autopilot helper for the playlists page """ |
631 | + def __init__(self, *args): |
632 | + super(MusicPage, self).__init__(*args) |
633 | + |
634 | + self.visible.wait_for(True) |
635 | + |
636 | + def get_count(self): |
637 | + return self.wait_select_single( |
638 | + "QQuickListView", objectName="playlistsListView").count |
639 | + |
640 | + |
641 | +class MusicaddtoPlaylist(MusicPage): |
642 | + """ Autopilot helper for add to playlist page """ |
643 | + def __init__(self, *args): |
644 | + super(MusicPage, self).__init__(*args) |
645 | + |
646 | + self.visible.wait_for(True) |
647 | + |
648 | + def click_new_playlist_action(self): |
649 | + self.main_view.get_header().click_action_button("newPlaylistButton") |
650 | + |
651 | + @click_object |
652 | + def click_playlist(self, i): |
653 | + return self.get_playlist(i) |
654 | + |
655 | + def get_count(self): # careful not to conflict until Page11 is fixed |
656 | + return self.wait_select_single( |
657 | + "QQuickListView", objectName="addToPlaylistListView").count |
658 | + |
659 | + def get_playlist(self, i): |
660 | + return (self.wait_select_single("Standard", |
661 | + objectName="addToPlaylistListItem" + str(i))) |
662 | + |
663 | + |
664 | +class Page11(MusicAlbums, MusicArtists, MusicTracks, MusicaddtoPlaylist): |
665 | + """ |
666 | + FIXME: Represents MusicTracks MusicArtists MusicAlbums MusicaddtoPlaylists |
667 | + due to bug 1341671 and bug 1337004 they all appear as Page11 |
668 | + Therefore this class 'contains' all of them for now |
669 | + Once the bugs are fixed Page11 should be swapped for MusicTracks etc |
670 | + """ |
671 | + def __init__(self, *args): |
672 | + super(MusicAlbums, self).__init__(*args) |
673 | + super(MusicArtists, self).__init__(*args) |
674 | + super(MusicTracks, self).__init__(*args) |
675 | + super(MusicaddtoPlaylist, self).__init__(*args) |
676 | + |
677 | + |
678 | +class Player(UbuntuUIToolkitCustomProxyObjectBase): |
679 | """Autopilot helper for Player""" |
680 | |
681 | |
682 | @@ -107,11 +215,48 @@ |
683 | objectName="nowPlayingQueueList").count |
684 | |
685 | def get_track(self, i): |
686 | - return (self.wait_select_single("ListItemWithActions", |
687 | + return (self.wait_select_single(ListItemWithActions, |
688 | objectName="nowPlayingListItem" + str(i))) |
689 | |
690 | |
691 | -class MusicToolbar(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
692 | +class AlbumsPage(MusicPage): |
693 | + """ Autopilot helper for the albums page """ |
694 | + def __init__(self, *args): |
695 | + super(MusicPage, self).__init__(*args) |
696 | + |
697 | + self.visible.wait_for(True) |
698 | + |
699 | + @click_object |
700 | + def click_artist(self, i): |
701 | + return self.wait_select_single("Standard", |
702 | + objectName="albumsArtistListItem" |
703 | + + str(i)) |
704 | + |
705 | + def get_artist(self): |
706 | + return self.wait_select_single("Label", objectName="artistLabel").text |
707 | + |
708 | + |
709 | +class SongsPage(MusicPage): |
710 | + """ Autopilot helper for the songs page """ |
711 | + def __init__(self, *args): |
712 | + super(MusicPage, self).__init__(*args) |
713 | + |
714 | + self.visible.wait_for(True) |
715 | + |
716 | + @click_object |
717 | + def click_track(self, i): |
718 | + return self.get_track(i) |
719 | + |
720 | + def get_header_artist_label(self): |
721 | + return self.wait_select_single("Label", |
722 | + objectName="songsPageHeaderAlbumArtist") |
723 | + |
724 | + def get_track(self, i): |
725 | + return (self.wait_select_single(ListItemWithActions, |
726 | + objectName="songsPageListItem" + str(i))) |
727 | + |
728 | + |
729 | +class MusicToolbar(UbuntuUIToolkitCustomProxyObjectBase): |
730 | """Autopilot helper for the toolbar |
731 | |
732 | expanded - refers to things when the toolbar is in its smaller state |
733 | @@ -147,6 +292,17 @@ |
734 | def click_shuffle_button(self): |
735 | return self.wait_select_single("*", objectName="shuffleShape") |
736 | |
737 | + def seek_to(self, percentage): |
738 | + progress_bar = self.wait_select_single( |
739 | + "*", objectName="progressBarShape") |
740 | + |
741 | + x1, y1, width, height = progress_bar.globalRect |
742 | + y1 += height // 2 |
743 | + |
744 | + x2 = x1 + int(width * percentage / 100) |
745 | + |
746 | + self.pointing_device.drag(x1, y1, x2, y1) |
747 | + |
748 | def set_repeat(self, state): |
749 | if self.player.repeat != state: |
750 | self.click_repeat_button() |
751 | @@ -169,7 +325,51 @@ |
752 | self.pointing_device.drag(x1, y1, x1, y1 - self.fullHeight) |
753 | |
754 | |
755 | -class MainView(ubuntuuitoolkit.MainView): |
756 | +class ListItemWithActions(UbuntuUIToolkitCustomProxyObjectBase): |
757 | + @click_object |
758 | + def click_add_to_playlist_action(self): |
759 | + return self.wait_select_single(objectName="addToPlaylistAction") |
760 | + |
761 | + @click_object |
762 | + def click_add_to_queue_action(self): |
763 | + return self.wait_select_single(objectName="addToQueueAction") |
764 | + |
765 | + @click_object |
766 | + def confirm_removal(self): |
767 | + return self.wait_select_single(objectName="swipeDeleteAction") |
768 | + |
769 | + def get_label_text(self, name): |
770 | + return self.wait_select_single(objectName=name).text |
771 | + |
772 | + def swipe_reveal_actions(self): |
773 | + x, y, width, height = self.globalRect |
774 | + start_x = x + (width * 0.8) |
775 | + stop_x = x + (width * 0.2) |
776 | + start_y = stop_y = y + (height // 2) |
777 | + |
778 | + self.pointing_device.drag(start_x, start_y, stop_x, stop_y) |
779 | + |
780 | + def swipe_to_delete(self): |
781 | + x, y, width, height = self.globalRect |
782 | + start_x = x + (width * 0.2) |
783 | + stop_x = x + (width * 0.8) |
784 | + start_y = stop_y = y + (height // 2) |
785 | + |
786 | + self.pointing_device.drag(start_x, start_y, stop_x, stop_y) |
787 | + |
788 | + |
789 | +class Dialog(UbuntuUIToolkitCustomProxyObjectBase): |
790 | + @click_object |
791 | + def click_new_playlist_dialog_create_button(self): |
792 | + return self.wait_select_single( |
793 | + "Button", objectName="newPlaylistDialogCreateButton") |
794 | + |
795 | + def type_new_playlist_dialog_name(self, text): |
796 | + self.wait_select_single( |
797 | + "TextField", objectName="playlistNameTextField").write(text) |
798 | + |
799 | + |
800 | +class MainView(MainView): |
801 | """Autopilot custom proxy object for the MainView.""" |
802 | retry_delay = 0.2 |
803 | |
804 | @@ -181,196 +381,3 @@ |
805 | spinner = self.wait_select_single("ActivityIndicator", |
806 | objectName="LoadingSpinner") |
807 | spinner.running.wait_for(False) |
808 | - |
809 | - def select_many_retry(self, object_type, **kwargs): |
810 | - """Returns the item that is searched for with app.select_many |
811 | - In case of no item was not found (not created yet) a second attempt is |
812 | - taken 1 second later""" |
813 | - items = self.select_many(object_type, **kwargs) |
814 | - tries = 10 |
815 | - while len(items) < 1 and tries > 0: |
816 | - sleep(self.retry_delay) |
817 | - items = self.select_many(object_type, **kwargs) |
818 | - tries = tries - 1 |
819 | - return items |
820 | - |
821 | - def tap_item(self, item): |
822 | - self.pointing_device.move_to_object(item) |
823 | - self.pointing_device.press() |
824 | - sleep(2) |
825 | - self.pointing_device.release() |
826 | - |
827 | - def seek_to_0(self): |
828 | - # Get the progress bar object |
829 | - progressBar = self.wait_select_single( |
830 | - "*", objectName="progressBarShape") |
831 | - |
832 | - # Move to the progress bar and get the position |
833 | - self.pointing_device.move_to_object(progressBar) |
834 | - x1, y1 = self.pointing_device.position() |
835 | - |
836 | - self.pointing_device.drag(x1, y1, x1 - (progressBar.width / 2) + 1, y1) |
837 | - |
838 | - def add_to_queue_from_albums_tab_album_page(self, artistName, trackTitle): |
839 | - # switch to albums tab |
840 | - self.switch_to_tab("albumstab") |
841 | - |
842 | - # select album |
843 | - albumartist = self.get_albums_albumartist(artistName) |
844 | - self.pointing_device.click_object(albumartist) |
845 | - |
846 | - # get track item to swipe and queue |
847 | - trackitem = self.get_songs_page_listview_tracktitle(trackTitle) |
848 | - songspage = self.get_songs_page_listview() |
849 | - |
850 | - # get coordinates to swipe |
851 | - start_x = int(songspage.globalRect.x + |
852 | - (songspage.globalRect.width * 0.9)) |
853 | - stop_x = int(songspage.globalRect.x) |
854 | - line_y = int(trackitem.globalRect.y) |
855 | - |
856 | - # swipe to add to queue |
857 | - self.pointing_device.move(start_x, line_y) |
858 | - self.pointing_device.drag(start_x, line_y, stop_x, line_y) |
859 | - |
860 | - # click on add to queue |
861 | - queueaction = self.get_add_to_queue_action() |
862 | - self.pointing_device.click_object(queueaction) |
863 | - |
864 | - def tap_new_playlist_action(self): |
865 | - header = self.get_header() |
866 | - header.click_action_button('newplaylistButton') |
867 | - |
868 | - def get_player_control_title(self): |
869 | - return self.select_single("Label", objectName="playercontroltitle") |
870 | - |
871 | - def get_first_genre_item(self): |
872 | - return self.wait_select_single("*", objectName="genreItemObject") |
873 | - |
874 | - def get_albumstab(self): |
875 | - return self.select_single("Tab", objectName="albumstab") |
876 | - |
877 | - def get_albums_albumartist_list(self): |
878 | - return self.select_many("Label", objectName="albums-albumartist") |
879 | - |
880 | - def get_albums_albumartist(self, artistName): |
881 | - albumartistList = self.get_albums_albumartist_list() |
882 | - for item in albumartistList: |
883 | - if item.text == artistName: |
884 | - return item |
885 | - |
886 | - def get_add_to_queue_action(self): |
887 | - return self.wait_select_single("*", |
888 | - objectName="addToQueueAction", |
889 | - primed=True) |
890 | - |
891 | - def get_add_to_playlist_action(self): |
892 | - return self.wait_select_single("*", |
893 | - objectName="addToPlaylistAction", |
894 | - primed=True) |
895 | - |
896 | - def get_add_to_queue_button(self): |
897 | - return self.wait_select_single("QQuickImage", |
898 | - objectName="albumpage-queue-all") |
899 | - |
900 | - def get_album_page_artist(self): |
901 | - return self.wait_select_single("Label", |
902 | - objectName="albumpage-albumartist") |
903 | - |
904 | - def get_songs_page_artist(self): |
905 | - return self.wait_select_single("Label", |
906 | - objectName="songspage-albumartist") |
907 | - |
908 | - def get_artist_page_artist(self): |
909 | - return self.wait_select_single("Label", |
910 | - objectName="artistpage-albumartist") |
911 | - |
912 | - def get_artist_page_artist_cover(self): |
913 | - return self.wait_select_single("*", |
914 | - objectName="artistpage-albumcover") |
915 | - |
916 | - def get_artiststab(self): |
917 | - return self.select_single("Tab", objectName="artiststab") |
918 | - |
919 | - def get_artists_artist_list(self): |
920 | - return self.select_many("Label", objectName="artists-artist") |
921 | - |
922 | - def get_artists_artist(self, artistName): |
923 | - artistList = self.get_artists_artist_list() |
924 | - for item in artistList: |
925 | - if item.text == artistName: |
926 | - return item |
927 | - |
928 | - def close_buttons(self): |
929 | - return self.select_many("Button", text="close") |
930 | - |
931 | - def get_album_page_listview_tracktitle(self, trackTitle): |
932 | - tracktitles = self.select_many_retry( |
933 | - "Label", objectName="albumpage-tracktitle") |
934 | - for item in tracktitles: |
935 | - if item.text == trackTitle: |
936 | - return item |
937 | - |
938 | - def get_songs_page_listview_tracktitle(self, trackTitle): |
939 | - tracktitles = self.select_many_retry( |
940 | - "Label", objectName="songspage-tracktitle") |
941 | - for item in tracktitles: |
942 | - if item.text == trackTitle: |
943 | - return item |
944 | - |
945 | - def get_queue_now_playing_artist(self, artistName): |
946 | - playingartists = self.select_many( |
947 | - "Label", objectName="nowplayingartist") |
948 | - for item in playingartists: |
949 | - if item.text == artistName: |
950 | - return item |
951 | - |
952 | - def get_queue_now_playing_title(self, trackTitle): |
953 | - playingtitles = self.select_many( |
954 | - "Label", objectName="nowplayingtitle") |
955 | - for item in playingtitles: |
956 | - if item.text == trackTitle: |
957 | - return item |
958 | - |
959 | - def get_tracks_tab_listview(self): |
960 | - return self.select_single("QQuickListView", |
961 | - objectName="trackstab-listview") |
962 | - |
963 | - def get_songs_page_listview(self): |
964 | - return self.select_single("QQuickListView", |
965 | - objectName="songspage-listview") |
966 | - |
967 | - def get_songs_tab_tracktitle(self, trackTitle): |
968 | - tracktitles = self.select_many_retry( |
969 | - "Label", objectName="tracktitle") |
970 | - for item in tracktitles: |
971 | - if item.text == trackTitle: |
972 | - return item |
973 | - |
974 | - def get_newPlaylistDialog_createButton(self): |
975 | - return self.wait_select_single( |
976 | - "Button", objectName="newPlaylistDialog_createButton") |
977 | - |
978 | - def get_newPlaylistDialog_name_textfield(self): |
979 | - return self.wait_select_single( |
980 | - "TextField", objectName="playlistnameTextfield") |
981 | - |
982 | - def get_addtoplaylistview(self): |
983 | - return self.wait_select_single( |
984 | - "QQuickListView", objectName="addtoplaylistview") |
985 | - |
986 | - def get_playlistname(self, playlistname): |
987 | - playlistnames = self.select_many_retry( |
988 | - "Standard", objectName="playlist") |
989 | - for item in playlistnames: |
990 | - if item.name == playlistname: |
991 | - return item |
992 | - |
993 | - def get_playlistslist(self): |
994 | - return self.wait_select_single( |
995 | - "QQuickListView", objectName="playlistslist") |
996 | - |
997 | - def get_swipedelete_icon(self): |
998 | - return self.wait_select_single( |
999 | - "*", objectName="swipeDeleteAction", |
1000 | - primed=True) |
1001 | |
1002 | === modified file 'tests/autopilot/music_app/tests/test_music.py' |
1003 | --- tests/autopilot/music_app/tests/test_music.py 2014-08-26 17:16:11 +0000 |
1004 | +++ tests/autopilot/music_app/tests/test_music.py 2014-09-04 23:02:29 +0000 |
1005 | @@ -12,7 +12,7 @@ |
1006 | import time |
1007 | import logging |
1008 | from autopilot.matchers import Eventually |
1009 | -from testtools.matchers import Equals, Is, Not, LessThan, NotEquals |
1010 | +from testtools.matchers import Equals, LessThan, NotEquals |
1011 | |
1012 | |
1013 | from music_app.tests import MusicAppTestCase |
1014 | @@ -25,9 +25,13 @@ |
1015 | def setUp(self): |
1016 | super(TestMainWindow, self).setUp() |
1017 | |
1018 | - self.trackTitle = u"Gran Vals" |
1019 | - self.artistName = u"Francisco Tárrega" |
1020 | - self.lastTrackTitle = u"TestMP3Title" |
1021 | + self.album_artist_index = 0 # position on AlbumsPage |
1022 | + self.album_index = 0 # position on MusicAlbums |
1023 | + self.artist_index = 0 # position on MusicArtists |
1024 | + self.track_index = 0 # position on MusicTracks |
1025 | + self.track_title = u"Gran Vals" |
1026 | + self.artist_name = u"Francisco Tárrega" |
1027 | + self.last_track_title = u"TestMP3Title" |
1028 | |
1029 | @property |
1030 | def main_view(self): |
1031 | @@ -49,8 +53,8 @@ |
1032 | |
1033 | title = lambda: self.player.currentMetaTitle |
1034 | artist = lambda: self.player.currentMetaArtist |
1035 | - self.assertThat(title, Eventually(Equals(self.trackTitle))) |
1036 | - self.assertThat(artist, Eventually(Equals(self.artistName))) |
1037 | + self.assertThat(title, Eventually(Equals(self.track_title))) |
1038 | + self.assertThat(artist, Eventually(Equals(self.artist_name))) |
1039 | |
1040 | def test_play_pause_library(self): |
1041 | """ Test playing and pausing a track (Music Library must exist) """ |
1042 | @@ -61,8 +65,17 @@ |
1043 | # get number of tracks in queue before queuing a track |
1044 | initial_tracks_count = now_playing_page.get_count() |
1045 | |
1046 | - self.main_view.add_to_queue_from_albums_tab_album_page( |
1047 | - self.artistName, self.trackTitle) |
1048 | + # switch to albums tab |
1049 | + albums_page = self.app.get_albums_page() |
1050 | + albums_page.click_album(self.album_index) # select album |
1051 | + |
1052 | + # get track item to swipe and queue |
1053 | + songs_page = self.app.get_songs_page() |
1054 | + |
1055 | + track = songs_page.get_track(0) |
1056 | + track.swipe_reveal_actions() |
1057 | + |
1058 | + track.click_add_to_queue_action() # add track to the queue |
1059 | |
1060 | # verify track queue has added one to initial value |
1061 | self.assertThat(now_playing_page.get_count(), |
1062 | @@ -76,12 +89,12 @@ |
1063 | self.assertThat(self.player.isPlaying, Eventually(Equals(False))) |
1064 | |
1065 | # verify song's metadata matches the item added to the Now Playing view |
1066 | - queueArtistName = self.main_view.get_queue_now_playing_artist( |
1067 | - self.artistName) |
1068 | - self.assertThat(queueArtistName.text, Equals(self.artistName)) |
1069 | - queueTrackTitle = self.main_view.get_queue_now_playing_title( |
1070 | - self.trackTitle) |
1071 | - self.assertThat(queueTrackTitle.text, Equals(self.trackTitle)) |
1072 | + current_track = now_playing_page.get_track(self.player.currentIndex) |
1073 | + |
1074 | + self.assertThat(current_track.get_label_text("artistLabel"), |
1075 | + Equals(self.artist_name)) |
1076 | + self.assertThat(current_track.get_label_text("titleLabel"), |
1077 | + Equals(self.track_title)) |
1078 | |
1079 | # click on close button to close the page |
1080 | self.main_view.go_back() |
1081 | @@ -160,8 +173,7 @@ |
1082 | nextArtist = self.player.currentMetaArtist |
1083 | logger.debug("Next Song %s, %s" % (nextTitle, nextArtist)) |
1084 | |
1085 | - """ Seek to 0 """ |
1086 | - self.main_view.seek_to_0() # TODO: put in helper in future |
1087 | + toolbar.seek_to(0) # seek to 0 (start) |
1088 | |
1089 | """ Select previous """ |
1090 | toolbar.click_previous_button() |
1091 | @@ -290,19 +302,21 @@ |
1092 | """tests navigating to the Albums tab and displaying the album page""" |
1093 | |
1094 | # switch to albums tab |
1095 | - self.main_view.switch_to_tab("albumstab") |
1096 | - |
1097 | - # select album |
1098 | - albumartist = self.main_view.get_albums_albumartist(self.artistName) |
1099 | - self.pointing_device.click_object(albumartist) |
1100 | - |
1101 | - # get album page album artist |
1102 | - songs_page_albumartist = self.main_view.get_songs_page_artist() |
1103 | - self.assertThat(songs_page_albumartist.text, Equals(self.artistName)) |
1104 | - |
1105 | - # click on close button to close album page |
1106 | + albums_page = self.app.get_albums_page() |
1107 | + albums_page.click_album(self.album_index) # select album |
1108 | + |
1109 | + # get songs page album artist |
1110 | + songs_page = self.app.get_songs_page() |
1111 | + artist_label = songs_page.get_header_artist_label() |
1112 | + |
1113 | + self.assertThat(artist_label.text, |
1114 | + Eventually(Equals(self.artist_name))) |
1115 | + |
1116 | + # click on close button to close songs page |
1117 | self.main_view.go_back() |
1118 | - self.assertThat(self.main_view.get_albumstab(), Not(Is(None))) |
1119 | + |
1120 | + # check that the albums page is now visible |
1121 | + self.assertThat(albums_page.visible, Eventually(Equals(True))) |
1122 | |
1123 | def test_add_song_to_queue_from_albums_page(self): |
1124 | """tests navigating to the Albums tab and adding a song to queue""" |
1125 | @@ -312,8 +326,17 @@ |
1126 | # get number of tracks in queue before queuing a track |
1127 | initial_tracks_count = now_playing_page.get_count() |
1128 | |
1129 | - self.main_view.add_to_queue_from_albums_tab_album_page( |
1130 | - self.artistName, self.trackTitle) |
1131 | + # switch to albums tab |
1132 | + albums_page = self.app.get_albums_page() |
1133 | + albums_page.click_album(self.album_index) # select album |
1134 | + |
1135 | + # get track item to swipe and queue |
1136 | + songs_page = self.app.get_songs_page() |
1137 | + |
1138 | + track = songs_page.get_track(0) |
1139 | + track.swipe_reveal_actions() |
1140 | + |
1141 | + track.click_add_to_queue_action() # add track to the queue |
1142 | |
1143 | # verify track queue has added one to initial value |
1144 | self.assertThat(now_playing_page.get_count(), |
1145 | @@ -323,16 +346,18 @@ |
1146 | self.assertThat(self.player.isPlaying, Eventually(Equals(False))) |
1147 | |
1148 | # verify song's metadata matches the item added to the Now Playing view |
1149 | - queueArtistName = self.main_view.get_queue_now_playing_artist( |
1150 | - self.artistName) |
1151 | - self.assertThat(queueArtistName.text, Equals(self.artistName)) |
1152 | - queueTrackTitle = self.main_view.get_queue_now_playing_title( |
1153 | - self.trackTitle) |
1154 | - self.assertThat(queueTrackTitle.text, Equals(self.trackTitle)) |
1155 | - |
1156 | - # click on close button to close album page |
1157 | + current_track = now_playing_page.get_track(self.player.currentIndex) |
1158 | + |
1159 | + self.assertThat(current_track.get_label_text("artistLabel"), |
1160 | + Equals(self.artist_name)) |
1161 | + self.assertThat(current_track.get_label_text("titleLabel"), |
1162 | + Equals(self.track_title)) |
1163 | + |
1164 | + # click on close button to close songs page |
1165 | self.main_view.go_back() |
1166 | - self.assertThat(self.main_view.get_albumstab(), Not(Is(None))) |
1167 | + |
1168 | + # check that the albums page is now visible |
1169 | + self.assertThat(albums_page.visible, Eventually(Equals(True))) |
1170 | |
1171 | def test_add_songs_to_queue_from_songs_tab_and_play(self): |
1172 | """tests navigating to the Songs tab and adding the library to the |
1173 | @@ -358,12 +383,12 @@ |
1174 | self.assertThat(self.player.isPlaying, Eventually(Equals(True))) |
1175 | |
1176 | # verify song's metadata matches the item added to the Now Playing view |
1177 | - queueArtistName = self.main_view.get_queue_now_playing_artist( |
1178 | - self.artistName) |
1179 | - self.assertThat(queueArtistName.text, Equals(self.artistName)) |
1180 | - queueTrackTitle = self.main_view.get_queue_now_playing_title( |
1181 | - self.trackTitle) |
1182 | - self.assertThat(queueTrackTitle.text, Equals(self.trackTitle)) |
1183 | + current_track = now_playing_page.get_track(self.player.currentIndex) |
1184 | + |
1185 | + self.assertThat(current_track.get_label_text("artistLabel"), |
1186 | + Equals(self.artist_name)) |
1187 | + self.assertThat(current_track.get_label_text("titleLabel"), |
1188 | + Equals(self.track_title)) |
1189 | |
1190 | def test_add_song_to_queue_from_songs_tab(self): |
1191 | """tests navigating to the Songs tab and adding a song from the library |
1192 | @@ -374,26 +399,14 @@ |
1193 | # get number of tracks in queue before queuing a track |
1194 | initial_tracks_count = now_playing_page.get_count() |
1195 | |
1196 | - # switch to songs tab |
1197 | - self.main_view.switch_to_tab("tracksTab") |
1198 | - |
1199 | - # get track item to swipe and queue |
1200 | - trackitem = self.main_view.get_songs_tab_tracktitle(self.trackTitle) |
1201 | - songspage = self.main_view.get_tracks_tab_listview() |
1202 | - |
1203 | - # get coordinates to swipe |
1204 | - start_x = int(songspage.globalRect.x + |
1205 | - (songspage.globalRect.width * 0.9)) |
1206 | - stop_x = int(songspage.globalRect.x) |
1207 | - line_y = int(trackitem.globalRect.y) |
1208 | - |
1209 | - # swipe to add to queue |
1210 | - self.pointing_device.move(start_x, line_y) |
1211 | - self.pointing_device.drag(start_x, line_y, stop_x, line_y) |
1212 | - |
1213 | - # click on add to queue |
1214 | - queueaction = self.main_view.get_add_to_queue_action() |
1215 | - self.pointing_device.click_object(queueaction) |
1216 | + # switch to tracks page |
1217 | + tracks_page = self.app.get_tracks_page() |
1218 | + |
1219 | + # get track row and swipe to reveal actions |
1220 | + track = tracks_page.get_track(self.track_index) |
1221 | + track.swipe_reveal_actions() |
1222 | + |
1223 | + track.click_add_to_queue_action() # add track to queue |
1224 | |
1225 | # verify track queue has added all songs to initial value |
1226 | self.assertThat(now_playing_page.get_count(), |
1227 | @@ -405,69 +418,61 @@ |
1228 | self.assertThat(self.player.isPlaying, Eventually(Equals(False))) |
1229 | |
1230 | # verify song's metadata matches the item added to the Now Playing view |
1231 | - queueArtistName = self.main_view.get_queue_now_playing_artist( |
1232 | - self.artistName) |
1233 | - self.assertThat(queueArtistName.text, Equals(self.artistName)) |
1234 | - queueTrackTitle = self.main_view.get_queue_now_playing_title( |
1235 | - self.trackTitle) |
1236 | - self.assertThat(queueTrackTitle.text, Equals(self.trackTitle)) |
1237 | + current_track = now_playing_page.get_track(self.player.currentIndex) |
1238 | + |
1239 | + self.assertThat(current_track.get_label_text("artistLabel"), |
1240 | + Equals(self.artist_name)) |
1241 | + self.assertThat(current_track.get_label_text("titleLabel"), |
1242 | + Equals(self.track_title)) |
1243 | |
1244 | def test_create_playlist_from_songs_tab(self): |
1245 | """tests navigating to the Songs tab and creating a playlist by |
1246 | selecting a song to add it to a new playlist. """ |
1247 | |
1248 | - # switch to songs tab |
1249 | - self.main_view.switch_to_tab("tracksTab") |
1250 | - |
1251 | - # get track item to swipe and queue |
1252 | - trackitem = self.main_view.get_songs_tab_tracktitle(self.trackTitle) |
1253 | - songspage = self.main_view.get_tracks_tab_listview() |
1254 | - |
1255 | - # get coordinates to swipe |
1256 | - start_x = int(songspage.globalRect.x + |
1257 | - (songspage.globalRect.width * 0.9)) |
1258 | - stop_x = int(songspage.globalRect.x) |
1259 | - line_y = int(trackitem.globalRect.y) |
1260 | - |
1261 | - # swipe to add to queue |
1262 | - self.pointing_device.move(start_x, line_y) |
1263 | - self.pointing_device.drag(start_x, line_y, stop_x, line_y) |
1264 | - |
1265 | - # click on add to playlist |
1266 | - playlistaction = self.main_view.get_add_to_playlist_action() |
1267 | - self.pointing_device.click_object(playlistaction) |
1268 | - |
1269 | - # Wait for animations to complete |
1270 | - playlistaction.primed.wait_for(False) |
1271 | + # switch to tracks page |
1272 | + tracks_page = self.app.get_tracks_page() |
1273 | + |
1274 | + # get track row and swipe to reveal actions |
1275 | + track = tracks_page.get_track(self.track_index) |
1276 | + track.swipe_reveal_actions() |
1277 | + |
1278 | + track.click_add_to_playlist_action() # add track to queue |
1279 | + |
1280 | + add_to_playlist_page = self.app.get_add_to_playlist_page() |
1281 | |
1282 | # get initial list view playlist count |
1283 | - playlist_count = self.main_view.get_addtoplaylistview().count |
1284 | + playlist_count = add_to_playlist_page.get_count() |
1285 | |
1286 | # click on New playlist button in header |
1287 | - self.main_view.tap_new_playlist_action() |
1288 | + add_to_playlist_page.click_new_playlist_action() |
1289 | + |
1290 | + # get dialog |
1291 | + new_dialog = self.app.get_new_playlist_dialog() |
1292 | |
1293 | # input playlist name |
1294 | - playlistNameFld = self.main_view.get_newPlaylistDialog_name_textfield() |
1295 | - self.pointing_device.click_object(playlistNameFld) |
1296 | - playlistNameFld.focus.wait_for(True) |
1297 | - self.keyboard.type("myPlaylist") |
1298 | + new_dialog.type_new_playlist_dialog_name("myPlaylist") |
1299 | |
1300 | - # click on get_newPlaylistDialog create Button |
1301 | - createButton = self.main_view.get_newPlaylistDialog_createButton() |
1302 | - self.pointing_device.click_object(createButton) |
1303 | + # click on the create Button |
1304 | + new_dialog.click_new_playlist_dialog_create_button() |
1305 | |
1306 | # verify playlist has been sucessfully created |
1307 | - palylist_final_count = self.main_view.get_addtoplaylistview().count |
1308 | - self.assertThat(palylist_final_count, Equals(playlist_count + 1)) |
1309 | - playlist = self.main_view.get_playlistname("myPlaylist") |
1310 | - self.assertThat(playlist, Not(Is(None))) |
1311 | + self.assertThat(add_to_playlist_page.get_count(), |
1312 | + Eventually(Equals(playlist_count + 1))) |
1313 | + |
1314 | + self.assertThat(add_to_playlist_page.get_playlist(0).name, |
1315 | + Equals("myPlaylist")) |
1316 | |
1317 | # select playlist to add song to |
1318 | - self.pointing_device.click_object(playlist) |
1319 | + add_to_playlist_page.click_playlist(0) |
1320 | + |
1321 | + # wait for add to playlist page to close |
1322 | + add_to_playlist_page.visible.wait_for(False) |
1323 | + |
1324 | + # open playlists page |
1325 | + playlists_page = self.app.get_playlists_page() |
1326 | |
1327 | # verify song has been added to playlist |
1328 | - playlistslist = self.main_view.get_playlistslist() |
1329 | - self.assertThat(playlistslist.count, Equals(1)) |
1330 | + self.assertThat(playlists_page.get_count(), Equals(1)) |
1331 | |
1332 | def test_artists_tab_album(self): |
1333 | """tests navigating to the Artists tab and playing an album""" |
1334 | @@ -478,31 +483,27 @@ |
1335 | initial_tracks_count = now_playing_page.get_count() |
1336 | |
1337 | # switch to artists tab |
1338 | - self.main_view.switch_to_tab("artiststab") |
1339 | - |
1340 | - # select artist |
1341 | - artist = self.main_view.get_artists_artist(self.artistName) |
1342 | - self.pointing_device.click_object(artist) |
1343 | - |
1344 | - # get album page album artist |
1345 | - page_albumartist = self.main_view.get_artist_page_artist() |
1346 | - self.assertThat(page_albumartist.text, Equals(self.artistName)) |
1347 | - |
1348 | - # click on album to shows the artists |
1349 | - albumartist_cover = self.main_view.get_artist_page_artist_cover() |
1350 | - self.pointing_device.click_object(albumartist_cover) |
1351 | + artists_page = self.app.get_artists_page() |
1352 | + artists_page.click_artist(self.artist_index) |
1353 | + |
1354 | + # get albums (by an artist) page |
1355 | + albums_page = self.app.get_albums_artist_page() |
1356 | + |
1357 | + # check album artist label is correct |
1358 | + self.assertThat(albums_page.get_artist(), Equals(self.artist_name)) |
1359 | + |
1360 | + # click on album to show tracks |
1361 | + albums_page.click_artist(self.album_artist_index) |
1362 | |
1363 | # get song page album artist |
1364 | - songs_page_albumartist = self.main_view.get_songs_page_artist() |
1365 | - self.assertThat(songs_page_albumartist.text, Equals(self.artistName)) |
1366 | - |
1367 | - # click on song to populate queue and start playing |
1368 | - self.pointing_device.click_object(songs_page_albumartist) |
1369 | - |
1370 | - # select artist |
1371 | - track = self.main_view.get_songs_page_listview_tracktitle( |
1372 | - self.trackTitle) |
1373 | - self.pointing_device.click_object(track) |
1374 | + songs_page = self.app.get_songs_page() |
1375 | + |
1376 | + # check the artist label |
1377 | + artist_label = songs_page.get_header_artist_label() |
1378 | + self.assertThat(artist_label.text, Equals(self.artist_name)) |
1379 | + |
1380 | + # click on track to play |
1381 | + songs_page.click_track(self.track_index) |
1382 | |
1383 | # get now playing again as it has moved |
1384 | now_playing_page = self.app.get_now_playing_page() |
1385 | @@ -517,12 +518,12 @@ |
1386 | self.assertThat(self.player.isPlaying, Eventually(Equals(True))) |
1387 | |
1388 | # verify song's metadata matches the item added to the Now Playing view |
1389 | - queueArtistName = self.main_view.get_queue_now_playing_artist( |
1390 | - self.artistName) |
1391 | - self.assertThat(queueArtistName.text, Equals(self.artistName)) |
1392 | - queueTrackTitle = self.main_view.get_queue_now_playing_title( |
1393 | - self.trackTitle) |
1394 | - self.assertThat(queueTrackTitle.text, Equals(self.trackTitle)) |
1395 | + current_track = now_playing_page.get_track(self.player.currentIndex) |
1396 | + |
1397 | + self.assertThat(current_track.get_label_text("artistLabel"), |
1398 | + Equals(self.artist_name)) |
1399 | + self.assertThat(current_track.get_label_text("titleLabel"), |
1400 | + Equals(self.track_title)) |
1401 | |
1402 | def test_swipe_to_delete_song(self): |
1403 | """tests navigating to the Now Playing queue, swiping to delete a |
1404 | @@ -535,24 +536,11 @@ |
1405 | # get initial queue count |
1406 | initial_queue_count = now_playing_page.get_count() |
1407 | |
1408 | - # get song to delete |
1409 | - track = now_playing_page.get_track(0) |
1410 | - |
1411 | - # TODO: make ListItemWithActions helper for swiping |
1412 | - # get coordinates to delete song |
1413 | - start_x = int(now_playing_page.globalRect.x + |
1414 | - now_playing_page.globalRect.width * 0.30) |
1415 | - stop_x = int(now_playing_page.globalRect.x + |
1416 | - now_playing_page.globalRect.width * 0.90) |
1417 | - line_y = int(track.globalRect.y) + int(track.height / 2) |
1418 | - |
1419 | - # swipe to remove song |
1420 | - self.pointing_device.move(start_x, line_y) |
1421 | - self.pointing_device.drag(start_x, line_y, stop_x, line_y) |
1422 | - |
1423 | - # click on delete icon/label to confirm removal |
1424 | - swipedeleteicon = self.main_view.get_swipedelete_icon() |
1425 | - self.pointing_device.click_object(swipedeleteicon) |
1426 | + # get track row and swipe to reveal swipe to delete |
1427 | + track = now_playing_page.get_track(self.track_index) |
1428 | + track.swipe_to_delete() |
1429 | + |
1430 | + track.confirm_removal() # confirm delete |
1431 | |
1432 | # verify song has been deleted |
1433 | self.assertThat(now_playing_page.get_count(), |
1434 | @@ -593,7 +581,7 @@ |
1435 | |
1436 | # Make sure we loop back to first song after last song ends |
1437 | actual_title = lambda: self.player.currentMetaTitle |
1438 | - self.assertThat(actual_title, Eventually(Equals(self.trackTitle))) |
1439 | + self.assertThat(actual_title, Eventually(Equals(self.track_title))) |
1440 | self.assertThat(self.player.isPlaying, Eventually(Equals(True))) |
1441 | |
1442 | def test_pressing_next_from_last_song_plays_first_when_repeat_on(self): |
1443 | @@ -612,7 +600,7 @@ |
1444 | toolbar.click_forward_button() |
1445 | |
1446 | actual_title = lambda: self.player.currentMetaTitle |
1447 | - self.assertThat(actual_title, Eventually(Equals(self.trackTitle))) |
1448 | + self.assertThat(actual_title, Eventually(Equals(self.track_title))) |
1449 | self.assertThat(self.player.isPlaying, Eventually(Equals(True))) |
1450 | |
1451 | def test_pressing_prev_from_first_song_plays_last_when_repeat_on(self): |
1452 | @@ -635,5 +623,6 @@ |
1453 | toolbar.click_previous_button() |
1454 | |
1455 | actual_title = lambda: self.player.currentMetaTitle |
1456 | - self.assertThat(actual_title, Eventually(Equals(self.lastTrackTitle))) |
1457 | + self.assertThat(actual_title, |
1458 | + Eventually(Equals(self.last_track_title))) |
1459 | self.assertThat(self.player.isPlaying, Eventually(Equals(True))) |
FAILED: Continuous integration, rev:608 91.189. 93.70:8080/ job/music- app-ci/ 1080/ 91.189. 93.70:8080/ job/generic- mediumtests- utopic/ 1730 91.189. 93.70:8080/ job/generic- mediumtests- utopic/ 1730/artifact/ work/output/ *zip*/output. zip 91.189. 93.70:8080/ job/music- app-utopic- amd64-ci/ 304
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/music- app-ci/ 1080/rebuild
http://