Merge lp:~carla-sella/music-app/queue-track-test into lp:music-app/trusty

Proposed by Carla Sella
Status: Merged
Approved by: Victor Thompson
Approved revision: 265
Merged at revision: 267
Proposed branch: lp:~carla-sella/music-app/queue-track-test
Merge into: lp:music-app/trusty
Diff against target: 188 lines (+101/-1)
4 files modified
MusicAlbums.qml (+4/-0)
MusicNowPlaying.qml (+4/-0)
tests/autopilot/music_app/emulators.py (+42/-0)
tests/autopilot/music_app/tests/test_music.py (+51/-1)
To merge this branch: bzr merge lp:~carla-sella/music-app/queue-track-test
Reviewer Review Type Date Requested Status
Victor Thompson Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Nicholas Skaggs Pending
Review via email: mp+197443@code.launchpad.net

Commit message

Autopilot test for music-app

Description of the change

Added test_add_song_to_queue_from_albums_sheet.
Fixed Bug #1253452.

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
Victor Thompson (vthompson) wrote :

Consider also doing the following (but I don't think it's absolutely required to do so):
1. Assert that the song added to the list is not playing.
2. Assert that the song's metadata matches the item added to the Now Playing view (the queue).

review: Approve
Revision history for this message
Carla Sella (carla-sella) wrote :

@Victor: I found in the queue, using autopilot vis, the item where the song has been added, but cannot distinguish it from the others, do not find a count ID or something that distinguishes that song queued from the others.
For instance if I queue twice the same song, cannot find the last one queued as they both have the same title and artist.
Can you suggest something for this ?
Thanks.

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 :

Can you get the last item in the ListView that you use to determine the
queue count?
On Dec 3, 2013 3:03 PM, "Carla Sella" <email address hidden> wrote:

> @Victor: I found in the queue, using autopilot vis, the item where the
> song has been added, but cannot distinguish it from the others, do not find
> a count ID or something that distinguishes that song queued from the others.
> For instance if I queue twice the same song, cannot find the last one
> queued as they both have the same title and artist.
> Can you suggest something for this ?
> Thanks.
> --
>
> https://code.launchpad.net/~carla-sella/music-app/queue-track-test/+merge/197443
> You are reviewing the proposed merge of
> lp:~carla-sella/music-app/queue-track-test into lp:music-app.
>

Revision history for this message
Carla Sella (carla-sella) wrote :

Yes.
What I can get in the ListView is the count property, but then I have, for instance, three objects named "Standard" containing the information about the queued items (track title, track author ...) but there is no way to determine witch of the three objects is the last queued a part the fact that it is in the last position, but I need a property to verify it's the last one.

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

I just put out a merge proposal that makes the initial state of the queue empty [1]. If that get's approved by the other developers on the music-app team, then you're problem should be solved as there should only be one item from a fresh start.

I might look a bit more later this evening, however, to see if I can help with an immediate solution.

[1] https://code.launchpad.net/~vthompson/music-app/start-with-empty-queue/+merge/197610

Revision history for this message
Carla Sella (carla-sella) wrote :

I tried to verify metadata matches the item added to the queue taking for granted that there is no other same track in the queue.
Hope this is ok.
So bug #1253452 should be fixed now.

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 :

Added verification looks good.

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

I just wanted to add that this perhaps isn't the best verification after looking it over a second time. It's possible that in the future the metadata being checked for against the first item being added to the queue won't be initialized until we start playing a song (this case seems ideal to me.). We'll cross that bridge when we get there, however. :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'MusicAlbums.qml'
2--- MusicAlbums.qml 2013-12-01 08:52:59 +0000
3+++ MusicAlbums.qml 2013-12-04 21:27:24 +0000
4@@ -241,6 +241,7 @@
5
6 ListItem.Standard {
7 id: track
8+ objectName: "albumsheet-track"
9 iconFrame: false
10 progression: false
11 height: styleMusic.albums.itemHeight
12@@ -267,6 +268,7 @@
13
14 Label {
15 id: trackTitle
16+ objectName: "albumsheet-tracktitle"
17 wrapMode: Text.NoWrap
18 maximumLineCount: 1
19 fontSize: "medium"
20@@ -284,6 +286,7 @@
21
22 Image {
23 id: expandItem
24+ objectName: "albumsheet-expanditem"
25 anchors.right: parent.right
26 anchors.rightMargin: units.gu(2)
27 source: expandable.visible ? "images/dropdown-menu-up.svg" : "images/dropdown-menu.svg"
28@@ -410,6 +413,7 @@
29 width: units.gu(15)
30 Image {
31 id: queueTrack
32+ objectName: "albumsheet-queuetrack"
33 anchors.top: parent.top
34 anchors.topMargin: height/2
35 source: "images/queue.png"
36
37=== modified file 'MusicNowPlaying.qml'
38--- MusicNowPlaying.qml 2013-12-01 08:52:59 +0000
39+++ MusicNowPlaying.qml 2013-12-04 21:27:24 +0000
40@@ -104,6 +104,7 @@
41
42 ListView {
43 id: queuelist
44+ objectName: "queuelist"
45 anchors.fill: parent
46 anchors.bottomMargin: musicToolbar.mouseAreaOffset + musicToolbar.minimizedHeight
47 anchors.topMargin: nowPlayingBackButton.height
48@@ -561,6 +562,7 @@
49 }
50 Label {
51 id: nowPlayingArtist
52+ objectName: "nowplayingartist"
53 color: styleMusic.nowPlaying.labelSecondaryColor
54 elide: Text.ElideRight
55 height: units.gu(1)
56@@ -572,6 +574,7 @@
57 }
58 Label {
59 id: nowPlayingTitle
60+ objectName: "nowplayingtitle"
61 color: styleMusic.common.white
62 elide: Text.ElideRight
63 height: units.gu(1)
64@@ -583,6 +586,7 @@
65 }
66 Label {
67 id: nowPlayingAlbum
68+ objectName: "nowplayingalbum"
69 color: styleMusic.nowPlaying.labelSecondaryColor
70 elide: Text.ElideRight
71 height: units.gu(1)
72
73=== modified file 'tests/autopilot/music_app/emulators.py'
74--- tests/autopilot/music_app/emulators.py 2013-11-26 21:42:53 +0000
75+++ tests/autopilot/music_app/emulators.py 2013-12-04 21:27:24 +0000
76@@ -105,3 +105,45 @@
77 for item in closebuttons:
78 if item.enabled:
79 return item
80+
81+ def get_album_sheet_listview_tracktitle(self, trackTitle):
82+ tracktitles = self.select_many(
83+ "Label", objectName="albumsheet-tracktitle")
84+ for item in tracktitles:
85+ if item.text == trackTitle:
86+ return item
87+
88+ def get_album_sheet_listview_trackicon(self, trackTitle):
89+ tracktitle = self.get_album_sheet_listview_tracktitle(trackTitle)
90+ tracktitle_position = tracktitle.globalRect[1]
91+ trackicons = self.select_many(
92+ "QQuickImage", objectName="albumsheet-expanditem")
93+ for item in trackicons:
94+ if item.globalRect[1] == tracktitle_position:
95+ return item
96+
97+ def get_album_sheet_queuetrack_image(self):
98+ queuetracks = self.select_many_retry(
99+ "QQuickImage", objectName="albumsheet-queuetrack")
100+ for item in queuetracks:
101+ if item.visible:
102+ return item
103+
104+ def get_queue_track_count(self):
105+ queuelist = self.select_single(
106+ "QQuickListView", objectName="queuelist")
107+ return queuelist.count
108+
109+ def get_queue_now_playing_artist(self, artistName):
110+ playingartists = self.select_many(
111+ "Label", objectName="nowplayingartist")
112+ for item in playingartists:
113+ if item.text == artistName:
114+ return item
115+
116+ def get_queue_now_playing_title(self, trackTitle):
117+ playingtitles = self.select_many(
118+ "Label", objectName="nowplayingtitle")
119+ for item in playingtitles:
120+ if item.text == trackTitle:
121+ return item
122
123=== modified file 'tests/autopilot/music_app/tests/test_music.py'
124--- tests/autopilot/music_app/tests/test_music.py 2013-11-27 21:13:57 +0000
125+++ tests/autopilot/music_app/tests/test_music.py 2013-12-04 21:27:24 +0000
126@@ -10,7 +10,7 @@
127 from __future__ import absolute_import
128
129 from autopilot.matchers import Eventually
130-from testtools.matchers import Equals, Is, Not, LessThan
131+from testtools.matchers import Equals, Is, Not, LessThan, NotEquals
132
133 from music_app.tests import MusicTestCase
134
135@@ -219,3 +219,53 @@
136 closebutton = self.main_view.get_album_sheet_close_button()
137 self.pointing_device.click_object(closebutton)
138 self.assertThat(self.main_view.get_albumstab(), Not(Is(None)))
139+
140+ def test_add_song_to_queue_from_albums_sheet(self):
141+
142+ trackTitle = "Foss Yeaaaah! (Radio Edit)"
143+ artistName = "Benjamin Kerensa"
144+
145+ # get number of tracks in queue before queuing a track
146+ initialtracksCount = self.main_view.get_queue_track_count()
147+
148+ # switch to albums tab
149+ self.main_view.switch_to_tab("albumstab")
150+
151+ #select album
152+ albumartist = self.main_view.get_albums_albumartist(artistName)
153+ self.pointing_device.click_object(albumartist)
154+
155+ #get album sheet album artist
156+ sheet_albumartist = self.main_view.get_album_sheet_artist()
157+ self.assertThat(sheet_albumartist.text, Eventually(Equals(artistName)))
158+
159+ #get track item to add to queue
160+ trackicon = self.main_view.get_album_sheet_listview_trackicon(
161+ trackTitle)
162+ self.pointing_device.click_object(trackicon)
163+
164+ #click on Add to queue
165+ queueTrackImage = self.main_view.get_album_sheet_queuetrack_image()
166+ self.pointing_device.click_object(queueTrackImage)
167+
168+ # verify track queue has added one to initial value
169+ endtracksCount = self.main_view.get_queue_track_count()
170+ self.assertThat(endtracksCount, Equals(initialtracksCount + 1))
171+
172+ #Assert that the song added to the list is not playing
173+ self.assertThat(self.main_view.currentIndex,
174+ Eventually(NotEquals(endtracksCount)))
175+ self.assertThat(self.main_view.isPlaying, Eventually(Equals(False)))
176+
177+ #verity song's metadata matches the item added to the Now Playing view
178+ queueArtistName = self.main_view.get_queue_now_playing_artist(
179+ artistName)
180+ self.assertThat(str(queueArtistName.text), Equals(artistName))
181+ queueTrackTitle = self.main_view.get_queue_now_playing_title(
182+ trackTitle)
183+ self.assertThat(str(queueTrackTitle.text), Equals(trackTitle))
184+
185+ # click on close button to close album sheet
186+ closebutton = self.main_view.get_album_sheet_close_button()
187+ self.pointing_device.click_object(closebutton)
188+ self.assertThat(self.main_view.get_albumstab(), Not(Is(None)))

Subscribers

People subscribed via source and target branches

to status/vote changes: