Merge lp:~canonical-platform-qa/ubuntu-system-tests/port_to_new_autopilot into lp:ubuntu-system-tests
- port_to_new_autopilot
- Merge into trunk
Proposed by
Omer Akram
Status: | Work in progress |
---|---|
Proposed branch: | lp:~canonical-platform-qa/ubuntu-system-tests/port_to_new_autopilot |
Merge into: | lp:ubuntu-system-tests |
Diff against target: |
2034 lines (+218/-697) 53 files modified
debian/tests/dependencies.json (+0/-1) ubuntu_system_tests/helpers/addressbook/_cpo.py (+4/-6) ubuntu_system_tests/helpers/autopilot/__init__.py (+2/-12) ubuntu_system_tests/helpers/autopilot/input.py (+0/-56) ubuntu_system_tests/helpers/autopilot/list.py (+0/-59) ubuntu_system_tests/helpers/autopilot/object.py (+0/-139) ubuntu_system_tests/helpers/autopilot/utils.py (+12/-124) ubuntu_system_tests/helpers/camera/_cpo.py (+4/-4) ubuntu_system_tests/helpers/clock/_cpo.py (+8/-6) ubuntu_system_tests/helpers/dialer_app/_cpo.py (+9/-11) ubuntu_system_tests/helpers/gallery/_cpo.py (+3/-3) ubuntu_system_tests/helpers/indicators/message.py (+3/-5) ubuntu_system_tests/helpers/messaging/_cpo.py (+14/-17) ubuntu_system_tests/helpers/messaging/app.py (+2/-2) ubuntu_system_tests/helpers/music/_cpo.py (+6/-7) ubuntu_system_tests/helpers/notifications/sim_pin.py (+4/-4) ubuntu_system_tests/helpers/notifications/utils.py (+4/-5) ubuntu_system_tests/helpers/power/fixture_setup.py (+4/-4) ubuntu_system_tests/helpers/power/utils.py (+4/-3) ubuntu_system_tests/helpers/processes.py (+3/-29) ubuntu_system_tests/helpers/scopes/apps/_cpo.py (+7/-11) ubuntu_system_tests/helpers/scopes/apps/_preview.py (+4/-5) ubuntu_system_tests/helpers/scopes/base.py (+8/-16) ubuntu_system_tests/helpers/scopes/music/_artist.py (+7/-7) ubuntu_system_tests/helpers/scopes/music/_cpo.py (+8/-9) ubuntu_system_tests/helpers/scopes/music/_preview.py (+1/-3) ubuntu_system_tests/helpers/scopes/photos/_category.py (+5/-7) ubuntu_system_tests/helpers/scopes/photos/_cpo.py (+9/-12) ubuntu_system_tests/helpers/scopes/photos/_list.py (+6/-7) ubuntu_system_tests/helpers/scopes/photos/_preview.py (+1/-3) ubuntu_system_tests/helpers/scopes/video/_cpo.py (+6/-7) ubuntu_system_tests/helpers/system_settings/_cpo.py (+3/-4) ubuntu_system_tests/helpers/telegram/app.py (+5/-3) ubuntu_system_tests/helpers/ubuntu_keyboard/_cpo.py (+2/-2) ubuntu_system_tests/helpers/ubuntuuitoolkit/mainview.py (+1/-1) ubuntu_system_tests/helpers/ubuntuuitoolkit/optiontoggle.py (+1/-2) ubuntu_system_tests/helpers/ubuntuuitoolkit/pageheader.py (+2/-11) ubuntu_system_tests/helpers/unity8/dash.py (+7/-11) ubuntu_system_tests/helpers/unity8/phone_stage.py (+10/-15) ubuntu_system_tests/helpers/unity8/settings_wizard.py (+3/-3) ubuntu_system_tests/helpers/webbrowser/_cpo.py (+15/-12) ubuntu_system_tests/helpers/webbrowser/app.py (+3/-1) ubuntu_system_tests/perftests/scalability/test_photos.py (+1/-2) ubuntu_system_tests/selftests/test_config.py (+0/-28) ubuntu_system_tests/tests/indicators/test_indicator_battery.py (+0/-1) ubuntu_system_tests/tests/indicators/test_indicator_bluetooth.py (+0/-1) ubuntu_system_tests/tests/indicators/test_indicator_datetime.py (+0/-1) ubuntu_system_tests/tests/indicators/test_indicator_network.py (+10/-6) ubuntu_system_tests/tests/indicators/test_indicator_sound.py (+0/-2) ubuntu_system_tests/tests/scopes/test_default_scopes.py (+1/-2) ubuntu_system_tests/tests/test_calls.py (+3/-2) ubuntu_system_tests/tests/test_clock.py (+1/-1) ubuntu_system_tests/tests/test_with_webbrowser.py (+2/-2) |
To merge this branch: | bzr merge lp:~canonical-platform-qa/ubuntu-system-tests/port_to_new_autopilot |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Canonical Platform QA Team | Pending | ||
Review via email: mp+301384@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
- 426. By Omer Akram
-
Introduce patched_select()
- 427. By Omer Akram
-
remove PID helpers, use from autopilot
- 428. By Omer Akram
-
Fix alarm test
- 429. By Omer Akram
-
Fix indicator sound tests
- 430. By Omer Akram
-
Don't restart unity twice, fix network indicator tests to work without SIM
- 431. By Omer Akram
-
Minor changes
Unmerged revisions
- 431. By Omer Akram
-
Minor changes
- 430. By Omer Akram
-
Don't restart unity twice, fix network indicator tests to work without SIM
- 429. By Omer Akram
-
Fix indicator sound tests
- 428. By Omer Akram
-
Fix alarm test
- 427. By Omer Akram
-
remove PID helpers, use from autopilot
- 426. By Omer Akram
-
Introduce patched_select()
- 425. By Omer Akram
-
Port to use new autopilot APIs
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'debian/tests/dependencies.json' |
2 | --- debian/tests/dependencies.json 2016-07-18 16:39:49 +0000 |
3 | +++ debian/tests/dependencies.json 2016-08-03 05:45:48 +0000 |
4 | @@ -89,7 +89,6 @@ |
5 | "gallery-app-autopilot", |
6 | "mediaplayer-app-autopilot", |
7 | "messaging-app-autopilot", |
8 | - "python3-autopilot", |
9 | "python3-dbus", |
10 | "python3-debian", |
11 | "python3-gi", |
12 | |
13 | === modified file 'ubuntu_system_tests/helpers/addressbook/_cpo.py' |
14 | --- ubuntu_system_tests/helpers/addressbook/_cpo.py 2016-05-06 22:37:58 +0000 |
15 | +++ ubuntu_system_tests/helpers/addressbook/_cpo.py 2016-08-03 05:45:48 +0000 |
16 | @@ -23,8 +23,7 @@ |
17 | from autopilot.exceptions import StateNotFoundError |
18 | from ubuntuuitoolkit import UbuntuUIToolkitCustomProxyObjectBase |
19 | |
20 | -from ubuntu_system_tests.helpers.autopilot import ( |
21 | - validate_dbus_object, wait_select_many) |
22 | +from ubuntu_system_tests.helpers.autopilot import validate_dbus_object |
23 | |
24 | APP_PATH_ROOT = b'AddressBookApp' |
25 | |
26 | @@ -83,10 +82,9 @@ |
27 | |
28 | def _get_sorted_contact_delegates(self): |
29 | """Over-ride base helper to use wait_select_many.""" |
30 | - contact_delegates = wait_select_many( |
31 | - self, type_name='ContactDelegate', visible=True) |
32 | - return sorted( |
33 | - contact_delegates, key=lambda delegate: delegate.globalRect.y) |
34 | + return self.wait_select_many( |
35 | + 'ContactDelegate', ap_result_sort_keys=['globalRect.y'], |
36 | + visible=True) |
37 | |
38 | |
39 | class ABContactViewPage(address_book_app.pages.ABContactViewPage): |
40 | |
41 | === modified file 'ubuntu_system_tests/helpers/autopilot/__init__.py' |
42 | --- ubuntu_system_tests/helpers/autopilot/__init__.py 2016-06-01 15:22:43 +0000 |
43 | +++ ubuntu_system_tests/helpers/autopilot/__init__.py 2016-08-03 05:45:48 +0000 |
44 | @@ -26,13 +26,8 @@ |
45 | get_proxy_object_for_existing_app, |
46 | get_proxy_object_for_existing_process, |
47 | get_proxy_object_for_existing_qmlscene_process, |
48 | - is_element, |
49 | - override_proxy_timeout, |
50 | - patched_select_single, |
51 | - patched_wait_select_single, |
52 | + patched_select, |
53 | validate_dbus_object, |
54 | - wait_select_many, |
55 | - wait_select_single, |
56 | ) |
57 | |
58 | |
59 | @@ -44,11 +39,6 @@ |
60 | 'get_proxy_object_for_existing_app', |
61 | 'get_proxy_object_for_existing_process', |
62 | 'get_proxy_object_for_existing_qmlscene_process', |
63 | - 'is_element', |
64 | - 'override_proxy_timeout', |
65 | - 'patched_select_single', |
66 | - 'patched_wait_select_single', |
67 | + 'patched_select', |
68 | 'validate_dbus_object', |
69 | - 'wait_select_many', |
70 | - 'wait_select_single', |
71 | ] |
72 | |
73 | === removed file 'ubuntu_system_tests/helpers/autopilot/input.py' |
74 | --- ubuntu_system_tests/helpers/autopilot/input.py 2016-04-18 15:09:45 +0000 |
75 | +++ ubuntu_system_tests/helpers/autopilot/input.py 1970-01-01 00:00:00 +0000 |
76 | @@ -1,56 +0,0 @@ |
77 | -# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
78 | - |
79 | -# |
80 | -# Ubuntu System Tests |
81 | -# Copyright (C) 2016 Canonical |
82 | -# |
83 | -# This program is free software: you can redistribute it and/or modify |
84 | -# it under the terms of the GNU General Public License as published by |
85 | -# the Free Software Foundation, either version 3 of the License, or |
86 | -# (at your option) any later version. |
87 | -# |
88 | -# This program is distributed in the hope that it will be useful, |
89 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
90 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
91 | -# GNU General Public License for more details. |
92 | -# |
93 | -# You should have received a copy of the GNU General Public License |
94 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
95 | -# |
96 | - |
97 | -import evdev |
98 | - |
99 | -from autopilot.input._uinput import _get_devnode_path |
100 | - |
101 | -from ubuntu_system_tests.helpers import wait_until |
102 | - |
103 | -INPUT_DEVICE_NAME = 'autopilot-power-button' |
104 | - |
105 | -input_device = None |
106 | - |
107 | - |
108 | -def press_power_button(): |
109 | - """Simulate a power key press event.""" |
110 | - global input_device |
111 | - input_device = evdev.UInput(name=INPUT_DEVICE_NAME, |
112 | - devnode=_get_devnode_path()) |
113 | - # wait until the input device is ready |
114 | - if not wait_until(_get_input_device, period=0.5): |
115 | - raise(RuntimeError('Could not find UInput device.')) |
116 | - # Send a press and release event |
117 | - input_device.write(evdev.ecodes.EV_KEY, evdev.ecodes.KEY_POWER, 1) |
118 | - input_device.write(evdev.ecodes.EV_KEY, evdev.ecodes.KEY_POWER, 0) |
119 | - input_device.syn() |
120 | - input_device.close() |
121 | - input_device = None |
122 | - |
123 | - |
124 | -def _get_input_device(): |
125 | - """Find the autopilot input device if it is available and save instace |
126 | - in the input_device global variable. |
127 | - :return: True if input device found, False otherwise.""" |
128 | - global input_device |
129 | - device = input_device._find_device() |
130 | - if device: |
131 | - input_device.device = device |
132 | - return device |
133 | |
134 | === modified file 'ubuntu_system_tests/helpers/autopilot/list.py' |
135 | --- ubuntu_system_tests/helpers/autopilot/list.py 2016-03-15 17:46:31 +0000 |
136 | +++ ubuntu_system_tests/helpers/autopilot/list.py 2016-08-03 05:45:48 +0000 |
137 | @@ -18,65 +18,6 @@ |
138 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
139 | # |
140 | |
141 | -from autopilot.display import is_point_on_any_screen |
142 | -from autopilot.exceptions import StateNotFoundError |
143 | - |
144 | -from ubuntu_system_tests.helpers.autopilot.object import ( |
145 | - _get_y_and_x, _get_x_and_y) |
146 | - |
147 | - |
148 | -def order_by_x_coord(object_list, include_off_screen=False): |
149 | - """ |
150 | - Return an ordered list of objects ordered by x co-ordinate first |
151 | - and then y co-ordinate second if x co-ordinates match. |
152 | - |
153 | - :param object_list: List of objects containing globalRect property. |
154 | - :param include_off_screen: Whether to include objects that are not within |
155 | - the bounds of any screen. |
156 | - :return: List of sorted objects. |
157 | - |
158 | - """ |
159 | - return _order_by_key(object_list, _get_x_and_y, include_off_screen) |
160 | - |
161 | - |
162 | -def _order_by_key(object_list, sort_key, include_off_screen): |
163 | - """ |
164 | - Return an ordered list of objects ordered by key. |
165 | - |
166 | - :param object_list: List of objects containing globalRect property. |
167 | - :param sort_key: Sorting key to use. |
168 | - :param include_off_screen: Whether to include objects that are not within |
169 | - the bounds of any screen. |
170 | - :return: List of sorted objects. |
171 | - |
172 | - """ |
173 | - objects = [] |
174 | - for obj in object_list: |
175 | - try: |
176 | - # If obj is no longer valid this can cause excpetion |
177 | - point = obj.globalRect.x, obj.globalRect.y |
178 | - if include_off_screen: |
179 | - objects.append(obj) |
180 | - elif is_point_on_any_screen(point): |
181 | - objects.append(obj) |
182 | - except StateNotFoundError: |
183 | - pass |
184 | - return sorted(objects, key=sort_key) |
185 | - |
186 | - |
187 | -def order_by_y_coord(object_list, include_off_screen=False): |
188 | - """ |
189 | - Return an ordered list of objects ordered by y co-ordinate first |
190 | - and then x co-ordinate second if y co-ordinates match. |
191 | - |
192 | - :param object_list: List of objects containing globalRect property. |
193 | - :param include_off_screen: Whether to include objects that are not within |
194 | - the bounds of any screen. |
195 | - :return: List of sorted objects. |
196 | - |
197 | - """ |
198 | - return _order_by_key(object_list, _get_y_and_x, include_off_screen) |
199 | - |
200 | |
201 | def list_contains_data(list, data): |
202 | """Return True if any item in list contains specified data.""" |
203 | |
204 | === removed file 'ubuntu_system_tests/helpers/autopilot/object.py' |
205 | --- ubuntu_system_tests/helpers/autopilot/object.py 2016-06-01 13:03:21 +0000 |
206 | +++ ubuntu_system_tests/helpers/autopilot/object.py 1970-01-01 00:00:00 +0000 |
207 | @@ -1,139 +0,0 @@ |
208 | -# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
209 | - |
210 | -# |
211 | -# Ubuntu System Tests |
212 | -# Copyright (C) 2016 Canonical |
213 | -# |
214 | -# This program is free software: you can redistribute it and/or modify |
215 | -# it under the terms of the GNU General Public License as published by |
216 | -# the Free Software Foundation, either version 3 of the License, or |
217 | -# (at your option) any later version. |
218 | -# |
219 | -# This program is distributed in the hope that it will be useful, |
220 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
221 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
222 | -# GNU General Public License for more details. |
223 | -# |
224 | -# You should received a copy of the GNU General Public License |
225 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
226 | -# |
227 | - |
228 | -import sys |
229 | -import time |
230 | - |
231 | -from autopilot.exceptions import StateNotFoundError |
232 | - |
233 | -from ubuntu_system_tests.helpers import wait_until |
234 | - |
235 | -CO_ORD_MAX = (sys.maxsize, sys.maxsize) |
236 | - |
237 | - |
238 | -def _get_y_and_x(item): |
239 | - """ |
240 | - Return y and x co-ordinates for specified object. |
241 | - |
242 | - :param item: Item to check |
243 | - :return: (y, x) co-ordinates |
244 | - """ |
245 | - try: |
246 | - # If item is no longer valid this can cause exception |
247 | - co_ords = item.globalRect.y, item.globalRect.x |
248 | - except StateNotFoundError: |
249 | - # Trying to sort an object that no longer exists |
250 | - # return a dummy key value so this item is sorted last |
251 | - co_ords = CO_ORD_MAX |
252 | - return co_ords |
253 | - |
254 | - |
255 | -def _get_x_and_y(item): |
256 | - """ |
257 | - Return x and y co-ordinates for specified object. |
258 | - |
259 | - :param item: Item to check |
260 | - :return: (x, y) co-ordinates |
261 | - """ |
262 | - try: |
263 | - # If item is no longer valid this can cause exception |
264 | - co_ords = item.globalRect.x, item.globalRect.y |
265 | - except StateNotFoundError: |
266 | - # Trying to sort an object that no longer exists |
267 | - # return a dummy key value so this item is sorted last |
268 | - co_ords = CO_ORD_MAX |
269 | - return co_ords |
270 | - |
271 | - |
272 | -def get_object_path(item): |
273 | - """Return the object path of a specified item.""" |
274 | - return item._path.decode('utf-8') |
275 | - |
276 | - |
277 | -def wait_until_is_not_moving(elem, move_time=0.5, timeout=10): |
278 | - """ Wait until the autopilot element is not moving based on its globalRect |
279 | - coordinates |
280 | - :param elem: autopilot element to check |
281 | - :param move_time: time in seconds between the coordinates are retrieved |
282 | - :param timeout: total time to wait until the element is not moving |
283 | - :return: True when the element is not moving before the timeout is reached, |
284 | - otherwise return False |
285 | - """ |
286 | - return wait_until(is_not_moving, elem, move_time, timeout=timeout, |
287 | - period=0) |
288 | - |
289 | - |
290 | -def is_not_moving(elem, move_time=0.5): |
291 | - """ Indicate if the element has not changed its position after a period |
292 | - based on its globalRect coordinates |
293 | - :param elem: autopilot element to check |
294 | - :param move_time: time between the coordinates are retrieved |
295 | - :return: True when the x and y coordinates are equal, False otherwise |
296 | - """ |
297 | - x1, y1, h1, w1 = elem.globalRect |
298 | - time.sleep(move_time) |
299 | - x2, y2, h2, w2 = elem.globalRect |
300 | - |
301 | - return x1 == x2 and y1 == y2 |
302 | - |
303 | - |
304 | -def _get_parent_by_type(item, required_type, **kwargs): |
305 | - """Return a parent item of the required type. |
306 | - :param item: The child item to start searching from. |
307 | - :param required_type: String name of parent object type required. |
308 | - :param kwargs: This is used for logging purposes only. |
309 | - :return: Parent object matching required type. |
310 | - :raises: StateNotFoundError if no matching object type can be found. |
311 | - """ |
312 | - parent = item.get_parent() |
313 | - path = get_object_path(parent).split('/') |
314 | - try: |
315 | - index = path.index(required_type) |
316 | - except ValueError: |
317 | - raise StateNotFoundError( |
318 | - '{}, and properties: {}'.format(required_type, kwargs)) |
319 | - for count in range(1, len(path) - index): |
320 | - parent = parent.get_parent() |
321 | - return parent |
322 | - |
323 | - |
324 | -def validate_properties(item, **kwargs): |
325 | - """Return True if item properties match specified keyword properties.""" |
326 | - props = item.get_properties() |
327 | - for key in kwargs.keys(): |
328 | - if props[key] != kwargs[key]: |
329 | - return False |
330 | - return True |
331 | - |
332 | - |
333 | -def get_parent(item, required_type, **kwargs): |
334 | - """Return a parent object of specified type and properties. |
335 | - :param item: The child item to start searching from. |
336 | - :param required_type: String name of parent object type required. |
337 | - :param kwargs: Any properties to match on the parent object. |
338 | - :return: Parent object matching required type and properties. |
339 | - :raises: StateNotFoundError if no matching object can be found. |
340 | - """ |
341 | - parent = item |
342 | - while True: |
343 | - parent = _get_parent_by_type(parent, required_type, **kwargs) |
344 | - if validate_properties(parent, **kwargs): |
345 | - return parent |
346 | - parent = parent.get_parent() |
347 | |
348 | === modified file 'ubuntu_system_tests/helpers/autopilot/utils.py' |
349 | --- ubuntu_system_tests/helpers/autopilot/utils.py 2016-07-15 10:40:16 +0000 |
350 | +++ ubuntu_system_tests/helpers/autopilot/utils.py 2016-08-03 05:45:48 +0000 |
351 | @@ -21,7 +21,9 @@ |
352 | from contextlib import contextmanager |
353 | |
354 | from autopilot import introspection |
355 | -from autopilot.exceptions import StateNotFoundError |
356 | +from autopilot.introspection.utilities import process_util |
357 | +from autopilot.introspection._object_registry import patch_registry |
358 | +from autopilot.introspection.dbus import get_type_name |
359 | |
360 | from ubuntu_system_tests.helpers import ( |
361 | processes, |
362 | @@ -33,22 +35,12 @@ |
363 | ubuntuuitoolkit = try_import('ubuntuuitoolkit') |
364 | |
365 | |
366 | -@contextmanager |
367 | -def override_proxy_timeout(proxy, timeout_seconds): |
368 | - original_timeout = proxy._poll_time |
369 | - try: |
370 | - proxy._poll_time = timeout_seconds |
371 | - yield proxy |
372 | - finally: |
373 | - proxy._poll_time = original_timeout |
374 | - |
375 | - |
376 | def _get_pid(pname): |
377 | """ Wait until the process pname is running and retrieve its pid. Raise |
378 | Runtime exception when the process is not started after 10 seconds |
379 | """ |
380 | if wait_until(processes.is_process_running, pname): |
381 | - return processes.get_process_id(pname) |
382 | + return process_util.get_pid_for_process(pname) |
383 | else: |
384 | raise RuntimeError('Could not find process: {} '.format(pname)) |
385 | |
386 | @@ -83,65 +75,15 @@ |
387 | return root |
388 | |
389 | |
390 | -def is_element(predicate, *args, **kwargs): |
391 | - """ |
392 | - Evaluate the predicate with the args and indicate if it raises |
393 | - StateNotFoundError |
394 | - :param: predicate: The method to be evaluated |
395 | - :param: *args: The predicate positional parameters |
396 | - :param: **kwargs: The predicate optional parameters |
397 | - :return: False if the predicate raises StateNotFoundError, True otherwise |
398 | - """ |
399 | - try: |
400 | - predicate(*args, **kwargs) |
401 | - return True |
402 | - except StateNotFoundError: |
403 | - return False |
404 | - |
405 | - |
406 | -def wait_select_single(root, type_name='*', timeout=10, **kwargs): |
407 | - """ |
408 | - Perform wait_select_single on root object using a custom timeout value. |
409 | - :param: root: The root object to make the query |
410 | - :param: type_name: Either a string naming the type you want, or a class |
411 | - of the appropriate type |
412 | - :param: timeout: The timeout for the polling |
413 | - """ |
414 | - default_time = root._poll_time |
415 | - root._poll_time = timeout |
416 | - try: |
417 | - item = root.wait_select_single(type_name, **kwargs) |
418 | +@contextmanager |
419 | +def patched_select(class_object, class_name=None): |
420 | + if not class_name: |
421 | + class_name = get_type_name(class_object) |
422 | + try: |
423 | + with patch_registry(get_patched_registry(class_object, class_name)): |
424 | + yield class_name |
425 | finally: |
426 | - root._poll_time = default_time |
427 | - return item |
428 | - |
429 | - |
430 | -def wait_select_many(root, number=1, timeout=10, period=0.5, type_name='*', |
431 | - **kwargs): |
432 | - """ |
433 | - Get a list of proxy objects matching some search criteria from the |
434 | - introspection tree, with type equal to *type_name* and (optionally) |
435 | - matching the keyword filters present in *kwargs*. This method will retry |
436 | - until either the objects matching the criteria are >= number or the timeout |
437 | - is reached |
438 | - :param: root: The root object to make the query |
439 | - :param: number: The number of objects that have to match to return |
440 | - :param: timeout: The timeout for the polling |
441 | - :param: period: The retry period of time |
442 | - :param: type_name: Either a string naming the type you want, or a class |
443 | - of the appropriate type |
444 | - :param: **kwargs: The optional parameters used to match objects |
445 | - :raise: StateNotFoundError: When the number of objects matching the query |
446 | - are less than the number passed as parameter |
447 | - :return: A list of proxy objects |
448 | - """ |
449 | - |
450 | - if wait_until( |
451 | - lambda: len(root.select_many(type_name, **kwargs)) >= number, |
452 | - timeout=timeout, period=period): |
453 | - return root.select_many(type_name, **kwargs) |
454 | - else: |
455 | - raise StateNotFoundError("Not found the number of elements requested") |
456 | + pass |
457 | |
458 | |
459 | def get_patched_registry(class_object, class_name): |
460 | @@ -164,60 +106,6 @@ |
461 | return registry |
462 | |
463 | |
464 | -def _patched_select(wait, root, class_object, class_name=None, **kwargs): |
465 | - """ |
466 | - Patch the autopilot object registry and select an object from root. |
467 | - |
468 | - This method is used to avoid autopilot CPO errors by patching the autopilot |
469 | - object registry before calling the required select method on the specified |
470 | - root object. |
471 | - |
472 | - :param wait: Whether to call wait_select_single or select_single. |
473 | - :param root: Root introspection object. |
474 | - :param class_object: Instance of object to patch the registry with. |
475 | - :param class_name: Name of registry entry to patch. If None then the class |
476 | - name of class_object will be used. |
477 | - :return: Intropsection object of type class_object. |
478 | - |
479 | - """ |
480 | - if not class_name: |
481 | - class_name = class_object.__class__.__name__ |
482 | - registry = get_patched_registry(class_object, class_name) |
483 | - with introspection._object_registry.patch_registry(registry): |
484 | - if wait: |
485 | - return root.wait_select_single(class_name, **kwargs) |
486 | - else: |
487 | - return root.select_single(class_name, **kwargs) |
488 | - |
489 | - |
490 | -def patched_select_single(root, class_object, class_name=None, **kwargs): |
491 | - """ |
492 | - Perform select_single on root object using patched autopilot registry. |
493 | - |
494 | - :param root: Root introspection object. |
495 | - :param class_object: Instance of object to patch the registry with. |
496 | - :param class_name: Name of registry entry to patch. If None then the class |
497 | - name of class_object will be used. |
498 | - :return: Intropsection object of type class_object. |
499 | - |
500 | - """ |
501 | - return _patched_select(False, root, class_object, class_name, **kwargs) |
502 | - |
503 | - |
504 | -def patched_wait_select_single(root, class_object, class_name=None, **kwargs): |
505 | - """ |
506 | - Perform wait_select_single on root object using patched autopilot registry. |
507 | - |
508 | - :param root: Root introspection object. |
509 | - :param class_object: Instance of object to patch the registry with. |
510 | - :param class_name: Name of registry entry to patch. If None then the class |
511 | - name of class_object will be used. |
512 | - :return: Intropsection object of type class_object. |
513 | - |
514 | - """ |
515 | - return _patched_select(True, root, class_object, class_name, **kwargs) |
516 | - |
517 | - |
518 | @timeout(60) |
519 | def get_proxy_object(pid): |
520 | return introspection.get_proxy_object_for_existing_process( |
521 | |
522 | === modified file 'ubuntu_system_tests/helpers/camera/_cpo.py' |
523 | --- ubuntu_system_tests/helpers/camera/_cpo.py 2016-07-11 16:39:38 +0000 |
524 | +++ ubuntu_system_tests/helpers/camera/_cpo.py 2016-08-03 05:45:48 +0000 |
525 | @@ -27,7 +27,6 @@ |
526 | from camera_app.emulators.panel import Panel |
527 | from retrying import retry |
528 | |
529 | -from ubuntu_system_tests.helpers.autopilot.list import order_by_x_coord |
530 | from ubuntu_system_tests.helpers.autopilot import validate_dbus_object |
531 | from ubuntu_system_tests.helpers import wait_until |
532 | |
533 | @@ -219,9 +218,10 @@ |
534 | |
535 | def start_playback(self): |
536 | """ Start playing the video """ |
537 | - objs = self.app.select_many(name='media-playback-start', visible=True) |
538 | - play = order_by_x_coord(objs)[0] |
539 | - self.app.pointing_device.click_object(play) |
540 | + objs = self.app.select_many( |
541 | + ap_result_sort_keys=['x', 'y'], name='media-playback-start', |
542 | + visible=True) |
543 | + self.app.pointing_device.click_object(objs[0]) |
544 | |
545 | def click_exposure_button(self): |
546 | """ Click on the button to either take a picture or record a video """ |
547 | |
548 | === modified file 'ubuntu_system_tests/helpers/clock/_cpo.py' |
549 | --- ubuntu_system_tests/helpers/clock/_cpo.py 2016-05-23 20:40:55 +0000 |
550 | +++ ubuntu_system_tests/helpers/clock/_cpo.py 2016-08-03 05:45:48 +0000 |
551 | @@ -22,8 +22,7 @@ |
552 | import ubuntuuitoolkit |
553 | |
554 | from ubuntu_system_tests.helpers.autopilot import ( |
555 | - patched_select_single, validate_dbus_object) |
556 | -from ubuntu_system_tests.helpers.autopilot.object import get_parent |
557 | + patched_select, validate_dbus_object) |
558 | |
559 | logger = logging.getLogger(__name__) |
560 | |
561 | @@ -83,8 +82,8 @@ |
562 | """Return current displayed PageHeader object.""" |
563 | from ubuntu_system_tests.helpers.ubuntuuitoolkit.pageheader import ( |
564 | PageHeader) |
565 | - return patched_select_single( |
566 | - self, PageHeader, class_name='PageHeader', visible=True) |
567 | + with patched_select(PageHeader, 'PageHeader') as name: |
568 | + return self.select_single(name, visible=True) |
569 | |
570 | |
571 | class MainPage(Page): |
572 | @@ -148,7 +147,10 @@ |
573 | return self.main_view.wait_select_single(EditAlarmPage) |
574 | |
575 | def get_add_alarm_button(self): |
576 | - return self.wait_select_single(objectName='addAlarmAction_button') |
577 | + add_button = self.wait_select_single( |
578 | + objectName='addAlarmAction_button') |
579 | + add_button.wait_until_not_moving() |
580 | + return add_button |
581 | |
582 | |
583 | class EditAlarmPage(Page): |
584 | @@ -222,7 +224,7 @@ |
585 | self.unselect_selected_days() |
586 | for day in days: |
587 | label = self.wait_select_single(text=day) |
588 | - list_item = get_parent(label, 'UCListItem') |
589 | + list_item = label.get_parent('UCListItem') |
590 | checkbox = list_item.select_single('CheckBox') |
591 | checkbox.check() |
592 | |
593 | |
594 | === modified file 'ubuntu_system_tests/helpers/dialer_app/_cpo.py' |
595 | --- ubuntu_system_tests/helpers/dialer_app/_cpo.py 2016-07-11 10:54:02 +0000 |
596 | +++ ubuntu_system_tests/helpers/dialer_app/_cpo.py 2016-08-03 05:45:48 +0000 |
597 | @@ -26,7 +26,7 @@ |
598 | from ubuntuuitoolkit import UbuntuUIToolkitCustomProxyObjectBase |
599 | |
600 | from ubuntu_system_tests.helpers.autopilot import ( |
601 | - patched_select_single, validate_dbus_object, wait_select_many) |
602 | + patched_select, validate_dbus_object) |
603 | from ubuntu_system_tests.helpers.dialer_app import unformatted_phone_number |
604 | |
605 | logger = logging.getLogger(__name__) |
606 | @@ -46,9 +46,8 @@ |
607 | |
608 | @property |
609 | def main_view(self): |
610 | - return patched_select_single( |
611 | - root=self, class_object=MainView, class_name='MainView', |
612 | - objectName='mainView') |
613 | + with patched_select(MainView, 'MainView') as name: |
614 | + return self.select_single(name, objectName='mainView') |
615 | |
616 | |
617 | class MainView(dialer_app.MainView): |
618 | @@ -80,9 +79,9 @@ |
619 | :return: Dialog object or None if it is not found. |
620 | """ |
621 | try: |
622 | - return patched_select_single( |
623 | - self, Dialog, class_name='Dialog', |
624 | - title='Call holding failure', visible=True) |
625 | + with patched_select(Dialog, 'Dialog') as name: |
626 | + return self.select_single( |
627 | + name, title='Call holding failure', visible=True) |
628 | except autopilot.exceptions.StateNotFoundError: |
629 | return None |
630 | |
631 | @@ -269,10 +268,9 @@ |
632 | objectName='contactsPage') |
633 | |
634 | def _get_sorted_contact_delegates(self): |
635 | - contact_delegates = wait_select_many( |
636 | - self, type_name='ContactDelegate', visible=True) |
637 | - return sorted( |
638 | - contact_delegates, key=lambda delegate: delegate.globalRect.y) |
639 | + return self.wait_select_many( |
640 | + 'ContactDelegate', ap_result_sort_keys=['globalRect.y'], |
641 | + visible=True) |
642 | |
643 | |
644 | class Dialog(UbuntuUIToolkitCustomProxyObjectBase): |
645 | |
646 | === modified file 'ubuntu_system_tests/helpers/gallery/_cpo.py' |
647 | --- ubuntu_system_tests/helpers/gallery/_cpo.py 2016-04-15 20:06:34 +0000 |
648 | +++ ubuntu_system_tests/helpers/gallery/_cpo.py 2016-08-03 05:45:48 +0000 |
649 | @@ -26,7 +26,6 @@ |
650 | from ubuntuuitoolkit import UbuntuUIToolkitCustomProxyObjectBase |
651 | |
652 | from ubuntu_system_tests.helpers.autopilot import validate_dbus_object |
653 | -from ubuntu_system_tests.helpers.autopilot.list import order_by_x_coord |
654 | from ubuntu_system_tests.helpers import context |
655 | from ubuntu_system_tests.helpers import file_system as fs |
656 | |
657 | @@ -99,7 +98,8 @@ |
658 | :param image_path: the path to match with the images source |
659 | """ |
660 | all_photos = [] |
661 | - photos = self.app.select_many('UCUbuntuShape', visible=True) |
662 | + photos = self.app.select_many( |
663 | + 'UCUbuntuShape', ap_result_sort_keys=['x', 'y'], visible=True) |
664 | for photo in photos: |
665 | images = photo.select_many('QQuickImage', status=1) |
666 | imgs = [image for image in images if image_path in image.source] |
667 | @@ -108,7 +108,7 @@ |
668 | if not all_photos: |
669 | raise exceptions.StateNotFoundError(class_name='QQuickImage', |
670 | status=1) |
671 | - return order_by_x_coord(all_photos, include_off_screen=True) |
672 | + return all_photos |
673 | |
674 | def get_media_list_for_event(self, event_number=0): |
675 | event = self.get_event(event_number) |
676 | |
677 | === modified file 'ubuntu_system_tests/helpers/indicators/message.py' |
678 | --- ubuntu_system_tests/helpers/indicators/message.py 2016-07-06 13:12:27 +0000 |
679 | +++ ubuntu_system_tests/helpers/indicators/message.py 2016-08-03 05:45:48 +0000 |
680 | @@ -25,10 +25,7 @@ |
681 | from ubuntu_system_tests.helpers import ofono, unity8 |
682 | from ubuntu_system_tests.helpers.indicators.utils import INDICATOR_PAGE_PATH |
683 | from ubuntu_system_tests.helpers.indicators._cpo import IndicatorPage |
684 | -from ubuntu_system_tests.helpers.autopilot import( |
685 | - validate_dbus_object, |
686 | - wait_select_many, |
687 | -) |
688 | +from ubuntu_system_tests.helpers.autopilot import validate_dbus_object |
689 | |
690 | |
691 | logger = logging.getLogger(__name__) |
692 | @@ -111,7 +108,8 @@ |
693 | |
694 | def get_last_message(self, number): |
695 | """ Get the last message displayed in the indicator """ |
696 | - return wait_select_many(self, number, objectName='title')[-1].text |
697 | + return self.wait_select_many( |
698 | + ap_result_count=number, objectName='title')[-1].text |
699 | |
700 | def wait_while_indicator_visible(self): |
701 | """ Wait until the indicator message is not displayed any more """ |
702 | |
703 | === modified file 'ubuntu_system_tests/helpers/messaging/_cpo.py' |
704 | --- ubuntu_system_tests/helpers/messaging/_cpo.py 2016-05-06 22:37:58 +0000 |
705 | +++ ubuntu_system_tests/helpers/messaging/_cpo.py 2016-08-03 05:45:48 +0000 |
706 | @@ -21,6 +21,7 @@ |
707 | import time |
708 | |
709 | import autopilot |
710 | +from autopilot.introspection.utilities import sort_by_keys |
711 | import ubuntuuitoolkit as uitk |
712 | |
713 | from autopilot.exceptions import StateNotFoundError |
714 | @@ -28,12 +29,7 @@ |
715 | from messaging_app import emulators as messaging_emulators |
716 | |
717 | from ubuntu_system_tests.helpers.autopilot import ( |
718 | - patched_select_single, patched_wait_select_single, validate_dbus_object, |
719 | - wait_select_many |
720 | -) |
721 | -from ubuntu_system_tests.helpers.autopilot.list import order_by_y_coord |
722 | -from ubuntu_system_tests.helpers.autopilot.object import ( |
723 | - wait_until_is_not_moving) |
724 | + patched_select, validate_dbus_object) |
725 | from ubuntu_system_tests.helpers.messaging import ( |
726 | MEDIA_TYPE_PICTURE, MEDIA_TYPE_VIDEO, MEDIA_TYPE_CONTACT) |
727 | from ubuntu_system_tests.helpers.system_settings import SIM_1, SIM_2 |
728 | @@ -53,8 +49,8 @@ |
729 | |
730 | def get_main_page(self): |
731 | """Override base class method to use patched select method.""" |
732 | - return patched_wait_select_single( |
733 | - root=self, class_object=MainPage, class_name='MainPage') |
734 | + with patched_select(MainPage, 'MainPage') as name: |
735 | + return self.wait_select_single(name) |
736 | |
737 | def get_main_title(self): |
738 | """ Retrieve the app title """ |
739 | @@ -89,9 +85,9 @@ |
740 | |
741 | def get_mobile_number_label(self, number): |
742 | """Return first matching label displayed.""" |
743 | - labels = wait_select_many( |
744 | - self, type_name='UCLabel', text='Mobile {}'.format(number)) |
745 | - return order_by_y_coord(labels)[0] |
746 | + return self.wait_select_many( |
747 | + 'UCLabel', ap_result_sort_keys=['y', 'x'], |
748 | + text='Mobile {}'.format(number))[0] |
749 | |
750 | def detect_select_sim_prompt(self): |
751 | """Detect if the select SIM dialog is shown.""" |
752 | @@ -123,7 +119,7 @@ |
753 | """ |
754 | self.pointing_device.click_object(self._get_attachment_button()) |
755 | panel = self._get_attachment_panel() |
756 | - wait_until_is_not_moving(panel) |
757 | + panel.wait_until_not_moving() |
758 | panel.choose_media_type(media_type) |
759 | return self._get_content_picker() |
760 | |
761 | @@ -206,9 +202,9 @@ |
762 | |
763 | def _get_sim_confirmation_dialog(self, sim): |
764 | """Return default confirmation dialog for specified SIM.""" |
765 | - return patched_select_single( |
766 | - self, class_object=Dialog, class_name='Dialog', |
767 | - text=DEFAULT_SIM_MSG.format(sim=sim)) |
768 | + with patched_select(Dialog, 'Dialog') as name: |
769 | + return self.select_single( |
770 | + name, text=DEFAULT_SIM_MSG.format(sim=sim)) |
771 | |
772 | def get_sim1_default_confirmation_dialog(self): |
773 | """Return SIM 1 default confirmation dialog.""" |
774 | @@ -350,6 +346,7 @@ |
775 | if ('filePath' in attachment.get_properties() and |
776 | len(attachment.filePath) > 0): |
777 | attachments.append(attachment) |
778 | + return sort_by_keys(attachments, ['y', 'x']) |
779 | return order_by_y_coord(attachments) |
780 | |
781 | def get_attachment_count(self): |
782 | @@ -440,8 +437,8 @@ |
783 | :param app_name: name of the app to tap |
784 | |
785 | """ |
786 | - app_icon = order_by_y_coord(wait_select_many( |
787 | - self, text=app_name))[0].get_parent() |
788 | + app_icon = self.wait_select_many( |
789 | + ap_result_sort_keys=['y', 'x'], text=app_name)[0].get_parent() |
790 | self.pointing_device.click_object(app_icon) |
791 | |
792 | |
793 | |
794 | === modified file 'ubuntu_system_tests/helpers/messaging/app.py' |
795 | --- ubuntu_system_tests/helpers/messaging/app.py 2016-07-07 10:18:52 +0000 |
796 | +++ ubuntu_system_tests/helpers/messaging/app.py 2016-08-03 05:45:48 +0000 |
797 | @@ -116,8 +116,8 @@ |
798 | |
799 | from ubuntu_system_tests.helpers.messaging._cpo import MainView |
800 | proxy = autopilot.get_proxy_object_for_existing_app(APP) |
801 | - return autopilot.patched_wait_select_single( |
802 | - root=proxy, class_object=MainView, class_name='MainView') |
803 | + with autopilot.patched_select(MainView, 'MainView') as name: |
804 | + return proxy.wait_select_single(name) |
805 | |
806 | |
807 | def launch_messaging_app_from_launcher(): |
808 | |
809 | === modified file 'ubuntu_system_tests/helpers/music/_cpo.py' |
810 | --- ubuntu_system_tests/helpers/music/_cpo.py 2016-06-13 19:20:19 +0000 |
811 | +++ ubuntu_system_tests/helpers/music/_cpo.py 2016-08-03 05:45:48 +0000 |
812 | @@ -20,7 +20,7 @@ |
813 | |
814 | from ubuntu_system_tests.helpers.autopilot import( |
815 | validate_dbus_object, |
816 | - patched_wait_select_single |
817 | + patched_select |
818 | ) |
819 | from ubuntu_system_tests.helpers.ubuntuuitoolkit.mainview import ( |
820 | MultiTabMainView) |
821 | @@ -38,9 +38,8 @@ |
822 | |
823 | @property |
824 | def main_view(self): |
825 | - return patched_wait_select_single( |
826 | - root=self, class_object=MainView, |
827 | - class_name='MainView', objectName='musicMainView') |
828 | + with patched_select(MainView, 'MainView') as name: |
829 | + return self.wait_select_single(name, objectName='musicMainView') |
830 | |
831 | |
832 | class MainView(MultiTabMainView): |
833 | @@ -76,9 +75,9 @@ |
834 | |
835 | @property |
836 | def main_view(self): |
837 | - return patched_wait_select_single( |
838 | - root=self.get_root_instance(), class_object=MainView, |
839 | - class_name='MainView', objectName='musicMainView') |
840 | + with patched_select(MainView, 'MainView') as name: |
841 | + root = self.get_root_instance() |
842 | + return root.wait_select_single(name, objectName='musicMainView') |
843 | |
844 | |
845 | class Songs(Page): |
846 | |
847 | === modified file 'ubuntu_system_tests/helpers/notifications/sim_pin.py' |
848 | --- ubuntu_system_tests/helpers/notifications/sim_pin.py 2016-06-02 09:12:43 +0000 |
849 | +++ ubuntu_system_tests/helpers/notifications/sim_pin.py 2016-08-03 05:45:48 +0000 |
850 | @@ -17,13 +17,13 @@ |
851 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
852 | # |
853 | |
854 | +import logging |
855 | + |
856 | import autopilot |
857 | -import logging |
858 | - |
859 | +from autopilot.introspection import is_element |
860 | from ubuntuuitoolkit import UbuntuUIToolkitCustomProxyObjectBase |
861 | |
862 | -from ubuntu_system_tests.helpers.autopilot import ( |
863 | - is_element, validate_dbus_object) |
864 | +from ubuntu_system_tests.helpers.autopilot import validate_dbus_object |
865 | from ubuntu_system_tests.helpers.notifications.utils import NotificationBase |
866 | from ubuntu_system_tests.helpers.ofono import get_number_of_modems |
867 | from ubuntu_system_tests.helpers.unity8 import UNITY8_PATH_ROOT |
868 | |
869 | === modified file 'ubuntu_system_tests/helpers/notifications/utils.py' |
870 | --- ubuntu_system_tests/helpers/notifications/utils.py 2016-06-02 09:12:43 +0000 |
871 | +++ ubuntu_system_tests/helpers/notifications/utils.py 2016-08-03 05:45:48 +0000 |
872 | @@ -21,10 +21,10 @@ |
873 | import ubuntuuitoolkit as uitk |
874 | |
875 | from autopilot.exceptions import StateNotFoundError |
876 | +from autopilot.introspection import is_element |
877 | |
878 | from ubuntu_system_tests.helpers import wait_until |
879 | -from ubuntu_system_tests.helpers.autopilot import ( |
880 | - is_element, patched_select_single) |
881 | +from ubuntu_system_tests.helpers.autopilot import patched_select |
882 | |
883 | NeedsImplementationError = functools.partial( |
884 | NotImplementedError, |
885 | @@ -93,9 +93,8 @@ |
886 | |
887 | """ |
888 | try: |
889 | - return patched_select_single( |
890 | - self, class_object=notification_class, |
891 | - class_name='Notification', objectName=obj_name, **kwargs) |
892 | + with patched_select(notification_class, 'Notification') as name: |
893 | + return self.select_single(name, objectName=obj_name, **kwargs) |
894 | except StateNotFoundError: |
895 | return None |
896 | |
897 | |
898 | === modified file 'ubuntu_system_tests/helpers/power/fixture_setup.py' |
899 | --- ubuntu_system_tests/helpers/power/fixture_setup.py 2016-07-04 20:54:36 +0000 |
900 | +++ ubuntu_system_tests/helpers/power/fixture_setup.py 2016-08-03 05:45:48 +0000 |
901 | @@ -17,13 +17,13 @@ |
902 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
903 | # |
904 | import fixtures |
905 | - |
906 | from subprocess import CalledProcessError |
907 | |
908 | +from autopilot.introspection.utilities import process_util |
909 | + |
910 | from ubuntu_system_tests.helpers.power import utils as power |
911 | from ubuntu_system_tests.helpers import sensors |
912 | from ubuntu_system_tests.helpers.power.utils import wait_until_powerd_running |
913 | -from ubuntu_system_tests.helpers.processes import get_process_id |
914 | from ubuntu_system_tests.helpers.testbed import run_command_with_sudo as sudo |
915 | |
916 | STOP_POWERD_COMMAND = '/sbin/initctl stop powerd' |
917 | @@ -104,7 +104,7 @@ |
918 | real sensors. |
919 | """ |
920 | try: |
921 | - pid = get_process_id('powerd') |
922 | + pid = process_util.get_pid_for_process('powerd') |
923 | except CalledProcessError: |
924 | pass |
925 | else: |
926 | @@ -126,7 +126,7 @@ |
927 | def are_fake_sensors_enabled(self): |
928 | """Return True if fake sensors enabled on powerd.""" |
929 | try: |
930 | - pid = get_process_id('powerd') |
931 | + pid = process_util.get_pid_for_process('powerd') |
932 | except CalledProcessError: |
933 | return False |
934 | return sensors.are_fake_sensors_enabled_for_process(pid) |
935 | |
936 | === modified file 'ubuntu_system_tests/helpers/power/utils.py' |
937 | --- ubuntu_system_tests/helpers/power/utils.py 2016-07-04 20:54:36 +0000 |
938 | +++ ubuntu_system_tests/helpers/power/utils.py 2016-08-03 05:45:48 +0000 |
939 | @@ -24,11 +24,11 @@ |
940 | |
941 | import dbus |
942 | from autopilot.matchers import Eventually |
943 | +from autopilot.introspection.utilities import process_util |
944 | from testtools.matchers import Equals |
945 | |
946 | from ubuntu_system_tests.helpers import wait_until |
947 | -from ubuntu_system_tests.helpers.processes import (get_process_id, |
948 | - is_process_running) |
949 | +from ubuntu_system_tests.helpers.processes import is_process_running |
950 | from ubuntu_system_tests.helpers.testbed import write_to_file_with_sudo |
951 | |
952 | GSETTINGS_BRIGHTNESS_MAX = 255 |
953 | @@ -90,7 +90,8 @@ |
954 | |
955 | def get_powerd_fifo_path(): |
956 | """Return path of fake sensor fifo used by powerd process.""" |
957 | - return '/tmp/sensor-fifo-{}'.format(get_process_id('powerd')) |
958 | + pid = process_util.get_pid_for_process('powerd') |
959 | + return '/tmp/sensor-fifo-{}'.format(pid) |
960 | |
961 | |
962 | def write_to_powerd_fifo(commands): |
963 | |
964 | === modified file 'ubuntu_system_tests/helpers/processes.py' |
965 | --- ubuntu_system_tests/helpers/processes.py 2016-07-26 20:02:31 +0000 |
966 | +++ ubuntu_system_tests/helpers/processes.py 2016-08-03 05:45:48 +0000 |
967 | @@ -25,6 +25,8 @@ |
968 | |
969 | import psutil |
970 | |
971 | +from autopilot.introspection.utilities import process_util |
972 | + |
973 | from ubuntu_system_tests.helpers import ( |
974 | try_import, |
975 | wait_until, |
976 | @@ -57,39 +59,11 @@ |
977 | |
978 | def is_process_running(pname): |
979 | try: |
980 | - return bool(get_process_ids(pname)) |
981 | + return bool(process_util.get_pids_for_process(pname)) |
982 | except ValueError: |
983 | return False |
984 | |
985 | |
986 | -def _query_pids_for_process(process_name): |
987 | - pids = [process.pid for process in psutil.process_iter() |
988 | - if process.name() == process_name] |
989 | - |
990 | - if not pids: |
991 | - raise ValueError('Process \'{}\' not running'.format(process_name)) |
992 | - return pids |
993 | - |
994 | - |
995 | -def get_process_id(pname): |
996 | - """ |
997 | - Return PID for the requested process. |
998 | - |
999 | - :param pname: name of the process to get PID of. |
1000 | - """ |
1001 | - pids = _query_pids_for_process(process_name=pname) |
1002 | - if len(pids) > 1: |
1003 | - raise ValueError( |
1004 | - 'More than one PID exists for process \'{}\''.format(pname)) |
1005 | - |
1006 | - return pids[0] |
1007 | - |
1008 | - |
1009 | -def get_process_ids(pname): |
1010 | - """Return PIDs of the requested process, in case there are multiple.""" |
1011 | - return _query_pids_for_process(process_name=pname) |
1012 | - |
1013 | - |
1014 | def stop_process(pname): |
1015 | if is_process_running(pname): |
1016 | [process.terminate() for process in psutil.process_iter() if |
1017 | |
1018 | === modified file 'ubuntu_system_tests/helpers/scopes/apps/_cpo.py' |
1019 | --- ubuntu_system_tests/helpers/scopes/apps/_cpo.py 2016-04-19 10:06:01 +0000 |
1020 | +++ ubuntu_system_tests/helpers/scopes/apps/_cpo.py 2016-08-03 05:45:48 +0000 |
1021 | @@ -21,10 +21,7 @@ |
1022 | from autopilot import exceptions, introspection |
1023 | |
1024 | from ubuntu_system_tests.helpers.autopilot import ( |
1025 | - get_patched_registry, patched_select_single, validate_dbus_object, |
1026 | - wait_select_many) |
1027 | -from ubuntu_system_tests.helpers.autopilot.list import order_by_y_coord |
1028 | -from ubuntu_system_tests.helpers.autopilot.object import get_parent |
1029 | + get_patched_registry, patched_select, validate_dbus_object) |
1030 | from ubuntu_system_tests.helpers.scopes.apps import _clickscope |
1031 | from ubuntu_system_tests.helpers.scopes.base import GenericScopeView |
1032 | from ubuntu_system_tests.helpers.unity8 import UNITY8_DASH_PATH_ROOT |
1033 | @@ -65,15 +62,14 @@ |
1034 | preview_list.subPageShown.wait_for(True) |
1035 | preview_list.x.wait_for(0) |
1036 | self.wait_for_processing_to_complete() |
1037 | - return patched_select_single( |
1038 | - root=preview_list, class_object=_preview.Preview, |
1039 | - class_name='Preview', objectName='preview') |
1040 | + with patched_select(_preview.Preview, 'Preview') as name: |
1041 | + return self.select_single(name, objectName='preview') |
1042 | |
1043 | def get_app_icon(self, app_name): |
1044 | """Return icon for required app_name.""" |
1045 | - buttons = wait_select_many(self, type_name='UCAbstractButton', |
1046 | - title=app_name) |
1047 | - return order_by_y_coord(buttons, include_off_screen=True)[0] |
1048 | + return self.wait_select_many( |
1049 | + 'UCAbstractButton', ap_result_sort_keys=['y', 'x'], |
1050 | + title=app_name)[0] |
1051 | |
1052 | def is_app_displayed(self, app_name): |
1053 | """Return True if app with specified name is displayed.""" |
1054 | @@ -86,4 +82,4 @@ |
1055 | def get_app_category(self, app_name): |
1056 | """Return the category name for a specified app_name.""" |
1057 | app = self.get_app_icon(app_name) |
1058 | - return get_parent(app, 'CardGrid').objectName |
1059 | + return app.get_parent('CardGrid').objectName |
1060 | |
1061 | === modified file 'ubuntu_system_tests/helpers/scopes/apps/_preview.py' |
1062 | --- ubuntu_system_tests/helpers/scopes/apps/_preview.py 2016-04-19 18:39:43 +0000 |
1063 | +++ ubuntu_system_tests/helpers/scopes/apps/_preview.py 2016-08-03 05:45:48 +0000 |
1064 | @@ -21,8 +21,7 @@ |
1065 | from autopilot import introspection |
1066 | from unity8.dash import Preview as DashPreview |
1067 | |
1068 | -from ubuntu_system_tests.helpers.autopilot import ( |
1069 | - get_path_root, wait_select_single) |
1070 | +from ubuntu_system_tests.helpers.autopilot import get_path_root |
1071 | from ubuntu_system_tests.helpers.scopes.apps import _clickscope |
1072 | from ubuntu_system_tests.helpers.unity8 import UNITY8_DASH_PATH_ROOT |
1073 | |
1074 | @@ -51,9 +50,9 @@ |
1075 | def _get_preview_button(self, button, wait=False): |
1076 | object_name = 'button{}'.format(button) |
1077 | if wait: |
1078 | - return wait_select_single( |
1079 | - self, 'PreviewActionButton', objectName=object_name, |
1080 | - timeout=120) |
1081 | + return self.wait_select_single( |
1082 | + 'PreviewActionButton', ap_query_timeout=120, |
1083 | + objectName=object_name) |
1084 | else: |
1085 | return self.select_single( |
1086 | 'PreviewActionButton', objectName=object_name) |
1087 | |
1088 | === modified file 'ubuntu_system_tests/helpers/scopes/base.py' |
1089 | --- ubuntu_system_tests/helpers/scopes/base.py 2016-04-19 10:06:01 +0000 |
1090 | +++ ubuntu_system_tests/helpers/scopes/base.py 2016-08-03 05:45:48 +0000 |
1091 | @@ -21,10 +21,10 @@ |
1092 | import logging |
1093 | |
1094 | from autopilot import exceptions |
1095 | +from autopilot.introspection.utilities import sort_by_keys |
1096 | from collections import namedtuple |
1097 | from unity8 import dash as unity8_dash |
1098 | |
1099 | -from ubuntu_system_tests.helpers.autopilot.list import order_by_y_coord |
1100 | from ubuntu_system_tests.helpers.ubuntuuitoolkit.pageheader import ( |
1101 | DashPageHeader) |
1102 | from ubuntu_system_tests.helpers.url_dispatcher import go_to_url |
1103 | @@ -63,9 +63,8 @@ |
1104 | """ |
1105 | if not subtitle: |
1106 | return category.wait_select_single(title=title) |
1107 | - icons = order_by_y_coord( |
1108 | - category.select_many('UCAbstractButton'), |
1109 | - include_off_screen=True) |
1110 | + icons = category.select_many( |
1111 | + 'UCAbstractButton', ap_result_sort_keys=['y', 'x']) |
1112 | for icon in icons: |
1113 | try: |
1114 | icon.select_single(objectName='titleLabel', text=title) |
1115 | @@ -136,7 +135,9 @@ |
1116 | existing_items list. |
1117 | |
1118 | """ |
1119 | - for item in order_by_y_coord(new_items, include_off_screen=True): |
1120 | + sorted_items = sort_by_keys( |
1121 | + new_items, sort_keys=['globalRect.y', 'globalRect.x']) |
1122 | + for item in sorted_items: |
1123 | existing_items.append(item.data) |
1124 | return existing_items |
1125 | |
1126 | @@ -247,15 +248,6 @@ |
1127 | self.pointing_device.click_object(self._get_setup_skip_button()) |
1128 | self.wait_for_header_to_stop_moving() |
1129 | |
1130 | - def _get_first_visible_object(self, objects): |
1131 | - """ Retrieve the object that is currently being displayed based on its |
1132 | - position |
1133 | - :param objects: the list of objects to compare |
1134 | - :return: First visible item from list |
1135 | - |
1136 | - """ |
1137 | - return order_by_y_coord(objects)[0] |
1138 | - |
1139 | def has_skip_button(self): |
1140 | """ Indicates if the skip button is present""" |
1141 | return self._get_setup_skip_button() is not None |
1142 | @@ -278,8 +270,8 @@ |
1143 | return self.select_single(objectName='search_button') |
1144 | |
1145 | def get_search_text_field(self): |
1146 | - return order_by_y_coord( |
1147 | - self.select_many(objectName='searchTextField'))[0] |
1148 | + return self.select_many( |
1149 | + ap_result_sort_keys=['y', 'x'], objectName='searchTextField')[0] |
1150 | |
1151 | def search(self, text): |
1152 | """ Search for a specific text in the scope and waits until the results |
1153 | |
1154 | === modified file 'ubuntu_system_tests/helpers/scopes/music/_artist.py' |
1155 | --- ubuntu_system_tests/helpers/scopes/music/_artist.py 2016-04-08 11:29:23 +0000 |
1156 | +++ ubuntu_system_tests/helpers/scopes/music/_artist.py 2016-08-03 05:45:48 +0000 |
1157 | @@ -19,7 +19,7 @@ |
1158 | # |
1159 | |
1160 | from ubuntu_system_tests.helpers.autopilot import ( |
1161 | - patched_wait_select_single, validate_dbus_object) |
1162 | + patched_select, validate_dbus_object) |
1163 | from ubuntu_system_tests.helpers.scopes.base import GenericScopeView |
1164 | from ubuntu_system_tests.helpers.unity8 import UNITY8_DASH_PATH_ROOT |
1165 | |
1166 | @@ -57,14 +57,14 @@ |
1167 | """Click on the track with the desired name and return Preview.""" |
1168 | from ubuntu_system_tests.helpers.scopes.music import _track |
1169 | self._click_button_by_title(track) |
1170 | - return patched_wait_select_single( |
1171 | - root=self, class_object=_track.Preview, class_name='Preview', |
1172 | - objectName='preview', visible=True) |
1173 | + with patched_select(_track.Preview, 'Preview') as name: |
1174 | + return self.wait_select_single( |
1175 | + name, objectName='preview', visible=True) |
1176 | |
1177 | def select_album(self, album): |
1178 | """Click on the track with the desired name and return Preview.""" |
1179 | from ubuntu_system_tests.helpers.scopes.music import _album |
1180 | self._click_button_by_title(album) |
1181 | - return patched_wait_select_single( |
1182 | - root=self, class_object=_album.Preview, class_name='Preview', |
1183 | - objectName='preview0', visible=True) |
1184 | + with patched_select(_album.Preview, 'Preview') as name: |
1185 | + return self.wait_select_single( |
1186 | + name, objectName='preview0', visible=True) |
1187 | |
1188 | === modified file 'ubuntu_system_tests/helpers/scopes/music/_cpo.py' |
1189 | --- ubuntu_system_tests/helpers/scopes/music/_cpo.py 2016-07-06 13:12:27 +0000 |
1190 | +++ ubuntu_system_tests/helpers/scopes/music/_cpo.py 2016-08-03 05:45:48 +0000 |
1191 | @@ -19,11 +19,10 @@ |
1192 | # |
1193 | |
1194 | from autopilot import exceptions |
1195 | +from autopilot.introspection import is_element |
1196 | |
1197 | from ubuntu_system_tests.helpers.autopilot import ( |
1198 | - is_element, patched_wait_select_single, wait_select_many, |
1199 | - validate_dbus_object) |
1200 | -from ubuntu_system_tests.helpers.autopilot.list import order_by_y_coord |
1201 | + patched_select, validate_dbus_object) |
1202 | from ubuntu_system_tests.helpers.scopes.base import ( |
1203 | GenericScopeView as GenericScopeViewBase) |
1204 | from ubuntu_system_tests.helpers.ubuntuuitoolkit import pageheader |
1205 | @@ -117,9 +116,9 @@ |
1206 | |
1207 | def get_artist(self, artist): |
1208 | """ Retrieve a list of artists with the desired name. """ |
1209 | - artists = wait_select_many( |
1210 | - root=self, objectName='subtitleLabel', text=artist) |
1211 | - return order_by_y_coord(artists, include_off_screen=True)[0] |
1212 | + return self.wait_select_many( |
1213 | + ap_result_sort_keys=['y', 'x'], objectName='subtitleLabel', |
1214 | + text=artist)[0] |
1215 | |
1216 | def select_artist(self, artist): |
1217 | """ |
1218 | @@ -231,9 +230,9 @@ |
1219 | """ Click on the track with the desired name """ |
1220 | from ubuntu_system_tests.helpers.scopes.music import _track |
1221 | self._click_button_by_title(track) |
1222 | - return patched_wait_select_single( |
1223 | - root=self, class_object=_track.Preview, class_name='Preview', |
1224 | - objectName='preview0', visible=True) |
1225 | + with patched_select(_track.Preview, 'Preview') as name: |
1226 | + return self.wait_select_single( |
1227 | + name, objectName='preview0', visible=True) |
1228 | |
1229 | def select_artist(self, artist): |
1230 | """ Click on the artist with the desired name """ |
1231 | |
1232 | === modified file 'ubuntu_system_tests/helpers/scopes/music/_preview.py' |
1233 | --- ubuntu_system_tests/helpers/scopes/music/_preview.py 2016-02-03 16:09:24 +0000 |
1234 | +++ ubuntu_system_tests/helpers/scopes/music/_preview.py 2016-08-03 05:45:48 +0000 |
1235 | @@ -19,8 +19,6 @@ |
1236 | # |
1237 | |
1238 | from unity8.dash import Preview as DashPreview |
1239 | -from ubuntu_system_tests.helpers.autopilot.object import \ |
1240 | - wait_until_is_not_moving |
1241 | |
1242 | |
1243 | class Preview(DashPreview): |
1244 | @@ -30,5 +28,5 @@ |
1245 | return False |
1246 | |
1247 | def click_not_moving(self, elem): |
1248 | - wait_until_is_not_moving(elem) |
1249 | + elem.wait_until_not_moving() |
1250 | self.pointing_device.click_object(elem) |
1251 | |
1252 | === modified file 'ubuntu_system_tests/helpers/scopes/photos/_category.py' |
1253 | --- ubuntu_system_tests/helpers/scopes/photos/_category.py 2016-02-03 16:09:24 +0000 |
1254 | +++ ubuntu_system_tests/helpers/scopes/photos/_category.py 2016-08-03 05:45:48 +0000 |
1255 | @@ -17,12 +17,10 @@ |
1256 | # You should have received a copy of the GNU General Public License |
1257 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1258 | # |
1259 | - |
1260 | +from autopilot.introspection import is_element |
1261 | from ubuntuuitoolkit import UbuntuUIToolkitCustomProxyObjectBase |
1262 | |
1263 | -from ubuntu_system_tests.helpers.autopilot import ( |
1264 | - is_element, validate_dbus_object) |
1265 | -from ubuntu_system_tests.helpers.autopilot.list import order_by_x_coord |
1266 | +from ubuntu_system_tests.helpers.autopilot import validate_dbus_object |
1267 | from ubuntu_system_tests.helpers.unity8 import UNITY8_DASH_PATH_ROOT |
1268 | |
1269 | |
1270 | @@ -44,9 +42,9 @@ |
1271 | |
1272 | def get_pictures_list(self): |
1273 | """ Retrieve all the pictures displayed currently in the list """ |
1274 | - imgs = self.select_many(type_name='CroppedImageMinimumSourceSize', |
1275 | - objectName='artImage') |
1276 | - return order_by_x_coord(imgs, include_off_screen=True) |
1277 | + return self.select_many( |
1278 | + 'CroppedImageMinimumSourceSize', ap_result_sort_keys=['x', 'y'], |
1279 | + objectName='artImage') |
1280 | |
1281 | def is_see_all_displayed(self): |
1282 | """ Indicate if there is at least a button with text "See all" """ |
1283 | |
1284 | === modified file 'ubuntu_system_tests/helpers/scopes/photos/_cpo.py' |
1285 | --- ubuntu_system_tests/helpers/scopes/photos/_cpo.py 2016-04-15 20:09:08 +0000 |
1286 | +++ ubuntu_system_tests/helpers/scopes/photos/_cpo.py 2016-08-03 05:45:48 +0000 |
1287 | @@ -19,12 +19,11 @@ |
1288 | # |
1289 | |
1290 | from autopilot import exceptions |
1291 | +from autopilot.introspection import is_element |
1292 | from retrying import retry |
1293 | |
1294 | -from ubuntu_system_tests.helpers.autopilot import( |
1295 | - is_element, patched_wait_select_single, validate_dbus_object) |
1296 | -from ubuntu_system_tests.helpers.autopilot.list import order_by_x_coord |
1297 | -from ubuntu_system_tests.helpers.autopilot.object import get_parent |
1298 | +from ubuntu_system_tests.helpers.autopilot import ( |
1299 | + patched_select, validate_dbus_object) |
1300 | from ubuntu_system_tests.helpers import context |
1301 | from ubuntu_system_tests.helpers.scopes.base import GenericScopeView |
1302 | from ubuntu_system_tests.helpers.unity8 import UNITY8_DASH_PATH_ROOT |
1303 | @@ -82,10 +81,9 @@ |
1304 | """ |
1305 | kwargs = {'objectName': 'artImage', 'visible': True} |
1306 | pictures = self.select_many( |
1307 | - 'CroppedImageMinimumSourceSize', **kwargs) |
1308 | - pictures_in_path = [picture for picture in pictures if |
1309 | - pic_path in picture.source] |
1310 | - return order_by_x_coord(pictures_in_path, include_off_screen=True) |
1311 | + 'CroppedImageMinimumSourceSize', ap_result_sort_keys=['x', 'y'], |
1312 | + **kwargs) |
1313 | + return [picture for picture in pictures if pic_path in picture.source] |
1314 | |
1315 | def select_picture_from_carousel(self, img): |
1316 | """ Select the picture in the carousel """ |
1317 | @@ -97,9 +95,8 @@ |
1318 | :return: The PhotoPreview object |
1319 | """ |
1320 | from ubuntu_system_tests.helpers.scopes.photos import _preview |
1321 | - return patched_wait_select_single( |
1322 | - root=self, class_object=_preview.Preview, class_name='Preview', |
1323 | - visible=True) |
1324 | + with patched_select(_preview.Preview, 'Preview') as name: |
1325 | + return self.wait_select_single(name, visible=True) |
1326 | |
1327 | def is_in_search_result(self, path): |
1328 | """ |
1329 | @@ -131,4 +128,4 @@ |
1330 | label = context.shared.dash.select_single( |
1331 | 'UCLabel', objectName='header_title_label', text='My Photos', |
1332 | visible=True) |
1333 | - return get_parent(label, 'ListViewWithPageHeader') |
1334 | + return label.get_parent('ListViewWithPageHeader') |
1335 | |
1336 | === modified file 'ubuntu_system_tests/helpers/scopes/photos/_list.py' |
1337 | --- ubuntu_system_tests/helpers/scopes/photos/_list.py 2016-03-12 02:18:42 +0000 |
1338 | +++ ubuntu_system_tests/helpers/scopes/photos/_list.py 2016-08-03 05:45:48 +0000 |
1339 | @@ -21,7 +21,7 @@ |
1340 | from ubuntuuitoolkit import QQuickFlickable |
1341 | |
1342 | from ubuntu_system_tests.helpers.autopilot import ( |
1343 | - patched_wait_select_single, validate_dbus_object, wait_select_many) |
1344 | + patched_select, validate_dbus_object) |
1345 | from ubuntu_system_tests.helpers.unity8 import UNITY8_DASH_PATH_ROOT |
1346 | |
1347 | |
1348 | @@ -36,16 +36,15 @@ |
1349 | def get_today_category(self): |
1350 | """ Get the today category section """ |
1351 | from ubuntu_system_tests.helpers.scopes.photos import _category |
1352 | - return patched_wait_select_single( |
1353 | - root=self, class_object=_category.DashCategoryBase, |
1354 | - class_name='DashCategoryBase', objectName='dashCategorytoday', |
1355 | - visible=True) |
1356 | + with patched_select( |
1357 | + _category.DashCategoryBase, 'DashCategoryBase') as name: |
1358 | + return self.wait_select_single( |
1359 | + name, objectName='dashCategorytoday', visible=True) |
1360 | |
1361 | def get_first_category(self): |
1362 | """ Get the first category section """ |
1363 | from ubuntu_system_tests.helpers.scopes.photos import _category # NOQA |
1364 | - return wait_select_many(self, type_name='DashCategoryBase', |
1365 | - visible=True)[0] |
1366 | + return self.wait_select_many('DashCategoryBase', visible=True)[0] |
1367 | |
1368 | def see_all(self, category): |
1369 | """ Click on the see all button displayed in the selected position """ |
1370 | |
1371 | === modified file 'ubuntu_system_tests/helpers/scopes/photos/_preview.py' |
1372 | --- ubuntu_system_tests/helpers/scopes/photos/_preview.py 2016-02-19 22:36:36 +0000 |
1373 | +++ ubuntu_system_tests/helpers/scopes/photos/_preview.py 2016-08-03 05:45:48 +0000 |
1374 | @@ -23,8 +23,6 @@ |
1375 | from ubuntuuitoolkit import UbuntuUIToolkitCustomProxyObjectBase |
1376 | |
1377 | from ubuntu_system_tests.helpers.autopilot import validate_dbus_object |
1378 | -from ubuntu_system_tests.helpers.autopilot.object import ( |
1379 | - wait_until_is_not_moving) |
1380 | from ubuntu_system_tests.helpers.unity8 import UNITY8_DASH_PATH_ROOT |
1381 | |
1382 | |
1383 | @@ -70,5 +68,5 @@ |
1384 | |
1385 | def click_open_button(self): |
1386 | button = self.get_open_button() |
1387 | - wait_until_is_not_moving(button) |
1388 | + button.wait_until_not_moving() |
1389 | self.pointing_device.click_object(button) |
1390 | |
1391 | === modified file 'ubuntu_system_tests/helpers/scopes/video/_cpo.py' |
1392 | --- ubuntu_system_tests/helpers/scopes/video/_cpo.py 2016-03-08 17:51:09 +0000 |
1393 | +++ ubuntu_system_tests/helpers/scopes/video/_cpo.py 2016-08-03 05:45:48 +0000 |
1394 | @@ -19,12 +19,11 @@ |
1395 | # |
1396 | |
1397 | from autopilot import exceptions |
1398 | +from autopilot.introspection import is_element |
1399 | |
1400 | from ubuntu_system_tests.helpers.autopilot import ( |
1401 | - patched_wait_select_single, |
1402 | - is_element, |
1403 | + patched_select, |
1404 | validate_dbus_object, |
1405 | - wait_select_many |
1406 | ) |
1407 | from ubuntu_system_tests.helpers.scopes.base import GenericScopeView |
1408 | from ubuntu_system_tests.helpers.unity8 import UNITY8_DASH_PATH_ROOT |
1409 | @@ -52,7 +51,8 @@ |
1410 | return False |
1411 | |
1412 | def _get_my_videos_section(self): |
1413 | - wait_select_many(self, timeout=30, objectName='dashCategorylocal') |
1414 | + self.wait_select_many( |
1415 | + ap_query_timeout=30, objectName='dashCategorylocal') |
1416 | return self.select_single( |
1417 | objectName='dashCategorylocal').select_single('QQuickGridView') |
1418 | |
1419 | @@ -99,6 +99,5 @@ |
1420 | self.pointing_device.click_object(video) |
1421 | self.wait_for_processing_to_complete() |
1422 | from ubuntu_system_tests.helpers.scopes.video import _preview |
1423 | - return patched_wait_select_single( |
1424 | - root=self, class_object=_preview.Preview, class_name='Preview', |
1425 | - objectName='preview') |
1426 | + with patched_select(_preview.Preview, 'Preview') as name: |
1427 | + return self.wait_select_single(name, objectName='preview') |
1428 | |
1429 | === modified file 'ubuntu_system_tests/helpers/system_settings/_cpo.py' |
1430 | --- ubuntu_system_tests/helpers/system_settings/_cpo.py 2016-07-27 14:30:11 +0000 |
1431 | +++ ubuntu_system_tests/helpers/system_settings/_cpo.py 2016-08-03 05:45:48 +0000 |
1432 | @@ -22,13 +22,12 @@ |
1433 | |
1434 | import autopilot.logging |
1435 | import autopilot.exceptions as exceptions |
1436 | +from autopilot.introspection import is_element |
1437 | |
1438 | import ubuntuuitoolkit as uitk |
1439 | import ubuntu_system_settings as uss |
1440 | |
1441 | -from ubuntu_system_tests.helpers.autopilot import ( |
1442 | - validate_dbus_object, is_element) |
1443 | -from ubuntu_system_tests.helpers.autopilot.list import order_by_y_coord |
1444 | +from ubuntu_system_tests.helpers.autopilot import validate_dbus_object |
1445 | from ubuntu_system_tests.helpers.brightness._cpo import BrightnessPageBase |
1446 | |
1447 | logger = logging.getLogger(__name__) |
1448 | @@ -294,7 +293,7 @@ |
1449 | def get_auto_adjust_checkbox(self): |
1450 | # TODO: Use select single once the checkbox gets an object name, |
1451 | # Until then, we need to get all the elements and filter them |
1452 | - return order_by_y_coord(self.select_many('CheckBox'))[0] |
1453 | + return self.select_many('CheckBox', ap_result_sort_keys=['y', 'x'])[0] |
1454 | |
1455 | def get_max_brightness(self): |
1456 | return 100 |
1457 | |
1458 | === modified file 'ubuntu_system_tests/helpers/telegram/app.py' |
1459 | --- ubuntu_system_tests/helpers/telegram/app.py 2016-06-09 19:56:51 +0000 |
1460 | +++ ubuntu_system_tests/helpers/telegram/app.py 2016-08-03 05:45:48 +0000 |
1461 | @@ -16,6 +16,8 @@ |
1462 | # You should have received a copy of the GNU General Public License |
1463 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1464 | |
1465 | +from autopilot.introspection.utilities import process_util |
1466 | + |
1467 | from ubuntu_system_tests.helpers import autopilot |
1468 | from ubuntu_system_tests.helpers import processes |
1469 | from ubuntu_system_tests.helpers.scopes.apps import ( |
1470 | @@ -54,8 +56,8 @@ |
1471 | """ |
1472 | from ubuntu_system_tests.helpers.telegram._cpo import MainView # NOQA |
1473 | proxy = autopilot.get_proxy_object(pid=pid) |
1474 | - return autopilot.patched_wait_select_single( |
1475 | - root=proxy, class_object=MainView, class_name='MainView') |
1476 | + with autopilot.patched_select(MainView, 'MainView') as name: |
1477 | + return proxy.wait_select_single(name) |
1478 | |
1479 | |
1480 | def get_telegram_process_id(): |
1481 | @@ -68,4 +70,4 @@ |
1482 | |
1483 | :return: PID of telegram app |
1484 | """ |
1485 | - return processes.get_process_ids(APP)[0] |
1486 | + return process_util.get_pid_for_process(APP)[0] |
1487 | |
1488 | === modified file 'ubuntu_system_tests/helpers/ubuntu_keyboard/_cpo.py' |
1489 | --- ubuntu_system_tests/helpers/ubuntu_keyboard/_cpo.py 2016-02-12 14:52:45 +0000 |
1490 | +++ ubuntu_system_tests/helpers/ubuntu_keyboard/_cpo.py 2016-08-03 05:45:48 +0000 |
1491 | @@ -18,10 +18,10 @@ |
1492 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1493 | # |
1494 | |
1495 | +from autopilot.introspection import is_element |
1496 | import ubuntuuitoolkit |
1497 | |
1498 | -from ubuntu_system_tests.helpers.autopilot import ( |
1499 | - is_element, validate_dbus_object) |
1500 | +from ubuntu_system_tests.helpers.autopilot import validate_dbus_object |
1501 | |
1502 | APP_PATH_ROOT = b'maliit-server' |
1503 | |
1504 | |
1505 | === modified file 'ubuntu_system_tests/helpers/ubuntuuitoolkit/mainview.py' |
1506 | --- ubuntu_system_tests/helpers/ubuntuuitoolkit/mainview.py 2016-06-16 08:35:00 +0000 |
1507 | +++ ubuntu_system_tests/helpers/ubuntuuitoolkit/mainview.py 2016-08-03 05:45:48 +0000 |
1508 | @@ -17,6 +17,7 @@ |
1509 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1510 | # |
1511 | |
1512 | +from autopilot.introspection import is_element |
1513 | # TODO: Remove this when extending from ubuntuuitoolkit main view |
1514 | from ubuntuuitoolkit._custom_proxy_objects import _tabs |
1515 | |
1516 | @@ -25,7 +26,6 @@ |
1517 | # views. Once that difference is implemented in ubuntuuitoolkit, then we |
1518 | # just import ubuntuuitoolkit here |
1519 | import ubuntuuitoolkit |
1520 | -from ubuntu_system_tests.helpers.autopilot import is_element |
1521 | |
1522 | |
1523 | class SingleTabMainView: |
1524 | |
1525 | === modified file 'ubuntu_system_tests/helpers/ubuntuuitoolkit/optiontoggle.py' |
1526 | --- ubuntu_system_tests/helpers/ubuntuuitoolkit/optiontoggle.py 2016-02-02 19:58:03 +0000 |
1527 | +++ ubuntu_system_tests/helpers/ubuntuuitoolkit/optiontoggle.py 2016-08-03 05:45:48 +0000 |
1528 | @@ -18,7 +18,6 @@ |
1529 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1530 | |
1531 | from ubuntuuitoolkit import UbuntuUIToolkitCustomProxyObjectBase |
1532 | -from ubuntu_system_tests.helpers.autopilot.list import order_by_y_coord |
1533 | |
1534 | |
1535 | class OptionToggle(UbuntuUIToolkitCustomProxyObjectBase): |
1536 | @@ -38,7 +37,7 @@ |
1537 | |
1538 | def get_options(self): |
1539 | """Return ordered list of availble options.""" |
1540 | - options = order_by_y_coord(self.select_many('UCLabel')) |
1541 | + options = self.select_many('UCLabel', ap_result_sort_keys=['y', 'x']) |
1542 | return [option.text for option in options] |
1543 | |
1544 | def select_option(self, option): |
1545 | |
1546 | === modified file 'ubuntu_system_tests/helpers/ubuntuuitoolkit/pageheader.py' |
1547 | --- ubuntu_system_tests/helpers/ubuntuuitoolkit/pageheader.py 2016-06-14 13:07:39 +0000 |
1548 | +++ ubuntu_system_tests/helpers/ubuntuuitoolkit/pageheader.py 2016-08-03 05:45:48 +0000 |
1549 | @@ -22,8 +22,6 @@ |
1550 | from ubuntuuitoolkit._custom_proxy_objects._common import ToolkitException |
1551 | from ubuntuuitoolkit._custom_proxy_objects._header import AppHeader |
1552 | |
1553 | -from ubuntu_system_tests.helpers.autopilot.list import order_by_y_coord |
1554 | - |
1555 | |
1556 | class PageHeader(AppHeader): |
1557 | |
1558 | @@ -68,18 +66,11 @@ |
1559 | |
1560 | def _get_cancel_button(self): |
1561 | """Return header cancel button.""" |
1562 | - cancel = order_by_y_coord(self.select_many(text='Cancel'))[0] |
1563 | + cancel = self.select_many( |
1564 | + ap_result_sort_keys=['y', 'x'], text='Cancel')[0] |
1565 | return cancel.get_parent() |
1566 | |
1567 | def clear_search(self): |
1568 | """Clear the search text field.""" |
1569 | self.searchEntryEnabled.wait_for(True) |
1570 | self.pointing_device.click_object(self._get_cancel_button()) |
1571 | - |
1572 | - def wait_until_not_moving(self): |
1573 | - """Wait until the header has stopped moving.""" |
1574 | - try: |
1575 | - container = self.select_single(objectName='headerContainer') |
1576 | - container.moving.wait_for(False) |
1577 | - except StateNotFoundError: |
1578 | - pass |
1579 | |
1580 | === modified file 'ubuntu_system_tests/helpers/unity8/dash.py' |
1581 | --- ubuntu_system_tests/helpers/unity8/dash.py 2016-02-03 16:09:24 +0000 |
1582 | +++ ubuntu_system_tests/helpers/unity8/dash.py 2016-08-03 05:45:48 +0000 |
1583 | @@ -24,8 +24,7 @@ |
1584 | from unity8 import dash as unity8_dash |
1585 | |
1586 | from ubuntu_system_tests.helpers.autopilot import ( |
1587 | - patched_wait_select_single, validate_dbus_object, wait_select_many) |
1588 | -from ubuntu_system_tests.helpers.autopilot.list import order_by_x_coord |
1589 | + patched_select, validate_dbus_object) |
1590 | from ubuntu_system_tests.helpers.ubuntuuitoolkit.pageheader import ( |
1591 | DashPageHeader |
1592 | ) |
1593 | @@ -82,7 +81,7 @@ |
1594 | self._scroll_to_right_scope() |
1595 | self.dash_content_list.moving.wait_for(False) |
1596 | |
1597 | - def get_current_scope(self, cpo=None, *args, **kwargs): |
1598 | + def get_current_scope(self, cpo=None, **kwargs): |
1599 | """ |
1600 | Return the GenericScopeView proxy object for current scope. |
1601 | |
1602 | @@ -95,9 +94,8 @@ |
1603 | from ubuntu_system_tests.helpers.scopes.generic._cpo import ( |
1604 | GenericScopeView) |
1605 | cpo = GenericScopeView |
1606 | - return patched_wait_select_single( |
1607 | - root=self, class_object=cpo, class_name=SCOPE_CLASS_NAME, |
1608 | - isCurrent=True, *args, **kwargs) |
1609 | + with patched_select(cpo, SCOPE_CLASS_NAME) as name: |
1610 | + return self.wait_select_single(name, isCurrent=True, **kwargs) |
1611 | |
1612 | def get_scope_count(self): |
1613 | """Count how many scopes are present.""" |
1614 | @@ -115,11 +113,9 @@ |
1615 | if wait_for_dash_loaded: |
1616 | self.wait_for_dash_loaded() |
1617 | |
1618 | - # Get a list of headers displayed on the screen |
1619 | - headers = wait_select_many(self, type_name=header_class, visible=True) |
1620 | - |
1621 | - # Return the first visible header ordered by x co-ordinate |
1622 | - return order_by_x_coord(headers)[0] |
1623 | + # Return the first visible header ordered by x co-ordinate. |
1624 | + return self.wait_select_many( |
1625 | + header_class, ap_result_sort_keys=['x', 'y'], visible=True)[0] |
1626 | |
1627 | def swipe_screen_from_left(self): |
1628 | """Move a focused application to the background and return to dash.""" |
1629 | |
1630 | === modified file 'ubuntu_system_tests/helpers/unity8/phone_stage.py' |
1631 | --- ubuntu_system_tests/helpers/unity8/phone_stage.py 2016-04-27 21:43:27 +0000 |
1632 | +++ ubuntu_system_tests/helpers/unity8/phone_stage.py 2016-08-03 05:45:48 +0000 |
1633 | @@ -24,7 +24,6 @@ |
1634 | from autopilot.exceptions import StateNotFoundError |
1635 | from ubuntuuitoolkit import UbuntuUIToolkitCustomProxyObjectBase |
1636 | from ubuntu_system_tests.helpers.autopilot import validate_dbus_object |
1637 | -from ubuntu_system_tests.helpers.autopilot.list import order_by_x_coord |
1638 | from ubuntu_system_tests.helpers.unity8 import ( |
1639 | UNITY8_PATH_ROOT, APP_WIN_NAME) |
1640 | |
1641 | @@ -38,9 +37,11 @@ |
1642 | return validate_dbus_object( |
1643 | path, state, UNITY8_PATH_ROOT, b'PhoneStage', objectName='stage') |
1644 | |
1645 | - def _get_app_windows(self): |
1646 | - """Return list of displayed ApplicationWindow objects.""" |
1647 | - return self.select_many('ApplicationWindow') |
1648 | + def get_all_app_windows(self): |
1649 | + """Return ordered list of all app window objects in task switcher.""" |
1650 | + return self.select_many( |
1651 | + 'ApplicationWindow', |
1652 | + ap_result_sort_keys=['globalRect.x', 'globalRect.y']) |
1653 | |
1654 | def _get_app_window(self, app_name): |
1655 | """Return ApplicationWindow object for required app.""" |
1656 | @@ -58,7 +59,7 @@ |
1657 | def _get_next_app_window(self, app_window): |
1658 | """Return the app_window on the right of the specified app_window. |
1659 | If there are no more apps on the right then return None.""" |
1660 | - apps = self.get_all_app_windows(include_off_screen=False) |
1661 | + apps = self.get_all_app_windows() |
1662 | next_app = self._get_app_window_position(apps, app_window) + 1 |
1663 | try: |
1664 | return apps[next_app] |
1665 | @@ -117,7 +118,7 @@ |
1666 | def swipe_top_app_from_view(self): |
1667 | """Swipe the right-most visible app from view by swiping it to the |
1668 | right edge.""" |
1669 | - apps = self.get_all_app_windows(include_off_screen=False) |
1670 | + apps = self.get_all_app_windows() |
1671 | app_count = len(apps) |
1672 | if app_count > 2: |
1673 | self._swipe_from_app_to_right_edge(apps[-1]) |
1674 | @@ -145,19 +146,13 @@ |
1675 | def is_app_visible(self, app_window): |
1676 | """Return True if specified app_window is in the visible section of |
1677 | the view. This is limited to the top 3 windows.""" |
1678 | - visible_apps = self.get_app_window_names(include_off_screen=False)[-3:] |
1679 | + visible_apps = self.get_app_window_names()[-3:] |
1680 | return app_window.title in visible_apps |
1681 | |
1682 | - def get_all_app_windows(self, include_off_screen=True): |
1683 | - """Return ordered list of all app window objects in task switcher.""" |
1684 | - return order_by_x_coord( |
1685 | - self._get_app_windows(), include_off_screen=include_off_screen) |
1686 | - |
1687 | - def get_app_window_names(self, include_off_screen=True): |
1688 | + def get_app_window_names(self): |
1689 | """Return ordered list of app window object names for each app |
1690 | displayed.""" |
1691 | - return [app.title for app in self.get_all_app_windows( |
1692 | - include_off_screen)] |
1693 | + return [app.title for app in self.get_all_app_windows()] |
1694 | |
1695 | def close(self): |
1696 | """Close the task switcher and return to dash.""" |
1697 | |
1698 | === modified file 'ubuntu_system_tests/helpers/unity8/settings_wizard.py' |
1699 | --- ubuntu_system_tests/helpers/unity8/settings_wizard.py 2016-07-07 09:03:17 +0000 |
1700 | +++ ubuntu_system_tests/helpers/unity8/settings_wizard.py 2016-08-03 05:45:48 +0000 |
1701 | @@ -352,9 +352,9 @@ |
1702 | |
1703 | def _get_notification(self, unity): |
1704 | logger.info('Waiting longer for notification object') |
1705 | - with override_proxy_timeout(unity, 30): |
1706 | - return unity.wait_select_single( |
1707 | - Notification, objectName='notification1', visible='True') |
1708 | + return unity.wait_select_single( |
1709 | + Notification, ap_query_timeout=30, objectName='notification1', |
1710 | + visible='True') |
1711 | |
1712 | def _get_back_button(self): |
1713 | return self.wait_select_single( |
1714 | |
1715 | === modified file 'ubuntu_system_tests/helpers/webbrowser/_cpo.py' |
1716 | --- ubuntu_system_tests/helpers/webbrowser/_cpo.py 2016-06-01 08:47:36 +0000 |
1717 | +++ ubuntu_system_tests/helpers/webbrowser/_cpo.py 2016-08-03 05:45:48 +0000 |
1718 | @@ -24,8 +24,7 @@ |
1719 | import ubuntuuitoolkit as uitk |
1720 | |
1721 | from ubuntu_system_tests.helpers.autopilot import ( |
1722 | - patched_wait_select_single, validate_dbus_object, wait_select_many) |
1723 | -from ubuntu_system_tests.helpers.autopilot.list import order_by_y_coord |
1724 | + patched_select, validate_dbus_object) |
1725 | |
1726 | logger = logging.getLogger(__name__) |
1727 | |
1728 | @@ -143,7 +142,7 @@ |
1729 | |
1730 | def get_history_urls(self): |
1731 | """Return all the pages (urls) that are shown in the history page""" |
1732 | - return wait_select_many(self, type_name='UrlDelegate', visible=True) |
1733 | + return self.wait_select_many('UrlDelegate', visible=True) |
1734 | |
1735 | def get_tab_preview_urls(self): |
1736 | """Return all the pages (urls) that are shown in the history page""" |
1737 | @@ -168,14 +167,15 @@ |
1738 | return next(elem for elem in elems if elem.text == text) |
1739 | |
1740 | def get_download_options_dialog(self): |
1741 | - return patched_wait_select_single( |
1742 | - self, Dialog, class_name='Dialog', |
1743 | - objectName='downloadOptionsDialog') |
1744 | + with patched_select(Dialog, 'Dialog') as name: |
1745 | + return self.wait_select_single( |
1746 | + name, objectName='downloadOptionsDialog') |
1747 | |
1748 | def get_open_with_dialog(self): |
1749 | - return patched_wait_select_single( |
1750 | - self, ContentPeerPicker13, class_name='ContentPeerPicker13', |
1751 | - objectName='contentPeerPicker') |
1752 | + with patched_select( |
1753 | + ContentPeerPicker13, 'ContentPeerPicker13') as name: |
1754 | + return self.wait_select_single( |
1755 | + name, objectName='contentPeerPicker') |
1756 | |
1757 | def open_page_and_accept_location_permission_prompt(self, url): |
1758 | """Open the provided url in the browser and accept the location |
1759 | @@ -266,7 +266,7 @@ |
1760 | |
1761 | def get_bookmarks_urls(self): |
1762 | """Return all the pages (urls) that are shown in the bookmarks page""" |
1763 | - return wait_select_many(self, type_name='UrlDelegate', visible=True) |
1764 | + return self.wait_select_many('UrlDelegate', visible=True) |
1765 | |
1766 | def delete_bookmark(self, url): |
1767 | bookmark_delegate = self.wait_select_single(UrlDelegate, url=url) |
1768 | @@ -363,8 +363,11 @@ |
1769 | objectName='contentPeerPicker') |
1770 | |
1771 | def _get_button(self, text): |
1772 | - return order_by_y_coord( |
1773 | - self.select_many(objectName='label', text=text))[0].get_parent() |
1774 | + buttons = self.select_many( |
1775 | + ap_result_sort_keys=['y', 'x'], objectName='label', |
1776 | + text=text) |
1777 | + top_button = buttons[0] |
1778 | + return top_button.get_parent() |
1779 | |
1780 | def _get_gallery_button(self): |
1781 | return self._get_button('Gallery') |
1782 | |
1783 | === modified file 'ubuntu_system_tests/helpers/webbrowser/app.py' |
1784 | --- ubuntu_system_tests/helpers/webbrowser/app.py 2016-06-02 11:24:05 +0000 |
1785 | +++ ubuntu_system_tests/helpers/webbrowser/app.py 2016-08-03 05:45:48 +0000 |
1786 | @@ -18,6 +18,8 @@ |
1787 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1788 | # |
1789 | |
1790 | +from autopilot.introspection.utilities import process_util |
1791 | + |
1792 | from ubuntu_system_tests.helpers import autopilot |
1793 | from ubuntu_system_tests.helpers import processes |
1794 | from ubuntu_system_tests.helpers.scopes.apps import ( |
1795 | @@ -68,4 +70,4 @@ |
1796 | |
1797 | def get_webbrowser_process_id(): |
1798 | """ Retrieve the webbrowser process id """ |
1799 | - return processes.get_process_id(APP) |
1800 | + return process_util.get_pid_for_process(APP) |
1801 | |
1802 | === modified file 'ubuntu_system_tests/perftests/scalability/test_photos.py' |
1803 | --- ubuntu_system_tests/perftests/scalability/test_photos.py 2016-06-14 17:59:07 +0000 |
1804 | +++ ubuntu_system_tests/perftests/scalability/test_photos.py 2016-08-03 05:45:48 +0000 |
1805 | @@ -24,7 +24,6 @@ |
1806 | from retrying import retry |
1807 | from testtools import skipUnless |
1808 | |
1809 | -from ubuntu_system_tests.helpers.autopilot import object |
1810 | from ubuntu_system_tests.helpers import cache |
1811 | from ubuntu_system_tests.helpers import context |
1812 | from ubuntu_system_tests.helpers import file_system as fs |
1813 | @@ -70,7 +69,7 @@ |
1814 | |
1815 | def _go_to_photo_preview(self, scope, pic): |
1816 | """ Go to the preview screen """ |
1817 | - object.wait_until_is_not_moving(pic) |
1818 | + pic.wait_until_not_moving() |
1819 | scope.select_picture_from_carousel(pic) |
1820 | return scope.get_current_photo_preview() |
1821 | |
1822 | |
1823 | === modified file 'ubuntu_system_tests/selftests/test_config.py' |
1824 | --- ubuntu_system_tests/selftests/test_config.py 2016-05-06 16:39:14 +0000 |
1825 | +++ ubuntu_system_tests/selftests/test_config.py 2016-08-03 05:45:48 +0000 |
1826 | @@ -28,34 +28,6 @@ |
1827 | from ubuntu_system_tests import selftests |
1828 | from ubuntu_system_tests.common import config |
1829 | from ubuntu_system_tests.common.options import Option |
1830 | -from ubuntu_system_tests.helpers.autopilot import override_proxy_timeout |
1831 | - |
1832 | - |
1833 | -class HelpersTestCase(selftests.ConfigBaseTestCase): |
1834 | - |
1835 | - def get_mock_proxy(self): |
1836 | - """Returns a rubbish proxy object that doesn't actually do anything.""" |
1837 | - return ProxyBase({'id': [0, 0]}, b'/root', None) |
1838 | - |
1839 | - def test_set_proxy_time_updates_polltime(self): |
1840 | - new_poll_time = 100 |
1841 | - proxy = self.get_mock_proxy() |
1842 | - self.assertNotEqual(proxy._poll_time, new_poll_time) |
1843 | - |
1844 | - with override_proxy_timeout(proxy, new_poll_time): |
1845 | - self.assertEqual(proxy._poll_time, new_poll_time) |
1846 | - |
1847 | - def test_set_proxy_time_resets_polltime(self): |
1848 | - new_poll_time = 100 |
1849 | - proxy = self.get_mock_proxy() |
1850 | - self.assertNotEqual(proxy._poll_time, new_poll_time) |
1851 | - |
1852 | - original_timeout = proxy._poll_time |
1853 | - |
1854 | - with override_proxy_timeout(proxy, new_poll_time): |
1855 | - pass |
1856 | - |
1857 | - self.assertEqual(proxy._poll_time, original_timeout) |
1858 | |
1859 | |
1860 | class ConfigDirTestCase(selftests.ConfigBaseTestCase): |
1861 | |
1862 | === modified file 'ubuntu_system_tests/tests/indicators/test_indicator_battery.py' |
1863 | --- ubuntu_system_tests/tests/indicators/test_indicator_battery.py 2016-06-09 19:06:08 +0000 |
1864 | +++ ubuntu_system_tests/tests/indicators/test_indicator_battery.py 2016-08-03 05:45:48 +0000 |
1865 | @@ -27,7 +27,6 @@ |
1866 | |
1867 | def setUp(self): |
1868 | super().setUp() |
1869 | - self.restart_unity() |
1870 | self.indicator_page = indicators.open_battery_indicator() |
1871 | |
1872 | def test_battery_settings_item_open_correct_page(self): |
1873 | |
1874 | === modified file 'ubuntu_system_tests/tests/indicators/test_indicator_bluetooth.py' |
1875 | --- ubuntu_system_tests/tests/indicators/test_indicator_bluetooth.py 2016-06-09 19:56:51 +0000 |
1876 | +++ ubuntu_system_tests/tests/indicators/test_indicator_bluetooth.py 2016-08-03 05:45:48 +0000 |
1877 | @@ -31,7 +31,6 @@ |
1878 | |
1879 | def setUp(self): |
1880 | super().setUp() |
1881 | - self.restart_unity() |
1882 | self.bluetooth_indicator = indicators.open_bluetooth_indicator() |
1883 | |
1884 | def test_bluetooth_settings_item_open_correct_page(self): |
1885 | |
1886 | === modified file 'ubuntu_system_tests/tests/indicators/test_indicator_datetime.py' |
1887 | --- ubuntu_system_tests/tests/indicators/test_indicator_datetime.py 2016-06-09 19:56:51 +0000 |
1888 | +++ ubuntu_system_tests/tests/indicators/test_indicator_datetime.py 2016-08-03 05:45:48 +0000 |
1889 | @@ -31,7 +31,6 @@ |
1890 | |
1891 | def setUp(self): |
1892 | super().setUp() |
1893 | - self.restart_unity() |
1894 | self.indicator_page = indicators.open_datetime_indicator() |
1895 | |
1896 | def test_date_time_settings_item_open_correct_page(self): |
1897 | |
1898 | === modified file 'ubuntu_system_tests/tests/indicators/test_indicator_network.py' |
1899 | --- ubuntu_system_tests/tests/indicators/test_indicator_network.py 2016-06-09 19:56:51 +0000 |
1900 | +++ ubuntu_system_tests/tests/indicators/test_indicator_network.py 2016-08-03 05:45:48 +0000 |
1901 | @@ -41,13 +41,17 @@ |
1902 | class NetworkIndicatorBase(base.BaseUbuntuSystemTestCase): |
1903 | |
1904 | def setUp(self): |
1905 | + super().setUp() |
1906 | + self.indicator_page = indicators.open_network_indicator() |
1907 | + |
1908 | + |
1909 | +class NetworkIndicatorWithSimBase(NetworkIndicatorBase): |
1910 | + def setUp(self): |
1911 | self.assertTrue(wait_for_all_sims_registered()) |
1912 | super().setUp() |
1913 | - self.restart_unity() |
1914 | - self.indicator_page = indicators.open_network_indicator() |
1915 | - |
1916 | - |
1917 | -class FlightModeTestCase(NetworkIndicatorBase): |
1918 | + |
1919 | + |
1920 | +class FlightModeTestCase(NetworkIndicatorWithSimBase): |
1921 | |
1922 | @skipUnless(ofono.is_sim_inserted() and is_wifi_supported(), |
1923 | 'SIM and Wi-Fi support required.') |
1924 | @@ -137,7 +141,7 @@ |
1925 | network.ensure_internet_connectivity(timeout=15) |
1926 | |
1927 | |
1928 | -class CellularProvidersTestCase(NetworkIndicatorBase): |
1929 | +class CellularProvidersTestCase(NetworkIndicatorWithSimBase): |
1930 | |
1931 | @skipUnless(ofono.is_sim_inserted(), 'At least one SIM card required') |
1932 | def setUp(self): |
1933 | |
1934 | === modified file 'ubuntu_system_tests/tests/indicators/test_indicator_sound.py' |
1935 | --- ubuntu_system_tests/tests/indicators/test_indicator_sound.py 2016-06-09 19:56:51 +0000 |
1936 | +++ ubuntu_system_tests/tests/indicators/test_indicator_sound.py 2016-08-03 05:45:48 +0000 |
1937 | @@ -41,7 +41,6 @@ |
1938 | |
1939 | def setUp(self): |
1940 | super().setUp() |
1941 | - self.restart_unity() |
1942 | self.indicator_page = indicators.open_sound_indicator() |
1943 | |
1944 | def test_sound_settings_item_open_correct_page(self): |
1945 | @@ -60,7 +59,6 @@ |
1946 | |
1947 | def setUp(self): |
1948 | super().setUp() |
1949 | - self.restart_unity() |
1950 | self.useFixture(media.BackupRestoreLocalMediaFixture()) |
1951 | self.useFixture(music_fixture.MusicAppWelcomeWizard(show_wizard=True)) |
1952 | shutil.copy2(test_data.SRC_AUDIO_FILE_2, test_data.LOCAL_AUDIO_FILE_2) |
1953 | |
1954 | === modified file 'ubuntu_system_tests/tests/scopes/test_default_scopes.py' |
1955 | --- ubuntu_system_tests/tests/scopes/test_default_scopes.py 2016-03-11 17:54:46 +0000 |
1956 | +++ ubuntu_system_tests/tests/scopes/test_default_scopes.py 2016-08-03 05:45:48 +0000 |
1957 | @@ -193,8 +193,7 @@ |
1958 | |
1959 | """ |
1960 | previous_index = -1 |
1961 | - expected_labels = get_section_names_from_list( |
1962 | - expected_sections) |
1963 | + expected_labels = get_section_names_from_list(expected_sections) |
1964 | for expected_section, expected_label in zip(expected_sections, |
1965 | expected_labels): |
1966 | if KEY_COMPARE_METHOD in expected_section: |
1967 | |
1968 | === modified file 'ubuntu_system_tests/tests/test_calls.py' |
1969 | --- ubuntu_system_tests/tests/test_calls.py 2016-07-27 15:18:57 +0000 |
1970 | +++ ubuntu_system_tests/tests/test_calls.py 2016-08-03 05:45:48 +0000 |
1971 | @@ -24,6 +24,7 @@ |
1972 | from threading import Event |
1973 | |
1974 | from autopilot.exceptions import StateNotFoundError |
1975 | +from autopilot.input._uinput import UInputHardwareKeysDevice |
1976 | from autopilot.matchers import Eventually |
1977 | from retrying import retry |
1978 | from testtools import skipUnless |
1979 | @@ -43,7 +44,6 @@ |
1980 | AddressBook, |
1981 | fixture_setup as address_book_fixture |
1982 | ) |
1983 | -from ubuntu_system_tests.helpers.autopilot import input |
1984 | from ubuntu_system_tests.helpers.data import load_test_metadata |
1985 | from ubuntu_system_tests.helpers.dialer_app import ( |
1986 | fixture_setup as dialer_fixture_setup, |
1987 | @@ -444,7 +444,8 @@ |
1988 | 7. Terminate the call. |
1989 | |
1990 | """ |
1991 | - input.press_power_button() |
1992 | + hardware_keys_device = UInputHardwareKeysDevice() |
1993 | + hardware_keys_device.press_and_release_power_button() |
1994 | self.assertTrue( |
1995 | wait_until(display.is_display_off, timeout=5), |
1996 | 'Display did not turn off with power button.') |
1997 | |
1998 | === modified file 'ubuntu_system_tests/tests/test_clock.py' |
1999 | --- ubuntu_system_tests/tests/test_clock.py 2016-07-20 19:41:05 +0000 |
2000 | +++ ubuntu_system_tests/tests/test_clock.py 2016-08-03 05:45:48 +0000 |
2001 | @@ -73,7 +73,7 @@ |
2002 | # Wait until the alarm is triggered and a notification is displayed |
2003 | notifications = self.shell.get_notifications_list() |
2004 | notif = notifications.get_alarm_notification(timeout=120) |
2005 | - self.assertIn(date.strftime("%-I:%M %p"), notif.summary) |
2006 | + self.assertIn(date.strftime("%-I:%M"), notif.summary) |
2007 | |
2008 | # Validate the notification is dismissed |
2009 | notif.dismiss() |
2010 | |
2011 | === modified file 'ubuntu_system_tests/tests/test_with_webbrowser.py' |
2012 | --- ubuntu_system_tests/tests/test_with_webbrowser.py 2016-07-07 10:23:31 +0000 |
2013 | +++ ubuntu_system_tests/tests/test_with_webbrowser.py 2016-08-03 05:45:48 +0000 |
2014 | @@ -23,10 +23,10 @@ |
2015 | import os.path |
2016 | |
2017 | from autopilot import exceptions |
2018 | +from autopilot.introspection import is_element |
2019 | from autopilot.matchers import Eventually |
2020 | from testtools.matchers import Equals |
2021 | |
2022 | -from ubuntu_system_tests.helpers import autopilot |
2023 | from ubuntu_system_tests.helpers.data import load_test_metadata |
2024 | from ubuntu_system_tests.helpers import file_system as fs |
2025 | from ubuntu_system_tests.helpers import gallery |
2026 | @@ -244,7 +244,7 @@ |
2027 | def _assert_find_in_page_item_not_visible_in_drawer(self): |
2028 | """Open the drawer and ensure 'Find in page' item is not visible.""" |
2029 | self.browser.open_drawer() |
2030 | - self.assertFalse(autopilot.is_element( |
2031 | + self.assertFalse(is_element( |
2032 | self.browser.chrome.get_drawer_action, 'findinpage')) |
2033 | |
2034 | def test_find_in_page_invisible_new_tabs_view(self): |