Merge lp:~darran-kelinske/music-app/lp_bug_1428454 into lp:music-app/remix

Proposed by dazza5000 on 2015-03-19
Status: Merged
Approved by: Andrew Hayzen on 2015-03-24
Approved revision: 853
Merged at revision: 849
Proposed branch: lp:~darran-kelinske/music-app/lp_bug_1428454
Merge into: lp:music-app/remix
Diff against target: 146 lines (+75/-1)
4 files modified
MusicPlaylists.qml (+1/-0)
common/SongsPage.qml (+2/-0)
tests/autopilot/music_app/__init__.py (+24/-0)
tests/autopilot/music_app/tests/test_music.py (+48/-1)
To merge this branch: bzr merge lp:~darran-kelinske/music-app/lp_bug_1428454
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2015-03-24
Andrew Hayzen 2015-03-19 Approve on 2015-03-24
Review via email: mp+253566@code.launchpad.net

Commit Message

* Added a test case for deleting a playlist

Description of the Change

Added a test case for deleting a playlist

To post a comment you must log in.
Andrew Hayzen (ahayzen) wrote :

Looks good so far :) Just a few inline comments...

L65, L75, L188 and possibly L140 - Could you remove this extra blank lines? (See PEP8 styling on this [0] - 2 lines for a class def and 1 for a method)
L102 - Is there any reason for renaming this var and method call? Could we keep it as add_to_playlist singular?

As I don't think jenkins runs for non-team members, I've manually run PEP8/pyflakes for you so you can see the errors [1]

0 - https://www.python.org/dev/peps/pep-0008/#blank-lines
1 - http://pastebin.ubuntu.com/10629706/

review: Needs Fixing
850. By Darran Kelinske <email address hidden> on 2015-03-19

fixing formatting and naming issues

851. By Darran Kelinske <email address hidden> on 2015-03-19

restore tracks variable that was removed

dazza5000 (darran-kelinske) wrote :

Thank yuo for the quick feedback! I think I got the changes. Please let me know. :)

852. By Darran Kelinske <email address hidden> on 2015-03-20

fixing more spacing issues

Andrew Hayzen (ahayzen) wrote :

This is looking closer :) Unfortunately there are still some failures...

Some of them are just because there is whitespace at the end of the line.

Also there is one inline comment.

$ pep8 tests/
tests/autopilot/music_app/__init__.py:216:80: E501 line too long (80 > 79 characters)
tests/autopilot/music_app/tests/test_music.py:85:42: W291 trailing whitespace
tests/autopilot/music_app/tests/test_music.py:488:1: W293 blank line contains whitespace
tests/autopilot/music_app/tests/test_music.py:490:53: W291 trailing whitespace
tests/autopilot/music_app/tests/test_music.py:535:2: E901 IndentationError: unindent does not match any outer indentation level
$ pyflakes tests/
tests/autopilot/music_app/tests/test_music.py:535:35: unindent does not match any outer indentation level
 def test_artists_tab_album(self):
                                  ^

I have made a diff [0] which contains fixes for the issues stated above. Then once it is passing pep8/pyflakes we can try triggering jenkins :)

0 - http://pastebin.ubuntu.com/10641729/

review: Needs Fixing
853. By Darran Kelinske <email address hidden> on 2015-03-21

additional formatting/syntax fixes :)

FAILED: Continuous integration, rev:853
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~darran-kelinske/music-app/lp_bug_1428454/+merge/253566/+edit-commit-message

http://91.189.93.70:8080/job/music-app-ci/1282/
Executed test runs:
    SUCCESS: http://91.189.93.70:8080/job/generic-mediumtests-utopic/2397
        deb: http://91.189.93.70:8080/job/generic-mediumtests-utopic/2397/artifact/work/output/*zip*/output.zip
    SUCCESS: http://91.189.93.70:8080/job/music-app-utopic-amd64-ci/376
    SUCCESS: http://91.189.93.70:8080/job/music-app-vivid-amd64-ci/134

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/music-app-ci/1282/rebuild

review: Needs Fixing (continuous-integration)
Andrew Hayzen (ahayzen) wrote :

Awesome, thanks for submitting this :) Looks good to me!

review: Approve
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'MusicPlaylists.qml'
--- MusicPlaylists.qml 2015-01-21 00:10:33 +0000
+++ MusicPlaylists.qml 2015-03-21 14:00:53 +0000
@@ -93,6 +93,7 @@
93 delegate: Card {93 delegate: Card {
94 id: playlistCard94 id: playlistCard
95 coverSources: Playlists.getPlaylistCovers(model.name)95 coverSources: Playlists.getPlaylistCovers(model.name)
96 objectName: "playlistCardItem" + index
96 primaryText: model.name97 primaryText: model.name
97 secondaryText: i18n.tr("%1 song", "%1 songs", model.count).arg(model.count)98 secondaryText: i18n.tr("%1 song", "%1 songs", model.count).arg(model.count)
9899
99100
=== modified file 'common/SongsPage.qml'
--- common/SongsPage.qml 2015-01-30 01:23:39 +0000
+++ common/SongsPage.qml 2015-03-21 14:00:53 +0000
@@ -593,6 +593,7 @@
593 id: removePlaylistDialog593 id: removePlaylistDialog
594 Dialog {594 Dialog {
595 id: dialogRemovePlaylist595 id: dialogRemovePlaylist
596 objectName: "dialogRemovePlaylist"
596 // TRANSLATORS: this is a title of a dialog with a prompt to delete a playlist597 // TRANSLATORS: this is a title of a dialog with a prompt to delete a playlist
597 title: i18n.tr("Permanently delete playlist?")598 title: i18n.tr("Permanently delete playlist?")
598 text: "("+i18n.tr("This cannot be undone")+")"599 text: "("+i18n.tr("This cannot be undone")+")"
@@ -602,6 +603,7 @@
602 Button {603 Button {
603 text: i18n.tr("Remove")604 text: i18n.tr("Remove")
604 color: styleMusic.dialog.confirmRemoveButtonColor605 color: styleMusic.dialog.confirmRemoveButtonColor
606 objectName: "removePlaylistDialogRemoveButton"
605 onClicked: {607 onClicked: {
606 // removing playlist608 // removing playlist
607 Playlists.removePlaylist(dialogRemovePlaylist.oldPlaylistName)609 Playlists.removePlaylist(dialogRemovePlaylist.oldPlaylistName)
608610
=== modified file 'tests/autopilot/music_app/__init__.py'
--- tests/autopilot/music_app/__init__.py 2015-01-19 17:13:12 +0000
+++ tests/autopilot/music_app/__init__.py 2015-03-21 14:00:53 +0000
@@ -75,6 +75,10 @@
75 return self.main_view.wait_select_single(75 return self.main_view.wait_select_single(
76 Dialog, objectName="dialogNewPlaylist")76 Dialog, objectName="dialogNewPlaylist")
7777
78 def get_delete_playlist_dialog(self):
79 return self.main_view.wait_select_single(
80 Dialog, objectName="dialogRemovePlaylist")
81
78 def get_now_playing_page(self):82 def get_now_playing_page(self):
79 return self.app.wait_select_single(MusicNowPlaying,83 return self.app.wait_select_single(MusicNowPlaying,
80 objectName="nowPlayingPage")84 objectName="nowPlayingPage")
@@ -208,6 +212,21 @@
208 return self.wait_select_single(212 return self.wait_select_single(
209 "CardView", objectName="playlistsCardView").count213 "CardView", objectName="playlistsCardView").count
210214
215 def click_new_playlist_action(self):
216 self.main_view.get_header(
217 ).click_action_button("newPlaylistButton")
218
219 @click_object
220 def click_playlist(self, i):
221 return self.get_playlist(i)
222
223 def get_playlist(self, i):
224 return (self.wait_select_single("Card",
225 objectName="playlistCardItem" + str(i)))
226
227 def click_delete_playlist_action(self):
228 self.main_view.get_header().click_action_button("deletePlaylist")
229
211230
212class MusicaddtoPlaylist(MusicPage):231class MusicaddtoPlaylist(MusicPage):
213 """ Autopilot helper for add to playlist page """232 """ Autopilot helper for add to playlist page """
@@ -411,6 +430,11 @@
411 self.wait_select_single(430 self.wait_select_single(
412 "TextField", objectName="playlistNameTextField").write(text)431 "TextField", objectName="playlistNameTextField").write(text)
413432
433 @click_object
434 def click_remove_playlist_dialog_remove_button(self):
435 return self.wait_select_single(
436 "Button", objectName="removePlaylistDialogRemoveButton")
437
414438
415class MainView(MainView):439class MainView(MainView):
416 """Autopilot custom proxy object for the MainView."""440 """Autopilot custom proxy object for the MainView."""
417441
=== modified file 'tests/autopilot/music_app/tests/test_music.py'
--- tests/autopilot/music_app/tests/test_music.py 2015-01-19 17:13:12 +0000
+++ tests/autopilot/music_app/tests/test_music.py 2015-03-21 14:00:53 +0000
@@ -81,7 +81,8 @@
81 track = self.app.get_songs_page().get_track(0)81 track = self.app.get_songs_page().get_track(0)
82 track.swipe_reveal_actions()82 track.swipe_reveal_actions()
8383
84 track.click_add_to_queue_action() # add track to the queue84 # add track to the queue
85 track.click_add_to_queue_action()
8586
86 # wait for track to be queued87 # wait for track to be queued
87 self.app.get_queue_count().wait_for(initial_tracks_count + 1)88 self.app.get_queue_count().wait_for(initial_tracks_count + 1)
@@ -485,6 +486,52 @@
485 # verify song has been added to playlist486 # verify song has been added to playlist
486 self.assertThat(playlists_page.get_count(), Equals(1))487 self.assertThat(playlists_page.get_count(), Equals(1))
487488
489 def test_select_and_delete_playlist(self):
490 """tests deleting a playlist by creating a playlist,
491 selecting it, and then deleting it. """
492
493 # switch to playlist page
494 playlists_page = self.app.get_playlists_page()
495
496 # get initial list view playlist count
497 playlist_count = playlists_page.get_count()
498
499 # click on New playlist button in header
500 playlists_page.click_new_playlist_action()
501
502 # get dialog
503 new_dialog = self.app.get_new_playlist_dialog()
504
505 # input playlist name
506 new_dialog.type_new_playlist_dialog_name("testDeletePlaylist")
507
508 # click on the create Button
509 new_dialog.click_new_playlist_dialog_create_button()
510
511 # verify playlist has been sucessfully created
512 self.assertThat(playlists_page.get_count(),
513 Eventually(Equals(playlist_count + 1)))
514
515 self.assertThat(playlists_page.get_playlist(0).primaryText,
516 Equals("testDeletePlaylist"))
517
518 # select the playlist that was just created
519 playlists_page.click_playlist(0)
520
521 # click the delete icon
522 playlists_page.click_delete_playlist_action()
523
524 # get dialog
525 delete_dialog = self.app.get_delete_playlist_dialog()
526
527 # click on the remove Button
528 delete_dialog.click_remove_playlist_dialog_remove_button()
529
530 playlists_page = self.app.get_playlists_page()
531
532 # verify that the playlist has been removed
533 self.assertThat(playlists_page.get_count(), Equals(playlist_count))
534
488 def test_artists_tab_album(self):535 def test_artists_tab_album(self):
489 """tests navigating to the Artists tab and playing an album"""536 """tests navigating to the Artists tab and playing an album"""
490537

Subscribers

People subscribed via source and target branches