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
1=== modified file 'tests/autopilot/music_app/tests/test_music.py'
2--- tests/autopilot/music_app/tests/test_music.py 2014-03-07 16:40:31 +0000
3+++ tests/autopilot/music_app/tests/test_music.py 2014-03-18 01:09:01 +0000
4@@ -61,13 +61,13 @@
5 back_button = self.main_view.get_back_button()
6 self.pointing_device.click_object(back_button)
7
8- self.main_view.show_toolbar()
9-
10 if self.main_view.wideAspect:
11 playbutton = self.main_view.get_now_playing_play_button()
12 else:
13 playbutton = self.main_view.get_play_button()
14
15+ self.main_view.show_toolbar()
16+
17 """ Track is playing"""
18 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))
19 self.pointing_device.click_object(playbutton)
20@@ -113,7 +113,6 @@
21 self.pointing_device.click_object(song)
22
23 playbutton = self.main_view.get_now_playing_play_button()
24- shufflebutton = self.main_view.get_shuffle_button()
25
26 title = lambda: self.player.currentMetaTitle
27 artist = lambda: self.player.currentMetaArtist
28@@ -131,6 +130,7 @@
29
30 #ensure shuffle is off
31 if self.player.shuffle:
32+ shufflebutton = self.main_view.get_shuffle_button()
33 logger.debug("Turning off shuffle")
34 self.pointing_device.click_object(shufflebutton)
35 else:
36@@ -143,6 +143,10 @@
37 self.pointing_device.click_object(forwardbutton)
38 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))
39
40+ """ Pause track """
41+ self.pointing_device.click_object(playbutton)
42+ self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
43+
44 #ensure different song
45 self.assertThat(title, Eventually(NotEquals(orgTitle)))
46 self.assertThat(artist, Eventually(NotEquals(orgArtist)))
47@@ -150,15 +154,15 @@
48 nextArtist = self.player.currentMetaArtist
49 logger.debug("Next Song %s, %s" % (nextTitle, nextArtist))
50
51- """ Pause track """
52- self.pointing_device.click_object(playbutton)
53- self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
54-
55 """ Select previous """
56 previousbutton = self.main_view.get_previous_button()
57 self.pointing_device.click_object(previousbutton)
58 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))
59
60+ """ Pause track """
61+ self.pointing_device.click_object(playbutton)
62+ self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
63+
64 #ensure we're back to original song
65 self.assertThat(title, Eventually(Equals(orgTitle)))
66 self.assertThat(artist, Eventually(Equals(orgArtist)))
67@@ -179,16 +183,13 @@
68 title = self.player.currentMetaTitle
69 artist = self.player.currentMetaArtist
70
71- #ensure track is playing
72- self.assertThat(self.player.isPlaying, Eventually(Equals(True)))
73-
74 #ensure shuffle is off
75 if self.player.shuffle:
76 logger.debug("Turning off shuffle")
77 self.pointing_device.click_object(shufflebutton)
78+ self.assertThat(self.player.shuffle, Eventually(Equals(False)))
79 else:
80 logger.debug("Shuffle already off")
81- self.assertThat(self.player.shuffle, Eventually(Equals(False)))
82
83 """ Track is playing """
84 count = 1
85@@ -198,15 +199,14 @@
86 while title != "TestMP3Title" and artist != "TestMP3Artist":
87 self.assertThat(count, LessThan(queue))
88
89- """ Pause track """
90- self.pointing_device.click_object(playbutton)
91- self.assertThat(self.player.isPlaying,
92- Eventually(Equals(False)))
93-
94 """ Select next """
95 forwardbutton = self.main_view.get_forward_button()
96 self.pointing_device.click_object(forwardbutton)
97- self.assertThat(self.player.isPlaying, Eventually(Equals(True)))
98+
99+ """ Pause track """
100+ self.pointing_device.click_object(playbutton)
101+ self.assertThat(self.player.isPlaying,
102+ Eventually(Equals(False)))
103
104 title = self.player.currentMetaTitle
105 artist = self.player.currentMetaArtist
106@@ -218,6 +218,7 @@
107 #make sure mp3 plays
108 self.assertThat(self.player.source.endswith("mp3"),
109 Equals(True))
110+ self.pointing_device.click_object(playbutton)
111 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))
112
113 def test_shuffle(self):
114@@ -475,7 +476,7 @@
115 playlistNameFld = self.main_view.get_newPlaylistDialog_name_textfield()
116 self.pointing_device.click_object(playlistNameFld)
117 playlistNameFld.focus.wait_for(True)
118- self.keyboard.type("MyPlaylist")
119+ self.keyboard.type("myPlaylist")
120
121 # click on get_newPlaylistDialog create Button
122 createButton = self.main_view.get_newPlaylistDialog_createButton()
123@@ -484,7 +485,7 @@
124 # verify playlist has been sucessfully created
125 palylist_final_count = self.main_view.get_addtoplaylistview()[0].count
126 self.assertThat(palylist_final_count, Equals(playlist_count + 1))
127- playlist = self.main_view.get_playlistname("MyPlaylist")
128+ playlist = self.main_view.get_playlistname("myPlaylist")
129 self.assertThat(playlist, Not(Is(None)))
130
131 # select playlist to add song to

Subscribers

People subscribed via source and target branches

to status/vote changes: