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
=== modified file 'MusicNowPlaying.qml'
--- MusicNowPlaying.qml 2013-12-05 21:21:32 +0000
+++ MusicNowPlaying.qml 2013-12-16 21:23:29 +0000
@@ -29,6 +29,7 @@
2929
30Page {30Page {
31 id: nowPlaying31 id: nowPlaying
32 objectName: "nowplayingpage"
32 anchors.fill: parent33 anchors.fill: parent
33 title: i18n.tr("Queue")34 title: i18n.tr("Queue")
34 visible: false35 visible: false
3536
=== modified file 'MusicPlaylists.qml'
--- MusicPlaylists.qml 2013-12-02 03:42:54 +0000
+++ MusicPlaylists.qml 2013-12-16 21:23:29 +0000
@@ -131,8 +131,8 @@
131 // page for the playlists131 // page for the playlists
132 Page {132 Page {
133 id: listspage133 id: listspage
134 // TRANSLATORS: this is the name of the playlists page shown in the tab header.134 // TRANSLATORS: this is the name of the playlists page shown in the tab header.
135 // Remember to keep the translation short to fit the screen width135 // Remember to keep the translation short to fit the screen width
136 title: i18n.tr("Playlists")136 title: i18n.tr("Playlists")
137137
138 onVisibleChanged: {138 onVisibleChanged: {
@@ -144,6 +144,7 @@
144144
145 ListView {145 ListView {
146 id: playlistslist146 id: playlistslist
147 objectName: "playlistslist"
147 anchors.fill: parent148 anchors.fill: parent
148 anchors.bottomMargin: musicToolbar.mouseAreaOffset + musicToolbar.minimizedHeight149 anchors.bottomMargin: musicToolbar.mouseAreaOffset + musicToolbar.minimizedHeight
149 model: playlistModel.model150 model: playlistModel.model
@@ -338,7 +339,7 @@
338 anchors.leftMargin: units.gu(0.5)339 anchors.leftMargin: units.gu(0.5)
339 color: styleMusic.common.white340 color: styleMusic.common.white
340 fontSize: "small"341 fontSize: "small"
341 // TRANSLATORS: this refers to editing a playlist342 // TRANSLATORS: this refers to editing a playlist
342 text: i18n.tr("Edit")343 text: i18n.tr("Edit")
343 }344 }
344 MouseArea {345 MouseArea {
@@ -380,7 +381,7 @@
380 anchors.leftMargin: units.gu(0.5)381 anchors.leftMargin: units.gu(0.5)
381 color: styleMusic.common.white382 color: styleMusic.common.white
382 fontSize: "small"383 fontSize: "small"
383 // TRANSLATORS: this refers to deleting a playlist384 // TRANSLATORS: this refers to deleting a playlist
384 text: i18n.tr("Delete")385 text: i18n.tr("Delete")
385 }386 }
386 MouseArea {387 MouseArea {
@@ -424,7 +425,7 @@
424 anchors.leftMargin: units.gu(0.5)425 anchors.leftMargin: units.gu(0.5)
425 color: styleMusic.common.white426 color: styleMusic.common.white
426 fontSize: "small"427 fontSize: "small"
427 // TRANSLATORS: this refers to sharing a playlist428 // TRANSLATORS: this refers to sharing a playlist
428 text: i18n.tr("Share")429 text: i18n.tr("Share")
429 }430 }
430 MouseArea {431 MouseArea {
@@ -565,7 +566,7 @@
565566
566 Label {567 Label {
567 id: playlistInfoCount568 id: playlistInfoCount
568 text: i18n.tr("%1 song", "%1 songs", playlist.count).arg(playlist.count)569 text: i18n.tr("%1 song", "%1 songs", playlist.count).arg(playlist.count)
569 color: styleMusic.common.white570 color: styleMusic.common.white
570 fontSize: "medium"571 fontSize: "medium"
571 anchors.left: parent.left572 anchors.left: parent.left
572573
=== modified file 'MusicTracks.qml'
--- MusicTracks.qml 2013-12-02 03:42:54 +0000
+++ MusicTracks.qml 2013-12-16 21:23:29 +0000
@@ -95,6 +95,7 @@
95 }95 }
96 Label {96 Label {
97 id: trackTitle97 id: trackTitle
98 objectName: "tracktitle"
98 wrapMode: Text.NoWrap99 wrapMode: Text.NoWrap
99 maximumLineCount: 1100 maximumLineCount: 1
100 fontSize: "small"101 fontSize: "small"
@@ -163,6 +164,7 @@
163 //Icon { // use for 1.0164 //Icon { // use for 1.0
164 Image {165 Image {
165 id: expandItem166 id: expandItem
167 objectName: "trackimage"
166 anchors.right: parent.right168 anchors.right: parent.right
167 anchors.rightMargin: units.gu(2)169 anchors.rightMargin: units.gu(2)
168 // name: "dropdown-menu" Use for 1.0170 // name: "dropdown-menu" Use for 1.0
@@ -256,6 +258,7 @@
256 width: styleMusic.common.expandedItem258 width: styleMusic.common.expandedItem
257 }259 }
258 Label {260 Label {
261 objectName: "songstab_addtoplaylist"
259 anchors.left: playlistTrack.right262 anchors.left: playlistTrack.right
260 anchors.leftMargin: units.gu(0.5)263 anchors.leftMargin: units.gu(0.5)
261 anchors.top: parent.top264 anchors.top: parent.top
@@ -305,6 +308,7 @@
305 width: styleMusic.common.expandedItem308 width: styleMusic.common.expandedItem
306 }309 }
307 Label {310 Label {
311 objectName: "songstab_addtoqueue"
308 anchors.left: queueTrack.right312 anchors.left: queueTrack.right
309 anchors.leftMargin: units.gu(0.5)313 anchors.leftMargin: units.gu(0.5)
310 anchors.top: parent.top314 anchors.top: parent.top
311315
=== modified file 'MusicaddtoPlaylist.qml'
--- MusicaddtoPlaylist.qml 2013-11-19 17:51:07 +0000
+++ MusicaddtoPlaylist.qml 2013-12-16 21:23:29 +0000
@@ -64,11 +64,13 @@
64 // show each playlist and make them chosable64 // show each playlist and make them chosable
65 ListView {65 ListView {
66 id: addtoPlaylistView66 id: addtoPlaylistView
67 objectName: "addtoplaylistview"
67 width: parent.width68 width: parent.width
68 height: parent.width69 height: parent.width
69 model: playlistModel.model70 model: playlistModel.model
70 delegate: ListItem.Standard {71 delegate: ListItem.Standard {
71 id: playlist72 id: playlist
73 objectName: "playlist"
72 height: units.gu(8)74 height: units.gu(8)
73 property string name: model.name75 property string name: model.name
74 property string count: model.count76 property string count: model.count
@@ -158,6 +160,7 @@
158160
159 Button {161 Button {
160 id: newPlaylistItem162 id: newPlaylistItem
163 objectName: "newplaylistButton"
161 text: i18n.tr("New playlist")164 text: i18n.tr("New playlist")
162 iconSource: "images/add.svg"165 iconSource: "images/add.svg"
163 iconPosition: "left"166 iconPosition: "left"
164167
=== modified file 'music-app.qml'
--- music-app.qml 2013-12-14 19:37:34 +0000
+++ music-app.qml 2013-12-16 21:23:29 +0000
@@ -1010,6 +1010,7 @@
1010 text: i18n.tr("Name your playlist.")1010 text: i18n.tr("Name your playlist.")
1011 TextField {1011 TextField {
1012 id: playlistName1012 id: playlistName
1013 objectName: "playlistnameTextfield"
1013 placeholderText: i18n.tr("Name")1014 placeholderText: i18n.tr("Name")
1014 }1015 }
1015 ListItem.Standard {1016 ListItem.Standard {
@@ -1019,6 +1020,7 @@
10191020
1020 Button {1021 Button {
1021 text: i18n.tr("Create")1022 text: i18n.tr("Create")
1023 objectName: "newPlaylistDialog_createButton"
1022 onClicked: {1024 onClicked: {
1023 newplaylistoutput.visible = false // make sure its hidden now if there was an error last time1025 newplaylistoutput.visible = false // make sure its hidden now if there was an error last time
1024 if (playlistName.text.length > 0) { // make sure something is acually inputed1026 if (playlistName.text.length > 0) { // make sure something is acually inputed
10251027
=== modified file 'tests/autopilot/music_app/emulators.py'
--- tests/autopilot/music_app/emulators.py 2013-12-04 21:25:45 +0000
+++ tests/autopilot/music_app/emulators.py 2013-12-16 21:23:29 +0000
@@ -147,3 +147,69 @@
147 for item in playingtitles:147 for item in playingtitles:
148 if item.text == trackTitle:148 if item.text == trackTitle:
149 return item149 return item
150
151 def get_songs_tab_tracktitle(self, trackTitle):
152 tracktitles = self.select_many_retry(
153 "Label", objectName="tracktitle")
154 for item in tracktitles:
155 if item.text == trackTitle:
156 return item
157
158 def get_songs_tab_trackimage(self, trackTitle):
159 trackimages = self.select_many_retry(
160 "QQuickImage", objectName="trackimage")
161 tracktitles = self.get_songs_tab_tracktitle(trackTitle)
162 imageheight = trackimages[0].height
163 trackimage_position = tracktitles.globalRect[1] + (imageheight / 2)
164 for item in trackimages:
165 if item.globalRect[1] == trackimage_position:
166 return item
167
168 def get_songs_tab_add_to_queue_label(self):
169 addtoqueue = self.select_many(
170 "Label", objectName="songstab_addtoqueue")
171 for item in addtoqueue:
172 if item.visible:
173 return item
174
175 def get_songs_tab_add_to_playlist_label(self):
176 addtoplaylist = self.select_many(
177 "Label", objectName="songstab_addtoplaylist")
178 for item in addtoplaylist:
179 if item.visible:
180 return item
181
182 def get_newplaylistButton(self):
183 return self.select_many_retry("Button", objectName="newplaylistButton")
184
185 def get_newPlaylistDialog_createButton(self):
186 return self.wait_select_single(
187 "Button", objectName="newPlaylistDialog_createButton")
188
189 def get_newPlaylistDialog_name_textfield(self):
190 return self.wait_select_single(
191 "TextField", objectName="playlistnameTextfield")
192
193 def get_addtoplaylistview(self):
194 return self.select_many_retry(
195 "QQuickListView", objectName="addtoplaylistview")
196
197 def get_playlistname(self, playlistname):
198 playlistnames = self.select_many_retry(
199 "Standard", objectName="playlist")
200 for item in playlistnames:
201 if item.name == playlistname:
202 return item
203
204 def get_playlistslist(self):
205 return self.wait_select_single(
206 "QQuickListView", objectName="playlistslist")
207
208 def get_MusicNowPlaying_page(self):
209 return self.wait_select_single(
210 "MusicNowPlaying", objectName="nowplayingpage")
211
212 def get_swipedelete_icon(self):
213 swipedelete = self.wait_select_single(
214 "SwipeDelete", direction="swipingRight")
215 return swipedelete.select_many("Icon", name="delete")[1]
150216
=== modified file 'tests/autopilot/music_app/tests/__init__.py'
--- tests/autopilot/music_app/tests/__init__.py 2013-11-04 22:34:00 +0000
+++ tests/autopilot/music_app/tests/__init__.py 2013-12-16 21:23:29 +0000
@@ -47,6 +47,9 @@
47 local_location_dir = os.path.dirname(os.path.dirname(working_dir))47 local_location_dir = os.path.dirname(os.path.dirname(working_dir))
48 local_location = local_location_dir + "/music-app.qml"48 local_location = local_location_dir + "/music-app.qml"
49 installed_location = "/usr/share/music-app/music-app.qml"49 installed_location = "/usr/share/music-app/music-app.qml"
50 sqlite_dir = os.path.expanduser(
51 "~/.local/share/com.ubuntu.music/Databases")
52 backup_dir = sqlite_dir + ".backup"
5053
51 def setup_environment(self):54 def setup_environment(self):
52 if os.path.exists(self.local_location):55 if os.path.exists(self.local_location):
@@ -61,6 +64,10 @@
61 return launch, test_type64 return launch, test_type
6265
63 def setUp(self):66 def setUp(self):
67 #backup and wipe db's before testing
68 self.temp_move_sqlite_db()
69 self.addCleanup(self.restore_sqlite_db)
70
64 launch, self.test_type = self.setup_environment()71 launch, self.test_type = self.setup_environment()
65 if self.test_type != 'click':72 if self.test_type != 'click':
66 self.home_dir = self._patch_home()73 self.home_dir = self._patch_home()
@@ -206,6 +213,35 @@
206 os.remove(in_filename)213 os.remove(in_filename)
207 os.rename(out_filename, in_filename)214 os.rename(out_filename, in_filename)
208215
216 def temp_move_sqlite_db(self):
217 try:
218 shutil.rmtree(self.backup_dir)
219 except:
220 pass
221 else:
222 logger.warning("Prexisting backup database found and removed")
223
224 try:
225 shutil.move(self.sqlite_dir, self.backup_dir)
226 except:
227 logger.warning("No current database found")
228 else:
229 logger.debug("Backed up database")
230
231 def restore_sqlite_db(self):
232 if os.path.exists(self.backup_dir):
233 if os.path.exists(self.sqlite_dir):
234 try:
235 shutil.rmtree(self.sqlite_dir)
236 except:
237 logger.error("Failed to remove test database and restore" /
238 "database")
239 return
240 try:
241 shutil.move(self.backup_dir, self.sqlite_dir)
242 except:
243 logger.error("Failed to restore database")
244
209 @property245 @property
210 def main_view(self):246 def main_view(self):
211 return self.app.select_single(emulators.MainView)247 return self.app.select_single(emulators.MainView)
212248
=== modified file 'tests/autopilot/music_app/tests/test_music.py'
--- tests/autopilot/music_app/tests/test_music.py 2013-12-12 19:26:33 +0000
+++ tests/autopilot/music_app/tests/test_music.py 2013-12-16 21:23:29 +0000
@@ -13,7 +13,6 @@
13import logging13import logging
14from autopilot.matchers import Eventually14from autopilot.matchers import Eventually
15from testtools.matchers import Equals, Is, Not, LessThan, NotEquals15from testtools.matchers import Equals, Is, Not, LessThan, NotEquals
16from testtools.matchers import GreaterThan
1716
1817
19from music_app.tests import MusicTestCase18from music_app.tests import MusicTestCase
@@ -308,6 +307,7 @@
308 self.assertThat(self.main_view.get_albumstab(), Not(Is(None)))307 self.assertThat(self.main_view.get_albumstab(), Not(Is(None)))
309308
310 def test_add_song_to_queue_from_albums_sheet(self):309 def test_add_song_to_queue_from_albums_sheet(self):
310 """tests navigating to the Albums tab and adding a song to queue"""
311311
312 trackTitle = "Foss Yeaaaah! (Radio Edit)"312 trackTitle = "Foss Yeaaaah! (Radio Edit)"
313 artistName = "Benjamin Kerensa"313 artistName = "Benjamin Kerensa"
@@ -344,50 +344,6 @@
344 Eventually(NotEquals(endtracksCount)))344 Eventually(NotEquals(endtracksCount)))
345 self.assertThat(self.main_view.isPlaying, Eventually(Equals(False)))345 self.assertThat(self.main_view.isPlaying, Eventually(Equals(False)))
346346
347 #verity song's metadata matches the item added to the Now Playing view
348 queueArtistName = self.main_view.get_queue_now_playing_artist(
349 artistName)
350 self.assertThat(str(queueArtistName.text), Equals(artistName))
351 queueTrackTitle = self.main_view.get_queue_now_playing_title(
352 trackTitle)
353 self.assertThat(str(queueTrackTitle.text), Equals(trackTitle))
354
355 # click on close button to close album sheet
356 closebutton = self.main_view.get_album_sheet_close_button()
357 self.pointing_device.click_object(closebutton)
358 self.assertThat(self.main_view.get_albumstab(), Not(Is(None)))
359
360 def test_add_album_to_queue_from_albums_sheet(self):
361
362 trackTitle = "Foss Yeaaaah! (Radio Edit)"
363 artistName = "Benjamin Kerensa"
364
365 # get number of tracks in queue before queuing a track
366 initialtracksCount = self.main_view.get_queue_track_count()
367
368 # switch to albums tab
369 self.main_view.switch_to_tab("albumstab")
370
371 #select album
372 albumartist = self.main_view.get_albums_albumartist(artistName)
373 self.pointing_device.click_object(albumartist)
374
375 #get album sheet album artist
376 sheet_albumartist = self.main_view.get_album_sheet_artist()
377 self.assertThat(sheet_albumartist.text, Eventually(Equals(artistName)))
378
379 #get track item to add to queue
380 trackitem = self.main_view.get_album_sheet_listview_tracktitle(
381 trackTitle)
382 self.pointing_device.click_object(trackitem)
383
384 #Assert that a song form the album added to the list is playing
385 self.assertThat(self.main_view.isPlaying, Eventually(Equals(True)))
386
387 # verify track queue count is greater than initial value
388 endtracksCount = self.main_view.get_queue_track_count()
389 self.assertThat(endtracksCount, GreaterThan(initialtracksCount))
390
391 #verify song's metadata matches the item added to the Now Playing view347 #verify song's metadata matches the item added to the Now Playing view
392 queueArtistName = self.main_view.get_queue_now_playing_artist(348 queueArtistName = self.main_view.get_queue_now_playing_artist(
393 artistName)349 artistName)
@@ -395,3 +351,157 @@
395 queueTrackTitle = self.main_view.get_queue_now_playing_title(351 queueTrackTitle = self.main_view.get_queue_now_playing_title(
396 trackTitle)352 trackTitle)
397 self.assertThat(str(queueTrackTitle.text), Equals(trackTitle))353 self.assertThat(str(queueTrackTitle.text), Equals(trackTitle))
354
355 # click on close button to close album sheet
356 closebutton = self.main_view.get_album_sheet_close_button()
357 self.pointing_device.click_object(closebutton)
358 self.assertThat(self.main_view.get_albumstab(), Not(Is(None)))
359
360 def test_add_songs_to_queue_from_songs_tab_and_play(self):
361 """tests navigating to the Songs tab and adding the library to the
362 queue with the selected item being played. """
363
364 trackTitle = "Foss Yeaaaah! (Radio Edit)"
365 artistName = "Benjamin Kerensa"
366
367 # get number of tracks in queue before queuing a track
368 initialtracksCount = self.main_view.get_queue_track_count()
369
370 # switch to songs tab
371 self.main_view.switch_to_tab("trackstab")
372
373 # get track item to add to queue
374 trackitem = self.main_view.get_songs_tab_tracktitle(trackTitle)
375 self.pointing_device.click_object(trackitem)
376
377 # verify track queue has added all songs to initial value
378 endtracksCount = self.main_view.get_queue_track_count()
379 self.assertThat(endtracksCount, Equals(initialtracksCount + 3))
380
381 # Assert that the song added to the list is playing
382 self.assertThat(self.main_view.currentIndex,
383 Eventually(NotEquals(endtracksCount)))
384 self.assertThat(self.main_view.isPlaying, Eventually(Equals(True)))
385
386 # verify song's metadata matches the item added to the Now Playing view
387 queueArtistName = self.main_view.get_queue_now_playing_artist(
388 artistName)
389 self.assertThat(str(queueArtistName.text), Equals(artistName))
390 queueTrackTitle = self.main_view.get_queue_now_playing_title(
391 trackTitle)
392 self.assertThat(str(queueTrackTitle.text), Equals(trackTitle))
393
394 def test_add_song_to_queue_from_songs_tab(self):
395 """tests navigating to the Songs tab and adding a song from the library
396 to the queue via the expandable list view item. """
397
398 trackTitle = "Foss Yeaaaah! (Radio Edit)"
399 artistName = "Benjamin Kerensa"
400
401 # get number of tracks in queue before queuing a track
402 initialtracksCount = self.main_view.get_queue_track_count()
403
404 # switch to songs tab
405 self.main_view.switch_to_tab("trackstab")
406
407 # get track item to add to queue
408 trackitem = self.main_view.get_songs_tab_trackimage(trackTitle)
409 self.pointing_device.click_object(trackitem)
410 addtoqueueLabel = self.main_view.get_songs_tab_add_to_queue_label()
411 self.pointing_device.click_object(addtoqueueLabel)
412
413 # verify track queue has added all songs to initial value
414 endtracksCount = self.main_view.get_queue_track_count()
415 self.assertThat(endtracksCount, Equals(initialtracksCount + 1))
416
417 # Assert that the song added to the list is not playing
418 self.assertThat(self.main_view.currentIndex,
419 Eventually(NotEquals(endtracksCount)))
420 self.assertThat(self.main_view.isPlaying, Eventually(Equals(False)))
421
422 # verify song's metadata matches the item added to the Now Playing view
423 queueArtistName = self.main_view.get_queue_now_playing_artist(
424 artistName)
425 self.assertThat(str(queueArtistName.text), Equals(artistName))
426 queueTrackTitle = self.main_view.get_queue_now_playing_title(
427 trackTitle)
428 self.assertThat(str(queueTrackTitle.text), Equals(trackTitle))
429
430 def test_create_playlist_from_songs_tab(self):
431 """tests navigating to the Songs tab and creating a playlist by
432 selecting a song to add it to a new playlist. """
433
434 trackTitle = "Foss Yeaaaah! (Radio Edit)"
435
436 # switch to songs tab
437 self.main_view.switch_to_tab("trackstab")
438
439 # get track item to add to queue
440 trackitem = self.main_view.get_songs_tab_trackimage(trackTitle)
441 self.pointing_device.click_object(trackitem)
442 addtoplaylistLbl = self.main_view.get_songs_tab_add_to_playlist_label()
443 self.pointing_device.click_object(addtoplaylistLbl)
444
445 # get initial list view playlist count
446 playlist_count = self.main_view.get_addtoplaylistview()[0].count
447
448 # click on New playlist button
449 newplaylistButton = self.main_view.get_newplaylistButton()[0]
450 self.pointing_device.click_object(newplaylistButton)
451
452 # input playlist name
453 playlistNameFld = self.main_view.get_newPlaylistDialog_name_textfield()
454 self.pointing_device.click_object(playlistNameFld)
455 self.keyboard.type("MyPlaylist")
456
457 # click on get_newPlaylistDialog create Button
458 createButton = self.main_view.get_newPlaylistDialog_createButton()
459 self.pointing_device.click_object(createButton)
460
461 # verify playlist has been sucessfully created
462 palylist_final_count = self.main_view.get_addtoplaylistview()[0].count
463 self.assertThat(palylist_final_count, Equals(playlist_count + 1))
464 playlist = self.main_view.get_playlistname("MyPlaylist")
465 self.assertThat(playlist, Not(Is(None)))
466
467 # select playlist to add song to
468 self.pointing_device.click_object(playlist)
469
470 # verify song has been added to playlist
471 playlistslist = self.main_view.get_playlistslist()
472 self.assertThat(playlistslist.count, Equals(1))
473
474 def test_swipe_to_delete_song(self):
475 """tests navigating to the Now Playing queue, swiping to delete a
476 track, and confirming the delete action. """
477
478 artistName = "Benjamin Kerensa"
479
480 # populate queue
481 first_genre_item = self.main_view.get_first_genre_item()
482 self.pointing_device.click_object(first_genre_item)
483
484 # get initial queue count
485 initialqueueCount = self.main_view.get_queue_track_count()
486
487 # get song to delete
488 artistToDelete = self.main_view.get_queue_now_playing_artist(
489 artistName)
490 musicnowplayingpage = self.main_view.get_MusicNowPlaying_page()
491
492 # get coordinates to delete song
493 startX = int(artistToDelete.x + musicnowplayingpage.width * 0.30)
494 stopX = int(artistToDelete.x + musicnowplayingpage.width)
495 lineY = int(artistToDelete.globalRect[1])
496
497 # swipe to remove song
498 self.pointing_device.move(startX, lineY)
499 self.pointing_device.drag(startX, lineY, stopX, lineY)
500
501 # click on delete icon/label to confirm removal
502 swipedeleteicon = self.main_view.get_swipedelete_icon()
503 self.pointing_device.click_object(swipedeleteicon)
504
505 # verify song has been deleted
506 finalqueueCount = self.main_view.get_queue_track_count()
507 self.assertThat(finalqueueCount, Equals(initialqueueCount - 1))

Subscribers

People subscribed via source and target branches

to status/vote changes: