Merge lp:~vthompson/music-app/fix-1293488 into lp:music-app/trusty

Proposed by Victor Thompson
Status: Merged
Approved by: Nicholas Skaggs
Approved revision: 385
Merged at revision: 385
Proposed branch: lp:~vthompson/music-app/fix-1293488
Merge into: lp:music-app/trusty
Diff against target: 131 lines (+20/-19)
1 file modified
tests/autopilot/music_app/tests/test_music.py (+20/-19)
To merge this branch: bzr merge lp:~vthompson/music-app/fix-1293488
Reviewer Review Type Date Requested Status
Nicholas Skaggs (community) Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+211435@code.launchpad.net

Commit message

Fix some timing issues in 4 failing tests.

Description of the change

Fix some timing issues in 4 failing tests. Some of the tests that get attributes from the Player component seem to take a long time to select. Reorganized some of the logic to making timing issues work.

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
Nicholas Skaggs (nskaggs) wrote :

Giving this a runthrough on mako and flo.

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

Running on #243, doesn't seem to work:

Traceback (most recent call last):
File "/home/phablet/autopilot/music_app/tests/test_music.py", line 54, in test_play_pause_library
first_genre_item = self.main_view.get_first_genre_item()
File "/home/phablet/autopilot/music_app/emulators.py", line 83, in get_first_genre_item
return self.wait_select_single("*", objectName="genreItemObject")
File "/usr/lib/python2.7/dist-packages/autopilot/introspection/dbus.py", line 374, in wait_select_single
return self.select_single(type_name, **kwargs)
File "/usr/lib/python2.7/dist-packages/autopilot/introspection/dbus.py", line 321, in select_single
raise ValueError("More than one item was returned for query")
ValueError: More than one item was returned for query
}}}

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

What might actually be the problem is that you still have your media in the mediascanner database. You could move the ~/.cache/mediascanner directory for safe keeping and reboot the phone. If so, this is related to lp:1292044

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

Victor, of course. Argh, why did someone disable the home patching on click . . .

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

Over the weekend I tried to do so. It seems like mocking of the home directory isn't "preserved" when the click package is ran. There might be other tricks that we'll need to do.

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

Yes, just undoing things and using the same mock setup doesn't do it. Regardless, this gets my greenlight, with the note I wasn't able to test properly because of the bug mentioned above.

review: Approve
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

You can't mock the env with click as it's launched with upstart; in any case you could inject stuff in upstart with initctl set-env

Revision history for this message
Leo Arias (elopio) wrote :

