Merge lp:~canonical-platform-qa/unity8/fix1306340-deprecate_emulators into lp:unity8
- fix1306340-deprecate_emulators
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Michael Zanetti |
Approved revision: | 1543 |
Merged at revision: | 1838 |
Proposed branch: | lp:~canonical-platform-qa/unity8/fix1306340-deprecate_emulators |
Merge into: | lp:unity8 |
Prerequisite: | lp:~josharenson/unity8/qa_helpers |
Diff against target: |
1265 lines (+432/-445) 21 files modified
tests/autopilot/unity8/__init__.py (+6/-2) tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py (+4/-2) tests/autopilot/unity8/dash.py (+7/-7) tests/autopilot/unity8/fixture_setup.py (+6/-16) tests/autopilot/unity8/greeter/__init__.py (+42/-1) tests/autopilot/unity8/greeter/tests/__init__.py (+2/-2) tests/autopilot/unity8/launcher.py (+3/-3) tests/autopilot/unity8/process_helpers.py (+2/-1) tests/autopilot/unity8/sensors.py (+1/-1) tests/autopilot/unity8/shell/__init__.py (+181/-2) tests/autopilot/unity8/shell/create_interactive_notification.py (+101/-0) tests/autopilot/unity8/shell/emulators.py (+52/-0) tests/autopilot/unity8/shell/emulators/__init__.py (+0/-22) tests/autopilot/unity8/shell/emulators/create_interactive_notification.py (+0/-101) tests/autopilot/unity8/shell/emulators/greeter.py (+0/-60) tests/autopilot/unity8/shell/emulators/main_window.py (+0/-199) tests/autopilot/unity8/shell/tests/__init__.py (+3/-3) tests/autopilot/unity8/shell/tests/test_helpers.py (+17/-18) tests/autopilot/unity8/shell/tests/test_notifications.py (+1/-1) tests/autopilot/unity8/shell/tests/test_rotation.py (+2/-2) tests/autopilot/unity8/shell/tests/test_tutorial.py (+2/-2) |
To merge this branch: | bzr merge lp:~canonical-platform-qa/unity8/fix1306340-deprecate_emulators |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Zanetti (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Albert Astals Cid (community) | Needs Fixing | ||
Brendan Donegan (community) | Approve | ||
Sergio Cazzolato (community) | Approve | ||
Josh Arenson | Pending | ||
Review via email:
|
This proposal supersedes a proposal from 2015-04-29.
Commit message
Reorganized the python test helper modules.
Deprecated the unity8.
Description of the change
Like a year ago we deprecated the word emulators from autopilot test because it caused a lot of confusion. This change was long due. The unity8 packages are even harder, because they have helpers and tests in multiple levels. With this change, all the helpers in the unity8.component. A next useful change would be to join all the tests in unity8.
Are there any related MPs required for this MP to build/function as expected? Please list.
This branch needs:
https:/
https:/
* Did you perform an exploratory manual test run of your code change and any related functionality?
Only ran the tests.
* Did you make sure that your branch does not contain spurious tags?
Yes.
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
No debian packaging changes.
* If you changed the UI, has there been a design review?
No UI changes.
* Did you have a look at the warnings when running tests? Can they be reduced?
No warnings introduced.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1533
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1533
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1533
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1535
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1535
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1536
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1536
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1536
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brendan Donegan (brendan-donegan) wrote : | # |
Merging this leaves a file 'tests/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Sergio Cazzolato (sergio-j-cazzolato) : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Leo Arias (elopio) wrote : | # |
> Merging this leaves a file 'tests/
> which I assume is not right
Fixed. Thanks for catching that.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1538
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brendan Donegan (brendan-donegan) wrote : | # |
Looks good from my POV
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Nicholas Skaggs (nskaggs) wrote : | # |
Who still needs to add approval here? How can we move this forward?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Michael Zanetti (mzanetti) wrote : | # |
small inline comment
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Albert Astals Cid (aacid) wrote : | # |
Text conflict in debian/control
Text conflict in tests/autopilot
Text conflict in tests/autopilot
Conflict: can't delete tests/autopilot
Conflict because tests/autopilot
Contents conflict in tests/autopilot
Text conflict in tests/autopilot
7 conflicts encountered.
- 1539. By Richard Huddie
-
Merged with trunk.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1539
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Albert Astals Cid (aacid) wrote : | # |
Text conflict in tests/autopilot
1 conflicts encountered.
- 1540. By Richard Huddie
-
Merged with trunk.
- 1541. By Richard Huddie
-
Update rotation tests to use new helpers.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1540
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1541
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1541
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1542. By Richard Huddie
-
Fix unlock unity in fake sensors test and remove duplicated test.
- 1543. By Richard Huddie
-
Fix flake8 errors, remove imports using emulator and rename emulator tests to helper tests.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1542
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1543
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Michael Zanetti (mzanetti) wrote : | # |
Yes! Thanks a lot.
* Did you perform an exploratory manual test run of the code change and any related functionality?
Only tests changed. Makes the pass in Jenkins again.
* Did CI run pass? If not, please explain why.
it did
* Did you make sure that the branch does not contain spurious tags?
yes, clean
Preview Diff
1 | === modified file 'tests/autopilot/unity8/__init__.py' |
2 | --- tests/autopilot/unity8/__init__.py 2014-02-23 01:46:02 +0000 |
3 | +++ tests/autopilot/unity8/__init__.py 2015-06-24 11:14:44 +0000 |
4 | @@ -1,7 +1,7 @@ |
5 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
6 | # |
7 | # Unity Autopilot Test Suite |
8 | -# Copyright (C) 2012, 2013, 2014 Canonical |
9 | +# Copyright (C) 2012, 2013, 2014, 2015 Canonical |
10 | # |
11 | # This program is free software: you can redistribute it and/or modify |
12 | # it under the terms of the GNU General Public License as published by |
13 | @@ -17,13 +17,17 @@ |
14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | # |
16 | |
17 | -"""unity autopilot tests and emulators - top level package.""" |
18 | +"""unity autopilot tests and helpers - top level package.""" |
19 | import os |
20 | import os.path |
21 | import subprocess |
22 | import sysconfig |
23 | |
24 | |
25 | +class UnityException(Exception): |
26 | + """Exception raised when there is an error with the Unity test helpers.""" |
27 | + |
28 | + |
29 | def running_installed_tests(): |
30 | binary_path = get_binary_path() |
31 | return binary_path.startswith('/usr') |
32 | |
33 | === modified file 'tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py' |
34 | --- tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py 2015-05-18 23:04:03 +0000 |
35 | +++ tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py 2015-06-24 11:14:44 +0000 |
36 | @@ -92,14 +92,16 @@ |
37 | process_helpers.lock_unity() |
38 | |
39 | # FIXME - this is because the device greeter uses a password. |
40 | - # Need to be able to selectively enable mocks so that we can use the fake greeter. |
41 | + # Need to be able to selectively enable mocks so that we can use the |
42 | + # fake greeter. |
43 | def unlock_thread_worker(greeter): |
44 | greeter.wait_swiped_away() |
45 | process_helpers.unlock_unity() |
46 | greeter.created.wait_for(False) |
47 | |
48 | greeter = self.main_window.get_greeter() |
49 | - unlock_thread = threading.Thread(target=unlock_thread_worker, args=(greeter,)) |
50 | + unlock_thread = threading.Thread( |
51 | + target=unlock_thread_worker, args=(greeter,)) |
52 | unlock_thread.start() |
53 | application_name = self.launch_fake_app() |
54 | unlock_thread.join(10) |
55 | |
56 | === renamed file 'tests/autopilot/unity8/shell/emulators/dash.py' => 'tests/autopilot/unity8/dash.py' |
57 | --- tests/autopilot/unity8/shell/emulators/dash.py 2015-06-16 15:12:08 +0000 |
58 | +++ tests/autopilot/unity8/dash.py 2015-06-24 11:14:44 +0000 |
59 | @@ -23,7 +23,7 @@ |
60 | from autopilot import logging as autopilot_logging |
61 | from autopilot.introspection import dbus |
62 | |
63 | -from unity8.shell import emulators |
64 | +import unity8 |
65 | |
66 | |
67 | logger = logging.getLogger(__name__) |
68 | @@ -41,7 +41,7 @@ |
69 | |
70 | |
71 | class Dash(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
72 | - """An emulator that understands the Dash.""" |
73 | + """A helper that understands the Dash.""" |
74 | |
75 | def __init__(self, *args): |
76 | super().__init__(*args) |
77 | @@ -93,10 +93,10 @@ |
78 | for l in aux.get_children_by_type('QQuickLoader'): |
79 | if (l.scopeId == scope_id): |
80 | return l |
81 | - raise emulators.UnityEmulatorException( |
82 | + raise unity8.UnityException( |
83 | 'No scope found with id {0}'.format(scope_id)) |
84 | except dbus.StateNotFoundError: |
85 | - raise emulators.UnityEmulatorException( |
86 | + raise unity8.UnityException( |
87 | 'No scope found with id {0}'.format(scope_id)) |
88 | |
89 | def _get_scope_from_loader(self, loader): |
90 | @@ -121,7 +121,7 @@ |
91 | elif scope_loader.globalRect.x > current_scope_loader.globalRect.x: |
92 | return self._scroll_to_right_scope |
93 | else: |
94 | - raise emulators.UnityEmulatorException('The scope is already open') |
95 | + raise unity8.UnityException('The scope is already open') |
96 | |
97 | @autopilot_logging.log_action(logger.info) |
98 | def _scroll_to_left_scope(self): |
99 | @@ -190,7 +190,7 @@ |
100 | |
101 | |
102 | class GenericScopeView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
103 | - """Autopilot emulator for generic scopes.""" |
104 | + """Autopilot helper for generic scopes.""" |
105 | |
106 | @autopilot_logging.log_action(logger.info) |
107 | def open_preview(self, category, app_name, press_duration=0.10): |
108 | @@ -237,7 +237,7 @@ |
109 | 'DashCategoryBase', |
110 | objectName='dashCategory{}'.format(category)) |
111 | except dbus.StateNotFoundError: |
112 | - raise emulators.UnityEmulatorException( |
113 | + raise unity8.UnityException( |
114 | 'No category found with name {}'.format(category)) |
115 | |
116 | def get_applications(self, category): |
117 | |
118 | === modified file 'tests/autopilot/unity8/fixture_setup.py' |
119 | --- tests/autopilot/unity8/fixture_setup.py 2015-05-13 11:13:04 +0000 |
120 | +++ tests/autopilot/unity8/fixture_setup.py 2015-06-24 11:14:44 +0000 |
121 | @@ -31,21 +31,14 @@ |
122 | |
123 | from unity8 import ( |
124 | get_binary_path, |
125 | + get_mocks_library_path, |
126 | + get_default_extra_mock_libraries, |
127 | + get_data_dirs, |
128 | sensors, |
129 | + shell, |
130 | process_helpers |
131 | ) |
132 | |
133 | -from unity8.shell import emulators |
134 | - |
135 | -from unity8.shell.emulators import ( |
136 | - main_window as main_window_emulator |
137 | -) |
138 | - |
139 | -from unity8 import ( |
140 | - get_mocks_library_path, |
141 | - get_default_extra_mock_libraries, |
142 | - get_data_dirs |
143 | -) |
144 | |
145 | logger = logging.getLogger(__name__) |
146 | |
147 | @@ -140,8 +133,7 @@ |
148 | args = [binary_arg] + env_args |
149 | self.unity_proxy = process_helpers.restart_unity_with_testability( |
150 | *args) |
151 | - self.main_win = self.unity_proxy.select_single( |
152 | - main_window_emulator.QQuickView) |
153 | + self.main_win = self.unity_proxy.select_single(shell.QQuickView) |
154 | |
155 | def _create_sensors(self): |
156 | # Wait for unity to start running. |
157 | @@ -150,7 +142,7 @@ |
158 | |
159 | # Wait for the sensors fifo file to be created. |
160 | fifo_path = '/tmp/sensor-fifo-{0}'.format( |
161 | - process_helpers.get_unity_pid()) |
162 | + process_helpers._get_unity_pid()) |
163 | Eventually(Equals(True)).match( |
164 | lambda: os.path.exists(fifo_path)) |
165 | |
166 | @@ -159,8 +151,6 @@ |
167 | fifo.write('create light 0 10 1\n') |
168 | fifo.write('create proximity\n') |
169 | |
170 | -logger = logging.getLogger(__name__) |
171 | - |
172 | |
173 | class RestartUnityWithTestability(fixtures.Fixture): |
174 | |
175 | |
176 | === modified file 'tests/autopilot/unity8/greeter/__init__.py' |
177 | --- tests/autopilot/unity8/greeter/__init__.py 2015-05-08 00:33:55 +0000 |
178 | +++ tests/autopilot/unity8/greeter/__init__.py 2015-06-24 11:14:44 +0000 |
179 | @@ -1,7 +1,7 @@ |
180 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
181 | # |
182 | # Unity Autopilot Test Suite |
183 | -# Copyright (C) 2015 Canonical |
184 | +# Copyright (C) 2012, 2013, 2014, 2015 Canonical |
185 | # |
186 | # This program is free software: you can redistribute it and/or modify |
187 | # it under the terms of the GNU General Public License as published by |
188 | @@ -19,8 +19,10 @@ |
189 | |
190 | import dbus |
191 | |
192 | +import ubuntuuitoolkit |
193 | from autopilot.matchers import Eventually |
194 | from testtools.matchers import Equals |
195 | +from autopilot.utilities import sleep |
196 | |
197 | |
198 | def hide_greeter_with_dbus(): |
199 | @@ -50,3 +52,42 @@ |
200 | return dbus_proxy.Get('com.canonical.UnityGreeter', 'IsActive') |
201 | except: |
202 | return False |
203 | + |
204 | + |
205 | +class Greeter(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
206 | + """A helper that understands the greeter screen.""" |
207 | + |
208 | + def wait_swiped_away(self): |
209 | + # We have to be careful here, because coverPage can go away at any time |
210 | + # if there isn't a lockscreen behind it (it hides completely, then |
211 | + # the greeter disposes it). But if there *is* a lockscreen, then we |
212 | + # need a different check, by looking at its showProgress. So make our |
213 | + # own wait_for loop and check both possibilities. |
214 | + for i in range(10): |
215 | + if not self.required: |
216 | + return |
217 | + coverPage = self.select_single(objectName='coverPage') |
218 | + if coverPage.showProgress == 0: |
219 | + return |
220 | + sleep(1) |
221 | + |
222 | + raise AssertionError("Greeter cover page still up after 10s") |
223 | + |
224 | + def swipe(self): |
225 | + """Swipe the greeter screen away.""" |
226 | + self.waiting.wait_for(False) |
227 | + coverPage = self.select_single(objectName='coverPage') |
228 | + coverPage.showProgress.wait_for(1) |
229 | + |
230 | + rect = self.globalRect |
231 | + start_x = rect[0] + rect[2] - 3 |
232 | + start_y = int(rect[1] + rect[3] / 2) |
233 | + stop_x = int(rect[0] + rect[2] * 0.2) |
234 | + stop_y = start_y |
235 | + self.pointing_device.drag(start_x, start_y, stop_x, stop_y) |
236 | + |
237 | + self.wait_swiped_away() |
238 | + |
239 | + def get_prompt(self): |
240 | + return self.select_single( |
241 | + ubuntuuitoolkit.TextField, objectName='passwordInput') |
242 | |
243 | === modified file 'tests/autopilot/unity8/greeter/tests/__init__.py' |
244 | --- tests/autopilot/unity8/greeter/tests/__init__.py 2015-04-20 16:05:51 +0000 |
245 | +++ tests/autopilot/unity8/greeter/tests/__init__.py 2015-06-24 11:14:44 +0000 |
246 | @@ -17,12 +17,12 @@ |
247 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
248 | # |
249 | |
250 | -from unity8.shell.emulators import main_window as main_window_emulator |
251 | +from unity8 import shell |
252 | from unity8.shell.tests import UnityTestCase |
253 | |
254 | |
255 | class GreeterTestCase(UnityTestCase): |
256 | def get_shell(self, unity_proxy): |
257 | main_window = ( |
258 | - unity_proxy.select_single(main_window_emulator.QQuickView)) |
259 | + unity_proxy.select_single(shell.QQuickView)) |
260 | return main_window.select_single('Shell') |
261 | |
262 | === renamed file 'tests/autopilot/unity8/shell/emulators/launcher.py' => 'tests/autopilot/unity8/launcher.py' |
263 | --- tests/autopilot/unity8/shell/emulators/launcher.py 2015-04-28 15:20:13 +0000 |
264 | +++ tests/autopilot/unity8/launcher.py 2015-06-24 11:14:44 +0000 |
265 | @@ -22,7 +22,7 @@ |
266 | import autopilot.logging |
267 | import ubuntuuitoolkit |
268 | |
269 | -from unity8.shell import emulators |
270 | +import unity8 |
271 | |
272 | |
273 | logger = logging.getLogger(__name__) |
274 | @@ -30,7 +30,7 @@ |
275 | |
276 | class Launcher(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
277 | |
278 | - """An emulator that understands the Launcher.""" |
279 | + """A helper that understands the Launcher.""" |
280 | |
281 | @autopilot.logging.log_action(logger.debug) |
282 | def show(self): |
283 | @@ -57,7 +57,7 @@ |
284 | 'QQuickImage', objectName='dashItem') |
285 | self.pointing_device.click_object(dash_icon) |
286 | else: |
287 | - raise emulators.UnityEmulatorException('The launcher is closed.') |
288 | + raise unity8.UnityException('The launcher is closed.') |
289 | |
290 | @autopilot.logging.log_action(logger.debug) |
291 | def click_application_launcher_icon(self, application_name): |
292 | |
293 | === modified file 'tests/autopilot/unity8/process_helpers.py' |
294 | --- tests/autopilot/unity8/process_helpers.py 2015-06-16 19:32:13 +0000 |
295 | +++ tests/autopilot/unity8/process_helpers.py 2015-06-24 11:14:44 +0000 |
296 | @@ -25,6 +25,7 @@ |
297 | |
298 | from unity8 import greeter |
299 | |
300 | + |
301 | logger = logging.getLogger(__name__) |
302 | |
303 | |
304 | @@ -175,7 +176,7 @@ |
305 | raise CannotAccessUnity(str(error)) |
306 | |
307 | |
308 | -def get_unity_pid(): |
309 | +def _get_unity_pid(): |
310 | try: |
311 | return get_job_pid('unity8') |
312 | except JobError as error: |
313 | |
314 | === modified file 'tests/autopilot/unity8/sensors.py' |
315 | --- tests/autopilot/unity8/sensors.py 2015-05-08 17:57:41 +0000 |
316 | +++ tests/autopilot/unity8/sensors.py 2015-06-24 11:14:44 +0000 |
317 | @@ -25,7 +25,7 @@ |
318 | class FakePlatformSensors: |
319 | |
320 | def __init__(self, pid=None): |
321 | - self.pid = pid or process_helpers.get_unity_pid() |
322 | + self.pid = pid or process_helpers._get_unity_pid() |
323 | |
324 | def set_orientation(self, action): |
325 | if action == 'top_up': |
326 | |
327 | === modified file 'tests/autopilot/unity8/shell/__init__.py' |
328 | --- tests/autopilot/unity8/shell/__init__.py 2015-04-24 16:10:02 +0000 |
329 | +++ tests/autopilot/unity8/shell/__init__.py 2015-06-24 11:14:44 +0000 |
330 | @@ -17,12 +17,21 @@ |
331 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
332 | # |
333 | |
334 | -"""unity shell autopilot tests and emulators - sub level package.""" |
335 | +"""unity shell autopilot tests and helpers - sub level package.""" |
336 | |
337 | +import logging |
338 | from functools import wraps |
339 | + |
340 | +import ubuntuuitoolkit |
341 | +from autopilot import logging as autopilot_logging |
342 | +from autopilot import input |
343 | from gi.repository import Notify |
344 | |
345 | -import logging |
346 | +from unity8 import ( |
347 | + greeter, |
348 | + launcher as launcher_helpers |
349 | +) |
350 | + |
351 | |
352 | logger = logging.getLogger(__name__) |
353 | |
354 | @@ -82,3 +91,173 @@ |
355 | 'NORMAL': Notify.Urgency.NORMAL, |
356 | 'CRITICAL': Notify.Urgency.CRITICAL} |
357 | return _urgency_enums.get(urgency.upper()) |
358 | + |
359 | + |
360 | +class QQuickView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
361 | + """An helper class that makes it easy to interact with the shell""" |
362 | + |
363 | + def get_greeter(self): |
364 | + return self.select_single(greeter.Greeter) |
365 | + |
366 | + def get_login_loader(self): |
367 | + return self.select_single("QQuickLoader", objectName="loginLoader") |
368 | + |
369 | + def get_login_list(self): |
370 | + return self.select_single("LoginList") |
371 | + |
372 | + def get_bottombar(self): |
373 | + return self.select_single("Bottombar") |
374 | + |
375 | + def get_pinPadLoader(self): |
376 | + return self.select_single( |
377 | + "QQuickLoader", |
378 | + objectName="pinPadLoader" |
379 | + ) |
380 | + |
381 | + def get_lockscreen(self): |
382 | + return self.select_single("Lockscreen") |
383 | + |
384 | + def get_pinentryField(self): |
385 | + return self.select_single(objectName="pinentryField") |
386 | + |
387 | + def _get_indicator_panel_item(self, indicator_name): |
388 | + return self.select_single( |
389 | + 'IndicatorItem', |
390 | + objectName=indicator_name+'-panelItem' |
391 | + ) |
392 | + |
393 | + def _get_indicator_page(self, indicator_name): |
394 | + return self.select_single( |
395 | + 'IndicatorPage', |
396 | + objectName=indicator_name+'-page' |
397 | + ) |
398 | + |
399 | + @autopilot_logging.log_action(logger.info) |
400 | + def open_indicator_page(self, indicator_name): |
401 | + """Swipe to open the indicator, wait until it's open. |
402 | + |
403 | + :returns: The indicator page. |
404 | + """ |
405 | + widget = self._get_indicator_panel_item(indicator_name) |
406 | + start_x, start_y = input.get_center_point(widget) |
407 | + end_x = start_x |
408 | + end_y = self.height |
409 | + self.pointing_device.drag(start_x, start_y, end_x, end_y) |
410 | + self.wait_select_single('IndicatorsMenu', fullyOpened=True) |
411 | + return self._get_indicator_page(indicator_name) |
412 | + |
413 | + @autopilot_logging.log_action(logger.info) |
414 | + def close_indicator_page(self): |
415 | + """Swipe to close the opened indicator, wait until it's closed.""" |
416 | + indicators_menu = self.wait_select_single('IndicatorsMenu') |
417 | + end_x, end_y = input.get_center_point(indicators_menu) |
418 | + start_x = end_x |
419 | + start_y = self.height |
420 | + self.pointing_device.drag(start_x, start_y, end_x, end_y) |
421 | + indicators_menu.fullyClosed.wait_for(True) |
422 | + |
423 | + @autopilot_logging.log_action(logger.info) |
424 | + def show_dash_swiping(self): |
425 | + """Show the dash swiping from the left.""" |
426 | + x, y, width, height = self._get_shell().globalRect |
427 | + start_x = x |
428 | + end_x = x + width |
429 | + start_y = end_y = y + height // 2 |
430 | + |
431 | + self.pointing_device.drag(start_x, start_y, end_x, end_y) |
432 | + self.get_current_focused_app_id().wait_for('unity8-dash') |
433 | + |
434 | + def _get_shell(self): |
435 | + return self.select_single('Shell') |
436 | + |
437 | + def get_current_focused_app_id(self): |
438 | + """Return the id of the focused application.""" |
439 | + return self._get_shell().focusedApplicationId |
440 | + |
441 | + @autopilot_logging.log_action(logger.info) |
442 | + def show_dash_from_launcher(self): |
443 | + """Open the dash clicking the dash icon on the launcher.""" |
444 | + launcher = self.open_launcher() |
445 | + launcher.click_dash_icon() |
446 | + self.get_current_focused_app_id().wait_for('unity8-dash') |
447 | + launcher.shown.wait_for(False) |
448 | + |
449 | + @autopilot_logging.log_action(logger.info) |
450 | + def open_launcher(self): |
451 | + launcher = self._get_launcher() |
452 | + launcher.show() |
453 | + return launcher |
454 | + |
455 | + def _get_launcher(self): |
456 | + return self.select_single(launcher_helpers.Launcher) |
457 | + |
458 | + def is_launcher_open(self): |
459 | + return self._get_launcher().shown |
460 | + |
461 | + @autopilot_logging.log_action(logger.info) |
462 | + def launch_application(self, application_name): |
463 | + """Launch an application. |
464 | + |
465 | + :parameter application_name: The name of the application to launch. |
466 | + |
467 | + """ |
468 | + launcher = self.open_launcher() |
469 | + launcher.click_application_launcher_icon(application_name) |
470 | + self.get_current_focused_app_id().wait_for(application_name) |
471 | + launcher.shown.wait_for(False) |
472 | + |
473 | + def enter_pin_code(self, code): |
474 | + """Enter code 'code' into the single-pin lightdm pincode entry screen. |
475 | + |
476 | + :param code: must be a string of numeric characters. |
477 | + :raises: TypeError if code is not a string. |
478 | + :raises: ValueError if code contains non-numeric characters. |
479 | + |
480 | + """ |
481 | + if not isinstance(code, str): |
482 | + raise TypeError( |
483 | + "'code' parameter must be a string, not %r." |
484 | + % type(code) |
485 | + ) |
486 | + for num in code: |
487 | + if not num.isdigit(): |
488 | + raise ValueError( |
489 | + "'code' parameter contains non-numeric characters." |
490 | + ) |
491 | + self.pointing_device.click_object( |
492 | + self._get_pinpad_button(int(num))) |
493 | + |
494 | + def _get_pinpad_button(self, button_id): |
495 | + return self.select_single( |
496 | + 'PinPadButton', |
497 | + objectName='pinPadButton{}'.format(button_id) |
498 | + ) |
499 | + |
500 | + def get_shell_orientation_angle(self): |
501 | + return self._get_shell().orientationAngle |
502 | + |
503 | + def get_shell_orientation(self): |
504 | + return self._get_shell().orientation |
505 | + |
506 | + def get_shell_primary_orientation(self): |
507 | + return self._get_shell().primaryOrientation |
508 | + |
509 | + def get_shell_native_orientation(self): |
510 | + return self._get_shell().nativeOrientation |
511 | + |
512 | + @autopilot_logging.log_action(logger.info) |
513 | + def wait_for_notification(self): |
514 | + """Wait for a notification dialog to appear. |
515 | + |
516 | + :return: An object for the notification dialog data. |
517 | + :raise StateNotFoundError: if the timeout expires when the |
518 | + notification has not appeared. |
519 | + |
520 | + """ |
521 | + notify_list = self.select_single('Notifications', |
522 | + objectName='notificationList') |
523 | + visible_notification = notify_list.wait_select_single('Notification', |
524 | + visible=True) |
525 | + return {'summary': visible_notification.summary, |
526 | + 'body': visible_notification.body, |
527 | + 'iconSource': visible_notification.iconSource} |
528 | |
529 | === added file 'tests/autopilot/unity8/shell/create_interactive_notification.py' |
530 | --- tests/autopilot/unity8/shell/create_interactive_notification.py 1970-01-01 00:00:00 +0000 |
531 | +++ tests/autopilot/unity8/shell/create_interactive_notification.py 2015-06-24 11:14:44 +0000 |
532 | @@ -0,0 +1,101 @@ |
533 | +#!/usr/bin/env python3 |
534 | + |
535 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
536 | +# |
537 | +# Unity Autopilot Test Suite |
538 | +# Copyright (C) 2012, 2013, 2014, 2015 Canonical |
539 | +# |
540 | +# This program is free software: you can redistribute it and/or modify |
541 | +# it under the terms of the GNU General Public License as published by |
542 | +# the Free Software Foundation, either version 3 of the License, or |
543 | +# (at your option) any later version. |
544 | +# |
545 | +# This program is distributed in the hope that it will be useful, |
546 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
547 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
548 | +# GNU General Public License for more details. |
549 | +# |
550 | +# You should have received a copy of the GNU General Public License |
551 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
552 | +# |
553 | + |
554 | +import argparse |
555 | +from gi.repository import GLib, Notify |
556 | +import signal |
557 | + |
558 | + |
559 | +def action_callback(notification, action_id, data): |
560 | + print(action_id) |
561 | + |
562 | + |
563 | +def quit_callback(notification): |
564 | + loop.quit() |
565 | + |
566 | + |
567 | +if __name__ == '__main__': |
568 | + parser = argparse.ArgumentParser( |
569 | + description='Create an interactive notification' |
570 | + ) |
571 | + |
572 | + parser.add_argument( |
573 | + '--summary', |
574 | + help='summary text of the notification', |
575 | + default='Summary' |
576 | + ) |
577 | + parser.add_argument( |
578 | + '--body', |
579 | + help='body text of the notification', |
580 | + default='Body' |
581 | + ) |
582 | + parser.add_argument( |
583 | + '--icon', |
584 | + help='path to the icon to display', |
585 | + default=None |
586 | + ) |
587 | + parser.add_argument( |
588 | + '--action', |
589 | + help='id and label for the callback in the format: id,label', |
590 | + action='append', |
591 | + default=[] |
592 | + ) |
593 | + parser.add_argument( |
594 | + '--urgency', |
595 | + help='LOW, NORMAL, CRITICAL', |
596 | + choices=['LOW', 'NORMAL', 'CRITICAL'], |
597 | + default='NORMAL' |
598 | + ) |
599 | + parser.add_argument( |
600 | + '--hints', |
601 | + help='list of comma sep options', |
602 | + action='append', |
603 | + default=[] |
604 | + ) |
605 | + |
606 | + args = parser.parse_args() |
607 | + |
608 | + Notify.init('Interactive Notifications') |
609 | + |
610 | + notification = Notify.Notification.new(args.summary, args.body, args.icon) |
611 | + |
612 | + for hint in args.hints: |
613 | + key, value = hint.split(',', 1) |
614 | + notification.set_hint_string(key, value) |
615 | + |
616 | + for action in args.action: |
617 | + action_id, action_label = action.split(',', 1) |
618 | + notification.add_action( |
619 | + action_id, |
620 | + action_label, |
621 | + action_callback, |
622 | + None |
623 | + ) |
624 | + |
625 | + def signal_handler(signam, frame): |
626 | + loop.quit() |
627 | + |
628 | + signal.signal(signal.SIGINT, signal_handler) |
629 | + |
630 | + loop = GLib.MainLoop.new(None, False) |
631 | + notification.connect('closed', quit_callback) |
632 | + notification.show() |
633 | + loop.run() |
634 | |
635 | === removed directory 'tests/autopilot/unity8/shell/emulators' |
636 | === added file 'tests/autopilot/unity8/shell/emulators.py' |
637 | --- tests/autopilot/unity8/shell/emulators.py 1970-01-01 00:00:00 +0000 |
638 | +++ tests/autopilot/unity8/shell/emulators.py 2015-06-24 11:14:44 +0000 |
639 | @@ -0,0 +1,52 @@ |
640 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
641 | +# |
642 | +# Unity Autopilot Test Suite |
643 | +# Copyright (C) 2015 Canonical |
644 | +# |
645 | +# This program is free software: you can redistribute it and/or modify |
646 | +# it under the terms of the GNU General Public License as published by |
647 | +# the Free Software Foundation, either version 3 of the License, or |
648 | +# (at your option) any later version. |
649 | +# |
650 | +# This program is distributed in the hope that it will be useful, |
651 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
652 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
653 | +# GNU General Public License for more details. |
654 | +# |
655 | +# You should have received a copy of the GNU General Public License |
656 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
657 | +# |
658 | + |
659 | +"""Emulators was the old name for the custom proxy objects.""" |
660 | + |
661 | +import logging |
662 | + |
663 | + |
664 | +logger = logging.getLogger(__name__) |
665 | + |
666 | + |
667 | +logger.warning( |
668 | + 'The unity8.shell.emulators module is deprecated. Import the autopilot ' |
669 | + 'helpers from the top-level unity8 module.') |
670 | + |
671 | + |
672 | +__all__ = [ |
673 | + 'create_interactive_notification', |
674 | + 'dash', |
675 | + 'greeter', |
676 | + 'launcher', |
677 | + 'main_window', |
678 | + 'tutorial', |
679 | + 'UnityEmulatorException', |
680 | +] |
681 | + |
682 | + |
683 | +from unity8 import ( |
684 | + greeter, |
685 | + dash, |
686 | + launcher, |
687 | + shell as main_window, |
688 | + tutorial, |
689 | + UnityException as UnityEmulatorException |
690 | +) |
691 | +from unity8.shell import create_interactive_notification |
692 | |
693 | === removed file 'tests/autopilot/unity8/shell/emulators/__init__.py' |
694 | --- tests/autopilot/unity8/shell/emulators/__init__.py 2015-04-28 15:20:13 +0000 |
695 | +++ tests/autopilot/unity8/shell/emulators/__init__.py 1970-01-01 00:00:00 +0000 |
696 | @@ -1,22 +0,0 @@ |
697 | -# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
698 | -# |
699 | -# Unity Autopilot Test Suite |
700 | -# Copyright (C) 2012, 2013, 2014, 2015 Canonical |
701 | -# |
702 | -# This program is free software: you can redistribute it and/or modify |
703 | -# it under the terms of the GNU General Public License as published by |
704 | -# the Free Software Foundation, either version 3 of the License, or |
705 | -# (at your option) any later version. |
706 | -# |
707 | -# This program is distributed in the hope that it will be useful, |
708 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
709 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
710 | -# GNU General Public License for more details. |
711 | -# |
712 | -# You should have received a copy of the GNU General Public License |
713 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
714 | -# |
715 | - |
716 | - |
717 | -class UnityEmulatorException(Exception): |
718 | - """Exception raised when there is an error with the Unity emulators.""" |
719 | |
720 | === removed file 'tests/autopilot/unity8/shell/emulators/create_interactive_notification.py' |
721 | --- tests/autopilot/unity8/shell/emulators/create_interactive_notification.py 2015-02-23 17:29:04 +0000 |
722 | +++ tests/autopilot/unity8/shell/emulators/create_interactive_notification.py 1970-01-01 00:00:00 +0000 |
723 | @@ -1,101 +0,0 @@ |
724 | -#!/usr/bin/env python3 |
725 | - |
726 | -# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
727 | -# |
728 | -# Unity Autopilot Test Suite |
729 | -# Copyright (C) 2012, 2013, 2014, 2015 Canonical |
730 | -# |
731 | -# This program is free software: you can redistribute it and/or modify |
732 | -# it under the terms of the GNU General Public License as published by |
733 | -# the Free Software Foundation, either version 3 of the License, or |
734 | -# (at your option) any later version. |
735 | -# |
736 | -# This program is distributed in the hope that it will be useful, |
737 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
738 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
739 | -# GNU General Public License for more details. |
740 | -# |
741 | -# You should have received a copy of the GNU General Public License |
742 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
743 | -# |
744 | - |
745 | -import argparse |
746 | -from gi.repository import GLib, Notify |
747 | -import signal |
748 | - |
749 | - |
750 | -def action_callback(notification, action_id, data): |
751 | - print(action_id) |
752 | - |
753 | - |
754 | -def quit_callback(notification): |
755 | - loop.quit() |
756 | - |
757 | - |
758 | -if __name__ == '__main__': |
759 | - parser = argparse.ArgumentParser( |
760 | - description='Create an interactive notification' |
761 | - ) |
762 | - |
763 | - parser.add_argument( |
764 | - '--summary', |
765 | - help='summary text of the notification', |
766 | - default='Summary' |
767 | - ) |
768 | - parser.add_argument( |
769 | - '--body', |
770 | - help='body text of the notification', |
771 | - default='Body' |
772 | - ) |
773 | - parser.add_argument( |
774 | - '--icon', |
775 | - help='path to the icon to display', |
776 | - default=None |
777 | - ) |
778 | - parser.add_argument( |
779 | - '--action', |
780 | - help='id and label for the callback in the format: id,label', |
781 | - action='append', |
782 | - default=[] |
783 | - ) |
784 | - parser.add_argument( |
785 | - '--urgency', |
786 | - help='LOW, NORMAL, CRITICAL', |
787 | - choices=['LOW', 'NORMAL', 'CRITICAL'], |
788 | - default='NORMAL' |
789 | - ) |
790 | - parser.add_argument( |
791 | - '--hints', |
792 | - help='list of comma sep options', |
793 | - action='append', |
794 | - default=[] |
795 | - ) |
796 | - |
797 | - args = parser.parse_args() |
798 | - |
799 | - Notify.init('Interactive Notifications') |
800 | - |
801 | - notification = Notify.Notification.new(args.summary, args.body, args.icon) |
802 | - |
803 | - for hint in args.hints: |
804 | - key, value = hint.split(',', 1) |
805 | - notification.set_hint_string(key, value) |
806 | - |
807 | - for action in args.action: |
808 | - action_id, action_label = action.split(',', 1) |
809 | - notification.add_action( |
810 | - action_id, |
811 | - action_label, |
812 | - action_callback, |
813 | - None |
814 | - ) |
815 | - |
816 | - def signal_handler(signam, frame): |
817 | - loop.quit() |
818 | - |
819 | - signal.signal(signal.SIGINT, signal_handler) |
820 | - |
821 | - loop = GLib.MainLoop.new(None, False) |
822 | - notification.connect('closed', quit_callback) |
823 | - notification.show() |
824 | - loop.run() |
825 | |
826 | === removed file 'tests/autopilot/unity8/shell/emulators/greeter.py' |
827 | --- tests/autopilot/unity8/shell/emulators/greeter.py 2015-05-12 00:00:50 +0000 |
828 | +++ tests/autopilot/unity8/shell/emulators/greeter.py 1970-01-01 00:00:00 +0000 |
829 | @@ -1,60 +0,0 @@ |
830 | -# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
831 | -# |
832 | -# Unity Autopilot Test Suite |
833 | -# Copyright (C) 2012, 2013, 2014, 2015 Canonical |
834 | -# |
835 | -# This program is free software: you can redistribute it and/or modify |
836 | -# it under the terms of the GNU General Public License as published by |
837 | -# the Free Software Foundation, either version 3 of the License, or |
838 | -# (at your option) any later version. |
839 | -# |
840 | -# This program is distributed in the hope that it will be useful, |
841 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
842 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
843 | -# GNU General Public License for more details. |
844 | -# |
845 | -# You should have received a copy of the GNU General Public License |
846 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
847 | -# |
848 | - |
849 | -import ubuntuuitoolkit |
850 | -from autopilot.utilities import sleep |
851 | - |
852 | - |
853 | -class Greeter(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
854 | - """An emulator that understands the greeter screen.""" |
855 | - |
856 | - def wait_swiped_away(self): |
857 | - # We have to be careful here, because coverPage can go away at any time |
858 | - # if there isn't a lockscreen behind it (it hides completely, then |
859 | - # the greeter disposes it). But if there *is* a lockscreen, then we |
860 | - # need a different check, by looking at its showProgress. So make our |
861 | - # own wait_for loop and check both possibilities. |
862 | - for i in range(10): |
863 | - if not self.required: |
864 | - return |
865 | - coverPage = self.select_single(objectName='coverPage') |
866 | - if coverPage.showProgress == 0: |
867 | - return |
868 | - sleep(1) |
869 | - |
870 | - raise AssertionError("Greeter cover page still up after 10s") |
871 | - |
872 | - def swipe(self): |
873 | - """Swipe the greeter screen away.""" |
874 | - self.waiting.wait_for(False) |
875 | - coverPage = self.select_single(objectName='coverPage') |
876 | - coverPage.showProgress.wait_for(1) |
877 | - |
878 | - rect = self.globalRect |
879 | - start_x = rect[0] + rect[2] - 3 |
880 | - start_y = int(rect[1] + rect[3] / 2) |
881 | - stop_x = int(rect[0] + rect[2] * 0.2) |
882 | - stop_y = start_y |
883 | - self.pointing_device.drag(start_x, start_y, stop_x, stop_y) |
884 | - |
885 | - self.wait_swiped_away() |
886 | - |
887 | - def get_prompt(self): |
888 | - return self.select_single( |
889 | - ubuntuuitoolkit.TextField, objectName='passwordInput') |
890 | |
891 | === removed file 'tests/autopilot/unity8/shell/emulators/main_window.py' |
892 | --- tests/autopilot/unity8/shell/emulators/main_window.py 2015-05-11 14:36:03 +0000 |
893 | +++ tests/autopilot/unity8/shell/emulators/main_window.py 1970-01-01 00:00:00 +0000 |
894 | @@ -1,199 +0,0 @@ |
895 | -# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
896 | -# |
897 | -# Unity Autopilot Test Suite |
898 | -# Copyright (C) 2012, 2013, 2014, 2015 Canonical |
899 | -# |
900 | -# This program is free software: you can redistribute it and/or modify |
901 | -# it under the terms of the GNU General Public License as published by |
902 | -# the Free Software Foundation, either version 3 of the License, or |
903 | -# (at your option) any later version. |
904 | -# |
905 | -# This program is distributed in the hope that it will be useful, |
906 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
907 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
908 | -# GNU General Public License for more details. |
909 | -# |
910 | -# You should have received a copy of the GNU General Public License |
911 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
912 | -# |
913 | - |
914 | -import logging |
915 | - |
916 | -import ubuntuuitoolkit |
917 | -from autopilot import logging as autopilot_logging |
918 | -from autopilot import input |
919 | - |
920 | -from unity8.shell.emulators.greeter import Greeter |
921 | -from unity8.shell.emulators.launcher import Launcher |
922 | - |
923 | -logger = logging.getLogger(__name__) |
924 | - |
925 | - |
926 | -class QQuickView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
927 | - """An emulator class that makes it easy to interact with the shell""" |
928 | - |
929 | - def get_greeter(self): |
930 | - return self.select_single(Greeter) |
931 | - |
932 | - def get_login_loader(self): |
933 | - return self.select_single("QQuickLoader", objectName="loginLoader") |
934 | - |
935 | - def get_login_list(self): |
936 | - return self.select_single("LoginList") |
937 | - |
938 | - def get_bottombar(self): |
939 | - return self.select_single("Bottombar") |
940 | - |
941 | - def get_pinPadLoader(self): |
942 | - return self.select_single( |
943 | - "QQuickLoader", |
944 | - objectName="pinPadLoader" |
945 | - ) |
946 | - |
947 | - def get_lockscreen(self): |
948 | - return self.select_single("Lockscreen") |
949 | - |
950 | - def get_pinentryField(self): |
951 | - return self.select_single(objectName="pinentryField") |
952 | - |
953 | - def _get_indicator_panel_item(self, indicator_name): |
954 | - return self.select_single( |
955 | - 'IndicatorItem', |
956 | - objectName=indicator_name+'-panelItem' |
957 | - ) |
958 | - |
959 | - def _get_indicator_page(self, indicator_name): |
960 | - return self.select_single( |
961 | - 'IndicatorPage', |
962 | - objectName=indicator_name+'-page' |
963 | - ) |
964 | - |
965 | - @autopilot_logging.log_action(logger.info) |
966 | - def open_indicator_page(self, indicator_name): |
967 | - """Swipe to open the indicator, wait until it's open. |
968 | - |
969 | - :returns: The indicator page. |
970 | - """ |
971 | - widget = self._get_indicator_panel_item(indicator_name) |
972 | - start_x, start_y = input.get_center_point(widget) |
973 | - end_x = start_x |
974 | - end_y = self.height |
975 | - self.pointing_device.drag(start_x, start_y, end_x, end_y) |
976 | - self.wait_select_single('IndicatorsMenu', fullyOpened=True) |
977 | - return self._get_indicator_page(indicator_name) |
978 | - |
979 | - @autopilot_logging.log_action(logger.info) |
980 | - def close_indicator_page(self): |
981 | - """Swipe to close the opened indicator, wait until it's closed.""" |
982 | - indicators_menu = self.wait_select_single('IndicatorsMenu') |
983 | - end_x, end_y = input.get_center_point(indicators_menu) |
984 | - start_x = end_x |
985 | - start_y = self.height |
986 | - self.pointing_device.drag(start_x, start_y, end_x, end_y) |
987 | - indicators_menu.fullyClosed.wait_for(True) |
988 | - |
989 | - @autopilot_logging.log_action(logger.info) |
990 | - def show_dash_swiping(self): |
991 | - """Show the dash swiping from the left.""" |
992 | - x, y, width, height = self._get_shell().globalRect |
993 | - start_x = x |
994 | - end_x = x + width |
995 | - start_y = end_y = y + height // 2 |
996 | - |
997 | - self.pointing_device.drag(start_x, start_y, end_x, end_y) |
998 | - self.get_current_focused_app_id().wait_for('unity8-dash') |
999 | - |
1000 | - def _get_shell(self): |
1001 | - return self.select_single('Shell') |
1002 | - |
1003 | - def get_current_focused_app_id(self): |
1004 | - """Return the id of the focused application.""" |
1005 | - return self._get_shell().focusedApplicationId |
1006 | - |
1007 | - @autopilot_logging.log_action(logger.info) |
1008 | - def show_dash_from_launcher(self): |
1009 | - """Open the dash clicking the dash icon on the launcher.""" |
1010 | - launcher = self.open_launcher() |
1011 | - launcher.click_dash_icon() |
1012 | - self.get_current_focused_app_id().wait_for('unity8-dash') |
1013 | - launcher.shown.wait_for(False) |
1014 | - |
1015 | - @autopilot_logging.log_action(logger.info) |
1016 | - def open_launcher(self): |
1017 | - launcher = self._get_launcher() |
1018 | - launcher.show() |
1019 | - return launcher |
1020 | - |
1021 | - def _get_launcher(self): |
1022 | - return self.select_single(Launcher) |
1023 | - |
1024 | - def is_launcher_open(self): |
1025 | - return self._get_launcher().shown |
1026 | - |
1027 | - @autopilot_logging.log_action(logger.info) |
1028 | - def launch_application(self, application_name): |
1029 | - """Launch an application. |
1030 | - |
1031 | - :parameter application_name: The name of the application to launch. |
1032 | - |
1033 | - """ |
1034 | - launcher = self.open_launcher() |
1035 | - launcher.click_application_launcher_icon(application_name) |
1036 | - self.get_current_focused_app_id().wait_for(application_name) |
1037 | - launcher.shown.wait_for(False) |
1038 | - |
1039 | - def enter_pin_code(self, code): |
1040 | - """Enter code 'code' into the single-pin lightdm pincode entry screen. |
1041 | - |
1042 | - :param code: must be a string of numeric characters. |
1043 | - :raises: TypeError if code is not a string. |
1044 | - :raises: ValueError if code contains non-numeric characters. |
1045 | - |
1046 | - """ |
1047 | - if not isinstance(code, str): |
1048 | - raise TypeError( |
1049 | - "'code' parameter must be a string, not %r." |
1050 | - % type(code) |
1051 | - ) |
1052 | - for num in code: |
1053 | - if not num.isdigit(): |
1054 | - raise ValueError( |
1055 | - "'code' parameter contains non-numeric characters." |
1056 | - ) |
1057 | - self.pointing_device.click_object( |
1058 | - self._get_pinpad_button(int(num))) |
1059 | - |
1060 | - def _get_pinpad_button(self, button_id): |
1061 | - return self.select_single( |
1062 | - 'PinPadButton', |
1063 | - objectName='pinPadButton{}'.format(button_id) |
1064 | - ) |
1065 | - |
1066 | - def get_shell_orientation_angle(self): |
1067 | - return self._get_shell().orientationAngle |
1068 | - |
1069 | - def get_shell_orientation(self): |
1070 | - return self._get_shell().orientation |
1071 | - |
1072 | - def get_shell_primary_orientation(self): |
1073 | - return self._get_shell().primaryOrientation |
1074 | - |
1075 | - def get_shell_native_orientation(self): |
1076 | - return self._get_shell().nativeOrientation |
1077 | - |
1078 | - @autopilot_logging.log_action(logger.info) |
1079 | - def wait_for_notification(self): |
1080 | - """Wait for a notification dialog to appear. |
1081 | - |
1082 | - :return: An object for the notification dialog data. |
1083 | - :raise StateNotFoundError: if the timeout expires when the |
1084 | - notification has not appeared. |
1085 | - |
1086 | - """ |
1087 | - notify_list = self.select_single('Notifications', |
1088 | - objectName='notificationList') |
1089 | - visible_notification = notify_list.wait_select_single('Notification', |
1090 | - visible=True) |
1091 | - return {'summary': visible_notification.summary, |
1092 | - 'body': visible_notification.body, |
1093 | - 'iconSource': visible_notification.iconSource} |
1094 | |
1095 | === modified file 'tests/autopilot/unity8/shell/tests/__init__.py' |
1096 | --- tests/autopilot/unity8/shell/tests/__init__.py 2015-05-11 14:36:03 +0000 |
1097 | +++ tests/autopilot/unity8/shell/tests/__init__.py 2015-06-24 11:14:44 +0000 |
1098 | @@ -51,9 +51,9 @@ |
1099 | fixture_setup, |
1100 | process_helpers |
1101 | ) |
1102 | -from unity8.shell.emulators import ( |
1103 | +from unity8 import ( |
1104 | dash as dash_helpers, |
1105 | - main_window as main_window_emulator, |
1106 | + shell |
1107 | ) |
1108 | |
1109 | |
1110 | @@ -297,7 +297,7 @@ |
1111 | |
1112 | @property |
1113 | def main_window(self): |
1114 | - return self._proxy.select_single(main_window_emulator.QQuickView) |
1115 | + return self._proxy.select_single(shell.QQuickView) |
1116 | |
1117 | |
1118 | class DashBaseTestCase(AutopilotTestCase): |
1119 | |
1120 | === renamed file 'tests/autopilot/unity8/shell/tests/test_emulators.py' => 'tests/autopilot/unity8/shell/tests/test_helpers.py' |
1121 | --- tests/autopilot/unity8/shell/tests/test_emulators.py 2015-06-18 19:39:27 +0000 |
1122 | +++ tests/autopilot/unity8/shell/tests/test_helpers.py 2015-06-24 11:14:44 +0000 |
1123 | @@ -17,13 +17,13 @@ |
1124 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1125 | # |
1126 | |
1127 | -"""Tests for the Dash autopilot emulators. |
1128 | +"""Tests for the Dash autopilot custom proxy objects. |
1129 | |
1130 | -The autopilot emulators are helpers for tests that check a user journey that |
1131 | -involves the dash. The code for some of those tests will not be inside this |
1132 | -branch, but in projects that depend on unity or that test the whole system |
1133 | -integration. So, we need to test the helpers in order to make sure that we |
1134 | -don't break them for those external projects. |
1135 | +The autopilot custom proxy objects are helpers for tests that check a user |
1136 | +journey that involves the dash. The code for some of those tests will not be |
1137 | +inside this branch, but in projects that depend on unity or that test the |
1138 | +whole system integration. So, we need to test the helpers in order to make |
1139 | +sure that we don't break them for those external projects. |
1140 | |
1141 | """ |
1142 | |
1143 | @@ -31,8 +31,7 @@ |
1144 | |
1145 | from unity8 import process_helpers |
1146 | from unity8.shell import fixture_setup, tests |
1147 | -from unity8.shell.emulators import dash as dash_emulators |
1148 | -from unity8.shell.emulators.dash import ListViewWithPageHeader |
1149 | +from unity8 import dash as dash_helpers |
1150 | |
1151 | |
1152 | class MainWindowTestCase(tests.UnityTestCase): |
1153 | @@ -45,7 +44,7 @@ |
1154 | process_helpers.unlock_unity() |
1155 | |
1156 | |
1157 | -class DashEmulatorTestCase(tests.DashBaseTestCase): |
1158 | +class DashHelperTestCase(tests.DashBaseTestCase): |
1159 | |
1160 | def test_search(self): |
1161 | self.dash.enter_search_query('Test') |
1162 | @@ -98,16 +97,16 @@ |
1163 | scope_id = 'musicaggregator' |
1164 | scope = self.dash.open_scope(scope_id) |
1165 | self._assert_scope_is_opened(scope, scope_id) |
1166 | - self.assertIsInstance(scope, dash_emulators.GenericScopeView) |
1167 | + self.assertIsInstance(scope, dash_helpers.GenericScopeView) |
1168 | |
1169 | def test_open_applications_scope(self): |
1170 | scope_id = 'clickscope' |
1171 | scope = self.dash.open_scope(scope_id) |
1172 | self._assert_scope_is_opened(scope, scope_id) |
1173 | - self.assertIsInstance(scope, dash_emulators.GenericScopeView) |
1174 | - |
1175 | - |
1176 | -class GenericScopeViewEmulatorTestCase(tests.DashBaseTestCase): |
1177 | + self.assertIsInstance(scope, dash_helpers.GenericScopeView) |
1178 | + |
1179 | + |
1180 | +class GenericScopeViewHelperTestCase(tests.DashBaseTestCase): |
1181 | |
1182 | def setUp(self): |
1183 | # Set up the fake scopes before launching unity. |
1184 | @@ -117,17 +116,17 @@ |
1185 | |
1186 | def test_open_preview(self): |
1187 | preview = self.generic_scope.open_preview('0', 'Title.0.0') |
1188 | - self.assertIsInstance(preview, dash_emulators.Preview) |
1189 | + self.assertIsInstance(preview, dash_helpers.Preview) |
1190 | self.assertTrue(preview.isCurrent) |
1191 | |
1192 | def test_open_preview_of_non_visible_item(self): |
1193 | """Open an item that requires swiping to make it visible.""" |
1194 | preview = self.generic_scope.open_preview('2', 'Title.2.0') |
1195 | - self.assertIsInstance(preview, dash_emulators.Preview) |
1196 | + self.assertIsInstance(preview, dash_helpers.Preview) |
1197 | self.assertTrue(preview.isCurrent) |
1198 | |
1199 | |
1200 | -class DashAppsEmulatorTestCase(tests.DashBaseTestCase): |
1201 | +class DashAppsHelperTestCase(tests.DashBaseTestCase): |
1202 | |
1203 | available_applications = [ |
1204 | 'Title.2.0', 'Title.2.1', 'Title.2.2', 'Title.2.3', 'Title.2.4', |
1205 | @@ -145,7 +144,7 @@ |
1206 | category_element = self.applications_scope._get_category_element( |
1207 | category) |
1208 | list_view = self.dash.get_scope('clickscope')\ |
1209 | - .select_single(ListViewWithPageHeader) |
1210 | + .select_single(dash_helpers.ListViewWithPageHeader) |
1211 | expected_apps_count = self._get_number_of_application_slots(category) |
1212 | expected_applications = self.available_applications[ |
1213 | :expected_apps_count] |
1214 | |
1215 | === modified file 'tests/autopilot/unity8/shell/tests/test_notifications.py' |
1216 | --- tests/autopilot/unity8/shell/tests/test_notifications.py 2015-05-08 12:43:34 +0000 |
1217 | +++ tests/autopilot/unity8/shell/tests/test_notifications.py 2015-06-24 11:14:44 +0000 |
1218 | @@ -362,7 +362,7 @@ |
1219 | """Returns the path to the interactive notification |
1220 | creation script. |
1221 | """ |
1222 | - file_path = "../../emulators/create_interactive_notification.py" |
1223 | + file_path = "../../create_interactive_notification.py" |
1224 | |
1225 | the_path = os.path.abspath( |
1226 | os.path.join(__file__, file_path)) |
1227 | |
1228 | === modified file 'tests/autopilot/unity8/shell/tests/test_rotation.py' |
1229 | --- tests/autopilot/unity8/shell/tests/test_rotation.py 2015-05-05 16:15:07 +0000 |
1230 | +++ tests/autopilot/unity8/shell/tests/test_rotation.py 2015-06-24 11:14:44 +0000 |
1231 | @@ -58,7 +58,7 @@ |
1232 | def test_fake_sensor(self): |
1233 | unity_with_sensors = fixture_setup.LaunchUnityWithFakeSensors() |
1234 | self.useFixture(unity_with_sensors) |
1235 | - process_helpers.unlock_unity(unity_with_sensors.unity_proxy) |
1236 | + process_helpers.unlock_unity() |
1237 | fake_sensors = unity_with_sensors.fake_sensors |
1238 | o_proxy = unity_with_sensors.main_win.select_single('OrientedShell') |
1239 | |
1240 | @@ -84,7 +84,7 @@ |
1241 | |
1242 | unity_with_sensors = fixture_setup.LaunchUnityWithFakeSensors() |
1243 | self.useFixture(unity_with_sensors) |
1244 | - process_helpers.unlock_unity(unity_with_sensors.unity_proxy) |
1245 | + process_helpers.unlock_unity() |
1246 | fake_sensors = unity_with_sensors.fake_sensors |
1247 | o_proxy = unity_with_sensors.main_win.select_single('OrientedShell') |
1248 | self.shell_proxy = unity_with_sensors.main_win.select_single('Shell') |
1249 | |
1250 | === modified file 'tests/autopilot/unity8/shell/tests/test_tutorial.py' |
1251 | --- tests/autopilot/unity8/shell/tests/test_tutorial.py 2015-04-20 16:04:34 +0000 |
1252 | +++ tests/autopilot/unity8/shell/tests/test_tutorial.py 2015-06-24 11:14:44 +0000 |
1253 | @@ -24,8 +24,8 @@ |
1254 | fixture_setup, |
1255 | tests |
1256 | ) |
1257 | -# unused import to load the tutorial emulators custom proxy objects. |
1258 | -from unity8.shell.emulators import tutorial as tutorial_emulator # NOQA |
1259 | +# unused import to load the tutorial helpers custom proxy objects. |
1260 | +from unity8 import tutorial as tutorial_helpers # NOQA |
1261 | |
1262 | |
1263 | class TutorialTestCase(tests.UnityTestCase): |
1264 | |
1265 | === renamed file 'tests/autopilot/unity8/shell/emulators/tutorial.py' => 'tests/autopilot/unity8/tutorial.py' |
FAILED: Continuous integration, rev:1532 /code.launchpad .net/~canonical -platform- qa/unity8/ fix1306340- deprecate_ emulators/ +merge/ 257812/ +edit-commit- message
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http:// jenkins. qa.ubuntu. com/job/ unity8- ci/5641/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- vivid-touch/ 2538 jenkins. qa.ubuntu. com/job/ unity-phablet- qmluitests- vivid/804 jenkins. qa.ubuntu. com/job/ unity8- vivid-amd64- ci/806 jenkins. qa.ubuntu. com/job/ unity8- vivid-i386- ci/806 jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- runner- vivid-mako/ 2199 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- vivid-armhf/ 2536 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- vivid-armhf/ 2536/artifact/ work/output/ *zip*/output. zip s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 20045
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity8- ci/5641/ rebuild
http://