Merge lp:~carla-sella/music-app/add_song_and_play into lp:music-app/trusty

Proposed by Carla Sella
Status: Merged
Approved by: Nicholas Skaggs
Approved revision: 284
Merged at revision: 278
Proposed branch: lp:~carla-sella/music-app/add_song_and_play
Merge into: lp:music-app/trusty
Diff against target: 516 lines (+274/-51)
8 files modified
MusicNowPlaying.qml (+1/-0)
MusicPlaylists.qml (+7/-6)
MusicTracks.qml (+4/-0)
MusicaddtoPlaylist.qml (+3/-0)
music-app.qml (+2/-0)
tests/autopilot/music_app/emulators.py (+66/-0)
tests/autopilot/music_app/tests/__init__.py (+36/-0)
tests/autopilot/music_app/tests/test_music.py (+155/-45)
To merge this branch: bzr merge lp:~carla-sella/music-app/add_song_and_play
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Nicholas Skaggs (community) Needs Fixing
Victor Thompson Approve
Review via email: mp+198175@code.launchpad.net

Commit message

Autopilot test for music-app.

Description of the change

Added test_add_songs_to_queue_from_songs_tab_and_play.
Fixe bug #1253453.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
271. By Launchpad Translations on behalf of music-app-dev

Launchpad automatic translations update.

272. By Carla Sella <email address hidden>

Autopilot test for music app. Fixes: https://bugs.launchpad.net/bugs/1253449.

Approved by Nicholas Skaggs, Victor Thompson, Ubuntu Phone Apps Jenkins Bot.

273. By Carla Sella <email address hidden>

Fixed conflicts.

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

I had some failures on this. I'll check them out further in the morning

review: Needs Fixing
274. By Carla Sella <email address hidden>

Fixed image detection error.

275. By Carla Sella <email address hidden>

Merged trunk.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
276. By Carla Sella <email address hidden>

Fixed pyflake error.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Victor Thompson (vthompson) wrote :

test_create_playlist_from_songs_tab fails with the following error on the Nexus 4:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/music_app/tests/test_music.py", line 465, in test_create_playlist_from_songs_tab
    self.assertThat(playlist, Not(Is(None)))
  File "/usr/lib/python2.7/dist-packages/testtools/testcase.py", line 412, in assertThat
    raise MismatchError(matchee, matcher, mismatch, verbose)
MismatchError: None matches Is(None)

review: Needs Fixing
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Jenkins is down at the moment, but we'll review this again. Thanks for catching the issues Victor.

277. By Carla Sella <email address hidden>

Implemented running tests in clean environment.

Revision history for this message
Victor Thompson (vthompson) wrote :

lgtm

review: Approve
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Carla, this should remove things on the device. The call to os.path.expanduser ensures you get the proper home directory no matter where it is running. I'll try running a few times on my device.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
278. By Carla Sella <email address hidden>

Fixed running tests in clean environment.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
279. By Carla Sella <email address hidden>

Fixed CI error.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Carla Sella (carla-sella) wrote :

Nicholas, looks like the tests are working also on device now regarding the clean environment issue.
Do not understand the CI issues though.

Revision history for this message
Victor Thompson (vthompson) wrote :

CI issue looks to be some sort of Jenkins issue: http://91.189.93.70:8080/job/music-app-trusty-amd64-ci/113/console

Revision history for this message
Andrew Hayzen (ahayzen) wrote :

Could be due to the planned outage?

https://lists.launchpad.net/ubuntu-phone/msg05542.html

280. By Carla Sella <email address hidden>

Added test_swipe_to_delete_song.

281. By Carla Sella <email address hidden>

Ran pep8 and pyflakes.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
282. By Carla Sella <email address hidden>

Fixing running test on device.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Sometimes this will fail on my device;

<balloons> Traceback (most recent call last):
<balloons> File "/home/phablet/autopilot/music_app/tests/test_music.py", line 465, in test_create_playlist_from_songs_tab
<balloons> self.assertThat(playlist, Not(Is(None)))
<balloons> File "/usr/lib/python2.7/dist-packages/testtools/testcase.py", line 412, in assertThat
<balloons> raise MismatchError(matchee, matcher, mismatch, verbose)
<balloons> MismatchError: None matches Is(None)

review: Needs Fixing
283. By Carla Sella <email address hidden>

Fixed failure on input playlist name.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
284. By Carla Sella <email address hidden>