We have a fixture in the oven to help tests setting temporary values on the env:
https://code.launchpad.net/~elopio/ubuntu-ui-toolkit/initctl_env_var/+merge/208612

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/autopilot/music_app/tests/test_music.py'
--- tests/autopilot/music_app/tests/test_music.py 2014-03-07 16:40:31 +0000
+++ tests/autopilot/music_app/tests/test_music.py 2014-03-18 01:09:01 +0000
@@ -61,13 +61,13 @@
61 back_button = self.main_view.get_back_button()61 back_button = self.main_view.get_back_button()
62 self.pointing_device.click_object(back_button)62 self.pointing_device.click_object(back_button)
6363
64 self.main_view.show_toolbar()
65
66 if self.main_view.wideAspect:64 if self.main_view.wideAspect:
67 playbutton = self.main_view.get_now_playing_play_button()65 playbutton = self.main_view.get_now_playing_play_button()
68 else:66 else:
69 playbutton = self.main_view.get_play_button()67 playbutton = self.main_view.get_play_button()
7068
69 self.main_view.show_toolbar()
70
71 """ Track is playing"""71 """ Track is playing"""
72 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))72 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))
73 self.pointing_device.click_object(playbutton)73 self.pointing_device.click_object(playbutton)
@@ -113,7 +113,6 @@
113 self.pointing_device.click_object(song)113 self.pointing_device.click_object(song)
114114
115 playbutton = self.main_view.get_now_playing_play_button()115 playbutton = self.main_view.get_now_playing_play_button()
116 shufflebutton = self.main_view.get_shuffle_button()
117116
118 title = lambda: self.player.currentMetaTitle117 title = lambda: self.player.currentMetaTitle
119 artist = lambda: self.player.currentMetaArtist118 artist = lambda: self.player.currentMetaArtist
@@ -131,6 +130,7 @@
131130
132 #ensure shuffle is off131 #ensure shuffle is off
133 if self.player.shuffle:132 if self.player.shuffle:
133 shufflebutton = self.main_view.get_shuffle_button()
134 logger.debug("Turning off shuffle")134 logger.debug("Turning off shuffle")
135 self.pointing_device.click_object(shufflebutton)135 self.pointing_device.click_object(shufflebutton)
136 else:136 else:
@@ -143,6 +143,10 @@
143 self.pointing_device.click_object(forwardbutton)143 self.pointing_device.click_object(forwardbutton)
144 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))144 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))
145145
146 """ Pause track """
147 self.pointing_device.click_object(playbutton)
148 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
149
146 #ensure different song150 #ensure different song
147 self.assertThat(title, Eventually(NotEquals(orgTitle)))151 self.assertThat(title, Eventually(NotEquals(orgTitle)))
148 self.assertThat(artist, Eventually(NotEquals(orgArtist)))152 self.assertThat(artist, Eventually(NotEquals(orgArtist)))
@@ -150,15 +154,15 @@
150 nextArtist = self.player.currentMetaArtist154 nextArtist = self.player.currentMetaArtist
151 logger.debug("Next Song %s, %s" % (nextTitle, nextArtist))155 logger.debug("Next Song %s, %s" % (nextTitle, nextArtist))
152156
153 """ Pause track """
154 self.pointing_device.click_object(playbutton)
155 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
156
157 """ Select previous """157 """ Select previous """
158 previousbutton = self.main_view.get_previous_button()158 previousbutton = self.main_view.get_previous_button()
159 self.pointing_device.click_object(previousbutton)159 self.pointing_device.click_object(previousbutton)
160 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))160 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))
161161
162 """ Pause track """
163 self.pointing_device.click_object(playbutton)
164 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
165
162 #ensure we're back to original song166 #ensure we're back to original song
163 self.assertThat(title, Eventually(Equals(orgTitle)))167 self.assertThat(title, Eventually(Equals(orgTitle)))
164 self.assertThat(artist, Eventually(Equals(orgArtist)))168 self.assertThat(artist, Eventually(Equals(orgArtist)))
@@ -179,16 +183,13 @@
179 title = self.player.currentMetaTitle183 title = self.player.currentMetaTitle
180 artist = self.player.currentMetaArtist184 artist = self.player.currentMetaArtist
181185
182 #ensure track is playing
183 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))
184
185 #ensure shuffle is off186 #ensure shuffle is off
186 if self.player.shuffle:187 if self.player.shuffle:
187 logger.debug("Turning off shuffle")188 logger.debug("Turning off shuffle")
188 self.pointing_device.click_object(shufflebutton)189 self.pointing_device.click_object(shufflebutton)
190 self.assertThat(self.player.shuffle, Eventually(Equals(False)))
189 else:191 else:
190 logger.debug("Shuffle already off")192 logger.debug("Shuffle already off")
191 self.assertThat(self.player.shuffle, Eventually(Equals(False)))
192193
193 """ Track is playing """194 """ Track is playing """
194 count = 1195 count = 1
@@ -198,15 +199,14 @@
198 while title != "TestMP3Title" and artist != "TestMP3Artist":199 while title != "TestMP3Title" and artist != "TestMP3Artist":
199 self.assertThat(count, LessThan(queue))200 self.assertThat(count, LessThan(queue))
200201
201 """ Pause track """
202 self.pointing_device.click_object(playbutton)
203 self.assertThat(self.player.isPlaying,
204 Eventually(Equals(False)))
205
206 """ Select next """202 """ Select next """
207 forwardbutton = self.main_view.get_forward_button()203 forwardbutton = self.main_view.get_forward_button()
208 self.pointing_device.click_object(forwardbutton)204 self.pointing_device.click_object(forwardbutton)
209 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))205
206 """ Pause track """
207 self.pointing_device.click_object(playbutton)
208 self.assertThat(self.player.isPlaying,
209 Eventually(Equals(False)))
210210
211 title = self.player.currentMetaTitle211 title = self.player.currentMetaTitle
212 artist = self.player.currentMetaArtist212 artist = self.player.currentMetaArtist
@@ -218,6 +218,7 @@
218 #make sure mp3 plays218 #make sure mp3 plays
219 self.assertThat(self.player.source.endswith("mp3"),219 self.assertThat(self.player.source.endswith("mp3"),
220 Equals(True))220 Equals(True))
221 self.pointing_device.click_object(playbutton)
221 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))222 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))
222223
223 def test_shuffle(self):224 def test_shuffle(self):
@@ -475,7 +476,7 @@
475 playlistNameFld = self.main_view.get_newPlaylistDialog_name_textfield()476 playlistNameFld = self.main_view.get_newPlaylistDialog_name_textfield()
476 self.pointing_device.click_object(playlistNameFld)477 self.pointing_device.click_object(playlistNameFld)
477 playlistNameFld.focus.wait_for(True)478 playlistNameFld.focus.wait_for(True)
478 self.keyboard.type("MyPlaylist")479 self.keyboard.type("myPlaylist")
479480
480 # click on get_newPlaylistDialog create Button481 # click on get_newPlaylistDialog create Button
481 createButton = self.main_view.get_newPlaylistDialog_createButton()482 createButton = self.main_view.get_newPlaylistDialog_createButton()
@@ -484,7 +485,7 @@
484 # verify playlist has been sucessfully created485 # verify playlist has been sucessfully created
485 palylist_final_count = self.main_view.get_addtoplaylistview()[0].count486 palylist_final_count = self.main_view.get_addtoplaylistview()[0].count
486 self.assertThat(palylist_final_count, Equals(playlist_count + 1))487 self.assertThat(palylist_final_count, Equals(playlist_count + 1))
487 playlist = self.main_view.get_playlistname("MyPlaylist")488 playlist = self.main_view.get_playlistname("myPlaylist")
488 self.assertThat(playlist, Not(Is(None)))489 self.assertThat(playlist, Not(Is(None)))
489490
490 # select playlist to add song to491 # select playlist to add song to

Subscribers

People subscribed via source and target branches

to status/vote changes: