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