Merge lp:~canonical-platform-qa/ubuntu-system-tests/fix-get-clock-pid into lp:ubuntu-system-tests
- fix-get-clock-pid
- Merge into trunk
Status: | Work in progress |
---|---|
Proposed branch: | lp:~canonical-platform-qa/ubuntu-system-tests/fix-get-clock-pid |
Merge into: | lp:ubuntu-system-tests |
Diff against target: |
1118 lines (+239/-291) 32 files modified
debian/tests/dependencies.json (+1/-0) ubuntu_system_tests/helpers/addressbook/app.py (+4/-5) ubuntu_system_tests/helpers/application.py (+18/-58) ubuntu_system_tests/helpers/calculator/app.py (+6/-7) ubuntu_system_tests/helpers/camera/app.py (+8/-9) ubuntu_system_tests/helpers/click.py (+0/-7) ubuntu_system_tests/helpers/clock/app.py (+6/-7) ubuntu_system_tests/helpers/dialer_app/app.py (+7/-9) ubuntu_system_tests/helpers/gallery/__init__.py (+2/-2) ubuntu_system_tests/helpers/gallery/app.py (+1/-1) ubuntu_system_tests/helpers/messaging/_cpo.py (+1/-1) ubuntu_system_tests/helpers/music/__init__.py (+2/-0) ubuntu_system_tests/helpers/music/app.py (+5/-3) ubuntu_system_tests/helpers/music/utils.py (+2/-2) ubuntu_system_tests/helpers/processes.py (+91/-39) ubuntu_system_tests/helpers/system_settings/app.py (+1/-0) ubuntu_system_tests/helpers/telegram/app.py (+4/-5) ubuntu_system_tests/helpers/ubuntuuitoolkit/_flickable.py (+1/-0) ubuntu_system_tests/helpers/unity8/fixture_setup.py (+4/-3) ubuntu_system_tests/helpers/webapp/__init__.py (+0/-4) ubuntu_system_tests/helpers/webapp/_cpo.py (+16/-0) ubuntu_system_tests/helpers/webapp/ebay.py (+8/-13) ubuntu_system_tests/helpers/webapp/here.py (+12/-14) ubuntu_system_tests/helpers/webapp/utils.py (+1/-69) ubuntu_system_tests/helpers/webbrowser/app.py (+6/-7) ubuntu_system_tests/perftests/scalability/test_photos.py (+2/-2) ubuntu_system_tests/tests/base_messaging.py (+17/-15) ubuntu_system_tests/tests/test_about_this_phone.py (+1/-1) ubuntu_system_tests/tests/test_app_store.py (+1/-2) ubuntu_system_tests/tests/test_app_switcher.py (+5/-4) ubuntu_system_tests/tests/webapps/test_ebay.py (+3/-1) ubuntu_system_tests/tests/webapps/test_here.py (+3/-1) |
To merge this branch: | bzr merge lp:~canonical-platform-qa/ubuntu-system-tests/fix-get-clock-pid |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Canonical Platform QA Team | Pending | ||
Review via email: mp+305969@code.launchpad.net |
Commit message
Description of the change
WIP
- 466. By Richard Huddie
-
Merge from trunk.
- 467. By Richard Huddie
-
Use pgrep to get the pid.
- 468. By Richard Huddie
-
Add periodic screenshots.
- 469. By Richard Huddie
-
Get screenshots only when launching.
- 470. By Richard Huddie
-
Get screenshots only when launching.
- 471. By Richard Huddie
-
Merge from trunk.
- 472. By Richard Huddie
-
Add a wait to ensure app is running before proceeding.
- 473. By Richard Huddie
-
Add extra screenshots.
- 474. By Richard Huddie
-
Add some more logging.
- 475. By Richard Huddie
-
Extra logging on going to scope.
- 476. By Richard Huddie
-
Move setup to after fixtures.
- 477. By Richard Huddie
-
Make location service a job, start removing old changes.
- 478. By Richard Huddie
-
Remove logging and screenshots.
- 479. By Richard Huddie
-
Tidy process helpers.
- 480. By Richard Huddie
-
Remove grep from process helpers.
- 481. By Richard Huddie
-
Use ubuntu-app-launch helpers for getting the app pids.
- 482. By Richard Huddie
-
remove redundant helpers for getting webapp proxy.
- 483. By Richard Huddie
-
Remove redundant app classes.
- 484. By Richard Huddie
-
Add a fix for failing ubuntu-app-stop.
- 485. By Richard Huddie
-
Update exisiting Application classes.
- 486. By Richard Huddie
-
Fix the app switcher tests to use the app helpers.
- 487. By Richard Huddie
-
Fix tests to use app helpers.
- 488. By Richard Huddie
-
Remove redundant helper.
- 489. By Richard Huddie
-
Fix music helpers.
- 490. By Richard Huddie
-
Merge from trunk.
- 491. By Richard Huddie
-
Merge from trunk.
Unmerged revisions
- 491. By Richard Huddie
-
Merge from trunk.
- 490. By Richard Huddie
-
Merge from trunk.
- 489. By Richard Huddie
-
Fix music helpers.
- 488. By Richard Huddie
-
Remove redundant helper.
- 487. By Richard Huddie
-
Fix tests to use app helpers.
- 486. By Richard Huddie
-
Fix the app switcher tests to use the app helpers.
- 485. By Richard Huddie
-
Update exisiting Application classes.
- 484. By Richard Huddie
-
Add a fix for failing ubuntu-app-stop.
- 483. By Richard Huddie
-
Remove redundant app classes.
- 482. By Richard Huddie
-
remove redundant helpers for getting webapp proxy.
Preview Diff
1 | === modified file 'debian/tests/dependencies.json' |
2 | --- debian/tests/dependencies.json 2016-09-06 12:55:23 +0000 |
3 | +++ debian/tests/dependencies.json 2016-10-14 14:22:00 +0000 |
4 | @@ -132,6 +132,7 @@ |
5 | "python3-testtools", |
6 | "python3-warlock", |
7 | "subunit", |
8 | + "ubuntu-app-launch-tools", |
9 | "ubuntu-keyboard-autopilot", |
10 | "ubuntu-system-tests-helpers", |
11 | "ubuntu-system-tests-suite", |
12 | |
13 | === modified file 'ubuntu_system_tests/helpers/addressbook/app.py' |
14 | --- ubuntu_system_tests/helpers/addressbook/app.py 2016-07-15 14:22:08 +0000 |
15 | +++ ubuntu_system_tests/helpers/addressbook/app.py 2016-10-14 14:22:00 +0000 |
16 | @@ -18,22 +18,21 @@ |
17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 | # |
19 | from collections import namedtuple |
20 | -from ubuntu_system_tests.helpers.application import QmlApplication |
21 | +from ubuntu_system_tests.helpers.application import Application |
22 | |
23 | -APP_PROCESS_NAME = 'address-book-app' |
24 | APP_NAME = 'Contacts' |
25 | APP_ID = 'address-book-app' |
26 | -APP_CLICK = 'com.ubuntu.address-book' |
27 | +APP_PACKAGE = 'address-book-app' |
28 | |
29 | |
30 | Contact = namedtuple('Contact', ['name', 'number', 'expected_reply']) |
31 | Contact.__new__.__defaults__ = (None, None, None) |
32 | |
33 | |
34 | -class AddressBook(QmlApplication): |
35 | +class AddressBook(Application): |
36 | |
37 | def __init__(self): |
38 | - super().__init__(APP_NAME, APP_CLICK, APP_PROCESS_NAME, APP_ID) |
39 | + super().__init__(APP_NAME, APP_PACKAGE, APP_ID) |
40 | |
41 | def get_main_view(self): |
42 | # TODO Move the address book helper upstream migrating the |
43 | |
44 | === modified file 'ubuntu_system_tests/helpers/application.py' |
45 | --- ubuntu_system_tests/helpers/application.py 2016-09-21 19:04:49 +0000 |
46 | +++ ubuntu_system_tests/helpers/application.py 2016-10-14 14:22:00 +0000 |
47 | @@ -22,10 +22,13 @@ |
48 | from autopilot.exceptions import ProcessSearchError |
49 | from psutil import NoSuchProcess |
50 | from retrying import retry |
51 | +from subprocess import CalledProcessError |
52 | |
53 | -from ubuntu_system_tests.helpers import autopilot |
54 | +from ubuntu_system_tests.helpers import ( |
55 | + autopilot, |
56 | + wait_until, |
57 | +) |
58 | from ubuntu_system_tests.helpers import processes |
59 | -from ubuntu_system_tests.helpers.processes import ensure_application_closed |
60 | from ubuntu_system_tests.helpers.scopes.apps import ( |
61 | launch_application_from_apps_scope) |
62 | from ubuntu_system_tests.helpers.unity8 import ( |
63 | @@ -35,9 +38,9 @@ |
64 | class Application: |
65 | __metaclass__ = ABCMeta |
66 | |
67 | - def __init__(self, app_name, app_click, app_id=None): |
68 | + def __init__(self, app_name, package, app_id=None): |
69 | self.app_name = app_name |
70 | - self.app_click = app_click |
71 | + self.app_package = package |
72 | self.app_id = app_id |
73 | self.proxy_object = None |
74 | |
75 | @@ -46,12 +49,14 @@ |
76 | Launch app from apps scope |
77 | """ |
78 | launch_application_from_apps_scope(self.app_name) |
79 | + self.wait_until_running() |
80 | if return_proxy: |
81 | return self.get_proxy_object() |
82 | |
83 | def launch_from_launcher(self, return_proxy=True): |
84 | """Drag out the launcher and tap the application icon to start it.""" |
85 | launch_application_from_launcher(self.app_id) |
86 | + self.wait_until_running() |
87 | if return_proxy: |
88 | return self.get_proxy_object() |
89 | |
90 | @@ -59,21 +64,25 @@ |
91 | pass |
92 | |
93 | def stop(self): |
94 | - ensure_application_closed(self.app_id) |
95 | + processes.stop_application(self.app_package) |
96 | |
97 | - @abstractmethod |
98 | def get_pid(self): |
99 | - pass |
100 | + return processes.get_application_pid(self.app_package) |
101 | |
102 | - @abstractmethod |
103 | def is_running(self): |
104 | - pass |
105 | + return processes.is_application_running(self.app_package) |
106 | + |
107 | + def wait_until_running(self): |
108 | + """Wait until the application is running.""" |
109 | + if not wait_until(self.is_running): |
110 | + raise RuntimeError('Application not running.') |
111 | |
112 | @retry(stop_max_delay=30000, |
113 | wait_exponential_multiplier=1000, |
114 | wait_exponential_max=10000, |
115 | retry_on_exception=lambda exception: ( |
116 | isinstance(exception, ProcessSearchError) or |
117 | + isinstance(exception, CalledProcessError) or |
118 | isinstance(exception, processes.PidNotFoundError) or |
119 | isinstance(exception, NoSuchProcess))) |
120 | def get_proxy_object(self): |
121 | @@ -85,52 +94,3 @@ |
122 | @abstractmethod |
123 | def get_main_view(self): |
124 | pass |
125 | - |
126 | - |
127 | -class WebApplication(Application): |
128 | - |
129 | - def get_proxy_object(self): |
130 | - """To be implemented""" |
131 | - pass |
132 | - |
133 | - @abstractmethod |
134 | - def get_main_window(self, proxy_object): |
135 | - pass |
136 | - |
137 | - @abstractmethod |
138 | - def get_main_view(self): |
139 | - pass |
140 | - |
141 | - |
142 | -class QmlApplication(Application): |
143 | - |
144 | - def __init__(self, app_name, app_click, app_process_name, app_id=None): |
145 | - self.app_process_name = app_process_name |
146 | - super().__init__(app_name, app_click, app_id) |
147 | - |
148 | - def get_pid(self): |
149 | - """Return the QML application process id""" |
150 | - return processes.get_process_id(self.app_process_name) |
151 | - |
152 | - def is_running(self): |
153 | - """Return bool representing if the app is running.""" |
154 | - return processes.is_process_running(self.app_process_name) |
155 | - |
156 | - @abstractmethod |
157 | - def get_main_view(self): |
158 | - pass |
159 | - |
160 | - |
161 | -class QmlSceneApplication(Application): |
162 | - |
163 | - def __init__(self, app_name, app_click, qml_file, app_id=None): |
164 | - self.qml_file = qml_file |
165 | - super().__init__(app_name, app_click, app_id) |
166 | - |
167 | - def get_pid(self): |
168 | - """Return the QML Scene application process id""" |
169 | - return processes.get_qmlscene_process_id(self.qml_file) |
170 | - |
171 | - @abstractmethod |
172 | - def get_main_view(self): |
173 | - pass |
174 | |
175 | === modified file 'ubuntu_system_tests/helpers/calculator/app.py' |
176 | --- ubuntu_system_tests/helpers/calculator/app.py 2016-08-29 14:25:05 +0000 |
177 | +++ ubuntu_system_tests/helpers/calculator/app.py 2016-10-14 14:22:00 +0000 |
178 | @@ -18,18 +18,17 @@ |
179 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
180 | # |
181 | |
182 | -from ubuntu_system_tests.helpers.application import QmlSceneApplication |
183 | +from ubuntu_system_tests.helpers.application import Application |
184 | |
185 | APP_NAME = 'Calculator' |
186 | APP_ID = 'com.ubuntu.calculator_calculator' |
187 | -APP_QML_FILE = 'ubuntu-calculator-app' |
188 | -APP_CLICK = 'com.ubuntu.calculator' |
189 | - |
190 | - |
191 | -class Calculator(QmlSceneApplication): |
192 | +APP_PACKAGE = 'com.ubuntu.calculator' |
193 | + |
194 | + |
195 | +class Calculator(Application): |
196 | |
197 | def __init__(self): |
198 | - super().__init__(APP_NAME, APP_CLICK, APP_QML_FILE, APP_ID) |
199 | + super().__init__(APP_NAME, APP_PACKAGE, APP_ID) |
200 | |
201 | def get_main_view(self): |
202 | from ubuntu_system_tests.helpers.calculator import _cpo # NOQA |
203 | |
204 | === modified file 'ubuntu_system_tests/helpers/camera/app.py' |
205 | --- ubuntu_system_tests/helpers/camera/app.py 2016-09-05 21:34:32 +0000 |
206 | +++ ubuntu_system_tests/helpers/camera/app.py 2016-10-14 14:22:00 +0000 |
207 | @@ -16,19 +16,18 @@ |
208 | # You should have received a copy of the GNU General Public License |
209 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
210 | # |
211 | -from ubuntu_system_tests.helpers.application import QmlApplication |
212 | - |
213 | - |
214 | -APP_QML_FILE = 'camera-app' |
215 | +from ubuntu_system_tests.helpers.application import Application |
216 | + |
217 | + |
218 | APP_NAME = 'Camera' |
219 | APP_ID = 'com.ubuntu.camera_camera' |
220 | -APP_CLICK = 'com.ubuntu.camera' |
221 | - |
222 | - |
223 | -class Camera(QmlApplication): |
224 | +APP_PACKAGE = 'com.ubuntu.camera' |
225 | + |
226 | + |
227 | +class Camera(Application): |
228 | |
229 | def __init__(self): |
230 | - super().__init__(APP_NAME, APP_CLICK, APP_QML_FILE, APP_ID) |
231 | + super().__init__(APP_NAME, APP_PACKAGE, APP_ID) |
232 | |
233 | def get_main_view(self): |
234 | from ubuntu_system_tests.helpers.camera._cpo import MainWindow |
235 | |
236 | === modified file 'ubuntu_system_tests/helpers/click.py' |
237 | --- ubuntu_system_tests/helpers/click.py 2015-06-03 15:46:34 +0000 |
238 | +++ ubuntu_system_tests/helpers/click.py 2016-10-14 14:22:00 +0000 |
239 | @@ -81,13 +81,6 @@ |
240 | return registry.has_package_name(package_name) |
241 | |
242 | |
243 | -def get_click_app_identifier(click): |
244 | - """Return the app identifier or None if not found running.""" |
245 | - output = subprocess.check_output(['ubuntu-app-triplet', click], |
246 | - universal_newlines=True) |
247 | - return output.strip() |
248 | - |
249 | - |
250 | def _get_click_registry(): |
251 | """Return click registry for the current user.""" |
252 | db = Click.DB() |
253 | |
254 | === modified file 'ubuntu_system_tests/helpers/clock/app.py' |
255 | --- ubuntu_system_tests/helpers/clock/app.py 2016-07-15 14:22:08 +0000 |
256 | +++ ubuntu_system_tests/helpers/clock/app.py 2016-10-14 14:22:00 +0000 |
257 | @@ -16,18 +16,17 @@ |
258 | # You should have received a copy of the GNU General Public License |
259 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
260 | # |
261 | -from ubuntu_system_tests.helpers.application import QmlSceneApplication |
262 | +from ubuntu_system_tests.helpers.application import Application |
263 | |
264 | APP_NAME = 'Clock' |
265 | APP_ID = 'com.ubuntu.clock_clock' |
266 | -APP_QML_FILE = 'ubuntu-clock-app' |
267 | -APP_CLICK = 'com.ubuntu.clock' |
268 | - |
269 | - |
270 | -class Clock(QmlSceneApplication): |
271 | +APP_PACKAGE = 'com.ubuntu.clock' |
272 | + |
273 | + |
274 | +class Clock(Application): |
275 | |
276 | def __init__(self): |
277 | - super().__init__(APP_NAME, APP_CLICK, APP_QML_FILE, APP_ID) |
278 | + super().__init__(APP_NAME, APP_PACKAGE, APP_ID) |
279 | |
280 | def get_main_view(self): |
281 | from ubuntu_system_tests.helpers.clock._cpo import MainView # NOQA |
282 | |
283 | === modified file 'ubuntu_system_tests/helpers/dialer_app/app.py' |
284 | --- ubuntu_system_tests/helpers/dialer_app/app.py 2016-09-20 13:29:33 +0000 |
285 | +++ ubuntu_system_tests/helpers/dialer_app/app.py 2016-10-14 14:22:00 +0000 |
286 | @@ -17,19 +17,17 @@ |
287 | # You should have received a copy of the GNU General Public License |
288 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
289 | # |
290 | -from ubuntu_system_tests.helpers.application import QmlApplication |
291 | +from ubuntu_system_tests.helpers.application import Application |
292 | |
293 | APP_NAME = 'Phone' |
294 | -APP_ID = 'com.ubuntu.dialer' |
295 | -APP_QML_FILE = 'dialer-app' |
296 | -APP_CLICK = 'com.ubuntu.dialer' |
297 | -APP_WIN_ID = 'dialer-app' |
298 | - |
299 | - |
300 | -class Dialer(QmlApplication): |
301 | +APP_ID = 'dialer-app' |
302 | +APP_PACKAGE = 'dialer-app' |
303 | + |
304 | + |
305 | +class Dialer(Application): |
306 | |
307 | def __init__(self): |
308 | - super().__init__(APP_NAME, APP_CLICK, APP_QML_FILE, APP_WIN_ID) |
309 | + super().__init__(APP_NAME, APP_PACKAGE, APP_ID) |
310 | |
311 | def get_main_view(self): |
312 | from ubuntu_system_tests.helpers.dialer_app import _cpo # NOQA |
313 | |
314 | === modified file 'ubuntu_system_tests/helpers/gallery/__init__.py' |
315 | --- ubuntu_system_tests/helpers/gallery/__init__.py 2016-06-01 14:18:12 +0000 |
316 | +++ ubuntu_system_tests/helpers/gallery/__init__.py 2016-10-14 14:22:00 +0000 |
317 | @@ -20,9 +20,9 @@ |
318 | |
319 | from ubuntu_system_tests.helpers.gallery.app import ( |
320 | APP, |
321 | - APP_CLICK, |
322 | APP_ICON_NAME, |
323 | APP_NAME, |
324 | + APP_PACKAGE, |
325 | APP_WIN_ID, |
326 | get_gallery_app_proxy, |
327 | get_gallery_events_view, |
328 | @@ -34,9 +34,9 @@ |
329 | |
330 | __all__ = [ |
331 | 'APP', |
332 | - 'APP_CLICK', |
333 | 'APP_ICON_NAME', |
334 | 'APP_NAME', |
335 | + 'APP_PACKAGE', |
336 | 'APP_WIN_ID', |
337 | 'get_gallery_app_proxy', |
338 | 'get_gallery_events_view', |
339 | |
340 | === modified file 'ubuntu_system_tests/helpers/gallery/app.py' |
341 | --- ubuntu_system_tests/helpers/gallery/app.py 2016-08-29 21:57:45 +0000 |
342 | +++ ubuntu_system_tests/helpers/gallery/app.py 2016-10-14 14:22:00 +0000 |
343 | @@ -31,7 +31,7 @@ |
344 | APP = 'gallery-app' |
345 | APP_NAME = 'Gallery' |
346 | APP_WIN_ID = 'com.ubuntu.gallery_gallery' |
347 | -APP_CLICK = 'com.ubuntu.gallery' |
348 | +APP_PACKAGE = 'com.ubuntu.gallery' |
349 | APP_ICON_NAME = 'gallery-app.png' |
350 | |
351 | |
352 | |
353 | === modified file 'ubuntu_system_tests/helpers/messaging/_cpo.py' |
354 | --- ubuntu_system_tests/helpers/messaging/_cpo.py 2016-09-22 12:58:15 +0000 |
355 | +++ ubuntu_system_tests/helpers/messaging/_cpo.py 2016-10-14 14:22:00 +0000 |
356 | @@ -140,7 +140,7 @@ |
357 | |
358 | def _get_attachment_panel(self): |
359 | """Return proxy object for attachment panel.""" |
360 | - return self.wait_select_single(AttachmentPanel) |
361 | + return self.wait_select_single(AttachmentPanel, visible=True) |
362 | |
363 | def _get_content_picker(self): |
364 | return self.wait_select_single(ContentPeerPicker13, visible=True) |
365 | |
366 | === modified file 'ubuntu_system_tests/helpers/music/__init__.py' |
367 | --- ubuntu_system_tests/helpers/music/__init__.py 2016-08-24 13:41:23 +0000 |
368 | +++ ubuntu_system_tests/helpers/music/__init__.py 2016-10-14 14:22:00 +0000 |
369 | @@ -20,6 +20,7 @@ |
370 | APP, |
371 | APP_NAME, |
372 | APP_ID, |
373 | + APP_PACKAGE, |
374 | APP_WIN_ID, |
375 | CONFIG_FILE, |
376 | get_music_app_proxy, |
377 | @@ -39,6 +40,7 @@ |
378 | 'APP', |
379 | 'APP_NAME', |
380 | 'APP_ID', |
381 | + 'APP_PACKAGE', |
382 | 'APP_WIN_ID', |
383 | 'CONFIG_FILE', |
384 | 'get_current_album', |
385 | |
386 | === modified file 'ubuntu_system_tests/helpers/music/app.py' |
387 | --- ubuntu_system_tests/helpers/music/app.py 2016-09-06 12:55:23 +0000 |
388 | +++ ubuntu_system_tests/helpers/music/app.py 2016-10-14 14:22:00 +0000 |
389 | @@ -29,6 +29,7 @@ |
390 | APP = 'music-app' |
391 | APP_NAME = 'Music' |
392 | APP_ID = 'com.ubuntu.music' |
393 | +APP_PACKAGE = 'com.ubuntu.music' |
394 | APP_WIN_ID = 'com.ubuntu.music_music' |
395 | QML = 'music-app.qml' |
396 | |
397 | @@ -49,7 +50,7 @@ |
398 | |
399 | def is_music_app_running(): |
400 | """ Indicate if the music app is currently running """ |
401 | - return processes.is_qmlscene_running_with_qmlfile(APP) |
402 | + return processes.is_application_running(APP_PACKAGE) |
403 | |
404 | |
405 | def get_music_app_proxy(): |
406 | @@ -60,10 +61,11 @@ |
407 | |
408 | """ |
409 | from ubuntu_system_tests.helpers.music import _cpo # NOQA |
410 | - proxy = autopilot.get_proxy_object(processes.get_qmlscene_process_id(APP)) |
411 | + proxy = autopilot.get_proxy_object( |
412 | + processes.get_application_pid(APP_PACKAGE)) |
413 | return proxy.main_view |
414 | |
415 | |
416 | def stop_music_app(): |
417 | """ Stop the music app qml process """ |
418 | - processes.stop_qmlscene_process(QML) |
419 | + processes.stop_application(APP_PACKAGE) |
420 | |
421 | === modified file 'ubuntu_system_tests/helpers/music/utils.py' |
422 | --- ubuntu_system_tests/helpers/music/utils.py 2016-08-24 13:41:23 +0000 |
423 | +++ ubuntu_system_tests/helpers/music/utils.py 2016-10-14 14:22:00 +0000 |
424 | @@ -22,7 +22,7 @@ |
425 | from ubuntu_system_tests.helpers import processes |
426 | from ubuntu_system_tests.helpers.music import ( |
427 | CONFIG_FILE, |
428 | - QML, |
429 | + APP_PACKAGE, |
430 | ) |
431 | |
432 | FIRST_RUN_CONFIG_TEXT = 'firstRun=' |
433 | @@ -40,7 +40,7 @@ |
434 | """ Retrieve the current song based on the url parameter |
435 | :param delimiter: The delimiter used to split the url args parameters |
436 | """ |
437 | - pid = processes.get_qmlscene_process_id(QML) |
438 | + pid = processes.get_application_pid(APP_PACKAGE) |
439 | line = processes.get_process_args(pid) |
440 | args = line.split() |
441 | for arg in args: |
442 | |
443 | === modified file 'ubuntu_system_tests/helpers/processes.py' |
444 | --- ubuntu_system_tests/helpers/processes.py 2016-09-21 19:04:49 +0000 |
445 | +++ ubuntu_system_tests/helpers/processes.py 2016-10-14 14:22:00 +0000 |
446 | @@ -32,8 +32,24 @@ |
447 | |
448 | process_helpers = try_import('unity8.process_helpers') |
449 | |
450 | +PROCESS_STATUS_WAITING = 'S' |
451 | +PROCESS_STATUS_RUNNING = 'R' |
452 | +PRCOESS_STATUS_UNINTERRUPTABLE = 'D' |
453 | +PROCESS_STATUS_STOPPED = 'T' |
454 | +PROCESS_STATUS_NOT_RUNNING = 'X' |
455 | +PROCESS_STATUS_ZOMBIE = 'Z' |
456 | + |
457 | +PROCESS_RUNNING_STATES = [ |
458 | + PROCESS_STATUS_WAITING, |
459 | + PROCESS_STATUS_RUNNING, |
460 | + PRCOESS_STATUS_UNINTERRUPTABLE, |
461 | + PROCESS_STATUS_STOPPED, |
462 | +] |
463 | + |
464 | logger = logging.getLogger(__name__) |
465 | |
466 | +app_ids = None |
467 | + |
468 | |
469 | class PidNotFoundError(RuntimeError): |
470 | """Pid not found error.""" |
471 | @@ -65,65 +81,101 @@ |
472 | except subprocess.CalledProcessError: |
473 | raise PidNotFoundError(pname) |
474 | for pid in pids: |
475 | - process = psutil.Process(int(pid)) |
476 | - if process.status() == psutil.STATUS_RUNNING \ |
477 | - or process.status() == psutil.STATUS_SLEEPING: |
478 | - return process.pid |
479 | + if get_process_status(pid) in PROCESS_RUNNING_STATES: |
480 | + return int(pid) |
481 | raise PidNotFoundError(pname) |
482 | |
483 | |
484 | +def get_process_status(pid): |
485 | + """Return the status code for specifiec process id.""" |
486 | + try: |
487 | + output = subprocess.check_output(['ps', '-p', pid, '-o', 'state']) |
488 | + except subprocess.CalledProcessError: |
489 | + return PROCESS_STATUS_NOT_RUNNING |
490 | + else: |
491 | + return output.decode().split()[1] |
492 | + |
493 | + |
494 | def stop_process(pname): |
495 | if is_process_running(pname): |
496 | [process.terminate() for process in psutil.process_iter() if |
497 | process.name() == pname] |
498 | |
499 | |
500 | -def start_application(app_name, *args): |
501 | - subprocess.call(['ubuntu-app-launch', app_name] + list(args)) |
502 | - |
503 | - |
504 | -def ensure_application_closed(app_id): |
505 | - subprocess.call(['ubuntu-app-stop', app_id]) |
506 | - |
507 | - |
508 | -def ensure_all_apps_closed(): |
509 | +def start_application(package, *args): |
510 | + """Start application with specified package.""" |
511 | + app_id = get_application_id(package) |
512 | + subprocess.check_call(['ubuntu-app-launch', app_id] + list(args)) |
513 | + |
514 | + |
515 | +def stop_application(package): |
516 | + """Stop application with specified package.""" |
517 | + app_id = get_application_id(package) |
518 | + if app_id == package: |
519 | + # This is a native application. |
520 | + # Due to https://launchpad.net/bugs/1626028 use os.kill instead of |
521 | + # ubuntu-app-stop. |
522 | + try: |
523 | + pid = get_application_pid(package) |
524 | + except PidNotFoundError: |
525 | + pass # app is already stopped |
526 | + else: |
527 | + os.kill(pid, signal.SIGKILL) |
528 | + else: |
529 | + # This is a web-app or click-app which works with ubuntu-app-stop |
530 | + subprocess.check_call(['ubuntu-app-stop', app_id]) |
531 | + |
532 | + |
533 | +def stop_all_applications(): |
534 | + """Stop all opened applications.""" |
535 | open_apps = list_open_applications() |
536 | for app in open_apps: |
537 | - ensure_application_closed(app) |
538 | + stop_application(app) |
539 | + |
540 | + |
541 | +def get_app_id_list(): |
542 | + """Get list of installed app ids, using saved list if present.""" |
543 | + global app_ids |
544 | + if not app_ids: |
545 | + app_ids = subprocess.check_output( |
546 | + ['ubuntu-app-launch-appids'], |
547 | + universal_newlines=True).strip().split() |
548 | + return app_ids |
549 | |
550 | |
551 | def list_open_applications(): |
552 | + """Return a list of open application ids.""" |
553 | apps = subprocess.check_output(['ubuntu-app-list'], |
554 | - shell=True, |
555 | universal_newlines=True) |
556 | return apps.split() |
557 | |
558 | |
559 | -def is_qmlscene_running_with_qmlfile(qmlfile): |
560 | - """ Indicate if the qmlscene is running the qml file qmlfile """ |
561 | - pline = subprocess.check_output('ps -ef | grep qmlscene', shell=True, |
562 | - universal_newlines=True) |
563 | - return qmlfile in pline |
564 | - |
565 | - |
566 | -def get_qmlscene_process_id(qmlfile): |
567 | - """ Retrieve the process id for the qmlscene running the file qmlfile """ |
568 | +def is_application_running(package): |
569 | + """Return boolean indicating if app is currently running.""" |
570 | + return get_application_id(package) in list_open_applications() |
571 | + |
572 | + |
573 | +def get_application_id(package): |
574 | + """Return application id for specified app_id or package name.""" |
575 | + if package in get_app_id_list(): |
576 | + # The specified package is already a valid app id |
577 | + return package |
578 | + output = subprocess.check_output( |
579 | + ['ubuntu-app-triplet', package], universal_newlines=True).strip() |
580 | + if output: |
581 | + return output |
582 | + else: |
583 | + raise ValueError('Package {} not found'.format(package)) |
584 | + |
585 | + |
586 | +def get_application_pid(package): |
587 | + app_id = get_application_id(package) |
588 | try: |
589 | - output = subprocess.check_output(['pgrep', 'qmlscene']) |
590 | - except subprocess.CalledProcessError: |
591 | - raise PidNotFoundError('qmlscene') |
592 | - else: |
593 | - for pid in output.decode().split(): |
594 | - if qmlfile in get_process_args(pid): |
595 | - return int(pid) |
596 | - raise PidNotFoundError('qmlscene {}'.format(qmlfile)) |
597 | - |
598 | - |
599 | -def stop_qmlscene_process(qmlfile): |
600 | - """ Stop the qmlscene process running the file qmlfile """ |
601 | - if is_qmlscene_running_with_qmlfile(qmlfile): |
602 | - pid = get_qmlscene_process_id(qmlfile) |
603 | - os.kill(pid, signal.SIGKILL) |
604 | + pid = int(subprocess.check_output(['ubuntu-app-pid', app_id], |
605 | + universal_newlines=True).strip()) |
606 | + except (subprocess.CalledProcessError, ValueError): |
607 | + raise PidNotFoundError(app_id) |
608 | + return pid |
609 | |
610 | |
611 | def get_process_args(pid): |
612 | |
613 | === modified file 'ubuntu_system_tests/helpers/system_settings/app.py' |
614 | --- ubuntu_system_tests/helpers/system_settings/app.py 2016-09-06 12:55:23 +0000 |
615 | +++ ubuntu_system_tests/helpers/system_settings/app.py 2016-10-14 14:22:00 +0000 |
616 | @@ -28,6 +28,7 @@ |
617 | APP = 'system-settings' |
618 | APP_NAME = 'System Settings' |
619 | APP_WIN_ID = 'ubuntu-system-settings' |
620 | +APP_PACKAGE = 'ubuntu-system-settings' |
621 | |
622 | |
623 | def launch_system_settings(): |
624 | |
625 | === modified file 'ubuntu_system_tests/helpers/telegram/app.py' |
626 | --- ubuntu_system_tests/helpers/telegram/app.py 2016-08-26 18:44:37 +0000 |
627 | +++ ubuntu_system_tests/helpers/telegram/app.py 2016-10-14 14:22:00 +0000 |
628 | @@ -16,18 +16,17 @@ |
629 | # You should have received a copy of the GNU General Public License |
630 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
631 | |
632 | -from ubuntu_system_tests.helpers.application import QmlApplication |
633 | +from ubuntu_system_tests.helpers.application import Application |
634 | |
635 | -APP_QML_FILE = 'telegram' |
636 | -APP_CLICK = 'com.ubuntu.telegram' |
637 | +APP_PACKAGE = 'com.ubuntu.telegram' |
638 | APP_NAME = 'Telegram' |
639 | APP_ID = 'com.ubuntu.telegram_telegram' |
640 | |
641 | |
642 | -class Telegram(QmlApplication): |
643 | +class Telegram(Application): |
644 | |
645 | def __init__(self): |
646 | - super().__init__(APP_NAME, APP_CLICK, APP_QML_FILE, APP_ID) |
647 | + super().__init__(APP_NAME, APP_PACKAGE, APP_ID) |
648 | |
649 | def get_main_view(self): |
650 | from ubuntu_system_tests.helpers.telegram._cpo import MainView # NOQA |
651 | |
652 | === modified file 'ubuntu_system_tests/helpers/ubuntuuitoolkit/_flickable.py' |
653 | --- ubuntu_system_tests/helpers/ubuntuuitoolkit/_flickable.py 2016-04-15 15:46:06 +0000 |
654 | +++ ubuntu_system_tests/helpers/ubuntuuitoolkit/_flickable.py 2016-10-14 14:22:00 +0000 |
655 | @@ -33,6 +33,7 @@ |
656 | """Over-ride base class helper to take account of OSK showing.""" |
657 | super().swipe_child_into_view(child) |
658 | self.move_item_above_osk(child) |
659 | + child.wait_until_not_moving() |
660 | |
661 | def move_upwards(self): |
662 | """Swipe the flickable object upwards slightly.""" |
663 | |
664 | === modified file 'ubuntu_system_tests/helpers/unity8/fixture_setup.py' |
665 | --- ubuntu_system_tests/helpers/unity8/fixture_setup.py 2016-09-23 20:23:53 +0000 |
666 | +++ ubuntu_system_tests/helpers/unity8/fixture_setup.py 2016-10-14 14:22:00 +0000 |
667 | @@ -29,8 +29,9 @@ |
668 | from ubuntu_system_tests.helpers import try_import |
669 | from ubuntu_system_tests.helpers.processes import ( |
670 | PidNotFoundError, |
671 | - ensure_all_apps_closed, |
672 | - is_testability_enabled_for_process) |
673 | + is_testability_enabled_for_process, |
674 | + stop_all_applications, |
675 | +) |
676 | from ubuntu_system_tests.helpers.unity8 import Unity8Job |
677 | from autopilot import ( |
678 | exceptions |
679 | @@ -106,7 +107,7 @@ |
680 | if not is_testability_enabled_for_process( |
681 | self.unity8.get_pid()): |
682 | self.unity8.restart() |
683 | - self.addCleanup(ensure_all_apps_closed) |
684 | + self.addCleanup(stop_all_applications) |
685 | |
686 | |
687 | class EnableUnity8FakeSensors(fixtures.Fixture): |
688 | |
689 | === modified file 'ubuntu_system_tests/helpers/webapp/__init__.py' |
690 | --- ubuntu_system_tests/helpers/webapp/__init__.py 2016-07-04 14:06:16 +0000 |
691 | +++ ubuntu_system_tests/helpers/webapp/__init__.py 2016-10-14 14:22:00 +0000 |
692 | @@ -23,8 +23,6 @@ |
693 | DEFAULT_WEBVIEW_INSPECTOR_IP, |
694 | DEFAULT_WEBVIEW_INSPECTOR_PORT, |
695 | get_webdriver, |
696 | - is_webapp_runing, |
697 | - launch_webapp, |
698 | ) |
699 | |
700 | |
701 | @@ -33,6 +31,4 @@ |
702 | 'DEFAULT_WEBVIEW_INSPECTOR_IP', |
703 | 'DEFAULT_WEBVIEW_INSPECTOR_PORT', |
704 | 'get_webdriver', |
705 | - 'is_webapp_runing', |
706 | - 'launch_webapp', |
707 | ] |
708 | |
709 | === modified file 'ubuntu_system_tests/helpers/webapp/_cpo.py' |
710 | --- ubuntu_system_tests/helpers/webapp/_cpo.py 2015-10-21 05:52:09 +0000 |
711 | +++ ubuntu_system_tests/helpers/webapp/_cpo.py 2016-10-14 14:22:00 +0000 |
712 | @@ -20,6 +20,22 @@ |
713 | |
714 | from ubuntuuitoolkit import UbuntuUIToolkitCustomProxyObjectBase |
715 | |
716 | +from ubuntu_system_tests.helpers.autopilot import validate_dbus_object |
717 | + |
718 | +HERE_PATH_ROOT = b'comnokiaheremaps' |
719 | + |
720 | + |
721 | +class comnokiaheremaps(UbuntuUIToolkitCustomProxyObjectBase): |
722 | + |
723 | + @classmethod |
724 | + def validate_dbus_object(cls, path, state): |
725 | + return validate_dbus_object( |
726 | + path, state, HERE_PATH_ROOT, HERE_PATH_ROOT) |
727 | + |
728 | + @property |
729 | + def main_view(self): |
730 | + return self.wait_select_single(BrowserWindow) |
731 | + |
732 | |
733 | class BrowserWindow(UbuntuUIToolkitCustomProxyObjectBase): |
734 | """ Autopilot helper for the webapp Browser Window """ |
735 | |
736 | === modified file 'ubuntu_system_tests/helpers/webapp/ebay.py' |
737 | --- ubuntu_system_tests/helpers/webapp/ebay.py 2016-07-14 19:11:58 +0000 |
738 | +++ ubuntu_system_tests/helpers/webapp/ebay.py 2016-10-14 14:22:00 +0000 |
739 | @@ -20,26 +20,21 @@ |
740 | |
741 | from ubuntu_system_tests.helpers import ( |
742 | try_import, |
743 | - webapp, |
744 | ) |
745 | +from ubuntu_system_tests.helpers.application import Application |
746 | from ubuntu_system_tests.helpers.webapp import BasePage |
747 | |
748 | WebDriverWait = try_import('selenium.webdriver.support.ui').WebDriverWait |
749 | |
750 | WEBAPP_NAME = 'eBay' |
751 | WEBAPP_PACKAGE = 'com.ubuntu.developer.webapps.webapp-ebay' |
752 | -WEBAPP_WIN_ID = 'com.ubuntu.developer.webapps.webapp-ebay_webapp-ebay' |
753 | - |
754 | - |
755 | -def launch_ebay_webapp(): |
756 | - """ Launch the Ebay webapp from apps scope and return its proxy object |
757 | - """ |
758 | - return webapp.launch_webapp(WEBAPP_NAME, WEBAPP_PACKAGE) |
759 | - |
760 | - |
761 | -def is_ebay_webapp_running(): |
762 | - """ Indicate if the ebay webapp is currently running """ |
763 | - return webapp.is_webapp_runing(WEBAPP_PACKAGE) |
764 | +WEBAPP_ID = 'com.ubuntu.developer.webapps.webapp-ebay_webapp-ebay' |
765 | + |
766 | + |
767 | +class EbayApplication(Application): |
768 | + |
769 | + def __init__(self): |
770 | + super().__init__(WEBAPP_NAME, WEBAPP_PACKAGE, WEBAPP_ID) |
771 | |
772 | |
773 | class Homepage(BasePage): |
774 | |
775 | === modified file 'ubuntu_system_tests/helpers/webapp/here.py' |
776 | --- ubuntu_system_tests/helpers/webapp/here.py 2016-07-15 13:30:57 +0000 |
777 | +++ ubuntu_system_tests/helpers/webapp/here.py 2016-10-14 14:22:00 +0000 |
778 | @@ -22,8 +22,8 @@ |
779 | |
780 | from ubuntu_system_tests.helpers import ( |
781 | try_import, |
782 | - webapp, |
783 | ) |
784 | +from ubuntu_system_tests.helpers.application import Application |
785 | from ubuntu_system_tests.helpers.webapp import BasePage |
786 | |
787 | TimeoutException = try_import('selenium.common.exceptions').TimeoutException |
788 | @@ -33,19 +33,17 @@ |
789 | |
790 | WEBAPP_NAME = 'HERE Maps' |
791 | WEBAPP_PACKAGE = 'com.nokia.heremaps' |
792 | -WEBAPP_WIN_ID = 'com.nokia.heremaps_here' |
793 | - |
794 | - |
795 | -def launch_here_webapp(): |
796 | - """ Launch the Here webapp from apps scope and return its proxy object |
797 | - """ |
798 | - return webapp.launch_webapp(WEBAPP_NAME, WEBAPP_PACKAGE) |
799 | - |
800 | - |
801 | -def is_here_webapp_running(): |
802 | - """ Indicate if the here webapp is currently running """ |
803 | - webapp_package = WEBAPP_PACKAGE |
804 | - return webapp.is_webapp_runing(webapp_package) |
805 | +WEBAPP_ID = 'com.nokia.heremaps_here' |
806 | + |
807 | + |
808 | +class HereApplication(Application): |
809 | + |
810 | + def __init__(self): |
811 | + super().__init__(WEBAPP_NAME, WEBAPP_PACKAGE, WEBAPP_ID) |
812 | + |
813 | + def get_main_view(self): |
814 | + from ubuntu_system_tests.helpers.webapp import _cpo # NOQA |
815 | + return self.get_proxy_object().main_view |
816 | |
817 | |
818 | class Homepage(BasePage): |
819 | |
820 | === modified file 'ubuntu_system_tests/helpers/webapp/utils.py' |
821 | --- ubuntu_system_tests/helpers/webapp/utils.py 2016-07-15 10:25:19 +0000 |
822 | +++ ubuntu_system_tests/helpers/webapp/utils.py 2016-10-14 14:22:00 +0000 |
823 | @@ -20,19 +20,10 @@ |
824 | |
825 | import glob |
826 | import logging |
827 | -import subprocess |
828 | import os |
829 | import time |
830 | |
831 | -from ubuntu_system_tests.helpers import ( |
832 | - autopilot, |
833 | - processes, |
834 | - try_import, |
835 | -) |
836 | -from ubuntu_system_tests.helpers.scopes.apps import ( |
837 | - launch_application_from_apps_scope |
838 | -) |
839 | -from ubuntu_system_tests.helpers import wait_until |
840 | +from ubuntu_system_tests.helpers import try_import |
841 | |
842 | webdriver = try_import('selenium.webdriver') |
843 | Options = webdriver.chrome.options.Options |
844 | @@ -44,65 +35,6 @@ |
845 | logger = logging.getLogger(__name__) |
846 | |
847 | |
848 | -def launch_webapp(app_name, web_app_package): |
849 | - """ Launch the webapp and return the webapp proxy object |
850 | - :param app_name: The name in the apps scope |
851 | - :param web_app_package: The package name |
852 | - :return: Proxy object for webapp |
853 | - """ |
854 | - launch_application_from_apps_scope(app_name) |
855 | - wait_until(is_webapp_runing, web_app_package) |
856 | - return get_webapp_proxy(web_app_package) |
857 | - |
858 | - |
859 | -def is_webapp_runing(web_app): |
860 | - """ Indicate if the web app is running """ |
861 | - try: |
862 | - return get_webapp_pid(web_app) != 0 |
863 | - except: |
864 | - return False |
865 | - |
866 | - |
867 | -def _get_webapp_id(web_app): |
868 | - try: |
869 | - webapp_id = subprocess.check_output( |
870 | - ['ubuntu-app-triplet', web_app], |
871 | - universal_newlines=True).strip() |
872 | - return webapp_id |
873 | - except subprocess.CalledProcessError: |
874 | - raise RuntimeError('No such webapp {}'.format(web_app)) |
875 | - |
876 | - |
877 | -def get_webapp_pid(web_app): |
878 | - """ Retrieve the web app process id """ |
879 | - try: |
880 | - webapp_id = _get_webapp_id(web_app) |
881 | - return int(subprocess.check_output(['ubuntu-app-pid', webapp_id], |
882 | - universal_newlines=True).strip()) |
883 | - except subprocess.CalledProcessError: |
884 | - raise RuntimeError('No such webapp {} running'.format(webapp_id)) |
885 | - |
886 | - |
887 | -def get_webapp_proxy(web_app_package): |
888 | - """ Return webapp proxy object from existing process. |
889 | - :param web_app_package: The package name |
890 | - :return: Proxy object for webapp. |
891 | - """ |
892 | - from ubuntu_system_tests.helpers.webapp import _cpo # NOQA |
893 | - |
894 | - pid = get_webapp_pid(web_app_package) |
895 | - proxy = autopilot.get_proxy_object(pid) |
896 | - return proxy.wait_select_single('BrowserWindow') |
897 | - |
898 | - |
899 | -def ensure_webapp_closed(web_app): |
900 | - try: |
901 | - webapp_id = _get_webapp_id(web_app) |
902 | - processes.ensure_application_closed(webapp_id) |
903 | - except subprocess.CalledProcessError: |
904 | - pass |
905 | - |
906 | - |
907 | def get_webdriver(cleanup_method): |
908 | """ Retrieve the webdriver for the current webapp container """ |
909 | driver = setup_webdriver() |
910 | |
911 | === modified file 'ubuntu_system_tests/helpers/webbrowser/app.py' |
912 | --- ubuntu_system_tests/helpers/webbrowser/app.py 2016-07-15 14:22:08 +0000 |
913 | +++ ubuntu_system_tests/helpers/webbrowser/app.py 2016-10-14 14:22:00 +0000 |
914 | @@ -17,18 +17,17 @@ |
915 | # You should have received a copy of the GNU General Public License |
916 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
917 | # |
918 | -from ubuntu_system_tests.helpers.application import QmlApplication |
919 | +from ubuntu_system_tests.helpers.application import Application |
920 | |
921 | APP_NAME = 'Browser' |
922 | APP_ID = 'com.ubuntu.webbrowser' |
923 | -APP_QML_FILE = 'webbrowser-app' |
924 | -APP_CLICK = 'com.ubuntu.webbrowser' |
925 | - |
926 | - |
927 | -class WebBrowser(QmlApplication): |
928 | +APP_PACKAGE = 'webbrowser-app' |
929 | + |
930 | + |
931 | +class WebBrowser(Application): |
932 | |
933 | def __init__(self): |
934 | - super().__init__(APP_NAME, APP_CLICK, APP_QML_FILE, APP_ID) |
935 | + super().__init__(APP_NAME, APP_PACKAGE, APP_ID) |
936 | |
937 | def get_main_view(self): |
938 | from ubuntu_system_tests.helpers.webbrowser import _cpo # NOQA |
939 | |
940 | === modified file 'ubuntu_system_tests/perftests/scalability/test_photos.py' |
941 | --- ubuntu_system_tests/perftests/scalability/test_photos.py 2016-08-30 17:21:28 +0000 |
942 | +++ ubuntu_system_tests/perftests/scalability/test_photos.py 2016-10-14 14:22:00 +0000 |
943 | @@ -120,7 +120,7 @@ |
944 | photo_viewer.get_photo_component().source) |
945 | self._log_completed(CAROUSEL, PICS_ID) |
946 | |
947 | - processes.ensure_application_closed(gallery.APP) |
948 | + processes.stop_application(gallery.APP_PACKAGE) |
949 | |
950 | @skipUnless(fs.is_media_folder_dir(fs.DIR_PICTURES), SD_REASON) |
951 | @skipUnless(scopes.is_scope_included(scopes.SCOPE_ID_PHOTOS), PHOTO_REASON) |
952 | @@ -181,7 +181,7 @@ |
953 | self.assertLess(0, len(pics)) |
954 | self._log_completed(GALLERY, PICS_ID) |
955 | |
956 | - processes.ensure_application_closed(gallery.APP) |
957 | + processes.stop_application(gallery.APP_PACKAGE) |
958 | |
959 | @skipUnless(fs.is_media_folder_dir(fs.DIR_PICTURES), SD_REASON) |
960 | def test_view_gallery_pictures_on_sdcard(self): |
961 | |
962 | === modified file 'ubuntu_system_tests/tests/base_messaging.py' |
963 | --- ubuntu_system_tests/tests/base_messaging.py 2016-08-03 09:32:27 +0000 |
964 | +++ ubuntu_system_tests/tests/base_messaging.py 2016-10-14 14:22:00 +0000 |
965 | @@ -508,9 +508,9 @@ |
966 | addressbook = AddressBook() |
967 | self._open_app_to_attach_content( |
968 | attachment.media_type, addressbook.app_name) |
969 | - addressbook_app = addressbook.proxy_object.main_window |
970 | - self.addCleanup(processes.ensure_application_closed, |
971 | - addressbook.app_id) |
972 | + addressbook_app = addressbook.get_main_view() |
973 | + self.addCleanup(processes.stop_application, |
974 | + addressbook.app_package) |
975 | list_page = addressbook_app.get_contact_list_pick_page() |
976 | list_page.select_contact_by_name(attachment.identifier) |
977 | list_page.confirm_selection() |
978 | @@ -520,7 +520,7 @@ |
979 | self._open_app_to_attach_content( |
980 | attachment.media_type, gallery.APP_NAME) |
981 | picker = gallery.get_gallery_app_proxy().picker_screen |
982 | - self.addCleanup(processes.ensure_application_closed, gallery.APP) |
983 | + self.addCleanup(processes.stop_application, gallery.APP_PACKAGE) |
984 | sample_photo_location = os.path.join(fs.DIR_HOME_CAMERA_PICTURES, |
985 | attachment.identifier) |
986 | photos = picker.go_to_photos() |
987 | @@ -529,20 +529,22 @@ |
988 | |
989 | def _add_attachment_from_camera(self, attachment): |
990 | """Add an attachment using the camera app.""" |
991 | + camera_app = camera.Camera() |
992 | self._open_app_to_attach_content( |
993 | - attachment.media_type, camera.APP_NAME) |
994 | - camera_app = camera.get_camera_app_proxy() |
995 | - self.addCleanup(processes.ensure_application_closed, camera.APP) |
996 | - camera_app.take_photo_and_select() |
997 | + attachment.media_type, camera_app.app_name) |
998 | + camera_view = camera_app.get_main_view() |
999 | + self.addCleanup(processes.stop_application, camera_app.app_package) |
1000 | + camera_view.take_photo_and_select() |
1001 | |
1002 | def _add_attachment_from_camera_photoroll(self, attachment): |
1003 | """Add an attachment using the camera app photoroll.""" |
1004 | + camera_app = camera.Camera() |
1005 | self._open_app_to_attach_content( |
1006 | - attachment.media_type, camera.APP_NAME) |
1007 | - camera_app = camera.get_camera_app_proxy() |
1008 | - self.addCleanup(processes.ensure_application_closed, camera.APP) |
1009 | - camera_app.swipe_to_gallery(self) |
1010 | - camera_app.select_photo_from_roll() |
1011 | + attachment.media_type, camera_app.app_name) |
1012 | + camera_view = camera_app.get_main_view() |
1013 | + self.addCleanup(processes.stop_application, camera_app.app_package) |
1014 | + camera_view.swipe_to_gallery(self) |
1015 | + camera_view.select_photo_from_roll() |
1016 | |
1017 | def set_default_sim_for_messages_with_uss(self, value): |
1018 | """ |
1019 | @@ -564,8 +566,8 @@ |
1020 | settings.scroll_to_and_click(selector) |
1021 | selector.selected.wait_for(True) |
1022 | self.dash.swipe_screen_from_left() |
1023 | - self.addCleanup(processes.ensure_application_closed, |
1024 | - system_settings.APP) |
1025 | + self.addCleanup(processes.stop_application, |
1026 | + system_settings.APP_PACKAGE) |
1027 | |
1028 | def click_message_url(self, message_text): |
1029 | """Click the message text in a message bubble.""" |
1030 | |
1031 | === modified file 'ubuntu_system_tests/tests/test_about_this_phone.py' |
1032 | --- ubuntu_system_tests/tests/test_about_this_phone.py 2016-09-16 16:44:29 +0000 |
1033 | +++ ubuntu_system_tests/tests/test_about_this_phone.py 2016-10-14 14:22:00 +0000 |
1034 | @@ -99,7 +99,7 @@ |
1035 | |
1036 | def _check_gallery_app_in_storage(self, storage_page): |
1037 | install_dir = os.path.join(fs.DIR_PREINSTALLED_CLICK_APPS, |
1038 | - gallery.APP_CLICK) |
1039 | + gallery.APP_PACKAGE) |
1040 | gallery_app_size = self._bytes_to_kb( |
1041 | fs.get_disk_usage(install_dir)) |
1042 | self._check_storage_in_range(gallery_app_size, self._storage_to_kb( |
1043 | |
1044 | === modified file 'ubuntu_system_tests/tests/test_app_store.py' |
1045 | --- ubuntu_system_tests/tests/test_app_store.py 2016-09-16 16:44:29 +0000 |
1046 | +++ ubuntu_system_tests/tests/test_app_store.py 2016-10-14 14:22:00 +0000 |
1047 | @@ -97,9 +97,8 @@ |
1048 | # Wait for the application to start installing. |
1049 | self.dash.wait_for_processing_to_complete() |
1050 | preview.wait_until_package_installed() |
1051 | - app_id = click.get_click_app_identifier(google_maps.PACKAGE_NAME) |
1052 | preview.open() |
1053 | - self.addCleanup(processes.ensure_application_closed, app_id) |
1054 | + self.addCleanup(processes.stop_application, google_maps.PACKAGE_NAME) |
1055 | |
1056 | self.assertThat( |
1057 | self.shell.get_current_focused_app_id, Eventually( |
1058 | |
1059 | === modified file 'ubuntu_system_tests/tests/test_app_switcher.py' |
1060 | --- ubuntu_system_tests/tests/test_app_switcher.py 2016-09-20 14:43:41 +0000 |
1061 | +++ ubuntu_system_tests/tests/test_app_switcher.py 2016-10-14 14:22:00 +0000 |
1062 | @@ -27,7 +27,8 @@ |
1063 | fixture_setup as camera_fixture) |
1064 | from ubuntu_system_tests.helpers.dialer_app import ( |
1065 | Dialer, |
1066 | - app as dialer_app_helpers) |
1067 | + app as dialer_app_helpers, |
1068 | +) |
1069 | from ubuntu_system_tests.helpers.messaging import Messaging |
1070 | from ubuntu_system_tests.helpers.processes import is_process_running |
1071 | from ubuntu_system_tests.helpers import unity8 |
1072 | @@ -88,7 +89,7 @@ |
1073 | camera_title, ma, aa, dialer_title = self._launch_applications(stage) |
1074 | self._switch_to_app(stage, camera_app_helpers.APP_ID, camera_title) |
1075 | stage = self.shell.swipe_to_show_app_switcher() |
1076 | - self._switch_to_app(stage, dialer_app_helpers.APP_WIN_ID, dialer_title) |
1077 | + self._switch_to_app(stage, camera_app_helpers.APP_ID, camera_title) |
1078 | |
1079 | def test_close_app(self): |
1080 | """ |
1081 | @@ -96,5 +97,5 @@ |
1082 | the swipe actions. |
1083 | """ |
1084 | stage = self._launch_switcher() |
1085 | - dialer_title = self._launch_applications(stage)[3] |
1086 | - self._close_app(stage, dialer_app_helpers.APP_WIN_ID, dialer_title) |
1087 | + dialer_title = self._launch_applications(stage)[0] |
1088 | + self._close_app(stage, dialer_app_helpers.APP_ID, dialer_title) |
1089 | |
1090 | === modified file 'ubuntu_system_tests/tests/webapps/test_ebay.py' |
1091 | --- ubuntu_system_tests/tests/webapps/test_ebay.py 2016-09-16 12:58:16 +0000 |
1092 | +++ ubuntu_system_tests/tests/webapps/test_ebay.py 2016-10-14 14:22:00 +0000 |
1093 | @@ -31,7 +31,9 @@ |
1094 | |
1095 | def setUp(self): |
1096 | super().setUp() |
1097 | - self.web_app = ebay.launch_ebay_webapp() |
1098 | + self.ebay_app = ebay.EbayApplication() |
1099 | + self.ebay_app.launch_from_scope(return_proxy=False) |
1100 | + self.web_app = self.ebay_app.get_proxy_object() |
1101 | self.driver = webapp.get_webdriver(self.addCleanup) |
1102 | |
1103 | def test_open_and_view_content(self): |
1104 | |
1105 | === modified file 'ubuntu_system_tests/tests/webapps/test_here.py' |
1106 | --- ubuntu_system_tests/tests/webapps/test_here.py 2016-09-16 12:58:16 +0000 |
1107 | +++ ubuntu_system_tests/tests/webapps/test_here.py 2016-10-14 14:22:00 +0000 |
1108 | @@ -41,7 +41,9 @@ |
1109 | self.useFixture(DummyLocation(*EIFFEL_TOWER)) |
1110 | super().setUp() |
1111 | self.useFixture(SetLocationAccessRequests(self.LOCATION_APP)) |
1112 | - self.webapp = here.launch_here_webapp() |
1113 | + self.here_app = here.HereApplication() |
1114 | + self.here_app.launch_from_scope(return_proxy=False) |
1115 | + self.webapp = self.here_app.get_main_view() |
1116 | self.driver = webapp.get_webdriver(self.addCleanup) |
1117 | |
1118 | def test_retrieve_location(self): |