Merge lp:~canonical-platform-qa/ubuntu-system-tests/clean-install into lp:ubuntu-system-tests
- clean-install
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Sergio Cazzolato |
Approved revision: | 469 |
Merged at revision: | 420 |
Proposed branch: | lp:~canonical-platform-qa/ubuntu-system-tests/clean-install |
Merge into: | lp:ubuntu-system-tests |
Diff against target: |
1982 lines (+585/-319) 54 files modified
debian/control (+22/-3) debian/rules (+4/-0) debian/tests/control (+1/-1) debian/ubuntu-system-tests-suite.install (+1/-0) ubuntu_system_tests/helpers/__init__.py (+2/-0) ubuntu_system_tests/helpers/addressbook/__init__.py (+3/-1) ubuntu_system_tests/helpers/addressbook/utils.py (+38/-0) ubuntu_system_tests/helpers/autopilot/utils.py (+13/-10) ubuntu_system_tests/helpers/brightness/__init__.py (+0/-4) ubuntu_system_tests/helpers/camera/app.py (+1/-5) ubuntu_system_tests/helpers/dekko/app.py (+1/-3) ubuntu_system_tests/helpers/dialer_app/fixture_setup.py (+3/-2) ubuntu_system_tests/helpers/gallery/app.py (+1/-3) ubuntu_system_tests/helpers/indicators/_cpo.py (+36/-0) ubuntu_system_tests/helpers/indicators/battery.py (+3/-5) ubuntu_system_tests/helpers/indicators/bluetooth.py (+2/-4) ubuntu_system_tests/helpers/indicators/datetime.py (+2/-4) ubuntu_system_tests/helpers/indicators/message.py (+2/-4) ubuntu_system_tests/helpers/indicators/network/_cpo.py (+2/-4) ubuntu_system_tests/helpers/indicators/sound.py (+2/-4) ubuntu_system_tests/helpers/indicators/utils.py (+0/-15) ubuntu_system_tests/helpers/mediascanner.py (+9/-6) ubuntu_system_tests/helpers/messaging/app.py (+4/-6) ubuntu_system_tests/helpers/messaging/fixture_setup.py (+6/-3) ubuntu_system_tests/helpers/processes.py (+25/-2) ubuntu_system_tests/helpers/scopes/music/_cpo.py (+1/-1) ubuntu_system_tests/helpers/sensors.py (+7/-4) ubuntu_system_tests/helpers/system_settings/__init__.py (+2/-0) ubuntu_system_tests/helpers/system_settings/_cpo.py (+1/-1) ubuntu_system_tests/helpers/system_settings/app.py (+14/-2) ubuntu_system_tests/helpers/ubuntu_keyboard/__init__.py (+2/-0) ubuntu_system_tests/helpers/ubuntu_keyboard/utils.py (+6/-4) ubuntu_system_tests/helpers/unity8/__init__.py (+8/-2) ubuntu_system_tests/helpers/unity8/settings_wizard.py (+4/-14) ubuntu_system_tests/helpers/unity8/shell.py (+1/-88) ubuntu_system_tests/helpers/unity8/shell_view.py (+116/-0) ubuntu_system_tests/helpers/unity8/utils.py (+27/-14) ubuntu_system_tests/helpers/utils.py (+74/-0) ubuntu_system_tests/helpers/webapp/ebay.py (+6/-3) ubuntu_system_tests/helpers/webapp/here.py (+9/-6) ubuntu_system_tests/helpers/webapp/utils.py (+10/-7) ubuntu_system_tests/helpers/webbrowser/fixture_setup.py (+6/-2) ubuntu_system_tests/selftests/test_commands.py (+35/-9) ubuntu_system_tests/selftests/test_tests_to_run.py (+1/-1) ubuntu_system_tests/tests/base.py (+34/-24) ubuntu_system_tests/tests/test_add_contact.py (+5/-11) ubuntu_system_tests/tests/test_calls.py (+3/-1) ubuntu_system_tests/tests/test_messaging_sms.py (+0/-1) ubuntu_system_tests/tests/test_settings_wizard.py (+5/-4) ubuntu_system_tests/tests/test_tutorial.py (+6/-5) ubuntu_system_tests/tests/test_ubuntu_keyboard.py (+9/-12) ubuntu_system_tests/tests/test_with_dialer.py (+6/-4) ubuntu_system_tests/tests/test_with_webbrowser.py (+0/-6) ubuntu_system_tests/tests/webapps/base.py (+4/-4) |
To merge this branch: | bzr merge lp:~canonical-platform-qa/ubuntu-system-tests/clean-install |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Santiago Baldassin (community) | Approve | ||
Sergio Cazzolato | Approve | ||
platform-qa-bot | continuous-integration | Approve | |
Review via email:
|
Commit message
Ensure ubuntu-system-tests installs and runs on a clean host with minimal dependencies.
Description of the change
This MP fixes the dependecies used by ubuntu-system-tests so it will install and run on a clean host system and also minimises the dependencies required to do so.
Changes include:
- Add missing dependencies to allow running tests (autopkgtest, phablet-tools etc.)
- Add missing dependencies required to build ubuntu-system-tests package from source
- Add missing dependencies required to list tests on host
- Remove autopilot dependencies from host and build packages - These should only be required on the test device itself
- Fix chromedriver dependency to use correct package, this fixes webapps tests (although other error with here test.)
- Add autopilot list command to the test rules so that it will run automatically to check there are no broken imports
- Add perftests folder to the ubuntu-
- Add a try_import helper which will return a dummy object in the case of ImportError exception. This allows top-level imports to be done without requiring the packages to be installed. Which allows ubuntu-
- Use try_import helper for selenium imports as this is required to installed from ppa.
- Move all custom proxy objects out of the main import path of the tests, which also removes them from autopilot registry. They are now only imported by helpers when they are required.
- Remove redundant cleanup_process parameter for get_proxy_
- Add mocking to ssh commands to reduce dependencies for selftests.
- Other minor fixes found when running tests.
I have tested this by installing onto a clean host system, running ubuntu-system-tests setup and run commands, and building debian packages.
You should also be able to list all tests without having any autopilot project installed (unity8-autopilot, ubuntu-
To test installation yourself you'll need to add following ppa to both your host and device:
sudo add-apt-repository ppa:rhuddie/ust
Adding this ppa is only required until this branch lands in trunk.
You should then be able to use ubuntu-system-tests command as normal with no autopilot/selenium packages installed on host.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
platform-qa-bot (platform-qa-bot) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
platform-qa-bot (platform-qa-bot) wrote : | # |
PASSED: Continuous integration, rev:454
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Sergio Cazzolato (sergio-j-cazzolato) wrote : | # |
The tests are passing and the whole change works. I see that the code is getting more complex with this change, perhaps we could research if there is an alternative to list the tests and avoid removing all these imports. What do you think?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Richard Huddie (rhuddie) wrote : | # |
> The tests are passing and the whole change works. I see that the code is
> getting more complex with this change, perhaps we could research if there is
> an alternative to list the tests and avoid removing all these imports. What do
> you think?
One thing to remember is that we are planning to remove at least some of the external dependencies, starting with unity8. So where there are some helpers that are wrappers around unity8, these would be replaced with the full implementation within ubuntu-system-tests itself. So this mp is making a start at localising those changes.
But that won't be the case for all of the imports, i.e. ubuntuuitoolkit and selenium. The only other way I can think of for that would be to do the imports in a try block and catch the ImportError exception, but that could lead to the case where a genuine import error on the device gets hidden. Have you any other thoughts?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Richard Huddie (rhuddie) wrote : | # |
> The tests are passing and the whole change works. I see that the code is
> getting more complex with this change, perhaps we could research if there is
> an alternative to list the tests and avoid removing all these imports. What do
> you think?
I was thinking about mocking the imports using method we discussed previously. This will not work for the case of running the self-tests on the host, as that would require at least some the real imports to be present.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
platform-qa-bot (platform-qa-bot) wrote : | # |
PASSED: Continuous integration, rev:455
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Santiago Baldassin (sbaldassin) wrote : | # |
Hi Richard, I still need to go through the entire mp but I rather not move the imports. Local imports, as a rule, should be used only if it's extremely necessary because for example the module that you are importing do a lot of processing causing performance issues so you actually want to import the module only if it's going to be used.
Another problem of moving the imports is that they could hide circular dependencies
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Richard Huddie (rhuddie) wrote : | # |
I'm going to see if there's another approach that could work here regarding the imports.
Just to give an idea of the current changes in install size, the trunk branch requires 560MB to install the suite and 452MB to install build-deps.
This branch currently requires 200MB to install suite and 70MB to install build-deps, which is a big reduction.
ubuntu-
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Richard Huddie (rhuddie) wrote : | # |
I've just made an update which adds a try_import() helper to import the modules in question. Please take a look to see if you're happy with this approach: http://
If so I'll update the rest of the branch to use this helper. Thanks.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
platform-qa-bot (platform-qa-bot) wrote : | # |
PASSED: Continuous integration, rev:456
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Sergio Cazzolato (sergio-j-cazzolato) wrote : | # |
> I've just made an update which adds a try_import() helper to import the
> modules in question. Please take a look to see if you're happy with this
> approach: http://
> tests/clean-
>
> If so I'll update the rest of the branch to use this helper. Thanks.
I prefer this change to hide all the external imports.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
platform-qa-bot (platform-qa-bot) wrote : | # |
PASSED: Continuous integration, rev:457
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
platform-qa-bot (platform-qa-bot) wrote : | # |
PASSED: Continuous integration, rev:467
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
None: https:/
Click here to trigger a rebuild:
https:/
- 468. By Richard Huddie
-
here imports.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
platform-qa-bot (platform-qa-bot) wrote : | # |
PASSED: Continuous integration, rev:468
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
None: https:/
Click here to trigger a rebuild:
https:/
- 469. By Richard Huddie
-
Merge from trunk.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
platform-qa-bot (platform-qa-bot) wrote : | # |
PASSED: Continuous integration, rev:469
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Richard Huddie (rhuddie) wrote : | # |
I've updated this branch now as mentioned above to use the try_import helper. I've run through several tests and all seems to be working fine. Let me know what you think.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Sergio Cazzolato (sergio-j-cazzolato) wrote : | # |
I agree with this implementation, tests passing in my device.
I was thinking that based on this implementation we could make a solution to install the dependencies for a subset of tests. For that we should use the try_import module to load and track all the modules needed, so, when we need to run a test class, we load the class and we can track all the imports needed in the try_import helper and retrieve a list of dependencies. We should have a map to know the package to install based on a dependency. We can discuss it on Monday.
Approving. I would like to wait until Santiago takes a look to the change before top approving it.
Good job richard
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Richard Huddie (rhuddie) wrote : | # |
Thanks for review Sergio.
I like the idea of discovering the dependencies for tests. I am also working on the next branch which provides the ability for dynamic dependencies, so you only use the dependencies you need for a specific group of tests: https:/
This has a json file which does the mapping between test cases and dependencies. Currently this is quite crude and it only distinguishes between the webapp tests that use chromedriver and all the other tests. So as the next piece of work we could try and refine the list a bit more using above approach.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Santiago Baldassin (sbaldassin) wrote : | # |
Looks good to me
Preview Diff
1 | === modified file 'debian/control' |
2 | --- debian/control 2016-05-10 16:47:27 +0000 |
3 | +++ debian/control 2016-07-15 14:58:58 +0000 |
4 | @@ -4,13 +4,24 @@ |
5 | Maintainer: Canonical Platform QA Team <qa-team@lists.canonical.com> |
6 | Build-Depends: debhelper (>= 9), |
7 | dh-python, |
8 | - openssh-server, |
9 | + gir1.2-click-0.4, |
10 | + lsb-release, |
11 | python3-all-dev (>= 3.4), |
12 | + python3-autopilot, |
13 | + python3-debian, |
14 | + python3-evdev, |
15 | python3-fixtures, |
16 | python3-flake8, |
17 | + python3-gi, |
18 | + python3-paramiko, |
19 | + python3-pexpect, |
20 | + python3-requests, |
21 | + python3-retrying, |
22 | python3-setuptools, |
23 | + python3-subunit, |
24 | python3-testscenarios, |
25 | - unity8-autopilot |
26 | + python3-warlock, |
27 | + system-image-common, |
28 | Standards-Version: 3.9.5 |
29 | Homepage: http://launchpad.net/ubuntu-system-tests |
30 | X-Python3-Version: >= 3.3 |
31 | @@ -33,8 +44,12 @@ |
32 | Architecture: all |
33 | Depends: ${misc:Depends}, |
34 | ${python3:Depends}, |
35 | + autopkgtest, |
36 | + openssh-server, |
37 | + phablet-tools, |
38 | subunit, |
39 | ubuntu-system-tests-common, |
40 | + virtualenv, |
41 | Description: Host test runner |
42 | This package contains scripts for running ubuntu-system-tests on a target |
43 | device from a host machine. |
44 | @@ -52,6 +67,9 @@ |
45 | Architecture: all |
46 | Depends: ${misc:Depends}, |
47 | ${python3:Depends}, |
48 | + libhybris-utils, |
49 | + ofono, |
50 | + openssh-client, |
51 | python3-dbus, |
52 | python3-debian, |
53 | python3-gi, |
54 | @@ -61,6 +79,7 @@ |
55 | python3-retrying, |
56 | python3-testtools, |
57 | python3-warlock, |
58 | + system-image-common, |
59 | Description: Ubuntu-system-tests common scripts |
60 | This package contains common scripts used by the ubuntu-system-tests host, |
61 | helpers and suite packages. |
62 | @@ -71,6 +90,6 @@ |
63 | ${python3:Depends}, |
64 | python3-autopilot, |
65 | ubuntu-system-tests-common, |
66 | - unity8-autopilot, |
67 | + ubuntu-system-tests-helpers, |
68 | Description: Ubuntu-system-tests test suite and test data |
69 | This package contains test suites and test data for ubuntu-system-tests. |
70 | |
71 | === modified file 'debian/rules' |
72 | --- debian/rules 2016-05-03 15:59:52 +0000 |
73 | +++ debian/rules 2016-07-15 14:58:58 +0000 |
74 | @@ -10,3 +10,7 @@ |
75 | override_dh_auto_build: |
76 | python3 -m flake8.run --max-complexity 6 . |
77 | dh_auto_build |
78 | + |
79 | +override_dh_auto_test: |
80 | + dh_auto_test |
81 | + ! autopilot3 list ubuntu_system_tests | grep "ImportError:" |
82 | |
83 | === modified file 'debian/tests/control' |
84 | --- debian/tests/control 2016-06-17 11:04:19 +0000 |
85 | +++ debian/tests/control 2016-07-15 14:58:58 +0000 |
86 | @@ -5,6 +5,7 @@ |
87 | address-book-app-autopilot (>=0.2+15.04.20150226-0ubuntu1), # TMPINSTALL |
88 | camera-app, |
89 | camera-app-autopilot, |
90 | + chromium-chromedriver, # TMPINSTALL |
91 | dialer-app, |
92 | dialer-app-autopilot, # TMPINSTALL |
93 | exiftool, |
94 | @@ -14,7 +15,6 @@ |
95 | mediaplayer-app-autopilot, # TMPINSTALL |
96 | messaging-app, |
97 | messaging-app-autopilot, # TMPINSTALL |
98 | - oxideqt-chromedriver, # TMPINSTALL |
99 | python3-autopilot, |
100 | python3-dbus, |
101 | python3-debian, |
102 | |
103 | === modified file 'debian/ubuntu-system-tests-suite.install' |
104 | --- debian/ubuntu-system-tests-suite.install 2016-05-11 13:49:53 +0000 |
105 | +++ debian/ubuntu-system-tests-suite.install 2016-07-15 14:58:58 +0000 |
106 | @@ -1,3 +1,4 @@ |
107 | +usr/lib/python3*/*/ubuntu_system_tests/perftests/ |
108 | usr/lib/python3*/*/ubuntu_system_tests/systemtests/ |
109 | usr/lib/python3*/*/ubuntu_system_tests/tests/ |
110 | ubuntu_system_tests/external_tests/ /usr/lib/python3/dist-packages/ubuntu_system_tests/ |
111 | |
112 | === modified file 'ubuntu_system_tests/helpers/__init__.py' |
113 | --- ubuntu_system_tests/helpers/__init__.py 2016-06-02 12:50:05 +0000 |
114 | +++ ubuntu_system_tests/helpers/__init__.py 2016-07-15 14:58:58 +0000 |
115 | @@ -20,6 +20,7 @@ |
116 | |
117 | from ubuntu_system_tests.helpers.utils import ( |
118 | AttrDict, |
119 | + try_import, |
120 | wait_until, |
121 | wait_until_stable, |
122 | ) |
123 | @@ -27,6 +28,7 @@ |
124 | |
125 | __all__ = [ |
126 | 'AttrDict', |
127 | + 'try_import', |
128 | 'wait_until', |
129 | 'wait_until_stable', |
130 | ] |
131 | |
132 | === modified file 'ubuntu_system_tests/helpers/addressbook/__init__.py' |
133 | --- ubuntu_system_tests/helpers/addressbook/__init__.py 2016-06-09 19:00:23 +0000 |
134 | +++ ubuntu_system_tests/helpers/addressbook/__init__.py 2016-07-15 14:58:58 +0000 |
135 | @@ -22,8 +22,10 @@ |
136 | AddressBook, |
137 | Contact |
138 | ) |
139 | +from ubuntu_system_tests.helpers.addressbook.utils import get_test_contact |
140 | |
141 | __all__ = [ |
142 | 'AddressBook', |
143 | - 'Contact' |
144 | + 'Contact', |
145 | + 'get_test_contact', |
146 | ] |
147 | |
148 | === added file 'ubuntu_system_tests/helpers/addressbook/utils.py' |
149 | --- ubuntu_system_tests/helpers/addressbook/utils.py 1970-01-01 00:00:00 +0000 |
150 | +++ ubuntu_system_tests/helpers/addressbook/utils.py 2016-07-15 14:58:58 +0000 |
151 | @@ -0,0 +1,38 @@ |
152 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
153 | + |
154 | +# |
155 | +# Ubuntu System Tests |
156 | +# Copyright (C) 2016 Canonical |
157 | +# |
158 | +# This program is free software: you can redistribute it and/or modify |
159 | +# it under the terms of the GNU General Public License as published by |
160 | +# the Free Software Foundation, either version 3 of the License, or |
161 | +# (at your option) any later version. |
162 | +# |
163 | +# This program is distributed in the hope that it will be useful, |
164 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
165 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
166 | +# GNU General Public License for more details. |
167 | +# |
168 | +# You should have received a copy of the GNU General Public License |
169 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
170 | +# |
171 | + |
172 | +from ubuntu_system_tests.helpers import try_import |
173 | + |
174 | +addr_data = try_import('address_book_app.address_book.data') |
175 | + |
176 | + |
177 | +def get_test_contact(first_name, last_name, phone_number): |
178 | + """ |
179 | + Return Contact object with specified details. |
180 | + |
181 | + :param first_name: First name of contact. |
182 | + :param last_name: Last name of contact. |
183 | + :param phone_number: Phone number of contact. |
184 | + :return: Contact object with specified details. |
185 | + """ |
186 | + mobile_number = addr_data.Phone(type_='Mobile', number=phone_number) |
187 | + return addr_data.Contact( |
188 | + first_name=first_name, last_name=last_name, |
189 | + phones=[mobile_number]) |
190 | |
191 | === modified file 'ubuntu_system_tests/helpers/autopilot/utils.py' |
192 | --- ubuntu_system_tests/helpers/autopilot/utils.py 2016-06-09 19:56:51 +0000 |
193 | +++ ubuntu_system_tests/helpers/autopilot/utils.py 2016-07-15 14:58:58 +0000 |
194 | @@ -20,14 +20,18 @@ |
195 | |
196 | from contextlib import contextmanager |
197 | |
198 | -import ubuntuuitoolkit |
199 | from autopilot import introspection |
200 | from autopilot.exceptions import StateNotFoundError |
201 | |
202 | -from ubuntu_system_tests.helpers import processes |
203 | +from ubuntu_system_tests.helpers import ( |
204 | + processes, |
205 | + try_import, |
206 | +) |
207 | from ubuntu_system_tests.helpers.timeout import timeout |
208 | from ubuntu_system_tests.helpers import wait_until |
209 | |
210 | +ubuntuuitoolkit = try_import('ubuntuuitoolkit') |
211 | + |
212 | |
213 | @contextmanager |
214 | def override_proxy_timeout(proxy, timeout_seconds): |
215 | @@ -232,9 +236,7 @@ |
216 | ) |
217 | |
218 | |
219 | -def get_proxy_object_for_existing_app( |
220 | - process_name, cleanup_process=None, |
221 | - base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
222 | +def get_proxy_object_for_existing_app(process_name, raw_proxy=False): |
223 | """ |
224 | Return proxy object from existing application process. |
225 | |
226 | @@ -243,15 +245,16 @@ |
227 | cleanup target using ensure_application_closed(). |
228 | |
229 | :param pname: Name of required application process. |
230 | - :param cleanup_process: Name of process to clean up. |
231 | - :param base: custom emulator base for proxy object |
232 | + :param raw_proxy: Whether to return a raw proxy object, or use default |
233 | + base class for proxy objects from ubuntuuitoolkit. |
234 | :return: Proxy object for the desired application. |
235 | |
236 | """ |
237 | - if not cleanup_process: |
238 | - cleanup_process = process_name |
239 | + if raw_proxy: |
240 | + base = None |
241 | + else: |
242 | + base = ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase |
243 | proxy = get_proxy_object_for_existing_process(process_name, base) |
244 | - |
245 | return proxy |
246 | |
247 | |
248 | |
249 | === modified file 'ubuntu_system_tests/helpers/brightness/__init__.py' |
250 | --- ubuntu_system_tests/helpers/brightness/__init__.py 2016-06-01 13:47:43 +0000 |
251 | +++ ubuntu_system_tests/helpers/brightness/__init__.py 2016-07-15 14:58:58 +0000 |
252 | @@ -17,7 +17,3 @@ |
253 | # You should have received a copy of the GNU General Public License |
254 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
255 | # |
256 | - |
257 | -from ubuntu_system_tests.helpers.brightness._cpo import BrightnessPageBase |
258 | - |
259 | -__all__ = ['BrightnessPageBase'] |
260 | |
261 | === modified file 'ubuntu_system_tests/helpers/camera/app.py' |
262 | --- ubuntu_system_tests/helpers/camera/app.py 2016-06-30 17:37:03 +0000 |
263 | +++ ubuntu_system_tests/helpers/camera/app.py 2016-07-15 14:58:58 +0000 |
264 | @@ -23,7 +23,6 @@ |
265 | import warlock |
266 | |
267 | from ubuntu_system_tests.helpers import autopilot |
268 | -from ubuntu_system_tests.helpers import click |
269 | from ubuntu_system_tests.helpers import file_system as fs |
270 | from ubuntu_system_tests.helpers import processes |
271 | from ubuntu_system_tests.helpers.scopes.apps import ( |
272 | @@ -99,10 +98,7 @@ |
273 | |
274 | """ |
275 | from ubuntu_system_tests.helpers.camera._cpo import MainWindow |
276 | - proxy = autopilot.get_proxy_object_for_existing_app( |
277 | - APP, |
278 | - cleanup_process=click.get_click_app_identifier(APP_CLICK) |
279 | - ) |
280 | + proxy = autopilot.get_proxy_object_for_existing_app(APP) |
281 | return MainWindow(proxy) |
282 | |
283 | |
284 | |
285 | === modified file 'ubuntu_system_tests/helpers/dekko/app.py' |
286 | --- ubuntu_system_tests/helpers/dekko/app.py 2016-06-01 13:58:27 +0000 |
287 | +++ ubuntu_system_tests/helpers/dekko/app.py 2016-07-15 14:58:58 +0000 |
288 | @@ -15,7 +15,6 @@ |
289 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
290 | |
291 | from ubuntu_system_tests.helpers import autopilot |
292 | -from ubuntu_system_tests.helpers import click |
293 | from ubuntu_system_tests.helpers import processes |
294 | from ubuntu_system_tests.helpers.scopes.apps import ( |
295 | launch_application_from_apps_scope) |
296 | @@ -42,5 +41,4 @@ |
297 | def get_dekko_proxy(): |
298 | """Return the proxy object of the calculator app.""" |
299 | from ubuntu_system_tests.helpers.dekko import _cpo # NOQA |
300 | - return autopilot.get_proxy_object_for_existing_app( |
301 | - APP, cleanup_process=click.get_click_app_identifier(APP_CLICK_ID)) |
302 | + return autopilot.get_proxy_object_for_existing_app(APP) |
303 | |
304 | === modified file 'ubuntu_system_tests/helpers/dialer_app/fixture_setup.py' |
305 | --- ubuntu_system_tests/helpers/dialer_app/fixture_setup.py 2015-08-25 11:24:23 +0000 |
306 | +++ ubuntu_system_tests/helpers/dialer_app/fixture_setup.py 2016-07-15 14:58:58 +0000 |
307 | @@ -20,11 +20,12 @@ |
308 | |
309 | import fixtures |
310 | |
311 | -from dialer_app.fixture_setup import UseEmptyHistory |
312 | - |
313 | +from ubuntu_system_tests.helpers import try_import |
314 | from ubuntu_system_tests.helpers.system_settings import ( |
315 | get_default_sim_for_calls, set_default_sim_for_calls) |
316 | |
317 | +UseEmptyHistory = try_import('dialer_app.fixture_setup').UseEmptyHistory |
318 | + |
319 | |
320 | class DialerTestEnvironment(fixtures.Fixture): |
321 | """Fixture used to prepare the phone environment""" |
322 | |
323 | === modified file 'ubuntu_system_tests/helpers/gallery/app.py' |
324 | --- ubuntu_system_tests/helpers/gallery/app.py 2016-06-01 14:18:12 +0000 |
325 | +++ ubuntu_system_tests/helpers/gallery/app.py 2016-07-15 14:58:58 +0000 |
326 | @@ -19,7 +19,6 @@ |
327 | # |
328 | |
329 | from ubuntu_system_tests.helpers import autopilot |
330 | -from ubuntu_system_tests.helpers import click |
331 | from ubuntu_system_tests.helpers import processes |
332 | from ubuntu_system_tests.helpers.scopes.apps import ( |
333 | launch_application_from_apps_scope |
334 | @@ -61,8 +60,7 @@ |
335 | |
336 | """ |
337 | from ubuntu_system_tests.helpers.gallery._cpo import GalleryApplication |
338 | - proxy = autopilot.get_proxy_object_for_existing_app( |
339 | - APP, cleanup_process=click.get_click_app_identifier(APP_CLICK)) |
340 | + proxy = autopilot.get_proxy_object_for_existing_app(APP) |
341 | return proxy.select_single(GalleryApplication) |
342 | |
343 | |
344 | |
345 | === added file 'ubuntu_system_tests/helpers/indicators/_cpo.py' |
346 | --- ubuntu_system_tests/helpers/indicators/_cpo.py 1970-01-01 00:00:00 +0000 |
347 | +++ ubuntu_system_tests/helpers/indicators/_cpo.py 2016-07-15 14:58:58 +0000 |
348 | @@ -0,0 +1,36 @@ |
349 | + |
350 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
351 | + |
352 | +# Ubuntu System Tests |
353 | +# Copyright (C) 2016 Canonical |
354 | +# |
355 | +# This program is free software: you can redistribute it and/or modify |
356 | +# it under the terms of the GNU General Public License as published by |
357 | +# the Free Software Foundation, either version 3 of the License, or |
358 | +# (at your option) any later version. |
359 | +# |
360 | +# This program is distributed in the hope that it will be useful, |
361 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
362 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
363 | +# GNU General Public License for more details. |
364 | +# |
365 | +# You should have received a copy of the GNU General Public License |
366 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
367 | + |
368 | +from unity8 import indicators |
369 | + |
370 | +from ubuntu_system_tests.helpers.ubuntuuitoolkit._qquicklistview import ( |
371 | + QQuickListView, |
372 | +) |
373 | + |
374 | + |
375 | +class IndicatorPage(indicators.IndicatorPage): |
376 | + """Extend IndicatorPage from Unity8.""" |
377 | + |
378 | + def _get_listview(self): |
379 | + """Return the list view object from the indicator.""" |
380 | + return self.select_single(QQuickListView, objectName='mainMenu') |
381 | + |
382 | + def press_label(self, text): |
383 | + """Press the label in the list view of the indicator.""" |
384 | + self._get_listview().press_label(text) |
385 | |
386 | === modified file 'ubuntu_system_tests/helpers/indicators/battery.py' |
387 | --- ubuntu_system_tests/helpers/indicators/battery.py 2016-06-08 08:07:44 +0000 |
388 | +++ ubuntu_system_tests/helpers/indicators/battery.py 2016-07-15 14:58:58 +0000 |
389 | @@ -16,11 +16,9 @@ |
390 | # You should have received a copy of the GNU General Public License |
391 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
392 | |
393 | -from ubuntu_system_tests.helpers.brightness import BrightnessPageBase |
394 | -from ubuntu_system_tests.helpers.indicators.utils import( |
395 | - IndicatorPage, |
396 | - INDICATOR_PAGE_PATH |
397 | -) |
398 | +from ubuntu_system_tests.helpers.brightness._cpo import BrightnessPageBase |
399 | +from ubuntu_system_tests.helpers.indicators.utils import INDICATOR_PAGE_PATH |
400 | +from ubuntu_system_tests.helpers.indicators._cpo import IndicatorPage |
401 | from ubuntu_system_tests.helpers.autopilot import validate_dbus_object |
402 | from ubuntu_system_tests.helpers import unity8 |
403 | |
404 | |
405 | === modified file 'ubuntu_system_tests/helpers/indicators/bluetooth.py' |
406 | --- ubuntu_system_tests/helpers/indicators/bluetooth.py 2016-06-01 15:05:13 +0000 |
407 | +++ ubuntu_system_tests/helpers/indicators/bluetooth.py 2016-07-15 14:58:58 +0000 |
408 | @@ -16,10 +16,8 @@ |
409 | # You should have received a copy of the GNU General Public License |
410 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
411 | |
412 | -from ubuntu_system_tests.helpers.indicators.utils import( |
413 | - IndicatorPage, |
414 | - INDICATOR_PAGE_PATH |
415 | -) |
416 | +from ubuntu_system_tests.helpers.indicators.utils import INDICATOR_PAGE_PATH |
417 | +from ubuntu_system_tests.helpers.indicators._cpo import IndicatorPage |
418 | from ubuntu_system_tests.helpers.autopilot import validate_dbus_object |
419 | from ubuntu_system_tests.helpers import unity8 |
420 | |
421 | |
422 | === modified file 'ubuntu_system_tests/helpers/indicators/datetime.py' |
423 | --- ubuntu_system_tests/helpers/indicators/datetime.py 2016-06-01 15:05:13 +0000 |
424 | +++ ubuntu_system_tests/helpers/indicators/datetime.py 2016-07-15 14:58:58 +0000 |
425 | @@ -16,10 +16,8 @@ |
426 | # You should have received a copy of the GNU General Public License |
427 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
428 | |
429 | -from ubuntu_system_tests.helpers.indicators.utils import( |
430 | - IndicatorPage, |
431 | - INDICATOR_PAGE_PATH |
432 | -) |
433 | +from ubuntu_system_tests.helpers.indicators.utils import INDICATOR_PAGE_PATH |
434 | +from ubuntu_system_tests.helpers.indicators._cpo import IndicatorPage |
435 | from ubuntu_system_tests.helpers.autopilot import validate_dbus_object |
436 | from ubuntu_system_tests.helpers import unity8 |
437 | |
438 | |
439 | === modified file 'ubuntu_system_tests/helpers/indicators/message.py' |
440 | --- ubuntu_system_tests/helpers/indicators/message.py 2016-06-01 15:04:34 +0000 |
441 | +++ ubuntu_system_tests/helpers/indicators/message.py 2016-07-15 14:58:58 +0000 |
442 | @@ -23,10 +23,8 @@ |
443 | import ubuntuuitoolkit as uuitk |
444 | |
445 | from ubuntu_system_tests.helpers import ofono, unity8 |
446 | -from ubuntu_system_tests.helpers.indicators.utils import( |
447 | - IndicatorPage, |
448 | - INDICATOR_PAGE_PATH |
449 | -) |
450 | +from ubuntu_system_tests.helpers.indicators.utils import INDICATOR_PAGE_PATH |
451 | +from ubuntu_system_tests.helpers.indicators._cpo import IndicatorPage |
452 | from ubuntu_system_tests.helpers.autopilot import( |
453 | validate_dbus_object, |
454 | wait_select_many, |
455 | |
456 | === modified file 'ubuntu_system_tests/helpers/indicators/network/_cpo.py' |
457 | --- ubuntu_system_tests/helpers/indicators/network/_cpo.py 2016-06-01 15:05:13 +0000 |
458 | +++ ubuntu_system_tests/helpers/indicators/network/_cpo.py 2016-07-15 14:58:58 +0000 |
459 | @@ -19,10 +19,8 @@ |
460 | |
461 | import ubuntuuitoolkit as uuitk |
462 | |
463 | -from ubuntu_system_tests.helpers.indicators.utils import( |
464 | - IndicatorPage, |
465 | - INDICATOR_PAGE_PATH |
466 | -) |
467 | +from ubuntu_system_tests.helpers.indicators.utils import INDICATOR_PAGE_PATH |
468 | +from ubuntu_system_tests.helpers.indicators._cpo import IndicatorPage |
469 | from ubuntu_system_tests.helpers.autopilot import validate_dbus_object |
470 | from ubuntu_system_tests.helpers import unity8 |
471 | from ubuntu_system_tests.helpers.ubuntuuitoolkit.switchmenu import SwitchMenu |
472 | |
473 | === modified file 'ubuntu_system_tests/helpers/indicators/sound.py' |
474 | --- ubuntu_system_tests/helpers/indicators/sound.py 2016-06-01 15:05:13 +0000 |
475 | +++ ubuntu_system_tests/helpers/indicators/sound.py 2016-07-15 14:58:58 +0000 |
476 | @@ -18,10 +18,8 @@ |
477 | |
478 | import ubuntuuitoolkit as uuitk |
479 | |
480 | -from ubuntu_system_tests.helpers.indicators.utils import( |
481 | - IndicatorPage, |
482 | - INDICATOR_PAGE_PATH |
483 | -) |
484 | +from ubuntu_system_tests.helpers.indicators.utils import INDICATOR_PAGE_PATH |
485 | +from ubuntu_system_tests.helpers.indicators._cpo import IndicatorPage |
486 | from ubuntu_system_tests.helpers.autopilot import validate_dbus_object |
487 | from ubuntu_system_tests.helpers import unity8 |
488 | from ubuntu_system_tests.helpers.ubuntuuitoolkit.switchmenu import SwitchMenu |
489 | |
490 | === modified file 'ubuntu_system_tests/helpers/indicators/utils.py' |
491 | --- ubuntu_system_tests/helpers/indicators/utils.py 2016-06-09 19:06:08 +0000 |
492 | +++ ubuntu_system_tests/helpers/indicators/utils.py 2016-07-15 14:58:58 +0000 |
493 | @@ -19,10 +19,7 @@ |
494 | |
495 | import logging |
496 | |
497 | -from unity8 import indicators |
498 | - |
499 | from ubuntu_system_tests.helpers import context |
500 | -from ubuntu_system_tests.helpers.ubuntuuitoolkit._qquicklistview import QQuickListView # NOQA |
501 | |
502 | INDICATOR_PAGE_PATH = b'IndicatorPage' |
503 | |
504 | @@ -43,18 +40,6 @@ |
505 | logger = logging.getLogger(__name__) |
506 | |
507 | |
508 | -class IndicatorPage(indicators.IndicatorPage): |
509 | - """Extend IndicatorPage from Unity8.""" |
510 | - |
511 | - def _get_listview(self): |
512 | - """Return the list view object from the indicator.""" |
513 | - return self.select_single(QQuickListView, objectName='mainMenu') |
514 | - |
515 | - def press_label(self, text): |
516 | - """Press the label in the list view of the indicator.""" |
517 | - self._get_listview().press_label(text) |
518 | - |
519 | - |
520 | class Indicator: |
521 | |
522 | def __init__(self, main_window, name, page): |
523 | |
524 | === modified file 'ubuntu_system_tests/helpers/mediascanner.py' |
525 | --- ubuntu_system_tests/helpers/mediascanner.py 2016-04-13 15:02:39 +0000 |
526 | +++ ubuntu_system_tests/helpers/mediascanner.py 2016-07-15 14:58:58 +0000 |
527 | @@ -21,9 +21,12 @@ |
528 | import dbus |
529 | import logging |
530 | |
531 | -from unity8 import process_helpers |
532 | - |
533 | from ubuntu_system_tests.helpers.dbus_observer import DBusObserver |
534 | +from ubuntu_system_tests.helpers.processes import ( |
535 | + is_job_running, |
536 | + start_job, |
537 | + stop_job, |
538 | +) |
539 | from ubuntu_system_tests.helpers.threads import StoppingThread |
540 | |
541 | MEDIA_SCANNER = 'mediascanner-2.0' |
542 | @@ -38,14 +41,14 @@ |
543 | |
544 | def stop_media_scanner(): |
545 | """ Stop the media scanner process """ |
546 | - if process_helpers.is_job_running(MEDIA_SCANNER): |
547 | - process_helpers.stop_job(MEDIA_SCANNER) |
548 | + if is_job_running(MEDIA_SCANNER): |
549 | + stop_job(MEDIA_SCANNER) |
550 | |
551 | |
552 | def start_media_scanner(): |
553 | """ Start the media scanner process """ |
554 | - if not process_helpers.is_job_running(MEDIA_SCANNER): |
555 | - process_helpers.start_job(MEDIA_SCANNER) |
556 | + if not is_job_running(MEDIA_SCANNER): |
557 | + start_job(MEDIA_SCANNER) |
558 | |
559 | |
560 | class MediaScannerObserver(DBusObserver): |
561 | |
562 | === modified file 'ubuntu_system_tests/helpers/messaging/app.py' |
563 | --- ubuntu_system_tests/helpers/messaging/app.py 2016-06-02 08:19:07 +0000 |
564 | +++ ubuntu_system_tests/helpers/messaging/app.py 2016-07-15 14:58:58 +0000 |
565 | @@ -19,7 +19,6 @@ |
566 | |
567 | from collections import namedtuple |
568 | from math import ceil |
569 | -import ubuntuuitoolkit |
570 | |
571 | from ubuntu_system_tests.helpers import autopilot |
572 | from ubuntu_system_tests.helpers import processes |
573 | @@ -104,17 +103,16 @@ |
574 | return processes.is_process_running(APP) |
575 | |
576 | |
577 | -def get_messaging_app_proxy( |
578 | - base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
579 | +def get_messaging_app_proxy(raw_proxy=False): |
580 | """ |
581 | Return messaging app proxy object from existing process. |
582 | |
583 | :return: Proxy object for messaging application. |
584 | |
585 | """ |
586 | - if not base: |
587 | - return autopilot.get_proxy_object_for_existing_app(APP, |
588 | - base=base) |
589 | + if raw_proxy: |
590 | + return autopilot.get_proxy_object_for_existing_app( |
591 | + APP, raw_proxy=raw_proxy) |
592 | |
593 | from ubuntu_system_tests.helpers.messaging._cpo import MainView |
594 | proxy = autopilot.get_proxy_object_for_existing_app(APP) |
595 | |
596 | === modified file 'ubuntu_system_tests/helpers/messaging/fixture_setup.py' |
597 | --- ubuntu_system_tests/helpers/messaging/fixture_setup.py 2015-12-14 09:58:30 +0000 |
598 | +++ ubuntu_system_tests/helpers/messaging/fixture_setup.py 2016-07-15 14:58:58 +0000 |
599 | @@ -24,10 +24,13 @@ |
600 | import shutil |
601 | import subprocess |
602 | |
603 | -from messaging_app import fixture_setup |
604 | +from ubuntu_system_tests.helpers import ( |
605 | + file_system as fs, |
606 | + system_settings, |
607 | + try_import, |
608 | +) |
609 | |
610 | -from ubuntu_system_tests.helpers import file_system as fs |
611 | -from ubuntu_system_tests.helpers import system_settings |
612 | +fixture_setup = try_import('messaging_app.fixture_setup') |
613 | |
614 | MESSAGING_APP_CONF = 'com.ubuntu.messaging-app/MessagingApp.conf' |
615 | |
616 | |
617 | === modified file 'ubuntu_system_tests/helpers/processes.py' |
618 | --- ubuntu_system_tests/helpers/processes.py 2016-06-08 19:11:00 +0000 |
619 | +++ ubuntu_system_tests/helpers/processes.py 2016-07-15 14:58:58 +0000 |
620 | @@ -25,13 +25,36 @@ |
621 | |
622 | import psutil |
623 | |
624 | -from unity8.process_helpers import get_job_status |
625 | +from ubuntu_system_tests.helpers import ( |
626 | + try_import, |
627 | + wait_until, |
628 | +) |
629 | |
630 | -from ubuntu_system_tests.helpers import wait_until |
631 | +process_helpers = try_import('unity8.process_helpers') |
632 | |
633 | logger = logging.getLogger(__name__) |
634 | |
635 | |
636 | +def get_job_pid(name): |
637 | + return process_helpers.get_job_pid(name) |
638 | + |
639 | + |
640 | +def get_job_status(name): |
641 | + return process_helpers.get_job_status(name) |
642 | + |
643 | + |
644 | +def is_job_running(name): |
645 | + return process_helpers.is_job_running(name) |
646 | + |
647 | + |
648 | +def start_job(name, *args): |
649 | + return process_helpers.start_job(name, *args) |
650 | + |
651 | + |
652 | +def stop_job(name): |
653 | + return process_helpers.stop_job(name) |
654 | + |
655 | + |
656 | def is_process_running(pname): |
657 | try: |
658 | return bool(get_process_ids(pname)) |
659 | |
660 | === modified file 'ubuntu_system_tests/helpers/scopes/music/_cpo.py' |
661 | --- ubuntu_system_tests/helpers/scopes/music/_cpo.py 2016-06-21 14:49:38 +0000 |
662 | +++ ubuntu_system_tests/helpers/scopes/music/_cpo.py 2016-07-15 14:58:58 +0000 |
663 | @@ -144,7 +144,7 @@ |
664 | |
665 | def is_category_displayed(self, category): |
666 | """ Indicates if a category section is being displayed """ |
667 | - is_element(self._get_category, category) |
668 | + is_element(self._get_category_section, category) |
669 | |
670 | def select_category(self, header): |
671 | """ |
672 | |
673 | === modified file 'ubuntu_system_tests/helpers/sensors.py' |
674 | --- ubuntu_system_tests/helpers/sensors.py 2016-04-25 19:02:31 +0000 |
675 | +++ ubuntu_system_tests/helpers/sensors.py 2016-07-15 14:58:58 +0000 |
676 | @@ -21,12 +21,15 @@ |
677 | import os |
678 | import subprocess |
679 | |
680 | -from unity8.sensors import FakePlatformSensors as Unity8Sensors |
681 | - |
682 | -from ubuntu_system_tests.helpers import context |
683 | +from ubuntu_system_tests.helpers import ( |
684 | + context, |
685 | + try_import, |
686 | +) |
687 | from ubuntu_system_tests.helpers.power import write_to_powerd_fifo |
688 | from ubuntu_system_tests.helpers.testbed import run_command_with_sudo as sudo |
689 | |
690 | +Unity8Sensors = try_import('unity8.sensors').FakePlatformSensors |
691 | + |
692 | DELAY_MS = 10 |
693 | ACCEL_SENSOR_RESOLUTION = 0.1 |
694 | ACCEL_SENSOR_MAX = 1000 |
695 | @@ -120,7 +123,7 @@ |
696 | |
697 | |
698 | def set_orientation(orientation): |
699 | - """Set accelerometer sensor orientation to specified value. |
700 | + """Set orientation sensor to specified value. |
701 | :param orientation: Orientation to set. |
702 | """ |
703 | Unity8Sensors(context.shared.get('unity_pid')).set_orientation(orientation) |
704 | |
705 | === modified file 'ubuntu_system_tests/helpers/system_settings/__init__.py' |
706 | --- ubuntu_system_tests/helpers/system_settings/__init__.py 2016-06-02 10:38:49 +0000 |
707 | +++ ubuntu_system_tests/helpers/system_settings/__init__.py 2016-07-15 14:58:58 +0000 |
708 | @@ -30,6 +30,7 @@ |
709 | get_rotation_lock, |
710 | get_silent_mode, |
711 | get_system_settings_proxy, |
712 | + is_reporting_enabled, |
713 | is_system_settings_running, |
714 | launch_system_settings, |
715 | set_default_modem_for_calls, |
716 | @@ -56,6 +57,7 @@ |
717 | 'get_rotation_lock', |
718 | 'get_silent_mode', |
719 | 'get_system_settings_proxy', |
720 | + 'is_reporting_enabled', |
721 | 'is_system_settings_running', |
722 | 'launch_system_settings', |
723 | 'set_default_modem_for_calls', |
724 | |
725 | === modified file 'ubuntu_system_tests/helpers/system_settings/_cpo.py' |
726 | --- ubuntu_system_tests/helpers/system_settings/_cpo.py 2016-06-01 16:14:35 +0000 |
727 | +++ ubuntu_system_tests/helpers/system_settings/_cpo.py 2016-07-15 14:58:58 +0000 |
728 | @@ -29,7 +29,7 @@ |
729 | from ubuntu_system_tests.helpers.autopilot import ( |
730 | validate_dbus_object, is_element) |
731 | from ubuntu_system_tests.helpers.autopilot.list import order_by_y_coord |
732 | -from ubuntu_system_tests.helpers.brightness import BrightnessPageBase |
733 | +from ubuntu_system_tests.helpers.brightness._cpo import BrightnessPageBase |
734 | |
735 | logger = logging.getLogger(__name__) |
736 | |
737 | |
738 | === modified file 'ubuntu_system_tests/helpers/system_settings/app.py' |
739 | --- ubuntu_system_tests/helpers/system_settings/app.py 2016-06-02 10:38:49 +0000 |
740 | +++ ubuntu_system_tests/helpers/system_settings/app.py 2016-07-15 14:58:58 +0000 |
741 | @@ -18,7 +18,9 @@ |
742 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
743 | # |
744 | |
745 | +import configparser |
746 | import dbus |
747 | +import os |
748 | from subprocess import ( |
749 | CalledProcessError, |
750 | check_call, |
751 | @@ -64,8 +66,7 @@ |
752 | |
753 | """ |
754 | from ubuntu_system_tests.helpers.system_settings import _cpo # NOQA |
755 | - proxy = autopilot.get_proxy_object_for_existing_app( |
756 | - APP, cleanup_process=APP_WIN_ID) |
757 | + proxy = autopilot.get_proxy_object_for_existing_app(APP) |
758 | return proxy.main_view |
759 | |
760 | |
761 | @@ -191,3 +192,14 @@ |
762 | def set_silent_mode(state): |
763 | """Set boolean value for silent mode setting.""" |
764 | _get_sound_interface().SetState('silent-mode', state, []) |
765 | + |
766 | + |
767 | +def is_reporting_enabled(): |
768 | + """ Detect if the reporting is enabled """ |
769 | + file = os.path.join('/', 'etc', 'writable', 'whoopsie') |
770 | + if not os.path.isfile(file): |
771 | + return True |
772 | + |
773 | + config = configparser.ConfigParser() |
774 | + config.read(file) |
775 | + return 'report_metrics' not in config.options('General') |
776 | |
777 | === modified file 'ubuntu_system_tests/helpers/ubuntu_keyboard/__init__.py' |
778 | --- ubuntu_system_tests/helpers/ubuntu_keyboard/__init__.py 2016-06-02 10:49:38 +0000 |
779 | +++ ubuntu_system_tests/helpers/ubuntu_keyboard/__init__.py 2016-07-15 14:58:58 +0000 |
780 | @@ -20,6 +20,7 @@ |
781 | |
782 | from ubuntu_system_tests.helpers.ubuntu_keyboard.utils import ( |
783 | APP, |
784 | + get_keyboard, |
785 | get_ubuntu_keyboard_proxy, |
786 | is_keyboard_shifted, |
787 | ) |
788 | @@ -27,6 +28,7 @@ |
789 | |
790 | __all__ = [ |
791 | 'APP', |
792 | + 'get_keyboard', |
793 | 'get_ubuntu_keyboard_proxy', |
794 | 'is_keyboard_shifted', |
795 | ] |
796 | |
797 | === modified file 'ubuntu_system_tests/helpers/ubuntu_keyboard/utils.py' |
798 | --- ubuntu_system_tests/helpers/ubuntu_keyboard/utils.py 2016-06-02 10:49:38 +0000 |
799 | +++ ubuntu_system_tests/helpers/ubuntu_keyboard/utils.py 2016-07-15 14:58:58 +0000 |
800 | @@ -18,8 +18,6 @@ |
801 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
802 | # |
803 | |
804 | -from ubuntu_keyboard.emulators.keyboard import Keyboard |
805 | - |
806 | from ubuntu_system_tests.helpers import autopilot |
807 | |
808 | APP = 'maliit-server' |
809 | @@ -31,5 +29,9 @@ |
810 | |
811 | |
812 | def is_keyboard_shifted(): |
813 | - keyboard = Keyboard() |
814 | - return keyboard.active_keypad_state == 'SHIFTED' |
815 | + return get_keyboard().active_keypad_state == 'SHIFTED' |
816 | + |
817 | + |
818 | +def get_keyboard(): |
819 | + from ubuntu_keyboard.emulators.keyboard import Keyboard |
820 | + return Keyboard() |
821 | |
822 | === modified file 'ubuntu_system_tests/helpers/unity8/__init__.py' |
823 | --- ubuntu_system_tests/helpers/unity8/__init__.py 2016-06-02 11:07:46 +0000 |
824 | +++ ubuntu_system_tests/helpers/unity8/__init__.py 2016-07-15 14:58:58 +0000 |
825 | @@ -19,28 +19,34 @@ |
826 | # |
827 | |
828 | from ubuntu_system_tests.helpers.unity8.utils import ( |
829 | + APP_WIN_NAME, |
830 | close_all_apps, |
831 | close_app, |
832 | ensure_unity_running_and_greeter_hidden, |
833 | ensure_unity_stopped, |
834 | get_dash, |
835 | + get_unity_pid, |
836 | launch_application_from_launcher, |
837 | + lock_unity, |
838 | PROC_NAME, |
839 | UNITY8_PATH_ROOT, |
840 | UNITY8_DASH_PATH_ROOT, |
841 | - APP_WIN_NAME, |
842 | + unlock_unity, |
843 | ) |
844 | |
845 | |
846 | __all__ = [ |
847 | + 'APP_WIN_NAME', |
848 | 'close_all_apps', |
849 | 'close_app', |
850 | 'ensure_unity_running_and_greeter_hidden', |
851 | 'ensure_unity_stopped', |
852 | 'get_dash', |
853 | + 'get_unity_pid', |
854 | 'launch_application_from_launcher', |
855 | + 'lock_unity', |
856 | 'PROC_NAME', |
857 | 'UNITY8_PATH_ROOT', |
858 | 'UNITY8_DASH_PATH_ROOT', |
859 | - 'APP_WIN_NAME', |
860 | + 'unlock_unity', |
861 | ] |
862 | |
863 | === modified file 'ubuntu_system_tests/helpers/unity8/settings_wizard.py' |
864 | --- ubuntu_system_tests/helpers/unity8/settings_wizard.py 2016-02-03 10:40:06 +0000 |
865 | +++ ubuntu_system_tests/helpers/unity8/settings_wizard.py 2016-07-15 14:58:58 +0000 |
866 | @@ -16,9 +16,7 @@ |
867 | # You should have received a copy of the GNU General Public License |
868 | # along with this program. If not, see <http://www.gnu.org/licenses/> |
869 | |
870 | -import configparser |
871 | import logging |
872 | -import os |
873 | import re |
874 | |
875 | import autopilot |
876 | @@ -27,6 +25,9 @@ |
877 | |
878 | from ubuntu_system_tests.helpers.autopilot import ( |
879 | override_proxy_timeout, validate_dbus_object) |
880 | +from ubuntu_system_tests.helpers.system_settings import ( |
881 | + is_reporting_enabled, |
882 | +) |
883 | from ubuntu_system_tests.helpers.unity8 import UNITY8_PATH_ROOT |
884 | |
885 | logger = logging.getLogger(__name__) |
886 | @@ -36,17 +37,6 @@ |
887 | return current_page.get_root_instance().select_single(Wizard) |
888 | |
889 | |
890 | -def reporting_page_included(): |
891 | - """ Detect if the reporting was set by default """ |
892 | - file = os.path.join('/', 'etc', 'writable', 'whoopsie') |
893 | - if not os.path.isfile(file): |
894 | - return True |
895 | - |
896 | - config = configparser.ConfigParser() |
897 | - config.read(file) |
898 | - return 'report_metrics' not in config.options('General') |
899 | - |
900 | - |
901 | class Wizard(UbuntuUIToolkitCustomProxyObjectBase): |
902 | """High-level helper to navigate through the pages of the wizard""" |
903 | |
904 | @@ -489,7 +479,7 @@ |
905 | @autopilot.logging.log_action(logger.info) |
906 | def continue_(self): |
907 | self.pointing_device.click_object(self._get_continue_button()) |
908 | - if reporting_page_included(): |
909 | + if is_reporting_enabled(): |
910 | return get_wizard(self).get_reporting_page() |
911 | else: |
912 | return get_wizard(self).get_finished_page() |
913 | |
914 | === modified file 'ubuntu_system_tests/helpers/unity8/shell.py' |
915 | --- ubuntu_system_tests/helpers/unity8/shell.py 2016-06-13 10:43:31 +0000 |
916 | +++ ubuntu_system_tests/helpers/unity8/shell.py 2016-07-15 14:58:58 +0000 |
917 | @@ -25,11 +25,8 @@ |
918 | logging as autopilot_logging |
919 | ) |
920 | import ubuntuuitoolkit |
921 | -from unity8.shell.emulators import main_window |
922 | |
923 | from ubuntu_system_tests.helpers.autopilot import validate_dbus_object |
924 | -from ubuntu_system_tests.helpers.indicators.message import NotificationsIndicatorPage, NotificationsIndicatorItem # NOQA |
925 | -from ubuntu_system_tests.helpers.notifications.utils import Notifications |
926 | from ubuntu_system_tests.helpers.unity8 import ( |
927 | greeter as greeter_helpers, UNITY8_PATH_ROOT) |
928 | |
929 | @@ -48,6 +45,7 @@ |
930 | |
931 | @property |
932 | def main_window(self): |
933 | + from ubuntu_system_tests.helpers.unity8.shell_view import ShellView |
934 | return self.select_single(ShellView) |
935 | |
936 | @autopilot_logging.log_action(logger.debug) |
937 | @@ -82,88 +80,3 @@ |
938 | except exceptions.StateNotFoundError: |
939 | # This is fine, it's already loaded |
940 | pass |
941 | - |
942 | - |
943 | -class ShellView(main_window.ShellView): |
944 | - """Class to extend Unity8 main window ShellView.""" |
945 | - |
946 | - @classmethod |
947 | - def validate_dbus_object(cls, path, state): |
948 | - return validate_dbus_object( |
949 | - path, state, UNITY8_PATH_ROOT, b'ShellView', title='Unity8') |
950 | - |
951 | - def get_notifications_list(self): |
952 | - """Return a list of notifications currently being displayed.""" |
953 | - return self.select_single( |
954 | - Notifications, objectName='notificationList') |
955 | - |
956 | - def get_notifications_panel(self): |
957 | - """Return 'Notifications' panel object.""" |
958 | - return self._get_indicator_panel_item('indicator-messages') |
959 | - |
960 | - def clear_notifications(self): |
961 | - """ |
962 | - Clear all existing notifications from 'Notifications' indicator. |
963 | - |
964 | - """ |
965 | - if self.is_new_notification_displayed(): |
966 | - self.open_indicator_page('indicator-messages').clear_all() |
967 | - self.close_indicator_page() |
968 | - |
969 | - def open_notifications_indicator(self): |
970 | - """Swipe down to display the notifications indicator.""" |
971 | - return self.open_indicator_page('indicator-messages') |
972 | - |
973 | - def is_new_notification_displayed(self): |
974 | - """Return True if new notification message icon is displayed.""" |
975 | - return self.get_notifications_panel().is_new_message_displayed() |
976 | - |
977 | - def get_passphrase_unlock_screen(self): |
978 | - """Wait for input method to be in shown state and return lockscreen.""" |
979 | - from ubuntu_system_tests.helpers.unity8 import lock_screen |
980 | - input_method = self.wait_select_single( |
981 | - 'InputMethod', objectName='inputMethod', visible=True) |
982 | - input_method.state.wait_for('shown') |
983 | - return self.select_single(lock_screen.PassphraseLockscreen) |
984 | - |
985 | - def get_missed_call_snap_decision(self): |
986 | - """Return missed call snap decision menu.""" |
987 | - from ubuntu_system_tests.helpers.snap_decision import missed_call |
988 | - return self.select_single( |
989 | - missed_call.SnapDecisionMenu, objectName='snapDecision', |
990 | - visible=True) |
991 | - |
992 | - def get_phone_stage(self): |
993 | - from ubuntu_system_tests.helpers.unity8 import phone_stage |
994 | - return self.select_single(phone_stage.PhoneStage, objectName='stage') |
995 | - |
996 | - def swipe_to_show_app_switcher(self): |
997 | - """Swipe from right edge to reveal task switcher.""" |
998 | - stage = self.get_phone_stage() |
999 | - stage.swipe_to_top() |
1000 | - return stage |
1001 | - |
1002 | - def get_current_focused_app(self): |
1003 | - """Return Id for current focused app.""" |
1004 | - return self.select_single('Shell').focusedApplicationId |
1005 | - |
1006 | - def _is_indicator_panel_opened(self): |
1007 | - indicator_page = self.wait_select_single('IndicatorsMenu') |
1008 | - return indicator_page.fullyOpened |
1009 | - |
1010 | - def close_indicator_page(self): |
1011 | - """ |
1012 | - Override the method to only try to close the indicator panel if its |
1013 | - not already. |
1014 | - """ |
1015 | - if self._is_indicator_panel_opened(): |
1016 | - super().close_indicator_page() |
1017 | - |
1018 | - def is_indicator_item_hidden(self, indicator_name): |
1019 | - """ |
1020 | - Return bool representing if the requested indicator item is hidden or |
1021 | - not. |
1022 | - """ |
1023 | - item = self.select_single('IndicatorItem', |
1024 | - objectName=indicator_name + '-panelItem') |
1025 | - return item.hidden |
1026 | |
1027 | === added file 'ubuntu_system_tests/helpers/unity8/shell_view.py' |
1028 | --- ubuntu_system_tests/helpers/unity8/shell_view.py 1970-01-01 00:00:00 +0000 |
1029 | +++ ubuntu_system_tests/helpers/unity8/shell_view.py 2016-07-15 14:58:58 +0000 |
1030 | @@ -0,0 +1,116 @@ |
1031 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
1032 | + |
1033 | +# |
1034 | +# Ubuntu System Tests |
1035 | +# Copyright (C) 2015, 2016 Canonical |
1036 | +# |
1037 | +# This program is free software: you can redistribute it and/or modify |
1038 | +# it under the terms of the GNU General Public License as published by |
1039 | +# the Free Software Foundation, either version 3 of the License, or |
1040 | +# (at your option) any later version. |
1041 | +# |
1042 | +# This program is distributed in the hope that it will be useful, |
1043 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1044 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1045 | +# GNU General Public License for more details. |
1046 | +# |
1047 | +# You should have received a copy of the GNU General Public License |
1048 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1049 | +# |
1050 | + |
1051 | +from unity8.shell.emulators import main_window |
1052 | + |
1053 | +from ubuntu_system_tests.helpers.autopilot import validate_dbus_object |
1054 | +from ubuntu_system_tests.helpers.indicators.message import NotificationsIndicatorItem # NOQA |
1055 | +from ubuntu_system_tests.helpers.notifications.utils import Notifications |
1056 | +from ubuntu_system_tests.helpers.unity8 import UNITY8_PATH_ROOT |
1057 | + |
1058 | + |
1059 | +class ShellView(main_window.ShellView): |
1060 | + """Class to extend Unity8 main window ShellView.""" |
1061 | + |
1062 | + @classmethod |
1063 | + def validate_dbus_object(cls, path, state): |
1064 | + return validate_dbus_object( |
1065 | + path, state, UNITY8_PATH_ROOT, b'ShellView', title='Unity8') |
1066 | + |
1067 | + def get_notifications_list(self): |
1068 | + """Return a list of notifications currently being displayed.""" |
1069 | + return self.select_single( |
1070 | + Notifications, objectName='notificationList') |
1071 | + |
1072 | + def get_notifications_panel(self): |
1073 | + """Return 'Notifications' panel object.""" |
1074 | + return self._get_indicator_panel_item('indicator-messages') |
1075 | + |
1076 | + def clear_notifications(self): |
1077 | + """ |
1078 | + Clear all existing notifications from 'Notifications' indicator. |
1079 | + |
1080 | + """ |
1081 | + if self.is_new_notification_displayed(): |
1082 | + self.open_indicator_page('indicator-messages').clear_all() |
1083 | + self.close_indicator_page() |
1084 | + |
1085 | + def open_notifications_indicator(self): |
1086 | + """Swipe down to display the notifications indicator.""" |
1087 | + return self.open_indicator_page('indicator-messages') |
1088 | + |
1089 | + def is_new_notification_displayed(self): |
1090 | + """Return True if new notification message icon is displayed.""" |
1091 | + return self.get_notifications_panel().is_new_message_displayed() |
1092 | + |
1093 | + def get_passphrase_unlock_screen(self): |
1094 | + """Wait for input method to be in shown state and return lockscreen.""" |
1095 | + from ubuntu_system_tests.helpers.unity8 import lock_screen |
1096 | + input_method = self.wait_select_single( |
1097 | + 'InputMethod', objectName='inputMethod', visible=True) |
1098 | + input_method.state.wait_for('shown') |
1099 | + return self.select_single(lock_screen.PassphraseLockscreen) |
1100 | + |
1101 | + def get_missed_call_snap_decision(self): |
1102 | + """Return missed call snap decision menu.""" |
1103 | + from ubuntu_system_tests.helpers.snap_decision import missed_call |
1104 | + return self.select_single( |
1105 | + missed_call.SnapDecisionMenu, objectName='snapDecision', |
1106 | + visible=True) |
1107 | + |
1108 | + def get_phone_stage(self): |
1109 | + from ubuntu_system_tests.helpers.unity8 import phone_stage |
1110 | + return self.select_single(phone_stage.PhoneStage, objectName='stage') |
1111 | + |
1112 | + def swipe_to_show_app_switcher(self): |
1113 | + """Swipe from right edge to reveal task switcher.""" |
1114 | + stage = self.get_phone_stage() |
1115 | + stage.swipe_to_top() |
1116 | + return stage |
1117 | + |
1118 | + def get_settings_wizard(self): |
1119 | + """Return settings wizard custom proxy object.""" |
1120 | + from ubuntu_system_tests.helpers.unity8.settings_wizard import Wizard |
1121 | + return self.select_single(Wizard) |
1122 | + |
1123 | + def get_current_focused_app(self): |
1124 | + """Return Id for current focused app.""" |
1125 | + return self.select_single('Shell').focusedApplicationId |
1126 | + |
1127 | + def _is_indicator_panel_opened(self): |
1128 | + indicator_page = self.wait_select_single('IndicatorsMenu') |
1129 | + return indicator_page.fullyOpened |
1130 | + |
1131 | + def close_indicator_page(self): |
1132 | + """ |
1133 | + Override the method to only try to close the indicator panel if its |
1134 | + not already. |
1135 | + """ |
1136 | + if self._is_indicator_panel_opened(): |
1137 | + super().close_indicator_page() |
1138 | + |
1139 | + def is_indicator_item_hidden(self, indicator_name): |
1140 | + """ |
1141 | + Return bool representing if the requested indicator item is hidden or |
1142 | + not. |
1143 | + """ |
1144 | + item = self.select_single('IndicatorItem', |
1145 | + objectName=indicator_name + '-panelItem') |
1146 | + return item.hidden |
1147 | |
1148 | === modified file 'ubuntu_system_tests/helpers/unity8/utils.py' |
1149 | --- ubuntu_system_tests/helpers/unity8/utils.py 2016-06-02 11:07:46 +0000 |
1150 | +++ ubuntu_system_tests/helpers/unity8/utils.py 2016-07-15 14:58:58 +0000 |
1151 | @@ -18,17 +18,22 @@ |
1152 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1153 | # |
1154 | |
1155 | -from ubuntuuitoolkit import UbuntuUIToolkitCustomProxyObjectBase |
1156 | -from unity8 import process_helpers |
1157 | - |
1158 | -from autopilot import introspection |
1159 | from autopilot.matchers import Eventually |
1160 | from testtools.matchers import Equals |
1161 | |
1162 | -from ubuntu_system_tests.helpers import context |
1163 | -from ubuntu_system_tests.helpers import timer |
1164 | +from ubuntu_system_tests.helpers import ( |
1165 | + context, |
1166 | + processes, |
1167 | + timer, |
1168 | + try_import, |
1169 | +) |
1170 | +from ubuntu_system_tests.helpers.autopilot import ( |
1171 | + get_proxy_object_for_existing_app, |
1172 | +) |
1173 | from ubuntu_system_tests.helpers.unity8 import greeter |
1174 | |
1175 | +process_helpers = try_import('unity8.process_helpers') |
1176 | + |
1177 | PROC_NAME = 'unity8' |
1178 | UNITY8_PATH_ROOT = b'unity8' |
1179 | UNITY8_DASH_PATH_ROOT = b'unity8-dash' |
1180 | @@ -37,30 +42,38 @@ |
1181 | |
1182 | def ensure_unity_stopped(): |
1183 | if _is_unity8_running(): |
1184 | - process_helpers.stop_job('unity8') |
1185 | + processes.stop_job('unity8') |
1186 | Eventually(Equals(False), timeout=300).match(_is_unity8_running) |
1187 | |
1188 | |
1189 | def ensure_unity_running_and_greeter_hidden(): |
1190 | if not _is_unity8_running(): |
1191 | - process_helpers.start_job('unity8') |
1192 | + processes.start_job('unity8') |
1193 | greeter.wait_for_greeter() |
1194 | |
1195 | greeter.hide_greeter_with_dbus() |
1196 | |
1197 | |
1198 | +def get_unity_pid(): |
1199 | + return process_helpers._get_unity_pid() |
1200 | + |
1201 | + |
1202 | +def lock_unity(): |
1203 | + process_helpers.lock_unity() |
1204 | + |
1205 | + |
1206 | +def unlock_unity(): |
1207 | + process_helpers.unlock_unity() |
1208 | + |
1209 | + |
1210 | def _is_unity8_running(): |
1211 | - return process_helpers.is_job_running('unity8') |
1212 | + return processes.is_job_running('unity8') |
1213 | |
1214 | |
1215 | def get_dash(): |
1216 | """Return the Unity8 Dash autopilot custom proxy object.""" |
1217 | from ubuntu_system_tests.helpers.unity8.dash import Dash |
1218 | - pid = process_helpers.get_job_pid('unity8-dash') |
1219 | - dash_proxy = introspection.get_proxy_object_for_existing_process( |
1220 | - pid=pid, |
1221 | - emulator_base=UbuntuUIToolkitCustomProxyObjectBase, |
1222 | - ) |
1223 | + dash_proxy = get_proxy_object_for_existing_app('unity8-dash') |
1224 | return dash_proxy.select_single(Dash) |
1225 | |
1226 | |
1227 | |
1228 | === modified file 'ubuntu_system_tests/helpers/utils.py' |
1229 | --- ubuntu_system_tests/helpers/utils.py 2016-06-02 12:50:05 +0000 |
1230 | +++ ubuntu_system_tests/helpers/utils.py 2016-07-15 14:58:58 +0000 |
1231 | @@ -18,9 +18,43 @@ |
1232 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1233 | # |
1234 | |
1235 | +import logging |
1236 | import time |
1237 | |
1238 | from collections import deque |
1239 | +from importlib import import_module |
1240 | +from inspect import stack |
1241 | + |
1242 | +logger = logging.getLogger(__name__) |
1243 | + |
1244 | + |
1245 | +def try_import(name, package=None): |
1246 | + """ |
1247 | + Import named module from package and return it or DummyObject if not found. |
1248 | + |
1249 | + This method is used in cases where an import is made but should not raise |
1250 | + an ImportError if the module is not found. The main usage for this is |
1251 | + where an autopilot package is not installed on the host, but it is still |
1252 | + required to list all availble tests on the host. In this case the test |
1253 | + module must import successfully, but won't actually be executed so it is |
1254 | + not neccessary to have the dependency installed. |
1255 | + |
1256 | + If a DummyObject is returned this allows any attributes or methods to be |
1257 | + imported from the DummyObject without error. |
1258 | + |
1259 | + :param name: Absolute or relative name of module to import. |
1260 | + :param package: If name is relative, package must specify the name of the |
1261 | + package to import from. |
1262 | + :return: Imported module or DummyObject if it doesn't exist. |
1263 | + |
1264 | + """ |
1265 | + try: |
1266 | + return import_module(name, package) |
1267 | + except ImportError as e: |
1268 | + logger.warn(e.msg) |
1269 | + logger.warn('DummyObject created for module: {m} at: {i}'.format( |
1270 | + m=name, i=_get_caller_info())) |
1271 | + return DummyObject() |
1272 | |
1273 | |
1274 | def wait_until(predicate, *args, timeout=10, period=1, stop_event=None, |
1275 | @@ -105,9 +139,49 @@ |
1276 | return bool(result) |
1277 | |
1278 | |
1279 | +def _get_caller_info(stack_level=2): |
1280 | + """Return info string about the caller of the calling function. |
1281 | + |
1282 | + :param stack_level: Number of level up the call stack to check. |
1283 | + :return: String info showing file path and line number. |
1284 | + """ |
1285 | + caller = stack()[stack_level] |
1286 | + return '{path}:{line}'.format(path=caller[1], line=caller[2]) |
1287 | + |
1288 | + |
1289 | class AttrDict(dict): |
1290 | """ Class used to access to the dict keys as parameters """ |
1291 | |
1292 | def __init__(self, *args, **kwargs): |
1293 | super(AttrDict, self).__init__(*args, **kwargs) |
1294 | self.__dict__ = self |
1295 | + |
1296 | + |
1297 | +class DummyObject: |
1298 | + """ |
1299 | + Class used to create objects with dummy attributes and methods. |
1300 | + |
1301 | + This is used when an object is required to return a dummy attribute value |
1302 | + or method result rather than raise a AttributeError or TypeError |
1303 | + exception. |
1304 | + |
1305 | + This class can be used to create objects that support nested attributes |
1306 | + and methods. |
1307 | + |
1308 | + """ |
1309 | + |
1310 | + def __init__(self, *args, **kwargs): |
1311 | + pass |
1312 | + |
1313 | + def __getattribute__(self, name): |
1314 | + """Return a refernce to self for every attribute value to support |
1315 | + nested attributes.""" |
1316 | + logger.warn('Accessing DummyObject attribute: {n} from: {f}'.format( |
1317 | + n=name, f=_get_caller_info())) |
1318 | + return self |
1319 | + |
1320 | + def __call__(self, *args, **kwargs): |
1321 | + """Return a reference to self for every function call to support |
1322 | + nested function calls.""" |
1323 | + logger.warn('DummyObject call from: {}'.format(_get_caller_info())) |
1324 | + return self |
1325 | |
1326 | === modified file 'ubuntu_system_tests/helpers/webapp/ebay.py' |
1327 | --- ubuntu_system_tests/helpers/webapp/ebay.py 2016-05-06 22:37:58 +0000 |
1328 | +++ ubuntu_system_tests/helpers/webapp/ebay.py 2016-07-15 14:58:58 +0000 |
1329 | @@ -18,11 +18,14 @@ |
1330 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1331 | # |
1332 | |
1333 | -from selenium.webdriver.support.ui import WebDriverWait |
1334 | - |
1335 | -from ubuntu_system_tests.helpers import webapp |
1336 | +from ubuntu_system_tests.helpers import ( |
1337 | + try_import, |
1338 | + webapp, |
1339 | +) |
1340 | from ubuntu_system_tests.helpers.webapp import BasePage |
1341 | |
1342 | +WebDriverWait = try_import('selenium.webdriver.support.ui').WebDriverWait |
1343 | + |
1344 | WEBAPP_NAME = 'eBay' |
1345 | WEBAPP_PACKAGE = 'com.ubuntu.developer.webapps.webapp-ebay' |
1346 | WEBAPP_WIN_ID = 'com.ubuntu.developer.webapps.webapp-ebay_webapp-ebay' |
1347 | |
1348 | === modified file 'ubuntu_system_tests/helpers/webapp/here.py' |
1349 | --- ubuntu_system_tests/helpers/webapp/here.py 2016-05-06 22:37:58 +0000 |
1350 | +++ ubuntu_system_tests/helpers/webapp/here.py 2016-07-15 14:58:58 +0000 |
1351 | @@ -20,14 +20,17 @@ |
1352 | |
1353 | import re |
1354 | |
1355 | -from selenium.common.exceptions import TimeoutException |
1356 | -from selenium.webdriver.common.by import By |
1357 | -from selenium.webdriver.support import expected_conditions as EC |
1358 | -from selenium.webdriver.support.ui import WebDriverWait |
1359 | - |
1360 | -from ubuntu_system_tests.helpers import webapp |
1361 | +from ubuntu_system_tests.helpers import ( |
1362 | + try_import, |
1363 | + webapp, |
1364 | +) |
1365 | from ubuntu_system_tests.helpers.webapp import BasePage |
1366 | |
1367 | +TimeoutException = try_import('selenium.common.exceptions').TimeoutException |
1368 | +By = try_import('selenium.webdriver.common.by').By |
1369 | +EC = try_import('selenium.webdriver.support.expected_conditions') |
1370 | +WebDriverWait = try_import('selenium.webdriver.support.ui').WebDriverWait |
1371 | + |
1372 | WEBAPP_NAME = 'HERE Maps' |
1373 | WEBAPP_PACKAGE = 'com.nokia.heremaps' |
1374 | WEBAPP_WIN_ID = 'com.nokia.heremaps_here' |
1375 | |
1376 | === modified file 'ubuntu_system_tests/helpers/webapp/utils.py' |
1377 | --- ubuntu_system_tests/helpers/webapp/utils.py 2016-06-09 19:56:51 +0000 |
1378 | +++ ubuntu_system_tests/helpers/webapp/utils.py 2016-07-15 14:58:58 +0000 |
1379 | @@ -24,17 +24,20 @@ |
1380 | import os |
1381 | import time |
1382 | |
1383 | -from selenium import webdriver |
1384 | -from selenium.webdriver.chrome.options import Options |
1385 | -from selenium.webdriver.common.touch_actions import TouchActions |
1386 | - |
1387 | -from ubuntu_system_tests.helpers import autopilot |
1388 | -from ubuntu_system_tests.helpers import processes |
1389 | +from ubuntu_system_tests.helpers import ( |
1390 | + autopilot, |
1391 | + processes, |
1392 | + try_import, |
1393 | +) |
1394 | from ubuntu_system_tests.helpers.scopes.apps import ( |
1395 | launch_application_from_apps_scope |
1396 | ) |
1397 | from ubuntu_system_tests.helpers import wait_until |
1398 | |
1399 | +webdriver = try_import('selenium.webdriver') |
1400 | +Options = webdriver.chrome.options.Options |
1401 | +TouchActions = webdriver.common.touch_actions.TouchActions |
1402 | + |
1403 | DEFAULT_WEBVIEW_INSPECTOR_IP = '127.0.0.1' |
1404 | DEFAULT_WEBVIEW_INSPECTOR_PORT = 9221 |
1405 | |
1406 | @@ -138,7 +141,7 @@ |
1407 | :returns: a string containing the chromedriver executable path |
1408 | """ |
1409 | base_deps_dir = '' |
1410 | - default_path = 'usr/lib/*/oxide-qt/chromedriver' |
1411 | + default_path = 'usr/lib/chromium-browser/chromedriver' |
1412 | adt_artifacts = os.path.dirname(os.getenv('ADT_ARTIFACTS', default='')) |
1413 | |
1414 | # This check is to avoid using a dependencies dir which has not been |
1415 | |
1416 | === modified file 'ubuntu_system_tests/helpers/webbrowser/fixture_setup.py' |
1417 | --- ubuntu_system_tests/helpers/webbrowser/fixture_setup.py 2016-03-28 17:58:25 +0000 |
1418 | +++ ubuntu_system_tests/helpers/webbrowser/fixture_setup.py 2016-07-15 14:58:58 +0000 |
1419 | @@ -24,9 +24,11 @@ |
1420 | import time |
1421 | |
1422 | import fixtures |
1423 | -from ubuntuuitoolkit import fixture_setup as ubuntuuitoolkit_fixtures |
1424 | |
1425 | -from ubuntu_system_tests.helpers import sqlite |
1426 | +from ubuntu_system_tests.helpers import ( |
1427 | + sqlite, |
1428 | + try_import, |
1429 | +) |
1430 | from ubuntu_system_tests.helpers.backup_restore_fixture import ( |
1431 | BackupRestoreFixture) |
1432 | from ubuntu_system_tests.helpers.download_manager import ( |
1433 | @@ -37,6 +39,8 @@ |
1434 | from ubuntu_system_tests.helpers.media import BackupRestoreLocalMediaFixture |
1435 | from ubuntu_system_tests.helpers.webbrowser import APP |
1436 | |
1437 | +ubuntuuitoolkit_fixtures = try_import('ubuntuuitoolkit.fixture_setup') |
1438 | + |
1439 | |
1440 | class WebbrowserTestEnvironment(fixtures.Fixture): |
1441 | """Fixture to prepare webbrowser test environment.""" |
1442 | |
1443 | === modified file 'ubuntu_system_tests/selftests/test_commands.py' |
1444 | --- ubuntu_system_tests/selftests/test_commands.py 2016-07-04 09:20:08 +0000 |
1445 | +++ ubuntu_system_tests/selftests/test_commands.py 2016-07-15 14:58:58 +0000 |
1446 | @@ -66,7 +66,16 @@ |
1447 | |
1448 | self.assertNotIn('-s', command) |
1449 | |
1450 | - def test_adt_run_must_be_called_with_short_timeout(self): |
1451 | + |
1452 | +@mock.patch('ubuntu_system_tests.common.ssh.get_ssh_config_commands') |
1453 | +class BuildAdtRunCommandTestCase(selftests.ConfigBaseTestCase): |
1454 | + |
1455 | + def setUp(self): |
1456 | + super().setUp() |
1457 | + self.config_stack = config.UbuntuSystemTestsConfig() |
1458 | + |
1459 | + def test_adt_run_must_be_called_with_short_timeout( |
1460 | + self, mock_ssh_config_commands): |
1461 | self.set_config_values() |
1462 | |
1463 | command = commands.build_adt_run_test_command( |
1464 | @@ -75,20 +84,26 @@ |
1465 | |
1466 | run_arguments, _ = command.split('---') |
1467 | self.assertIn('--timeout-short=600', run_arguments) |
1468 | + mock_ssh_config_commands.assert_called_once_with() |
1469 | |
1470 | - def test_adt_run_command_no_rw_file_mount(self): |
1471 | + def test_adt_run_command_no_rw_file_mount( |
1472 | + self, mock_ssh_config_commands): |
1473 | self.set_config_values() |
1474 | run_cmd = ' '.join(commands.build_adt_run_test_command( |
1475 | self.config_stack, config.KEY_DEFAULT)) |
1476 | self.assertNotIn('mount -o remount,rw /', run_cmd) |
1477 | + mock_ssh_config_commands.assert_called_once_with() |
1478 | |
1479 | - def test_adt_run_command_ro_file_mount(self): |
1480 | + def test_adt_run_command_ro_file_mount( |
1481 | + self, mock_ssh_config_commands): |
1482 | self.set_config_values() |
1483 | run_cmd = ' '.join(commands.build_adt_run_test_command( |
1484 | self.config_stack, config.KEY_DEFAULT)) |
1485 | self.assertIn('mount -o remount,ro /', run_cmd) |
1486 | + mock_ssh_config_commands.assert_called_once_with() |
1487 | |
1488 | - def test_adt_run_with_serial(self): |
1489 | + def test_adt_run_with_serial( |
1490 | + self, mock_ssh_config_commands): |
1491 | serial = 'test_serial' |
1492 | self.set_config_values(device_serial=serial) |
1493 | |
1494 | @@ -98,8 +113,10 @@ |
1495 | |
1496 | _, adb_arguments = command.split('ssh -s adb --') |
1497 | self.assertIn('-s test_serial', adb_arguments) |
1498 | + mock_ssh_config_commands.assert_called_once_with() |
1499 | |
1500 | - def test_adt_run_without_serial(self): |
1501 | + def test_adt_run_without_serial( |
1502 | + self, mock_ssh_config_commands): |
1503 | self.set_config_values(device_serial='') |
1504 | |
1505 | command = commands.build_adt_run_test_command( |
1506 | @@ -108,8 +125,10 @@ |
1507 | |
1508 | _, adb_arguments = command.split('ssh -s adb --') |
1509 | self.assertNotIn('-s test_serial', adb_arguments) |
1510 | + mock_ssh_config_commands.assert_called_once_with() |
1511 | |
1512 | - def test_adt_run_command_with_network_ready_creates_no_network(self): |
1513 | + def test_adt_run_command_with_network_ready_creates_no_network( |
1514 | + self, mock_ssh_config_commands): |
1515 | self.set_config_values() |
1516 | |
1517 | command = commands.build_adt_run_test_command( |
1518 | @@ -117,8 +136,10 @@ |
1519 | |
1520 | self.assertFalse(check_any_item_in_list_startswith_value( |
1521 | command, 'nmcli device wifi connect')) |
1522 | + mock_ssh_config_commands.assert_called_once_with() |
1523 | |
1524 | - def test_adt_run_command_with_default_parameters_creates_network(self): |
1525 | + def test_adt_run_command_with_default_parameters_creates_network( |
1526 | + self, mock_ssh_config_commands): |
1527 | self.set_config_values() |
1528 | |
1529 | command = commands.build_adt_run_test_command( |
1530 | @@ -126,19 +147,24 @@ |
1531 | |
1532 | self.assertTrue(check_any_item_in_list_startswith_value( |
1533 | command, 'nmcli device wifi connect')) |
1534 | + mock_ssh_config_commands.assert_called_once_with() |
1535 | |
1536 | - def test_enabling_verbose_option(self): |
1537 | + def test_enabling_verbose_option( |
1538 | + self, mock_ssh_config_commands): |
1539 | self.set_config_values() |
1540 | command = commands.build_adt_run_test_command( |
1541 | self.config_stack, config.KEY_DEFAULT, verbose=True) |
1542 | self.assertTrue(check_any_item_in_list_contains_value(command, '-ddd')) |
1543 | + mock_ssh_config_commands.assert_called_once_with() |
1544 | |
1545 | - def test_verbose_disabled_by_default(self): |
1546 | + def test_verbose_disabled_by_default( |
1547 | + self, mock_ssh_config_commands): |
1548 | self.set_config_values() |
1549 | command = commands.build_adt_run_test_command( |
1550 | self.config_stack, config.KEY_DEFAULT) |
1551 | self.assertFalse( |
1552 | check_any_item_in_list_contains_value(command, '-ddd')) |
1553 | + mock_ssh_config_commands.assert_called_once_with() |
1554 | |
1555 | |
1556 | class SetupCommandTestCase(selftests.ConfigBaseTestCase): |
1557 | |
1558 | === modified file 'ubuntu_system_tests/selftests/test_tests_to_run.py' |
1559 | --- ubuntu_system_tests/selftests/test_tests_to_run.py 2016-06-06 09:53:20 +0000 |
1560 | +++ ubuntu_system_tests/selftests/test_tests_to_run.py 2016-07-15 14:58:58 +0000 |
1561 | @@ -133,7 +133,7 @@ |
1562 | 'ubuntu_system_tests.helpers.unity8.utils.greeter', |
1563 | new_callable=FakeGreeterHelpers) |
1564 | @mock.patch( |
1565 | - 'ubuntu_system_tests.helpers.unity8.utils.process_helpers', |
1566 | + 'ubuntu_system_tests.helpers.unity8.utils.processes', |
1567 | new_callable=FakeProcessHelpers) |
1568 | class EnsureUnityInRequiredStateTestCase(unittest.TestCase): |
1569 | |
1570 | |
1571 | === modified file 'ubuntu_system_tests/tests/base.py' |
1572 | --- ubuntu_system_tests/tests/base.py 2016-07-13 09:57:44 +0000 |
1573 | +++ ubuntu_system_tests/tests/base.py 2016-07-15 14:58:58 +0000 |
1574 | @@ -32,46 +32,58 @@ |
1575 | logging as autopilot_logging, |
1576 | testcase |
1577 | ) |
1578 | -from autopilot._fixtures import OSKAlwaysEnabled |
1579 | from autopilot.introspection import _object_registry as object_registry |
1580 | -from ubuntuuitoolkit import fixture_setup |
1581 | -from unity8 import process_helpers |
1582 | |
1583 | -from ubuntu_system_tests.helpers import autopilot |
1584 | -from ubuntu_system_tests.helpers import context |
1585 | -from ubuntu_system_tests.helpers import images |
1586 | -from ubuntu_system_tests.helpers import mir |
1587 | +from ubuntu_system_tests.helpers import ( |
1588 | + autopilot, |
1589 | + context, |
1590 | + images, |
1591 | + mir, |
1592 | + try_import, |
1593 | +) |
1594 | from ubuntu_system_tests.helpers.location.fixture_setup import ( |
1595 | SetLocationAccessRequests) |
1596 | from ubuntu_system_tests.helpers.notifications import sim_pin_observer |
1597 | from ubuntu_system_tests.helpers import ofono |
1598 | -from ubuntu_system_tests.helpers.processes import wait_for_job_spawned |
1599 | +from ubuntu_system_tests.helpers.processes import ( |
1600 | + start_job, |
1601 | + wait_for_job_spawned, |
1602 | +) |
1603 | from ubuntu_system_tests.helpers import screen |
1604 | from ubuntu_system_tests.helpers.timeout import timeout |
1605 | -from ubuntu_system_tests.helpers import unity8 |
1606 | -from ubuntu_system_tests.helpers.unity8 import get_dash |
1607 | -from ubuntu_system_tests.helpers.unity8 import sensors |
1608 | -from ubuntu_system_tests.helpers.unity8.shell import Unity8 # NOQA |
1609 | +from ubuntu_system_tests.helpers.unity8 import ( |
1610 | + ensure_unity_running_and_greeter_hidden, |
1611 | + ensure_unity_stopped, |
1612 | + get_dash, |
1613 | + get_unity_pid, |
1614 | + PROC_NAME, |
1615 | + sensors, |
1616 | +) |
1617 | from ubuntu_system_tests.helpers import wait_until |
1618 | -from ubuntu_system_tests.helpers import webapp |
1619 | +from ubuntu_system_tests.helpers.webapp import ( |
1620 | + DEFAULT_WEBVIEW_INSPECTOR_IP, |
1621 | + DEFAULT_WEBVIEW_INSPECTOR_PORT, |
1622 | +) |
1623 | |
1624 | # Any test name ending with this will leave device locked |
1625 | TEST_ID_DEVICE_LOCKED = 'device_locked' |
1626 | |
1627 | logger = logging.getLogger(__name__) |
1628 | |
1629 | +fixture_setup = try_import('ubuntuuitoolkit.fixture_setup') |
1630 | + |
1631 | |
1632 | class BaseUbuntuSystemTestCase(testcase.AutopilotTestCase): |
1633 | |
1634 | @classmethod |
1635 | def setUpClass(cls): |
1636 | - unity8.ensure_unity_stopped() |
1637 | + ensure_unity_stopped() |
1638 | super().setUpClass() |
1639 | |
1640 | @classmethod |
1641 | def tearDownClass(cls): |
1642 | super().tearDownClass() |
1643 | - unity8.ensure_unity_running_and_greeter_hidden() |
1644 | + ensure_unity_running_and_greeter_hidden() |
1645 | |
1646 | def setUp(self, allow_scopes_location=True): |
1647 | super().setUp() |
1648 | @@ -87,6 +99,7 @@ |
1649 | context.shared.retry_time = 10000 |
1650 | |
1651 | def _get_unity8_proxy_object(self): |
1652 | + from ubuntu_system_tests.helpers.unity8.shell import Unity8 # NOQA |
1653 | return autopilot.get_job_proxy_object('unity8') |
1654 | |
1655 | @autopilot_logging.log_action(logger.info) |
1656 | @@ -114,8 +127,6 @@ |
1657 | self._remove_autopilot_keyboard() |
1658 | self._reset_keyboard() |
1659 | self._enable_osk_for_uitk() |
1660 | - # Workaround for bug lp:1474444 |
1661 | - self.useFixture(OSKAlwaysEnabled()) |
1662 | # Disable setting touch visualization due to bug: |
1663 | # https://bugs.launchpad.net/bugs/1602600 |
1664 | # This should be re-enabled once an alternative method is provided. |
1665 | @@ -155,11 +166,11 @@ |
1666 | args = ['QT_LOAD_TESTABILITY=1'] |
1667 | if no_wait: |
1668 | args.append('--no-wait') |
1669 | - process_helpers.start_job(unity8.PROC_NAME, *args) |
1670 | + start_job(PROC_NAME, *args) |
1671 | if no_wait: |
1672 | # just wait for job to be spawned rather than fully running |
1673 | - wait_for_job_spawned(unity8.PROC_NAME) |
1674 | - context.shared.unity_pid = process_helpers._get_unity_pid() |
1675 | + wait_for_job_spawned(PROC_NAME) |
1676 | + context.shared.unity_pid = get_unity_pid() |
1677 | |
1678 | def _enable_osk_for_uitk(self): |
1679 | """Enable use of the OSK with uitk helpers.""" |
1680 | @@ -231,7 +242,7 @@ |
1681 | :returns: The proxy object for the Unity8 shell |
1682 | |
1683 | """ |
1684 | - unity8.ensure_unity_stopped() |
1685 | + ensure_unity_stopped() |
1686 | unity_proxy = self.launch_unity(fake_sensors=fake_sensors) |
1687 | if self.device_unlock_required(): |
1688 | unity_proxy.unlock() |
1689 | @@ -281,6 +292,5 @@ |
1690 | """ |
1691 | self.useFixture(fixture_setup.InitctlEnvironmentVariable( |
1692 | global_=True, |
1693 | - UBUNTU_WEBVIEW_DEVTOOLS_HOST=webapp.DEFAULT_WEBVIEW_INSPECTOR_IP, |
1694 | - UBUNTU_WEBVIEW_DEVTOOLS_PORT=str( |
1695 | - webapp.DEFAULT_WEBVIEW_INSPECTOR_PORT))) |
1696 | + UBUNTU_WEBVIEW_DEVTOOLS_HOST=DEFAULT_WEBVIEW_INSPECTOR_IP, |
1697 | + UBUNTU_WEBVIEW_DEVTOOLS_PORT=str(DEFAULT_WEBVIEW_INSPECTOR_PORT))) |
1698 | |
1699 | === modified file 'ubuntu_system_tests/tests/test_add_contact.py' |
1700 | --- ubuntu_system_tests/tests/test_add_contact.py 2016-06-30 13:45:35 +0000 |
1701 | +++ ubuntu_system_tests/tests/test_add_contact.py 2016-07-15 14:58:58 +0000 |
1702 | @@ -20,9 +20,10 @@ |
1703 | from autopilot.matchers import Eventually |
1704 | from testtools.matchers import Equals |
1705 | |
1706 | -from address_book_app.address_book.data import Phone, Contact |
1707 | - |
1708 | -from ubuntu_system_tests.helpers.addressbook import AddressBook |
1709 | +from ubuntu_system_tests.helpers.addressbook import ( |
1710 | + AddressBook, |
1711 | + get_test_contact, |
1712 | +) |
1713 | from ubuntu_system_tests.tests import base |
1714 | from ubuntu_system_tests.helpers.addressbook import ( |
1715 | fixture_setup as addressbook_fixtures) |
1716 | @@ -47,18 +48,11 @@ |
1717 | unity_proxy.unlock() |
1718 | self.useFixture(addressbook_fixtures.AddressBookTestEnvironment()) |
1719 | |
1720 | - @staticmethod |
1721 | - def get_test_contact(): |
1722 | - mobile_number = Phone(type_='Mobile', number=TYPED_MOBILE) |
1723 | - return Contact( |
1724 | - first_name=FIRST_NAME, last_name=LAST_NAME, |
1725 | - phones=[mobile_number]) |
1726 | - |
1727 | def test_add_contact_with_name_and_number(self): |
1728 | self.addressbook_app.launch_from_scope(return_proxy=False) |
1729 | address_book = self.addressbook_app.proxy_object.main_window |
1730 | |
1731 | - test_contact = self.get_test_contact() |
1732 | + test_contact = get_test_contact(FIRST_NAME, LAST_NAME, TYPED_MOBILE) |
1733 | test_contact_name = ( |
1734 | test_contact.first_name + ' ' + test_contact.last_name) |
1735 | |
1736 | |
1737 | === modified file 'ubuntu_system_tests/tests/test_calls.py' |
1738 | --- ubuntu_system_tests/tests/test_calls.py 2016-07-15 09:44:25 +0000 |
1739 | +++ ubuntu_system_tests/tests/test_calls.py 2016-07-15 14:58:58 +0000 |
1740 | @@ -45,7 +45,9 @@ |
1741 | ) |
1742 | from ubuntu_system_tests.helpers.autopilot import input |
1743 | from ubuntu_system_tests.helpers.data import load_test_metadata |
1744 | -from ubuntu_system_tests.helpers.dialer_app import fixture_setup as dialer_fixture_setup # NOQA |
1745 | +from ubuntu_system_tests.helpers.dialer_app import ( |
1746 | + fixture_setup as dialer_fixture_setup |
1747 | +) |
1748 | from ubuntu_system_tests.helpers import indicators |
1749 | from ubuntu_system_tests.helpers.indicators import( |
1750 | network as network_indicator |
1751 | |
1752 | === modified file 'ubuntu_system_tests/tests/test_messaging_sms.py' |
1753 | --- ubuntu_system_tests/tests/test_messaging_sms.py 2016-03-02 12:20:50 +0000 |
1754 | +++ ubuntu_system_tests/tests/test_messaging_sms.py 2016-07-15 14:58:58 +0000 |
1755 | @@ -37,7 +37,6 @@ |
1756 | fixture_setup as network_fixture |
1757 | ) |
1758 | from ubuntu_system_tests.helpers import ofono |
1759 | -from ubuntu_system_tests.helpers.indicators.message import NotificationsIndicatorPage, NotificationsIndicatorItem # NOQA |
1760 | from ubuntu_system_tests.helpers.system_settings import SIM_1, SIM_ASK |
1761 | from ubuntu_system_tests.helpers.uid import b64_uuid |
1762 | from ubuntu_system_tests.helpers import webbrowser |
1763 | |
1764 | === modified file 'ubuntu_system_tests/tests/test_settings_wizard.py' |
1765 | --- ubuntu_system_tests/tests/test_settings_wizard.py 2016-05-06 16:39:14 +0000 |
1766 | +++ ubuntu_system_tests/tests/test_settings_wizard.py 2016-07-15 14:58:58 +0000 |
1767 | @@ -22,9 +22,10 @@ |
1768 | is_agps_supported, is_wifi_supported |
1769 | ) |
1770 | from ubuntu_system_tests.helpers import testbed |
1771 | +from ubuntu_system_tests.helpers.system_settings import ( |
1772 | + is_reporting_enabled, |
1773 | +) |
1774 | from ubuntu_system_tests.helpers.unity8.fixture_setup import SettingsWizard |
1775 | -from ubuntu_system_tests.helpers.unity8 import settings_wizard |
1776 | -from ubuntu_system_tests.helpers.unity8.settings_wizard import Wizard |
1777 | |
1778 | from ubuntu_system_tests.tests import base |
1779 | |
1780 | @@ -65,7 +66,7 @@ |
1781 | |
1782 | def _get_settings_wizard(self): |
1783 | """Wait for the settings wizard to appear and return Wizard object""" |
1784 | - return self.unity.wait_select_single(Wizard) |
1785 | + return self.unity.main_window.get_settings_wizard() |
1786 | |
1787 | def _test_language_page(self): |
1788 | """Get the language page, check default language and continue""" |
1789 | @@ -181,7 +182,7 @@ |
1790 | self.config[KEY_WIFI_SSID], |
1791 | self.config[KEY_WIFI_PASSWORD]) |
1792 | |
1793 | - if settings_wizard.reporting_page_included(): |
1794 | + if is_reporting_enabled(): |
1795 | # Validate the reporting page when it is part of the wizard |
1796 | reporting_page = self._test_location_support( |
1797 | location_supported, next_page) |
1798 | |
1799 | === modified file 'ubuntu_system_tests/tests/test_tutorial.py' |
1800 | --- ubuntu_system_tests/tests/test_tutorial.py 2015-05-21 18:15:40 +0000 |
1801 | +++ ubuntu_system_tests/tests/test_tutorial.py 2016-07-15 14:58:58 +0000 |
1802 | @@ -21,13 +21,11 @@ |
1803 | from autopilot.matchers import Eventually |
1804 | from testtools.matchers import Equals |
1805 | |
1806 | -from unity8.shell import fixture_setup |
1807 | - |
1808 | -# unused import to load the tutorial custom proxy objects. |
1809 | -from unity8.shell.emulators import tutorial # NOQA |
1810 | - |
1811 | +from ubuntu_system_tests.helpers import try_import |
1812 | from ubuntu_system_tests.tests import base |
1813 | |
1814 | +fixture_setup = try_import('unity8.shell.fixture_setup') |
1815 | + |
1816 | |
1817 | class TutorialTestCase(base.BaseUbuntuSystemTestCase): |
1818 | |
1819 | @@ -36,6 +34,9 @@ |
1820 | self.useFixture(fixture_setup.Tutorial(True)) |
1821 | |
1822 | def test_complete_tutorial(self): |
1823 | + # TODO: This test needs to be re-written for the new tutorial. |
1824 | + # unused import to load the tutorial custom proxy objects. |
1825 | + from unity8.shell.emulators import tutorial # NOQA |
1826 | unity = self.launch_unity() |
1827 | |
1828 | greeter = unity.main_window.get_greeter() |
1829 | |
1830 | === modified file 'ubuntu_system_tests/tests/test_ubuntu_keyboard.py' |
1831 | --- ubuntu_system_tests/tests/test_ubuntu_keyboard.py 2016-02-12 15:42:55 +0000 |
1832 | +++ ubuntu_system_tests/tests/test_ubuntu_keyboard.py 2016-07-15 14:58:58 +0000 |
1833 | @@ -20,8 +20,6 @@ |
1834 | from autopilot.matchers import Eventually |
1835 | from testtools.matchers import Equals |
1836 | |
1837 | -from ubuntu_keyboard.emulators.keyboard import Keyboard as UbuntuKeyboard |
1838 | - |
1839 | from ubuntu_system_tests.tests import base |
1840 | from ubuntu_system_tests.helpers.messaging import( |
1841 | fixture_setup as messaging_fixture |
1842 | @@ -48,6 +46,7 @@ |
1843 | self.unity_proxy = self.restart_unity() |
1844 | self.useFixture(messaging_fixture.SetDefaultSIM()) |
1845 | self.messaging_app = messaging_helpers.launch_messaging_app() |
1846 | + self.osk = osk_helpers.get_keyboard() |
1847 | |
1848 | def _focus_message_input_field_to_invoke_keyboard(self): |
1849 | # Due to some reason, using the proxy object with uitk emulator base, |
1850 | @@ -55,7 +54,7 @@ |
1851 | # settings are reset during the test. Getting the proxy object without |
1852 | # custom emulator base, solves the issue. --om26er 16-12-2015 |
1853 | messaging_app_raw_proxy = messaging_helpers.get_messaging_app_proxy( |
1854 | - base=None) |
1855 | + raw_proxy=True) |
1856 | return messaging_helpers.focus_message_input_field( |
1857 | messaging_app_raw_proxy, self.messaging_app.pointing_device) |
1858 | |
1859 | @@ -81,12 +80,11 @@ |
1860 | self.assertThat(lambda: osk_helpers.is_keyboard_shifted(), |
1861 | Eventually(Equals(True))) |
1862 | |
1863 | - keyboard = UbuntuKeyboard() |
1864 | - keyboard.type('Hello my friend. ') |
1865 | + self.osk.type('Hello my friend. ') |
1866 | self.assertThat(lambda: osk_helpers.is_keyboard_shifted(), |
1867 | Eventually(Equals(True))) |
1868 | |
1869 | - keyboard.type('\b') |
1870 | + self.osk.type('\b') |
1871 | self.assertThat(lambda: osk_helpers.is_keyboard_shifted(), |
1872 | Eventually(Equals(False))) |
1873 | |
1874 | @@ -117,20 +115,19 @@ |
1875 | 6. Press a space and type 'i' and ensure that the word 'I' is shown |
1876 | capitalized as bold |
1877 | """ |
1878 | - osk = UbuntuKeyboard() |
1879 | - osk.type(INITIAL_TEXT) |
1880 | + self.osk.type(INITIAL_TEXT) |
1881 | proxy = osk_helpers.get_ubuntu_keyboard_proxy() |
1882 | word_ribbon_list = proxy.keyboard.word_ribbon_list |
1883 | |
1884 | suggestions_list = word_ribbon_list.get_suggested_words() |
1885 | self._assert_words_in_ribbon(suggestions_list, EXPECTED_WORDS) |
1886 | |
1887 | - osk.type(' ') |
1888 | + self.osk.type(' ') |
1889 | self.assertThat(self.input_field.text, Eventually(Equals(SENTENCE_1))) |
1890 | self.assertThat(lambda: word_ribbon_list.is_suggestions_list_empty(), |
1891 | Eventually(Equals(True))) |
1892 | |
1893 | - osk.type(UNIQUE_WORD_1) |
1894 | + self.osk.type(UNIQUE_WORD_1) |
1895 | self.assertThat(lambda: word_ribbon_list.is_text_bold(UNIQUE_WORD_1), |
1896 | Eventually(Equals(True))) |
1897 | word_ribbon_list.tap_suggested_word(text=UNIQUE_WORD_1) |
1898 | @@ -138,10 +135,10 @@ |
1899 | self.assertThat(self.input_field.text, |
1900 | Eventually(Equals(expected_text))) |
1901 | |
1902 | - osk.type(UNIQUE_WORD_2) |
1903 | + self.osk.type(UNIQUE_WORD_2) |
1904 | self.assertThat(lambda: word_ribbon_list.is_text_bold(UNIQUE_WORD_2), |
1905 | Eventually(Equals(True))) |
1906 | |
1907 | - osk.type(' i') |
1908 | + self.osk.type(' i') |
1909 | self.assertThat(lambda: word_ribbon_list.is_text_bold('I'), |
1910 | Eventually(Equals(True))) |
1911 | |
1912 | === modified file 'ubuntu_system_tests/tests/test_with_dialer.py' |
1913 | --- ubuntu_system_tests/tests/test_with_dialer.py 2016-02-03 22:25:18 +0000 |
1914 | +++ ubuntu_system_tests/tests/test_with_dialer.py 2016-07-15 14:58:58 +0000 |
1915 | @@ -20,9 +20,11 @@ |
1916 | from autopilot.matchers import Eventually |
1917 | from testtools.matchers import Equals |
1918 | |
1919 | -from unity8 import process_helpers as unity_helpers |
1920 | - |
1921 | from ubuntu_system_tests.helpers import dialer_app |
1922 | +from ubuntu_system_tests.helpers.unity8 import ( |
1923 | + lock_unity, |
1924 | + unlock_unity, |
1925 | +) |
1926 | from ubuntu_system_tests.tests import base |
1927 | |
1928 | |
1929 | @@ -44,8 +46,8 @@ |
1930 | self.assertThat(self.dialer_app.contacts_page.active, |
1931 | Eventually(Equals(True))) |
1932 | |
1933 | - unity_helpers.lock_unity() |
1934 | - unity_helpers.unlock_unity() |
1935 | + lock_unity() |
1936 | + unlock_unity() |
1937 | |
1938 | self.assertThat(self.dialer_app.contacts_page.active, |
1939 | Eventually(Equals(True))) |
1940 | |
1941 | === modified file 'ubuntu_system_tests/tests/test_with_webbrowser.py' |
1942 | --- ubuntu_system_tests/tests/test_with_webbrowser.py 2016-05-26 10:40:07 +0000 |
1943 | +++ ubuntu_system_tests/tests/test_with_webbrowser.py 2016-07-15 14:58:58 +0000 |
1944 | @@ -26,8 +26,6 @@ |
1945 | from autopilot.matchers import Eventually |
1946 | from testtools.matchers import Equals |
1947 | |
1948 | -from ubuntu_keyboard.emulators import keyboard |
1949 | - |
1950 | from ubuntu_system_tests.helpers import autopilot |
1951 | from ubuntu_system_tests.helpers.data import load_test_metadata |
1952 | from ubuntu_system_tests.helpers import file_system as fs |
1953 | @@ -390,10 +388,6 @@ |
1954 | self.browser.copy_url_text() |
1955 | |
1956 | messaging_app = messaging.launch_messaging_app_from_launcher() |
1957 | - # Apparently the OSK stays visible if the app was switched while |
1958 | - # the keyboard was on screen. Reported: LP: 1505630 |
1959 | - keyboard.Keyboard().dismiss() |
1960 | - |
1961 | text_entry = messaging_app.paste_text_in_message_field() |
1962 | self.assertThat( |
1963 | text_entry.text, |
1964 | |
1965 | === modified file 'ubuntu_system_tests/tests/webapps/base.py' |
1966 | --- ubuntu_system_tests/tests/webapps/base.py 2016-06-02 13:30:35 +0000 |
1967 | +++ ubuntu_system_tests/tests/webapps/base.py 2016-07-15 14:58:58 +0000 |
1968 | @@ -18,10 +18,10 @@ |
1969 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1970 | # |
1971 | |
1972 | -from ubuntu_system_tests.tests import base |
1973 | - |
1974 | - |
1975 | -class BaseWebAppTestCase(base.BaseUbuntuSystemTestCase): |
1976 | +from ubuntu_system_tests.tests.base import BaseUbuntuSystemTestCase |
1977 | + |
1978 | + |
1979 | +class BaseWebAppTestCase(BaseUbuntuSystemTestCase): |
1980 | """ Base class to be used for all the WebApp tests """ |
1981 | |
1982 | def setUp(self): |
FAILED: Continuous integration, rev:454 /code.launchpad .net/~canonical -platform- qa/ubuntu- system- tests/clean- install/ +merge/ 299546/ +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:/
https:/ /platform- qa-jenkins. ubuntu. com/job/ ubuntu- system- tests-ci/ 293/ /platform- qa-jenkins. ubuntu. com/job/ build-wily- amd64-package/ 461 /platform- qa-jenkins. ubuntu. com/job/ build-wily- amd64-package/ 461/artifact/ work/output/ *zip*/output. zip /platform- qa-jenkins. ubuntu. com/job/ build-wily- i386-package/ 461 /platform- qa-jenkins. ubuntu. com/job/ build-wily- i386-package/ 461/artifact/ work/output/ *zip*/output. zip /platform- qa-jenkins. ubuntu. com/job/ generic- update- mp/398/ console
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
None: https:/
Click here to trigger a rebuild: /platform- qa-jenkins. ubuntu. com/job/ ubuntu- system- tests-ci/ 293/rebuild
https:/