Fixed pep8 error.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'MusicNowPlaying.qml'
2--- MusicNowPlaying.qml 2013-12-05 21:21:32 +0000
3+++ MusicNowPlaying.qml 2013-12-16 21:23:29 +0000
4@@ -29,6 +29,7 @@
5
6 Page {
7 id: nowPlaying
8+ objectName: "nowplayingpage"
9 anchors.fill: parent
10 title: i18n.tr("Queue")
11 visible: false
12
13=== modified file 'MusicPlaylists.qml'
14--- MusicPlaylists.qml 2013-12-02 03:42:54 +0000
15+++ MusicPlaylists.qml 2013-12-16 21:23:29 +0000
16@@ -131,8 +131,8 @@
17 // page for the playlists
18 Page {
19 id: listspage
20- // TRANSLATORS: this is the name of the playlists page shown in the tab header.
21- // Remember to keep the translation short to fit the screen width
22+ // TRANSLATORS: this is the name of the playlists page shown in the tab header.
23+ // Remember to keep the translation short to fit the screen width
24 title: i18n.tr("Playlists")
25
26 onVisibleChanged: {
27@@ -144,6 +144,7 @@
28
29 ListView {
30 id: playlistslist
31+ objectName: "playlistslist"
32 anchors.fill: parent
33 anchors.bottomMargin: musicToolbar.mouseAreaOffset + musicToolbar.minimizedHeight
34 model: playlistModel.model
35@@ -338,7 +339,7 @@
36 anchors.leftMargin: units.gu(0.5)
37 color: styleMusic.common.white
38 fontSize: "small"
39- // TRANSLATORS: this refers to editing a playlist
40+ // TRANSLATORS: this refers to editing a playlist
41 text: i18n.tr("Edit")
42 }
43 MouseArea {
44@@ -380,7 +381,7 @@
45 anchors.leftMargin: units.gu(0.5)
46 color: styleMusic.common.white
47 fontSize: "small"
48- // TRANSLATORS: this refers to deleting a playlist
49+ // TRANSLATORS: this refers to deleting a playlist
50 text: i18n.tr("Delete")
51 }
52 MouseArea {
53@@ -424,7 +425,7 @@
54 anchors.leftMargin: units.gu(0.5)
55 color: styleMusic.common.white
56 fontSize: "small"
57- // TRANSLATORS: this refers to sharing a playlist
58+ // TRANSLATORS: this refers to sharing a playlist
59 text: i18n.tr("Share")
60 }
61 MouseArea {
62@@ -565,7 +566,7 @@
63
64 Label {
65 id: playlistInfoCount
66- text: i18n.tr("%1 song", "%1 songs", playlist.count).arg(playlist.count)
67+ text: i18n.tr("%1 song", "%1 songs", playlist.count).arg(playlist.count)
68 color: styleMusic.common.white
69 fontSize: "medium"
70 anchors.left: parent.left
71
72=== modified file 'MusicTracks.qml'
73--- MusicTracks.qml 2013-12-02 03:42:54 +0000
74+++ MusicTracks.qml 2013-12-16 21:23:29 +0000
75@@ -95,6 +95,7 @@
76 }
77 Label {
78 id: trackTitle
79+ objectName: "tracktitle"
80 wrapMode: Text.NoWrap
81 maximumLineCount: 1
82 fontSize: "small"
83@@ -163,6 +164,7 @@
84 //Icon { // use for 1.0
85 Image {
86 id: expandItem
87+ objectName: "trackimage"
88 anchors.right: parent.right
89 anchors.rightMargin: units.gu(2)
90 // name: "dropdown-menu" Use for 1.0
91@@ -256,6 +258,7 @@
92 width: styleMusic.common.expandedItem
93 }
94 Label {
95+ objectName: "songstab_addtoplaylist"
96 anchors.left: playlistTrack.right
97 anchors.leftMargin: units.gu(0.5)
98 anchors.top: parent.top
99@@ -305,6 +308,7 @@
100 width: styleMusic.common.expandedItem
101 }
102 Label {
103+ objectName: "songstab_addtoqueue"
104 anchors.left: queueTrack.right
105 anchors.leftMargin: units.gu(0.5)
106 anchors.top: parent.top
107
108=== modified file 'MusicaddtoPlaylist.qml'
109--- MusicaddtoPlaylist.qml 2013-11-19 17:51:07 +0000
110+++ MusicaddtoPlaylist.qml 2013-12-16 21:23:29 +0000
111@@ -64,11 +64,13 @@
112 // show each playlist and make them chosable
113 ListView {
114 id: addtoPlaylistView
115+ objectName: "addtoplaylistview"
116 width: parent.width
117 height: parent.width
118 model: playlistModel.model
119 delegate: ListItem.Standard {
120 id: playlist
121+ objectName: "playlist"
122 height: units.gu(8)
123 property string name: model.name
124 property string count: model.count
125@@ -158,6 +160,7 @@
126
127 Button {
128 id: newPlaylistItem
129+ objectName: "newplaylistButton"
130 text: i18n.tr("New playlist")
131 iconSource: "images/add.svg"
132 iconPosition: "left"
133
134=== modified file 'music-app.qml'
135--- music-app.qml 2013-12-14 19:37:34 +0000
136+++ music-app.qml 2013-12-16 21:23:29 +0000
137@@ -1010,6 +1010,7 @@
138 text: i18n.tr("Name your playlist.")
139 TextField {
140 id: playlistName
141+ objectName: "playlistnameTextfield"
142 placeholderText: i18n.tr("Name")
143 }
144 ListItem.Standard {
145@@ -1019,6 +1020,7 @@
146
147 Button {
148 text: i18n.tr("Create")
149+ objectName: "newPlaylistDialog_createButton"
150 onClicked: {
151 newplaylistoutput.visible = false // make sure its hidden now if there was an error last time
152 if (playlistName.text.length > 0) { // make sure something is acually inputed
153
154=== modified file 'tests/autopilot/music_app/emulators.py'
155--- tests/autopilot/music_app/emulators.py 2013-12-04 21:25:45 +0000
156+++ tests/autopilot/music_app/emulators.py 2013-12-16 21:23:29 +0000
157@@ -147,3 +147,69 @@
158 for item in playingtitles:
159 if item.text == trackTitle:
160 return item
161+
162+ def get_songs_tab_tracktitle(self, trackTitle):
163+ tracktitles = self.select_many_retry(
164+ "Label", objectName="tracktitle")
165+ for item in tracktitles:
166+ if item.text == trackTitle:
167+ return item
168+
169+ def get_songs_tab_trackimage(self, trackTitle):
170+ trackimages = self.select_many_retry(
171+ "QQuickImage", objectName="trackimage")
172+ tracktitles = self.get_songs_tab_tracktitle(trackTitle)
173+ imageheight = trackimages[0].height
174+ trackimage_position = tracktitles.globalRect[1] + (imageheight / 2)
175+ for item in trackimages:
176+ if item.globalRect[1] == trackimage_position:
177+ return item
178+
179+ def get_songs_tab_add_to_queue_label(self):
180+ addtoqueue = self.select_many(
181+ "Label", objectName="songstab_addtoqueue")
182+ for item in addtoqueue:
183+ if item.visible:
184+ return item
185+
186+ def get_songs_tab_add_to_playlist_label(self):
187+ addtoplaylist = self.select_many(
188+ "Label", objectName="songstab_addtoplaylist")
189+ for item in addtoplaylist:
190+ if item.visible:
191+ return item
192+
193+ def get_newplaylistButton(self):
194+ return self.select_many_retry("Button", objectName="newplaylistButton")
195+
196+ def get_newPlaylistDialog_createButton(self):
197+ return self.wait_select_single(
198+ "Button", objectName="newPlaylistDialog_createButton")
199+
200+ def get_newPlaylistDialog_name_textfield(self):
201+ return self.wait_select_single(
202+ "TextField", objectName="playlistnameTextfield")
203+
204+ def get_addtoplaylistview(self):
205+ return self.select_many_retry(
206+ "QQuickListView", objectName="addtoplaylistview")
207+
208+ def get_playlistname(self, playlistname):
209+ playlistnames = self.select_many_retry(
210+ "Standard", objectName="playlist")
211+ for item in playlistnames:
212+ if item.name == playlistname:
213+ return item
214+
215+ def get_playlistslist(self):
216+ return self.wait_select_single(
217+ "QQuickListView", objectName="playlistslist")
218+
219+ def get_MusicNowPlaying_page(self):
220+ return self.wait_select_single(
221+ "MusicNowPlaying", objectName="nowplayingpage")
222+
223+ def get_swipedelete_icon(self):
224+ swipedelete = self.wait_select_single(
225+ "SwipeDelete", direction="swipingRight")
226+ return swipedelete.select_many("Icon", name="delete")[1]
227
228=== modified file 'tests/autopilot/music_app/tests/__init__.py'
229--- tests/autopilot/music_app/tests/__init__.py 2013-11-04 22:34:00 +0000
230+++ tests/autopilot/music_app/tests/__init__.py 2013-12-16 21:23:29 +0000
231@@ -47,6 +47,9 @@
232 local_location_dir = os.path.dirname(os.path.dirname(working_dir))
233 local_location = local_location_dir + "/music-app.qml"
234 installed_location = "/usr/share/music-app/music-app.qml"
235+ sqlite_dir = os.path.expanduser(
236+ "~/.local/share/com.ubuntu.music/Databases")
237+ backup_dir = sqlite_dir + ".backup"
238
239 def setup_environment(self):
240 if os.path.exists(self.local_location):
241@@ -61,6 +64,10 @@
242 return launch, test_type
243
244 def setUp(self):
245+ #backup and wipe db's before testing
246+ self.temp_move_sqlite_db()
247+ self.addCleanup(self.restore_sqlite_db)
248+
249 launch, self.test_type = self.setup_environment()
250 if self.test_type != 'click':
251 self.home_dir = self._patch_home()
252@@ -206,6 +213,35 @@
253 os.remove(in_filename)
254 os.rename(out_filename, in_filename)
255
256+ def temp_move_sqlite_db(self):
257+ try:
258+ shutil.rmtree(self.backup_dir)
259+ except:
260+ pass
261+ else:
262+ logger.warning("Prexisting backup database found and removed")
263+
264+ try:
265+ shutil.move(self.sqlite_dir, self.backup_dir)
266+ except:
267+ logger.warning("No current database found")
268+ else:
269+ logger.debug("Backed up database")
270+
271+ def restore_sqlite_db(self):
272+ if os.path.exists(self.backup_dir):
273+ if os.path.exists(self.sqlite_dir):
274+ try:
275+ shutil.rmtree(self.sqlite_dir)
276+ except:
277+ logger.error("Failed to remove test database and restore" /
278+ "database")
279+ return
280+ try:
281+ shutil.move(self.backup_dir, self.sqlite_dir)
282+ except:
283+ logger.error("Failed to restore database")
284+
285 @property
286 def main_view(self):
287 return self.app.select_single(emulators.MainView)
288
289=== modified file 'tests/autopilot/music_app/tests/test_music.py'
290--- tests/autopilot/music_app/tests/test_music.py 2013-12-12 19:26:33 +0000
291+++ tests/autopilot/music_app/tests/test_music.py 2013-12-16 21:23:29 +0000
292@@ -13,7 +13,6 @@
293 import logging
294 from autopilot.matchers import Eventually
295 from testtools.matchers import Equals, Is, Not, LessThan, NotEquals
296-from testtools.matchers import GreaterThan
297
298
299 from music_app.tests import MusicTestCase
300@@ -308,6 +307,7 @@
301 self.assertThat(self.main_view.get_albumstab(), Not(Is(None)))
302
303 def test_add_song_to_queue_from_albums_sheet(self):
304+ """tests navigating to the Albums tab and adding a song to queue"""
305
306 trackTitle = "Foss Yeaaaah! (Radio Edit)"
307 artistName = "Benjamin Kerensa"
308@@ -344,50 +344,6 @@
309 Eventually(NotEquals(endtracksCount)))
310 self.assertThat(self.main_view.isPlaying, Eventually(Equals(False)))
311
312- #verity song's metadata matches the item added to the Now Playing view
313- queueArtistName = self.main_view.get_queue_now_playing_artist(
314- artistName)
315- self.assertThat(str(queueArtistName.text), Equals(artistName))
316- queueTrackTitle = self.main_view.get_queue_now_playing_title(
317- trackTitle)
318- self.assertThat(str(queueTrackTitle.text), Equals(trackTitle))
319-
320- # click on close button to close album sheet
321- closebutton = self.main_view.get_album_sheet_close_button()
322- self.pointing_device.click_object(closebutton)
323- self.assertThat(self.main_view.get_albumstab(), Not(Is(None)))
324-
325- def test_add_album_to_queue_from_albums_sheet(self):
326-
327- trackTitle = "Foss Yeaaaah! (Radio Edit)"
328- artistName = "Benjamin Kerensa"
329-
330- # get number of tracks in queue before queuing a track
331- initialtracksCount = self.main_view.get_queue_track_count()
332-
333- # switch to albums tab
334- self.main_view.switch_to_tab("albumstab")
335-
336- #select album
337- albumartist = self.main_view.get_albums_albumartist(artistName)
338- self.pointing_device.click_object(albumartist)
339-
340- #get album sheet album artist
341- sheet_albumartist = self.main_view.get_album_sheet_artist()
342- self.assertThat(sheet_albumartist.text, Eventually(Equals(artistName)))
343-
344- #get track item to add to queue
345- trackitem = self.main_view.get_album_sheet_listview_tracktitle(
346- trackTitle)
347- self.pointing_device.click_object(trackitem)
348-
349- #Assert that a song form the album added to the list is playing
350- self.assertThat(self.main_view.isPlaying, Eventually(Equals(True)))
351-
352- # verify track queue count is greater than initial value
353- endtracksCount = self.main_view.get_queue_track_count()
354- self.assertThat(endtracksCount, GreaterThan(initialtracksCount))
355-
356 #verify song's metadata matches the item added to the Now Playing view
357 queueArtistName = self.main_view.get_queue_now_playing_artist(
358 artistName)
359@@ -395,3 +351,157 @@
360 queueTrackTitle = self.main_view.get_queue_now_playing_title(
361 trackTitle)
362 self.assertThat(str(queueTrackTitle.text), Equals(trackTitle))
363+
364+ # click on close button to close album sheet
365+ closebutton = self.main_view.get_album_sheet_close_button()
366+ self.pointing_device.click_object(closebutton)
367+ self.assertThat(self.main_view.get_albumstab(), Not(Is(None)))
368+
369+ def test_add_songs_to_queue_from_songs_tab_and_play(self):
370+ """tests navigating to the Songs tab and adding the library to the
371+ queue with the selected item being played. """
372+
373+ trackTitle = "Foss Yeaaaah! (Radio Edit)"
374+ artistName = "Benjamin Kerensa"
375+
376+ # get number of tracks in queue before queuing a track
377+ initialtracksCount = self.main_view.get_queue_track_count()
378+
379+ # switch to songs tab
380+ self.main_view.switch_to_tab("trackstab")
381+
382+ # get track item to add to queue
383+ trackitem = self.main_view.get_songs_tab_tracktitle(trackTitle)
384+ self.pointing_device.click_object(trackitem)
385+
386+ # verify track queue has added all songs to initial value
387+ endtracksCount = self.main_view.get_queue_track_count()
388+ self.assertThat(endtracksCount, Equals(initialtracksCount + 3))
389+
390+ # Assert that the song added to the list is playing
391+ self.assertThat(self.main_view.currentIndex,
392+ Eventually(NotEquals(endtracksCount)))
393+ self.assertThat(self.main_view.isPlaying, Eventually(Equals(True)))
394+
395+ # verify song's metadata matches the item added to the Now Playing view
396+ queueArtistName = self.main_view.get_queue_now_playing_artist(
397+ artistName)
398+ self.assertThat(str(queueArtistName.text), Equals(artistName))
399+ queueTrackTitle = self.main_view.get_queue_now_playing_title(
400+ trackTitle)
401+ self.assertThat(str(queueTrackTitle.text), Equals(trackTitle))
402+
403+ def test_add_song_to_queue_from_songs_tab(self):
404+ """tests navigating to the Songs tab and adding a song from the library
405+ to the queue via the expandable list view item. """
406+
407+ trackTitle = "Foss Yeaaaah! (Radio Edit)"
408+ artistName = "Benjamin Kerensa"
409+
410+ # get number of tracks in queue before queuing a track
411+ initialtracksCount = self.main_view.get_queue_track_count()
412+
413+ # switch to songs tab
414+ self.main_view.switch_to_tab("trackstab")
415+
416+ # get track item to add to queue
417+ trackitem = self.main_view.get_songs_tab_trackimage(trackTitle)
418+ self.pointing_device.click_object(trackitem)
419+ addtoqueueLabel = self.main_view.get_songs_tab_add_to_queue_label()
420+ self.pointing_device.click_object(addtoqueueLabel)
421+
422+ # verify track queue has added all songs to initial value
423+ endtracksCount = self.main_view.get_queue_track_count()
424+ self.assertThat(endtracksCount, Equals(initialtracksCount + 1))
425+
426+ # Assert that the song added to the list is not playing
427+ self.assertThat(self.main_view.currentIndex,
428+ Eventually(NotEquals(endtracksCount)))
429+ self.assertThat(self.main_view.isPlaying, Eventually(Equals(False)))
430+
431+ # verify song's metadata matches the item added to the Now Playing view
432+ queueArtistName = self.main_view.get_queue_now_playing_artist(
433+ artistName)
434+ self.assertThat(str(queueArtistName.text), Equals(artistName))
435+ queueTrackTitle = self.main_view.get_queue_now_playing_title(
436+ trackTitle)
437+ self.assertThat(str(queueTrackTitle.text), Equals(trackTitle))
438+
439+ def test_create_playlist_from_songs_tab(self):
440+ """tests navigating to the Songs tab and creating a playlist by
441+ selecting a song to add it to a new playlist. """
442+
443+ trackTitle = "Foss Yeaaaah! (Radio Edit)"
444+
445+ # switch to songs tab
446+ self.main_view.switch_to_tab("trackstab")
447+
448+ # get track item to add to queue
449+ trackitem = self.main_view.get_songs_tab_trackimage(trackTitle)
450+ self.pointing_device.click_object(trackitem)
451+ addtoplaylistLbl = self.main_view.get_songs_tab_add_to_playlist_label()
452+ self.pointing_device.click_object(addtoplaylistLbl)
453+
454+ # get initial list view playlist count
455+ playlist_count = self.main_view.get_addtoplaylistview()[0].count
456+
457+ # click on New playlist button
458+ newplaylistButton = self.main_view.get_newplaylistButton()[0]
459+ self.pointing_device.click_object(newplaylistButton)
460+
461+ # input playlist name
462+ playlistNameFld = self.main_view.get_newPlaylistDialog_name_textfield()
463+ self.pointing_device.click_object(playlistNameFld)
464+ self.keyboard.type("MyPlaylist")
465+
466+ # click on get_newPlaylistDialog create Button
467+ createButton = self.main_view.get_newPlaylistDialog_createButton()
468+ self.pointing_device.click_object(createButton)
469+
470+ # verify playlist has been sucessfully created
471+ palylist_final_count = self.main_view.get_addtoplaylistview()[0].count
472+ self.assertThat(palylist_final_count, Equals(playlist_count + 1))
473+ playlist = self.main_view.get_playlistname("MyPlaylist")
474+ self.assertThat(playlist, Not(Is(None)))
475+
476+ # select playlist to add song to
477+ self.pointing_device.click_object(playlist)
478+
479+ # verify song has been added to playlist
480+ playlistslist = self.main_view.get_playlistslist()
481+ self.assertThat(playlistslist.count, Equals(1))
482+
483+ def test_swipe_to_delete_song(self):
484+ """tests navigating to the Now Playing queue, swiping to delete a
485+ track, and confirming the delete action. """
486+
487+ artistName = "Benjamin Kerensa"
488+
489+ # populate queue
490+ first_genre_item = self.main_view.get_first_genre_item()
491+ self.pointing_device.click_object(first_genre_item)
492+
493+ # get initial queue count
494+ initialqueueCount = self.main_view.get_queue_track_count()
495+
496+ # get song to delete
497+ artistToDelete = self.main_view.get_queue_now_playing_artist(
498+ artistName)
499+ musicnowplayingpage = self.main_view.get_MusicNowPlaying_page()
500+
501+ # get coordinates to delete song
502+ startX = int(artistToDelete.x + musicnowplayingpage.width * 0.30)
503+ stopX = int(artistToDelete.x + musicnowplayingpage.width)
504+ lineY = int(artistToDelete.globalRect[1])
505+
506+ # swipe to remove song
507+ self.pointing_device.move(startX, lineY)
508+ self.pointing_device.drag(startX, lineY, stopX, lineY)
509+
510+ # click on delete icon/label to confirm removal
511+ swipedeleteicon = self.main_view.get_swipedelete_icon()
512+ self.pointing_device.click_object(swipedeleteicon)
513+
514+ # verify song has been deleted
515+ finalqueueCount = self.main_view.get_queue_track_count()
516+ self.assertThat(finalqueueCount, Equals(initialqueueCount - 1))

Subscribers

People subscribed via source and target branches

to status/vote changes: