Merge lp:~elopio/unity8/generic_preview into lp:unity8
- generic_preview
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Albert Astals Cid |
Approved revision: | 653 |
Merged at revision: | 676 |
Proposed branch: | lp:~elopio/unity8/generic_preview |
Merge into: | lp:unity8 |
Prerequisite: | lp:~elopio/unity8/wait_for_category |
Diff against target: |
287 lines (+143/-63) 4 files modified
qml/Dash/Generic/GenericPreview.qml (+2/-1) tests/autopilot/unity8/shell/emulators/dash.py (+51/-33) tests/autopilot/unity8/shell/fixture_setup.py (+53/-0) tests/autopilot/unity8/shell/tests/test_emulators.py (+37/-29) |
To merge this branch: | bzr merge lp:~elopio/unity8/generic_preview |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Albert Astals Cid (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Richard Huddie | Pending | ||
Javier Collado | Pending | ||
VĂctor R. Ruiz | Pending | ||
Review via email: mp+202793@code.launchpad.net |
Commit message
Added the DashPreview autopilot helper.
Description of the change
[Copied from comment]
* Are there any related MPs required for this MP to build/function as expected? Yes:
https:/
* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes.
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
Not applicable, no packaging changes.
* If you changed the UI, has there been a design review?
Not applicable, no UI changes.
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:652
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Francis Ginther (fginther) wrote : | # |
Touch tests failed due to an issue with phablet-tools on the adb host. It has been resolved and this build has been restarted.
Leo Arias (elopio) wrote : | # |
Thanks Francis.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:652
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Leo Arias (elopio) wrote : | # |
Are there any related MPs required for this MP to build/function as expected? Yes:
https:/
Did you perform an exploratory manual test run of your code change and any related functionality? Yes.
If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP? Not applicable, no packaging changes.
If you changed the UI, has there been a design review? Not applicable, no UI changes.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:653
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Albert Astals Cid (aacid) wrote : | # |
* Did you perform an exploratory manual test run of the code change and any related functionality?
It's all test code, so N/A
* Did CI run pass? If not, please explain why.
No, sd test broken, the rest and new ones work
Preview Diff
1 | === modified file 'qml/Dash/Generic/GenericPreview.qml' | |||
2 | --- qml/Dash/Generic/GenericPreview.qml 2013-10-11 13:54:24 +0000 | |||
3 | +++ qml/Dash/Generic/GenericPreview.qml 2014-01-28 14:43:06 +0000 | |||
4 | @@ -1,5 +1,5 @@ | |||
5 | 1 | /* | 1 | /* |
7 | 2 | * Copyright (C) 2013 Canonical, Ltd. | 2 | * Copyright (C) 2013, 2014 Canonical, Ltd. |
8 | 3 | * | 3 | * |
9 | 4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
10 | 5 | * it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by |
11 | @@ -120,6 +120,7 @@ | |||
12 | 120 | 120 | ||
13 | 121 | Label { | 121 | Label { |
14 | 122 | id: descriptionLabel | 122 | id: descriptionLabel |
15 | 123 | objectName: "descriptionLabel" | ||
16 | 123 | anchors { left: parent.left; right: parent.right } | 124 | anchors { left: parent.left; right: parent.right } |
17 | 124 | visible: text != "" | 125 | visible: text != "" |
18 | 125 | fontSize: "small" | 126 | fontSize: "small" |
19 | 126 | 127 | ||
20 | === modified file 'tests/autopilot/unity8/shell/emulators/dash.py' | |||
21 | --- tests/autopilot/unity8/shell/emulators/dash.py 2014-01-28 14:43:06 +0000 | |||
22 | +++ tests/autopilot/unity8/shell/emulators/dash.py 2014-01-28 14:43:06 +0000 | |||
23 | @@ -137,32 +137,23 @@ | |||
24 | 137 | self.dash_content_list.currentIndex.wait_for(original_index + 1) | 137 | self.dash_content_list.currentIndex.wait_for(original_index + 1) |
25 | 138 | 138 | ||
26 | 139 | 139 | ||
27 | 140 | class DashPreview(emulators.UnityEmulatorBase): | ||
28 | 141 | """Autopilot emulator for the generic preview.""" | ||
29 | 142 | |||
30 | 143 | def get_details(self): | ||
31 | 144 | """Return the details of the open preview.""" | ||
32 | 145 | title = self.select_single('Label', objectName='titleLabel').text | ||
33 | 146 | subtitle = self.select_single( | ||
34 | 147 | 'Label', objectName='subtitleLabel').text | ||
35 | 148 | description = self.select_single( | ||
36 | 149 | 'Label', objectName='descriptionLabel').text | ||
37 | 150 | return dict(title=title, subtitle=subtitle, description=description) | ||
38 | 151 | |||
39 | 152 | |||
40 | 140 | class GenericScopeView(emulators.UnityEmulatorBase): | 153 | class GenericScopeView(emulators.UnityEmulatorBase): |
41 | 141 | """Autopilot emulator for generic scopes.""" | 154 | """Autopilot emulator for generic scopes.""" |
42 | 142 | 155 | ||
66 | 143 | 156 | preview_class = DashPreview | |
44 | 144 | class DashApps(emulators.UnityEmulatorBase): | ||
45 | 145 | """Autopilot emulator for the applications scope.""" | ||
46 | 146 | |||
47 | 147 | def get_applications(self, category): | ||
48 | 148 | """Return the list of applications on a category. | ||
49 | 149 | |||
50 | 150 | :parameter category: The name of the category. | ||
51 | 151 | |||
52 | 152 | """ | ||
53 | 153 | category_element = self._get_category_element(category) | ||
54 | 154 | application_tiles = category_element.select_many('Tile') | ||
55 | 155 | # TODO return them on the same order they are displayed. | ||
56 | 156 | # --elopio - 2014-1-15 | ||
57 | 157 | return [tile.text for tile in application_tiles] | ||
58 | 158 | |||
59 | 159 | def _get_category_element(self, category): | ||
60 | 160 | try: | ||
61 | 161 | return self.wait_select_single( | ||
62 | 162 | 'Base', objectName='dashCategory{}'.format(category)) | ||
63 | 163 | except dbus.StateNotFoundError: | ||
64 | 164 | raise emulators.UnityEmulatorException( | ||
65 | 165 | 'No category found with name {}'.format(category)) | ||
67 | 166 | 157 | ||
68 | 167 | @autopilot_logging.log_action(logger.info) | 158 | @autopilot_logging.log_action(logger.info) |
69 | 168 | def open_preview(self, category, app_name): | 159 | def open_preview(self, category, app_name): |
70 | @@ -178,19 +169,46 @@ | |||
71 | 178 | # Some categories do not show previews, like recent apps. | 169 | # Some categories do not show previews, like recent apps. |
72 | 179 | # --elopio - 2014-1-14 | 170 | # --elopio - 2014-1-14 |
73 | 180 | self.pointing_device.click_object(icon) | 171 | self.pointing_device.click_object(icon) |
78 | 181 | return self.get_root_instance().wait_select_single(AppPreview) | 172 | preview = self.get_root_instance().wait_select_single( |
79 | 182 | 173 | self.preview_class, isCurrent=True) | |
80 | 183 | 174 | preview.showProcessingAction.wait_for(False) | |
81 | 184 | class AppPreview(emulators.UnityEmulatorBase): | 175 | return preview |
82 | 176 | |||
83 | 177 | def _get_category_element(self, category): | ||
84 | 178 | try: | ||
85 | 179 | return self.wait_select_single( | ||
86 | 180 | 'Base', objectName='dashCategory{}'.format(category)) | ||
87 | 181 | except dbus.StateNotFoundError: | ||
88 | 182 | raise emulators.UnityEmulatorException( | ||
89 | 183 | 'No category found with name {}'.format(category)) | ||
90 | 184 | |||
91 | 185 | |||
92 | 186 | class AppPreview(DashPreview): | ||
93 | 185 | """Autopilot emulator for the application preview.""" | 187 | """Autopilot emulator for the application preview.""" |
94 | 186 | 188 | ||
95 | 187 | def get_details(self): | 189 | def get_details(self): |
96 | 188 | """Return the details of the application showed in its preview.""" | 190 | """Return the details of the application showed in its preview.""" |
102 | 189 | title = self.select_single('Label', objectName='titleLabel').text | 191 | details = super(AppPreview, self).get_details() |
98 | 190 | publisher = self.select_single( | ||
99 | 191 | 'Label', objectName='subtitleLabel').text | ||
100 | 192 | description = self.select_single( | ||
101 | 193 | 'Label', objectName='descriptionLabel').text | ||
103 | 194 | # TODO return screenshots, icon, rating and reviews. | 192 | # TODO return screenshots, icon, rating and reviews. |
104 | 195 | # --elopio - 2014-1-15 | 193 | # --elopio - 2014-1-15 |
106 | 196 | return dict(title=title, publisher=publisher, description=description) | 194 | return dict( |
107 | 195 | title=details.get('title'), publisher=details.get('subtitle'), | ||
108 | 196 | description=details.get('description')) | ||
109 | 197 | |||
110 | 198 | |||
111 | 199 | class DashApps(GenericScopeView): | ||
112 | 200 | """Autopilot emulator for the applications scope.""" | ||
113 | 201 | |||
114 | 202 | preview_class = AppPreview | ||
115 | 203 | |||
116 | 204 | def get_applications(self, category): | ||
117 | 205 | """Return the list of applications on a category. | ||
118 | 206 | |||
119 | 207 | :parameter category: The name of the category. | ||
120 | 208 | |||
121 | 209 | """ | ||
122 | 210 | category_element = self._get_category_element(category) | ||
123 | 211 | application_tiles = category_element.select_many('Tile') | ||
124 | 212 | # TODO return them on the same order they are displayed. | ||
125 | 213 | # --elopio - 2014-1-15 | ||
126 | 214 | return [tile.text for tile in application_tiles] | ||
127 | 197 | 215 | ||
128 | === added file 'tests/autopilot/unity8/shell/fixture_setup.py' | |||
129 | --- tests/autopilot/unity8/shell/fixture_setup.py 1970-01-01 00:00:00 +0000 | |||
130 | +++ tests/autopilot/unity8/shell/fixture_setup.py 2014-01-28 14:43:06 +0000 | |||
131 | @@ -0,0 +1,53 @@ | |||
132 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | ||
133 | 2 | # | ||
134 | 3 | # Unity Autopilot Test Suite | ||
135 | 4 | # Copyright (C) 2014 Canonical | ||
136 | 5 | # | ||
137 | 6 | # This program is free software: you can redistribute it and/or modify | ||
138 | 7 | # it under the terms of the GNU General Public License as published by | ||
139 | 8 | # the Free Software Foundation, either version 3 of the License, or | ||
140 | 9 | # (at your option) any later version. | ||
141 | 10 | # | ||
142 | 11 | # This program is distributed in the hope that it will be useful, | ||
143 | 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
144 | 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
145 | 14 | # GNU General Public License for more details. | ||
146 | 15 | # | ||
147 | 16 | # You should have received a copy of the GNU General Public License | ||
148 | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
149 | 18 | # | ||
150 | 19 | |||
151 | 20 | """Set up and clean up fixtures for the Unity acceptance tests.""" | ||
152 | 21 | |||
153 | 22 | import os | ||
154 | 23 | import sysconfig | ||
155 | 24 | |||
156 | 25 | import fixtures | ||
157 | 26 | |||
158 | 27 | import unity8 | ||
159 | 28 | |||
160 | 29 | |||
161 | 30 | class FakeScopes(fixtures.Fixture): | ||
162 | 31 | |||
163 | 32 | def setUp(self): | ||
164 | 33 | super(FakeScopes, self).setUp() | ||
165 | 34 | self.useFixture( | ||
166 | 35 | fixtures.EnvironmentVariable( | ||
167 | 36 | 'QML2_IMPORT_PATH', | ||
168 | 37 | newvalue=self._get_fake_scopes_library_path())) | ||
169 | 38 | |||
170 | 39 | def _get_fake_scopes_library_path(self): | ||
171 | 40 | if unity8.running_installed_tests(): | ||
172 | 41 | mock_path = 'qml/scopefakes/' | ||
173 | 42 | else: | ||
174 | 43 | mock_path = os.path.join( | ||
175 | 44 | '../lib/', sysconfig.get_config_var('MULTIARCH'), | ||
176 | 45 | 'unity8/qml/scopefakes/') | ||
177 | 46 | lib_path = unity8.get_lib_path() | ||
178 | 47 | ld_library_path = os.path.abspath(os.path.join(lib_path, mock_path)) | ||
179 | 48 | |||
180 | 49 | if not os.path.exists(ld_library_path): | ||
181 | 50 | raise RuntimeError( | ||
182 | 51 | 'Expected library path does not exists: %s.' % ( | ||
183 | 52 | ld_library_path)) | ||
184 | 53 | return ld_library_path | ||
185 | 0 | 54 | ||
186 | === modified file 'tests/autopilot/unity8/shell/tests/test_emulators.py' | |||
187 | --- tests/autopilot/unity8/shell/tests/test_emulators.py 2014-01-16 17:35:23 +0000 | |||
188 | +++ tests/autopilot/unity8/shell/tests/test_emulators.py 2014-01-28 14:43:06 +0000 | |||
189 | @@ -27,17 +27,12 @@ | |||
190 | 27 | 27 | ||
191 | 28 | """ | 28 | """ |
192 | 29 | 29 | ||
193 | 30 | import os | ||
194 | 31 | import sysconfig | ||
195 | 32 | |||
196 | 33 | import mock | 30 | import mock |
197 | 34 | 31 | ||
198 | 35 | import fixtures | ||
199 | 36 | from testtools.matchers import Contains, HasLength | 32 | from testtools.matchers import Contains, HasLength |
200 | 37 | 33 | ||
201 | 38 | import unity8 | ||
202 | 39 | from unity8 import process_helpers | 34 | from unity8 import process_helpers |
204 | 40 | from unity8.shell import emulators, tests | 35 | from unity8.shell import emulators, fixture_setup, tests |
205 | 41 | from unity8.shell.emulators import dash as dash_emulators | 36 | from unity8.shell.emulators import dash as dash_emulators |
206 | 42 | 37 | ||
207 | 43 | 38 | ||
208 | @@ -140,6 +135,30 @@ | |||
209 | 140 | self.assertIsInstance(scope, dash_emulators.DashApps) | 135 | self.assertIsInstance(scope, dash_emulators.DashApps) |
210 | 141 | 136 | ||
211 | 142 | 137 | ||
212 | 138 | class GenericScopeViewEmulatorTestCase(DashBaseTestCase): | ||
213 | 139 | |||
214 | 140 | def setUp(self): | ||
215 | 141 | # Set up the fake scopes before launching unity. | ||
216 | 142 | self.useFixture(fixture_setup.FakeScopes()) | ||
217 | 143 | super(GenericScopeViewEmulatorTestCase, self).setUp() | ||
218 | 144 | self.home_scope = self.dash.open_scope('home') | ||
219 | 145 | |||
220 | 146 | def test_open_preview(self): | ||
221 | 147 | preview = self.home_scope.open_preview('0', 'Title.0') | ||
222 | 148 | self.assertIsInstance(preview, dash_emulators.DashPreview) | ||
223 | 149 | self.assertTrue(preview.isCurrent) | ||
224 | 150 | self.assertFalse(preview.showProcessingAction) | ||
225 | 151 | |||
226 | 152 | def test_get_details(self): | ||
227 | 153 | expected_details = dict( | ||
228 | 154 | title='Title', subtitle='Subtitle', description='Description') | ||
229 | 155 | |||
230 | 156 | preview = self.home_scope.open_preview('0', 'Title.0') | ||
231 | 157 | details = preview.get_details() | ||
232 | 158 | |||
233 | 159 | self.assertEqual(expected_details, details) | ||
234 | 160 | |||
235 | 161 | |||
236 | 143 | class DashAppsEmulatorTestCase(DashBaseTestCase): | 162 | class DashAppsEmulatorTestCase(DashBaseTestCase): |
237 | 144 | 163 | ||
238 | 145 | available_applications = [ | 164 | available_applications = [ |
239 | @@ -148,32 +167,11 @@ | |||
240 | 148 | 'Title.201', 'Title.221', 'Title.241', 'Title.261', 'Title.281'] | 167 | 'Title.201', 'Title.221', 'Title.241', 'Title.261', 'Title.281'] |
241 | 149 | 168 | ||
242 | 150 | def setUp(self): | 169 | def setUp(self): |
244 | 151 | self._use_scope_fakes() | 170 | # Set up the fake scopes before launching unity. |
245 | 171 | self.useFixture(fixture_setup.FakeScopes()) | ||
246 | 152 | super(DashAppsEmulatorTestCase, self).setUp() | 172 | super(DashAppsEmulatorTestCase, self).setUp() |
247 | 153 | self.applications_scope = self.dash.open_scope('applications') | 173 | self.applications_scope = self.dash.open_scope('applications') |
248 | 154 | 174 | ||
249 | 155 | def _use_scope_fakes(self): | ||
250 | 156 | self.useFixture( | ||
251 | 157 | fixtures.EnvironmentVariable( | ||
252 | 158 | 'QML2_IMPORT_PATH', | ||
253 | 159 | newvalue=self._get_fake_scopes_library_path())) | ||
254 | 160 | |||
255 | 161 | def _get_fake_scopes_library_path(self): | ||
256 | 162 | if unity8.running_installed_tests(): | ||
257 | 163 | mock_path = 'qml/scopefakes/' | ||
258 | 164 | else: | ||
259 | 165 | mock_path = os.path.join( | ||
260 | 166 | '../lib/', sysconfig.get_config_var('MULTIARCH'), | ||
261 | 167 | 'unity8/qml/scopefakes/') | ||
262 | 168 | lib_path = unity8.get_lib_path() | ||
263 | 169 | ld_library_path = os.path.abspath(os.path.join(lib_path, mock_path)) | ||
264 | 170 | |||
265 | 171 | if not os.path.exists(ld_library_path): | ||
266 | 172 | raise RuntimeError( | ||
267 | 173 | 'Expected library path does not exists: %s.' % ( | ||
268 | 174 | ld_library_path)) | ||
269 | 175 | return ld_library_path | ||
270 | 176 | |||
271 | 177 | def test_get_applications_with_unexisting_category(self): | 175 | def test_get_applications_with_unexisting_category(self): |
272 | 178 | exception = self.assertRaises( | 176 | exception = self.assertRaises( |
273 | 179 | emulators.UnityEmulatorException, | 177 | emulators.UnityEmulatorException, |
274 | @@ -205,3 +203,13 @@ | |||
275 | 205 | preview = self.applications_scope.open_preview('installed', 'Title.1') | 203 | preview = self.applications_scope.open_preview('installed', 'Title.1') |
276 | 206 | self.assertIsInstance(preview, dash_emulators.AppPreview) | 204 | self.assertIsInstance(preview, dash_emulators.AppPreview) |
277 | 207 | self.assertTrue(preview.isCurrent) | 205 | self.assertTrue(preview.isCurrent) |
278 | 206 | self.assertFalse(preview.showProcessingAction) | ||
279 | 207 | |||
280 | 208 | def test_get_details(self): | ||
281 | 209 | expected_details = dict( | ||
282 | 210 | title='Title', publisher='', description='Description') | ||
283 | 211 | |||
284 | 212 | preview = self.applications_scope.open_preview('installed', 'Title.1') | ||
285 | 213 | details = preview.get_details() | ||
286 | 214 | |||
287 | 215 | self.assertEqual(expected_details, details) |
FAILED: Continuous integration, rev:651 jenkins. qa.ubuntu. com/job/ unity8- ci/2111/ jenkins. qa.ubuntu. com/job/ generic- mediumtests- trusty/ 2543 jenkins. qa.ubuntu. com/job/ generic- mediumtests- trusty- touch/2349/ console jenkins. qa.ubuntu. com/job/ unity-phablet- qmluitests- trusty/ 981 jenkins. qa.ubuntu. com/job/ unity8- trusty- amd64-ci/ 633 jenkins. qa.ubuntu. com/job/ unity8- trusty- armhf-ci/ 635 jenkins. qa.ubuntu. com/job/ unity8- trusty- armhf-ci/ 635/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ unity8- trusty- i386-ci/ 633 jenkins. qa.ubuntu. com/job/ autopilot- testrunner- otto-trusty/ 2219 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- amd64/2545 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- amd64/2545/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- armhf/2350 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- armhf/2350/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner- mako/4792/ console s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 3277
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity8- ci/2111/ rebuild
http://