Merge lp:~canonical-platform-qa/ubuntu-system-tests/clean-install into lp:ubuntu-system-tests

Proposed by Richard Huddie
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
Reviewer Review Type Date Requested Status
Santiago Baldassin (community) Approve
Sergio Cazzolato Approve
platform-qa-bot continuous-integration Approve
Review via email: mp+299546@code.launchpad.net

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-system-tests-suite package (was missing)
- 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-ui-toolkit-autopilot and unity8-autopilot to be removed as host dependencies which saves huge amount of install space.
- 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_object_for_existing_app.
- 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-ui-toolkit-autopilot etc.) You'll need autopilot itself installed though of course.

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.

To post a comment you must log in.
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
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?

review: Needs Information
Revision history for this message
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?

Revision history for this message
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.

Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
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

review: Needs Fixing
Revision history for this message
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-ui-toolkit-autopilot is 261MB and unity8-autopilot adds another 121MB to that size. So that is why I'm keen to remove them.

Revision history for this message
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://bazaar.launchpad.net/~canonical-platform-qa/ubuntu-system-tests/clean-install/revision/456

If so I'll update the rest of the branch to use this helper. Thanks.

Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
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://bazaar.launchpad.net/~canonical-platform-qa/ubuntu-system-
> tests/clean-install/revision/456
>
> 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.

Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
468. By Richard Huddie

here imports.

Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
469. By Richard Huddie

Merge from trunk.

Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
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.

Revision history for this message
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

review: Approve
Revision history for this message
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://code.launchpad.net/~canonical-platform-qa/ubuntu-system-tests/dynamic-dependencies/+merge/299943

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.

Revision history for this message
Santiago Baldassin (sbaldassin) wrote :

Looks good to me

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2016-05-10 16:47:27 +0000
+++ debian/control 2016-07-15 14:58:58 +0000
@@ -4,13 +4,24 @@
4Maintainer: Canonical Platform QA Team <qa-team@lists.canonical.com>4Maintainer: Canonical Platform QA Team <qa-team@lists.canonical.com>
5Build-Depends: debhelper (>= 9),5Build-Depends: debhelper (>= 9),
6 dh-python,6 dh-python,
7 openssh-server,7 gir1.2-click-0.4,
8 lsb-release,
8 python3-all-dev (>= 3.4),9 python3-all-dev (>= 3.4),
10 python3-autopilot,
11 python3-debian,
12 python3-evdev,
9 python3-fixtures,13 python3-fixtures,
10 python3-flake8,14 python3-flake8,
15 python3-gi,
16 python3-paramiko,
17 python3-pexpect,
18 python3-requests,
19 python3-retrying,
11 python3-setuptools,20 python3-setuptools,
21 python3-subunit,
12 python3-testscenarios,22 python3-testscenarios,
13 unity8-autopilot23 python3-warlock,
24 system-image-common,
14Standards-Version: 3.9.525Standards-Version: 3.9.5
15Homepage: http://launchpad.net/ubuntu-system-tests26Homepage: http://launchpad.net/ubuntu-system-tests
16X-Python3-Version: >= 3.327X-Python3-Version: >= 3.3
@@ -33,8 +44,12 @@
33Architecture: all44Architecture: all
34Depends: ${misc:Depends},45Depends: ${misc:Depends},
35 ${python3:Depends},46 ${python3:Depends},
47 autopkgtest,
48 openssh-server,
49 phablet-tools,
36 subunit,50 subunit,
37 ubuntu-system-tests-common,51 ubuntu-system-tests-common,
52 virtualenv,
38Description: Host test runner53Description: Host test runner
39 This package contains scripts for running ubuntu-system-tests on a target54 This package contains scripts for running ubuntu-system-tests on a target
40 device from a host machine.55 device from a host machine.
@@ -52,6 +67,9 @@
52Architecture: all67Architecture: all
53Depends: ${misc:Depends},68Depends: ${misc:Depends},
54 ${python3:Depends},69 ${python3:Depends},
70 libhybris-utils,
71 ofono,
72 openssh-client,
55 python3-dbus,73 python3-dbus,
56 python3-debian,74 python3-debian,
57 python3-gi,75 python3-gi,
@@ -61,6 +79,7 @@
61 python3-retrying,79 python3-retrying,
62 python3-testtools,80 python3-testtools,
63 python3-warlock,81 python3-warlock,
82 system-image-common,
64Description: Ubuntu-system-tests common scripts83Description: Ubuntu-system-tests common scripts
65 This package contains common scripts used by the ubuntu-system-tests host,84 This package contains common scripts used by the ubuntu-system-tests host,
66 helpers and suite packages.85 helpers and suite packages.
@@ -71,6 +90,6 @@
71 ${python3:Depends},90 ${python3:Depends},
72 python3-autopilot,91 python3-autopilot,
73 ubuntu-system-tests-common,92 ubuntu-system-tests-common,
74 unity8-autopilot,93 ubuntu-system-tests-helpers,
75Description: Ubuntu-system-tests test suite and test data94Description: Ubuntu-system-tests test suite and test data
76 This package contains test suites and test data for ubuntu-system-tests.95 This package contains test suites and test data for ubuntu-system-tests.
7796
=== modified file 'debian/rules'
--- debian/rules 2016-05-03 15:59:52 +0000
+++ debian/rules 2016-07-15 14:58:58 +0000
@@ -10,3 +10,7 @@
10override_dh_auto_build:10override_dh_auto_build:
11 python3 -m flake8.run --max-complexity 6 .11 python3 -m flake8.run --max-complexity 6 .
12 dh_auto_build12 dh_auto_build
13
14override_dh_auto_test:
15 dh_auto_test
16 ! autopilot3 list ubuntu_system_tests | grep "ImportError:"
1317
=== modified file 'debian/tests/control'
--- debian/tests/control 2016-06-17 11:04:19 +0000
+++ debian/tests/control 2016-07-15 14:58:58 +0000
@@ -5,6 +5,7 @@
5 address-book-app-autopilot (>=0.2+15.04.20150226-0ubuntu1), # TMPINSTALL5 address-book-app-autopilot (>=0.2+15.04.20150226-0ubuntu1), # TMPINSTALL
6 camera-app,6 camera-app,
7 camera-app-autopilot,7 camera-app-autopilot,
8 chromium-chromedriver, # TMPINSTALL
8 dialer-app,9 dialer-app,
9 dialer-app-autopilot, # TMPINSTALL10 dialer-app-autopilot, # TMPINSTALL
10 exiftool,11 exiftool,
@@ -14,7 +15,6 @@
14 mediaplayer-app-autopilot, # TMPINSTALL15 mediaplayer-app-autopilot, # TMPINSTALL
15 messaging-app,16 messaging-app,
16 messaging-app-autopilot, # TMPINSTALL17 messaging-app-autopilot, # TMPINSTALL
17 oxideqt-chromedriver, # TMPINSTALL
18 python3-autopilot,18 python3-autopilot,
19 python3-dbus,19 python3-dbus,
20 python3-debian,20 python3-debian,
2121
=== modified file 'debian/ubuntu-system-tests-suite.install'
--- debian/ubuntu-system-tests-suite.install 2016-05-11 13:49:53 +0000
+++ debian/ubuntu-system-tests-suite.install 2016-07-15 14:58:58 +0000
@@ -1,3 +1,4 @@
1usr/lib/python3*/*/ubuntu_system_tests/perftests/
1usr/lib/python3*/*/ubuntu_system_tests/systemtests/2usr/lib/python3*/*/ubuntu_system_tests/systemtests/
2usr/lib/python3*/*/ubuntu_system_tests/tests/3usr/lib/python3*/*/ubuntu_system_tests/tests/
3ubuntu_system_tests/external_tests/ /usr/lib/python3/dist-packages/ubuntu_system_tests/4ubuntu_system_tests/external_tests/ /usr/lib/python3/dist-packages/ubuntu_system_tests/
45
=== modified file 'ubuntu_system_tests/helpers/__init__.py'
--- ubuntu_system_tests/helpers/__init__.py 2016-06-02 12:50:05 +0000
+++ ubuntu_system_tests/helpers/__init__.py 2016-07-15 14:58:58 +0000
@@ -20,6 +20,7 @@
2020
21from ubuntu_system_tests.helpers.utils import (21from ubuntu_system_tests.helpers.utils import (
22 AttrDict,22 AttrDict,
23 try_import,
23 wait_until,24 wait_until,
24 wait_until_stable,25 wait_until_stable,
25)26)
@@ -27,6 +28,7 @@
2728
28__all__ = [29__all__ = [
29 'AttrDict',30 'AttrDict',
31 'try_import',
30 'wait_until',32 'wait_until',
31 'wait_until_stable',33 'wait_until_stable',
32]34]
3335
=== modified file 'ubuntu_system_tests/helpers/addressbook/__init__.py'
--- ubuntu_system_tests/helpers/addressbook/__init__.py 2016-06-09 19:00:23 +0000
+++ ubuntu_system_tests/helpers/addressbook/__init__.py 2016-07-15 14:58:58 +0000
@@ -22,8 +22,10 @@
22 AddressBook,22 AddressBook,
23 Contact23 Contact
24)24)
25from ubuntu_system_tests.helpers.addressbook.utils import get_test_contact
2526
26__all__ = [27__all__ = [
27 'AddressBook',28 'AddressBook',
28 'Contact'29 'Contact',
30 'get_test_contact',
29]31]
3032
=== added file 'ubuntu_system_tests/helpers/addressbook/utils.py'
--- ubuntu_system_tests/helpers/addressbook/utils.py 1970-01-01 00:00:00 +0000
+++ ubuntu_system_tests/helpers/addressbook/utils.py 2016-07-15 14:58:58 +0000
@@ -0,0 +1,38 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2
3#
4# Ubuntu System Tests
5# Copyright (C) 2016 Canonical
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20
21from ubuntu_system_tests.helpers import try_import
22
23addr_data = try_import('address_book_app.address_book.data')
24
25
26def get_test_contact(first_name, last_name, phone_number):
27 """
28 Return Contact object with specified details.
29
30 :param first_name: First name of contact.
31 :param last_name: Last name of contact.
32 :param phone_number: Phone number of contact.
33 :return: Contact object with specified details.
34 """
35 mobile_number = addr_data.Phone(type_='Mobile', number=phone_number)
36 return addr_data.Contact(
37 first_name=first_name, last_name=last_name,
38 phones=[mobile_number])
039
=== modified file 'ubuntu_system_tests/helpers/autopilot/utils.py'
--- ubuntu_system_tests/helpers/autopilot/utils.py 2016-06-09 19:56:51 +0000
+++ ubuntu_system_tests/helpers/autopilot/utils.py 2016-07-15 14:58:58 +0000
@@ -20,14 +20,18 @@
2020
21from contextlib import contextmanager21from contextlib import contextmanager
2222
23import ubuntuuitoolkit
24from autopilot import introspection23from autopilot import introspection
25from autopilot.exceptions import StateNotFoundError24from autopilot.exceptions import StateNotFoundError
2625
27from ubuntu_system_tests.helpers import processes26from ubuntu_system_tests.helpers import (
27 processes,
28 try_import,
29)
28from ubuntu_system_tests.helpers.timeout import timeout30from ubuntu_system_tests.helpers.timeout import timeout
29from ubuntu_system_tests.helpers import wait_until31from ubuntu_system_tests.helpers import wait_until
3032
33ubuntuuitoolkit = try_import('ubuntuuitoolkit')
34
3135
32@contextmanager36@contextmanager
33def override_proxy_timeout(proxy, timeout_seconds):37def override_proxy_timeout(proxy, timeout_seconds):
@@ -232,9 +236,7 @@
232 )236 )
233237
234238
235def get_proxy_object_for_existing_app(239def get_proxy_object_for_existing_app(process_name, raw_proxy=False):
236 process_name, cleanup_process=None,
237 base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
238 """240 """
239 Return proxy object from existing application process.241 Return proxy object from existing application process.
240242
@@ -243,15 +245,16 @@
243 cleanup target using ensure_application_closed().245 cleanup target using ensure_application_closed().
244246
245 :param pname: Name of required application process.247 :param pname: Name of required application process.
246 :param cleanup_process: Name of process to clean up.248 :param raw_proxy: Whether to return a raw proxy object, or use default
247 :param base: custom emulator base for proxy object249 base class for proxy objects from ubuntuuitoolkit.
248 :return: Proxy object for the desired application.250 :return: Proxy object for the desired application.
249251
250 """252 """
251 if not cleanup_process:253 if raw_proxy:
252 cleanup_process = process_name254 base = None
255 else:
256 base = ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase
253 proxy = get_proxy_object_for_existing_process(process_name, base)257 proxy = get_proxy_object_for_existing_process(process_name, base)
254
255 return proxy258 return proxy
256259
257260
258261
=== modified file 'ubuntu_system_tests/helpers/brightness/__init__.py'
--- ubuntu_system_tests/helpers/brightness/__init__.py 2016-06-01 13:47:43 +0000
+++ ubuntu_system_tests/helpers/brightness/__init__.py 2016-07-15 14:58:58 +0000
@@ -17,7 +17,3 @@
17# You should have received a copy of the GNU General Public License17# You should have received a copy of the GNU General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#19#
20
21from ubuntu_system_tests.helpers.brightness._cpo import BrightnessPageBase
22
23__all__ = ['BrightnessPageBase']
2420
=== modified file 'ubuntu_system_tests/helpers/camera/app.py'
--- ubuntu_system_tests/helpers/camera/app.py 2016-06-30 17:37:03 +0000
+++ ubuntu_system_tests/helpers/camera/app.py 2016-07-15 14:58:58 +0000
@@ -23,7 +23,6 @@
23import warlock23import warlock
2424
25from ubuntu_system_tests.helpers import autopilot25from ubuntu_system_tests.helpers import autopilot
26from ubuntu_system_tests.helpers import click
27from ubuntu_system_tests.helpers import file_system as fs26from ubuntu_system_tests.helpers import file_system as fs
28from ubuntu_system_tests.helpers import processes27from ubuntu_system_tests.helpers import processes
29from ubuntu_system_tests.helpers.scopes.apps import (28from ubuntu_system_tests.helpers.scopes.apps import (
@@ -99,10 +98,7 @@
9998
100 """99 """
101 from ubuntu_system_tests.helpers.camera._cpo import MainWindow100 from ubuntu_system_tests.helpers.camera._cpo import MainWindow
102 proxy = autopilot.get_proxy_object_for_existing_app(101 proxy = autopilot.get_proxy_object_for_existing_app(APP)
103 APP,
104 cleanup_process=click.get_click_app_identifier(APP_CLICK)
105 )
106 return MainWindow(proxy)102 return MainWindow(proxy)
107103
108104
109105
=== modified file 'ubuntu_system_tests/helpers/dekko/app.py'
--- ubuntu_system_tests/helpers/dekko/app.py 2016-06-01 13:58:27 +0000
+++ ubuntu_system_tests/helpers/dekko/app.py 2016-07-15 14:58:58 +0000
@@ -15,7 +15,6 @@
15# along with this program. If not, see <http://www.gnu.org/licenses/>.15# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
17from ubuntu_system_tests.helpers import autopilot17from ubuntu_system_tests.helpers import autopilot
18from ubuntu_system_tests.helpers import click
19from ubuntu_system_tests.helpers import processes18from ubuntu_system_tests.helpers import processes
20from ubuntu_system_tests.helpers.scopes.apps import (19from ubuntu_system_tests.helpers.scopes.apps import (
21 launch_application_from_apps_scope)20 launch_application_from_apps_scope)
@@ -42,5 +41,4 @@
42def get_dekko_proxy():41def get_dekko_proxy():
43 """Return the proxy object of the calculator app."""42 """Return the proxy object of the calculator app."""
44 from ubuntu_system_tests.helpers.dekko import _cpo # NOQA43 from ubuntu_system_tests.helpers.dekko import _cpo # NOQA
45 return autopilot.get_proxy_object_for_existing_app(44 return autopilot.get_proxy_object_for_existing_app(APP)
46 APP, cleanup_process=click.get_click_app_identifier(APP_CLICK_ID))
4745
=== modified file 'ubuntu_system_tests/helpers/dialer_app/fixture_setup.py'
--- ubuntu_system_tests/helpers/dialer_app/fixture_setup.py 2015-08-25 11:24:23 +0000
+++ ubuntu_system_tests/helpers/dialer_app/fixture_setup.py 2016-07-15 14:58:58 +0000
@@ -20,11 +20,12 @@
2020
21import fixtures21import fixtures
2222
23from dialer_app.fixture_setup import UseEmptyHistory23from ubuntu_system_tests.helpers import try_import
24
25from ubuntu_system_tests.helpers.system_settings import (24from ubuntu_system_tests.helpers.system_settings import (
26 get_default_sim_for_calls, set_default_sim_for_calls)25 get_default_sim_for_calls, set_default_sim_for_calls)
2726
27UseEmptyHistory = try_import('dialer_app.fixture_setup').UseEmptyHistory
28
2829
29class DialerTestEnvironment(fixtures.Fixture):30class DialerTestEnvironment(fixtures.Fixture):
30 """Fixture used to prepare the phone environment"""31 """Fixture used to prepare the phone environment"""
3132
=== modified file 'ubuntu_system_tests/helpers/gallery/app.py'
--- ubuntu_system_tests/helpers/gallery/app.py 2016-06-01 14:18:12 +0000
+++ ubuntu_system_tests/helpers/gallery/app.py 2016-07-15 14:58:58 +0000
@@ -19,7 +19,6 @@
19#19#
2020
21from ubuntu_system_tests.helpers import autopilot21from ubuntu_system_tests.helpers import autopilot
22from ubuntu_system_tests.helpers import click
23from ubuntu_system_tests.helpers import processes22from ubuntu_system_tests.helpers import processes
24from ubuntu_system_tests.helpers.scopes.apps import (23from ubuntu_system_tests.helpers.scopes.apps import (
25 launch_application_from_apps_scope24 launch_application_from_apps_scope
@@ -61,8 +60,7 @@
6160
62 """61 """
63 from ubuntu_system_tests.helpers.gallery._cpo import GalleryApplication62 from ubuntu_system_tests.helpers.gallery._cpo import GalleryApplication
64 proxy = autopilot.get_proxy_object_for_existing_app(63 proxy = autopilot.get_proxy_object_for_existing_app(APP)
65 APP, cleanup_process=click.get_click_app_identifier(APP_CLICK))
66 return proxy.select_single(GalleryApplication)64 return proxy.select_single(GalleryApplication)
6765
6866
6967
=== added file 'ubuntu_system_tests/helpers/indicators/_cpo.py'
--- ubuntu_system_tests/helpers/indicators/_cpo.py 1970-01-01 00:00:00 +0000
+++ ubuntu_system_tests/helpers/indicators/_cpo.py 2016-07-15 14:58:58 +0000
@@ -0,0 +1,36 @@
1
2# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3
4# Ubuntu System Tests
5# Copyright (C) 2016 Canonical
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20from unity8 import indicators
21
22from ubuntu_system_tests.helpers.ubuntuuitoolkit._qquicklistview import (
23 QQuickListView,
24)
25
26
27class IndicatorPage(indicators.IndicatorPage):
28 """Extend IndicatorPage from Unity8."""
29
30 def _get_listview(self):
31 """Return the list view object from the indicator."""
32 return self.select_single(QQuickListView, objectName='mainMenu')
33
34 def press_label(self, text):
35 """Press the label in the list view of the indicator."""
36 self._get_listview().press_label(text)
037
=== modified file 'ubuntu_system_tests/helpers/indicators/battery.py'
--- ubuntu_system_tests/helpers/indicators/battery.py 2016-06-08 08:07:44 +0000
+++ ubuntu_system_tests/helpers/indicators/battery.py 2016-07-15 14:58:58 +0000
@@ -16,11 +16,9 @@
16# You should have received a copy of the GNU General Public License16# You should have received a copy of the GNU General Public License
17# along with this program. If not, see <http://www.gnu.org/licenses/>.17# along with this program. If not, see <http://www.gnu.org/licenses/>.
1818
19from ubuntu_system_tests.helpers.brightness import BrightnessPageBase19from ubuntu_system_tests.helpers.brightness._cpo import BrightnessPageBase
20from ubuntu_system_tests.helpers.indicators.utils import(20from ubuntu_system_tests.helpers.indicators.utils import INDICATOR_PAGE_PATH
21 IndicatorPage,21from ubuntu_system_tests.helpers.indicators._cpo import IndicatorPage
22 INDICATOR_PAGE_PATH
23)
24from ubuntu_system_tests.helpers.autopilot import validate_dbus_object22from ubuntu_system_tests.helpers.autopilot import validate_dbus_object
25from ubuntu_system_tests.helpers import unity823from ubuntu_system_tests.helpers import unity8
2624
2725
=== modified file 'ubuntu_system_tests/helpers/indicators/bluetooth.py'
--- ubuntu_system_tests/helpers/indicators/bluetooth.py 2016-06-01 15:05:13 +0000
+++ ubuntu_system_tests/helpers/indicators/bluetooth.py 2016-07-15 14:58:58 +0000
@@ -16,10 +16,8 @@
16# You should have received a copy of the GNU General Public License16# You should have received a copy of the GNU General Public License
17# along with this program. If not, see <http://www.gnu.org/licenses/>.17# along with this program. If not, see <http://www.gnu.org/licenses/>.
1818
19from ubuntu_system_tests.helpers.indicators.utils import(19from ubuntu_system_tests.helpers.indicators.utils import INDICATOR_PAGE_PATH
20 IndicatorPage,20from ubuntu_system_tests.helpers.indicators._cpo import IndicatorPage
21 INDICATOR_PAGE_PATH
22)
23from ubuntu_system_tests.helpers.autopilot import validate_dbus_object21from ubuntu_system_tests.helpers.autopilot import validate_dbus_object
24from ubuntu_system_tests.helpers import unity822from ubuntu_system_tests.helpers import unity8
2523
2624
=== modified file 'ubuntu_system_tests/helpers/indicators/datetime.py'
--- ubuntu_system_tests/helpers/indicators/datetime.py 2016-06-01 15:05:13 +0000
+++ ubuntu_system_tests/helpers/indicators/datetime.py 2016-07-15 14:58:58 +0000
@@ -16,10 +16,8 @@
16# You should have received a copy of the GNU General Public License16# You should have received a copy of the GNU General Public License
17# along with this program. If not, see <http://www.gnu.org/licenses/>.17# along with this program. If not, see <http://www.gnu.org/licenses/>.
1818
19from ubuntu_system_tests.helpers.indicators.utils import(19from ubuntu_system_tests.helpers.indicators.utils import INDICATOR_PAGE_PATH
20 IndicatorPage,20from ubuntu_system_tests.helpers.indicators._cpo import IndicatorPage
21 INDICATOR_PAGE_PATH
22)
23from ubuntu_system_tests.helpers.autopilot import validate_dbus_object21from ubuntu_system_tests.helpers.autopilot import validate_dbus_object
24from ubuntu_system_tests.helpers import unity822from ubuntu_system_tests.helpers import unity8
2523
2624
=== modified file 'ubuntu_system_tests/helpers/indicators/message.py'
--- ubuntu_system_tests/helpers/indicators/message.py 2016-06-01 15:04:34 +0000
+++ ubuntu_system_tests/helpers/indicators/message.py 2016-07-15 14:58:58 +0000
@@ -23,10 +23,8 @@
23import ubuntuuitoolkit as uuitk23import ubuntuuitoolkit as uuitk
2424
25from ubuntu_system_tests.helpers import ofono, unity825from ubuntu_system_tests.helpers import ofono, unity8
26from ubuntu_system_tests.helpers.indicators.utils import(26from ubuntu_system_tests.helpers.indicators.utils import INDICATOR_PAGE_PATH
27 IndicatorPage,27from ubuntu_system_tests.helpers.indicators._cpo import IndicatorPage
28 INDICATOR_PAGE_PATH
29)
30from ubuntu_system_tests.helpers.autopilot import(28from ubuntu_system_tests.helpers.autopilot import(
31 validate_dbus_object,29 validate_dbus_object,
32 wait_select_many,30 wait_select_many,
3331
=== modified file 'ubuntu_system_tests/helpers/indicators/network/_cpo.py'
--- ubuntu_system_tests/helpers/indicators/network/_cpo.py 2016-06-01 15:05:13 +0000
+++ ubuntu_system_tests/helpers/indicators/network/_cpo.py 2016-07-15 14:58:58 +0000
@@ -19,10 +19,8 @@
1919
20import ubuntuuitoolkit as uuitk20import ubuntuuitoolkit as uuitk
2121
22from ubuntu_system_tests.helpers.indicators.utils import(22from ubuntu_system_tests.helpers.indicators.utils import INDICATOR_PAGE_PATH
23 IndicatorPage,23from ubuntu_system_tests.helpers.indicators._cpo import IndicatorPage
24 INDICATOR_PAGE_PATH
25)
26from ubuntu_system_tests.helpers.autopilot import validate_dbus_object24from ubuntu_system_tests.helpers.autopilot import validate_dbus_object
27from ubuntu_system_tests.helpers import unity825from ubuntu_system_tests.helpers import unity8
28from ubuntu_system_tests.helpers.ubuntuuitoolkit.switchmenu import SwitchMenu26from ubuntu_system_tests.helpers.ubuntuuitoolkit.switchmenu import SwitchMenu
2927
=== modified file 'ubuntu_system_tests/helpers/indicators/sound.py'
--- ubuntu_system_tests/helpers/indicators/sound.py 2016-06-01 15:05:13 +0000
+++ ubuntu_system_tests/helpers/indicators/sound.py 2016-07-15 14:58:58 +0000
@@ -18,10 +18,8 @@
1818
19import ubuntuuitoolkit as uuitk19import ubuntuuitoolkit as uuitk
2020
21from ubuntu_system_tests.helpers.indicators.utils import(21from ubuntu_system_tests.helpers.indicators.utils import INDICATOR_PAGE_PATH
22 IndicatorPage,22from ubuntu_system_tests.helpers.indicators._cpo import IndicatorPage
23 INDICATOR_PAGE_PATH
24)
25from ubuntu_system_tests.helpers.autopilot import validate_dbus_object23from ubuntu_system_tests.helpers.autopilot import validate_dbus_object
26from ubuntu_system_tests.helpers import unity824from ubuntu_system_tests.helpers import unity8
27from ubuntu_system_tests.helpers.ubuntuuitoolkit.switchmenu import SwitchMenu25from ubuntu_system_tests.helpers.ubuntuuitoolkit.switchmenu import SwitchMenu
2826
=== modified file 'ubuntu_system_tests/helpers/indicators/utils.py'
--- ubuntu_system_tests/helpers/indicators/utils.py 2016-06-09 19:06:08 +0000
+++ ubuntu_system_tests/helpers/indicators/utils.py 2016-07-15 14:58:58 +0000
@@ -19,10 +19,7 @@
1919
20import logging20import logging
2121
22from unity8 import indicators
23
24from ubuntu_system_tests.helpers import context22from ubuntu_system_tests.helpers import context
25from ubuntu_system_tests.helpers.ubuntuuitoolkit._qquicklistview import QQuickListView # NOQA
2623
27INDICATOR_PAGE_PATH = b'IndicatorPage'24INDICATOR_PAGE_PATH = b'IndicatorPage'
2825
@@ -43,18 +40,6 @@
43logger = logging.getLogger(__name__)40logger = logging.getLogger(__name__)
4441
4542
46class IndicatorPage(indicators.IndicatorPage):
47 """Extend IndicatorPage from Unity8."""
48
49 def _get_listview(self):
50 """Return the list view object from the indicator."""
51 return self.select_single(QQuickListView, objectName='mainMenu')
52
53 def press_label(self, text):
54 """Press the label in the list view of the indicator."""
55 self._get_listview().press_label(text)
56
57
58class Indicator:43class Indicator:
5944
60 def __init__(self, main_window, name, page):45 def __init__(self, main_window, name, page):
6146
=== modified file 'ubuntu_system_tests/helpers/mediascanner.py'
--- ubuntu_system_tests/helpers/mediascanner.py 2016-04-13 15:02:39 +0000
+++ ubuntu_system_tests/helpers/mediascanner.py 2016-07-15 14:58:58 +0000
@@ -21,9 +21,12 @@
21import dbus21import dbus
22import logging22import logging
2323
24from unity8 import process_helpers
25
26from ubuntu_system_tests.helpers.dbus_observer import DBusObserver24from ubuntu_system_tests.helpers.dbus_observer import DBusObserver
25from ubuntu_system_tests.helpers.processes import (
26 is_job_running,
27 start_job,
28 stop_job,
29)
27from ubuntu_system_tests.helpers.threads import StoppingThread30from ubuntu_system_tests.helpers.threads import StoppingThread
2831
29MEDIA_SCANNER = 'mediascanner-2.0'32MEDIA_SCANNER = 'mediascanner-2.0'
@@ -38,14 +41,14 @@
3841
39def stop_media_scanner():42def stop_media_scanner():
40 """ Stop the media scanner process """43 """ Stop the media scanner process """
41 if process_helpers.is_job_running(MEDIA_SCANNER):44 if is_job_running(MEDIA_SCANNER):
42 process_helpers.stop_job(MEDIA_SCANNER)45 stop_job(MEDIA_SCANNER)
4346
4447
45def start_media_scanner():48def start_media_scanner():
46 """ Start the media scanner process """49 """ Start the media scanner process """
47 if not process_helpers.is_job_running(MEDIA_SCANNER):50 if not is_job_running(MEDIA_SCANNER):
48 process_helpers.start_job(MEDIA_SCANNER)51 start_job(MEDIA_SCANNER)
4952
5053
51class MediaScannerObserver(DBusObserver):54class MediaScannerObserver(DBusObserver):
5255
=== modified file 'ubuntu_system_tests/helpers/messaging/app.py'
--- ubuntu_system_tests/helpers/messaging/app.py 2016-06-02 08:19:07 +0000
+++ ubuntu_system_tests/helpers/messaging/app.py 2016-07-15 14:58:58 +0000
@@ -19,7 +19,6 @@
1919
20from collections import namedtuple20from collections import namedtuple
21from math import ceil21from math import ceil
22import ubuntuuitoolkit
2322
24from ubuntu_system_tests.helpers import autopilot23from ubuntu_system_tests.helpers import autopilot
25from ubuntu_system_tests.helpers import processes24from ubuntu_system_tests.helpers import processes
@@ -104,17 +103,16 @@
104 return processes.is_process_running(APP)103 return processes.is_process_running(APP)
105104
106105
107def get_messaging_app_proxy(106def get_messaging_app_proxy(raw_proxy=False):
108 base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
109 """107 """
110 Return messaging app proxy object from existing process.108 Return messaging app proxy object from existing process.
111109
112 :return: Proxy object for messaging application.110 :return: Proxy object for messaging application.
113111
114 """112 """
115 if not base:113 if raw_proxy:
116 return autopilot.get_proxy_object_for_existing_app(APP,114 return autopilot.get_proxy_object_for_existing_app(
117 base=base)115 APP, raw_proxy=raw_proxy)
118116
119 from ubuntu_system_tests.helpers.messaging._cpo import MainView117 from ubuntu_system_tests.helpers.messaging._cpo import MainView
120 proxy = autopilot.get_proxy_object_for_existing_app(APP)118 proxy = autopilot.get_proxy_object_for_existing_app(APP)
121119
=== modified file 'ubuntu_system_tests/helpers/messaging/fixture_setup.py'
--- ubuntu_system_tests/helpers/messaging/fixture_setup.py 2015-12-14 09:58:30 +0000
+++ ubuntu_system_tests/helpers/messaging/fixture_setup.py 2016-07-15 14:58:58 +0000
@@ -24,10 +24,13 @@
24import shutil24import shutil
25import subprocess25import subprocess
2626
27from messaging_app import fixture_setup27from ubuntu_system_tests.helpers import (
28 file_system as fs,
29 system_settings,
30 try_import,
31)
2832
29from ubuntu_system_tests.helpers import file_system as fs33fixture_setup = try_import('messaging_app.fixture_setup')
30from ubuntu_system_tests.helpers import system_settings
3134
32MESSAGING_APP_CONF = 'com.ubuntu.messaging-app/MessagingApp.conf'35MESSAGING_APP_CONF = 'com.ubuntu.messaging-app/MessagingApp.conf'
3336
3437
=== modified file 'ubuntu_system_tests/helpers/processes.py'
--- ubuntu_system_tests/helpers/processes.py 2016-06-08 19:11:00 +0000
+++ ubuntu_system_tests/helpers/processes.py 2016-07-15 14:58:58 +0000
@@ -25,13 +25,36 @@
2525
26import psutil26import psutil
2727
28from unity8.process_helpers import get_job_status28from ubuntu_system_tests.helpers import (
29 try_import,
30 wait_until,
31)
2932
30from ubuntu_system_tests.helpers import wait_until33process_helpers = try_import('unity8.process_helpers')
3134
32logger = logging.getLogger(__name__)35logger = logging.getLogger(__name__)
3336
3437
38def get_job_pid(name):
39 return process_helpers.get_job_pid(name)
40
41
42def get_job_status(name):
43 return process_helpers.get_job_status(name)
44
45
46def is_job_running(name):
47 return process_helpers.is_job_running(name)
48
49
50def start_job(name, *args):
51 return process_helpers.start_job(name, *args)
52
53
54def stop_job(name):
55 return process_helpers.stop_job(name)
56
57
35def is_process_running(pname):58def is_process_running(pname):
36 try:59 try:
37 return bool(get_process_ids(pname))60 return bool(get_process_ids(pname))
3861
=== modified file 'ubuntu_system_tests/helpers/scopes/music/_cpo.py'
--- ubuntu_system_tests/helpers/scopes/music/_cpo.py 2016-06-21 14:49:38 +0000
+++ ubuntu_system_tests/helpers/scopes/music/_cpo.py 2016-07-15 14:58:58 +0000
@@ -144,7 +144,7 @@
144144
145 def is_category_displayed(self, category):145 def is_category_displayed(self, category):
146 """ Indicates if a category section is being displayed """146 """ Indicates if a category section is being displayed """
147 is_element(self._get_category, category)147 is_element(self._get_category_section, category)
148148
149 def select_category(self, header):149 def select_category(self, header):
150 """150 """
151151
=== modified file 'ubuntu_system_tests/helpers/sensors.py'
--- ubuntu_system_tests/helpers/sensors.py 2016-04-25 19:02:31 +0000
+++ ubuntu_system_tests/helpers/sensors.py 2016-07-15 14:58:58 +0000
@@ -21,12 +21,15 @@
21import os21import os
22import subprocess22import subprocess
2323
24from unity8.sensors import FakePlatformSensors as Unity8Sensors24from ubuntu_system_tests.helpers import (
2525 context,
26from ubuntu_system_tests.helpers import context26 try_import,
27)
27from ubuntu_system_tests.helpers.power import write_to_powerd_fifo28from ubuntu_system_tests.helpers.power import write_to_powerd_fifo
28from ubuntu_system_tests.helpers.testbed import run_command_with_sudo as sudo29from ubuntu_system_tests.helpers.testbed import run_command_with_sudo as sudo
2930
31Unity8Sensors = try_import('unity8.sensors').FakePlatformSensors
32
30DELAY_MS = 1033DELAY_MS = 10
31ACCEL_SENSOR_RESOLUTION = 0.134ACCEL_SENSOR_RESOLUTION = 0.1
32ACCEL_SENSOR_MAX = 100035ACCEL_SENSOR_MAX = 1000
@@ -120,7 +123,7 @@
120123
121124
122def set_orientation(orientation):125def set_orientation(orientation):
123 """Set accelerometer sensor orientation to specified value.126 """Set orientation sensor to specified value.
124 :param orientation: Orientation to set.127 :param orientation: Orientation to set.
125 """128 """
126 Unity8Sensors(context.shared.get('unity_pid')).set_orientation(orientation)129 Unity8Sensors(context.shared.get('unity_pid')).set_orientation(orientation)
127130
=== modified file 'ubuntu_system_tests/helpers/system_settings/__init__.py'
--- ubuntu_system_tests/helpers/system_settings/__init__.py 2016-06-02 10:38:49 +0000
+++ ubuntu_system_tests/helpers/system_settings/__init__.py 2016-07-15 14:58:58 +0000
@@ -30,6 +30,7 @@
30 get_rotation_lock,30 get_rotation_lock,
31 get_silent_mode,31 get_silent_mode,
32 get_system_settings_proxy,32 get_system_settings_proxy,
33 is_reporting_enabled,
33 is_system_settings_running,34 is_system_settings_running,
34 launch_system_settings,35 launch_system_settings,
35 set_default_modem_for_calls,36 set_default_modem_for_calls,
@@ -56,6 +57,7 @@
56 'get_rotation_lock',57 'get_rotation_lock',
57 'get_silent_mode',58 'get_silent_mode',
58 'get_system_settings_proxy',59 'get_system_settings_proxy',
60 'is_reporting_enabled',
59 'is_system_settings_running',61 'is_system_settings_running',
60 'launch_system_settings',62 'launch_system_settings',
61 'set_default_modem_for_calls',63 'set_default_modem_for_calls',
6264
=== modified file 'ubuntu_system_tests/helpers/system_settings/_cpo.py'
--- ubuntu_system_tests/helpers/system_settings/_cpo.py 2016-06-01 16:14:35 +0000
+++ ubuntu_system_tests/helpers/system_settings/_cpo.py 2016-07-15 14:58:58 +0000
@@ -29,7 +29,7 @@
29from ubuntu_system_tests.helpers.autopilot import (29from ubuntu_system_tests.helpers.autopilot import (
30 validate_dbus_object, is_element)30 validate_dbus_object, is_element)
31from ubuntu_system_tests.helpers.autopilot.list import order_by_y_coord31from ubuntu_system_tests.helpers.autopilot.list import order_by_y_coord
32from ubuntu_system_tests.helpers.brightness import BrightnessPageBase32from ubuntu_system_tests.helpers.brightness._cpo import BrightnessPageBase
3333
34logger = logging.getLogger(__name__)34logger = logging.getLogger(__name__)
3535
3636
=== modified file 'ubuntu_system_tests/helpers/system_settings/app.py'
--- ubuntu_system_tests/helpers/system_settings/app.py 2016-06-02 10:38:49 +0000
+++ ubuntu_system_tests/helpers/system_settings/app.py 2016-07-15 14:58:58 +0000
@@ -18,7 +18,9 @@
18# along with this program. If not, see <http://www.gnu.org/licenses/>.18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#19#
2020
21import configparser
21import dbus22import dbus
23import os
22from subprocess import (24from subprocess import (
23 CalledProcessError,25 CalledProcessError,
24 check_call,26 check_call,
@@ -64,8 +66,7 @@
6466
65 """67 """
66 from ubuntu_system_tests.helpers.system_settings import _cpo # NOQA68 from ubuntu_system_tests.helpers.system_settings import _cpo # NOQA
67 proxy = autopilot.get_proxy_object_for_existing_app(69 proxy = autopilot.get_proxy_object_for_existing_app(APP)
68 APP, cleanup_process=APP_WIN_ID)
69 return proxy.main_view70 return proxy.main_view
7071
7172
@@ -191,3 +192,14 @@
191def set_silent_mode(state):192def set_silent_mode(state):
192 """Set boolean value for silent mode setting."""193 """Set boolean value for silent mode setting."""
193 _get_sound_interface().SetState('silent-mode', state, [])194 _get_sound_interface().SetState('silent-mode', state, [])
195
196
197def is_reporting_enabled():
198 """ Detect if the reporting is enabled """
199 file = os.path.join('/', 'etc', 'writable', 'whoopsie')
200 if not os.path.isfile(file):
201 return True
202
203 config = configparser.ConfigParser()
204 config.read(file)
205 return 'report_metrics' not in config.options('General')
194206
=== modified file 'ubuntu_system_tests/helpers/ubuntu_keyboard/__init__.py'
--- ubuntu_system_tests/helpers/ubuntu_keyboard/__init__.py 2016-06-02 10:49:38 +0000
+++ ubuntu_system_tests/helpers/ubuntu_keyboard/__init__.py 2016-07-15 14:58:58 +0000
@@ -20,6 +20,7 @@
2020
21from ubuntu_system_tests.helpers.ubuntu_keyboard.utils import (21from ubuntu_system_tests.helpers.ubuntu_keyboard.utils import (
22 APP,22 APP,
23 get_keyboard,
23 get_ubuntu_keyboard_proxy,24 get_ubuntu_keyboard_proxy,
24 is_keyboard_shifted,25 is_keyboard_shifted,
25)26)
@@ -27,6 +28,7 @@
2728
28__all__ = [29__all__ = [
29 'APP',30 'APP',
31 'get_keyboard',
30 'get_ubuntu_keyboard_proxy',32 'get_ubuntu_keyboard_proxy',
31 'is_keyboard_shifted',33 'is_keyboard_shifted',
32]34]
3335
=== modified file 'ubuntu_system_tests/helpers/ubuntu_keyboard/utils.py'
--- ubuntu_system_tests/helpers/ubuntu_keyboard/utils.py 2016-06-02 10:49:38 +0000
+++ ubuntu_system_tests/helpers/ubuntu_keyboard/utils.py 2016-07-15 14:58:58 +0000
@@ -18,8 +18,6 @@
18# along with this program. If not, see <http://www.gnu.org/licenses/>.18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#19#
2020
21from ubuntu_keyboard.emulators.keyboard import Keyboard
22
23from ubuntu_system_tests.helpers import autopilot21from ubuntu_system_tests.helpers import autopilot
2422
25APP = 'maliit-server'23APP = 'maliit-server'
@@ -31,5 +29,9 @@
3129
3230
33def is_keyboard_shifted():31def is_keyboard_shifted():
34 keyboard = Keyboard()32 return get_keyboard().active_keypad_state == 'SHIFTED'
35 return keyboard.active_keypad_state == 'SHIFTED'33
34
35def get_keyboard():
36 from ubuntu_keyboard.emulators.keyboard import Keyboard
37 return Keyboard()
3638
=== modified file 'ubuntu_system_tests/helpers/unity8/__init__.py'
--- ubuntu_system_tests/helpers/unity8/__init__.py 2016-06-02 11:07:46 +0000
+++ ubuntu_system_tests/helpers/unity8/__init__.py 2016-07-15 14:58:58 +0000
@@ -19,28 +19,34 @@
19#19#
2020
21from ubuntu_system_tests.helpers.unity8.utils import (21from ubuntu_system_tests.helpers.unity8.utils import (
22 APP_WIN_NAME,
22 close_all_apps,23 close_all_apps,
23 close_app,24 close_app,
24 ensure_unity_running_and_greeter_hidden,25 ensure_unity_running_and_greeter_hidden,
25 ensure_unity_stopped,26 ensure_unity_stopped,
26 get_dash,27 get_dash,
28 get_unity_pid,
27 launch_application_from_launcher,29 launch_application_from_launcher,
30 lock_unity,
28 PROC_NAME,31 PROC_NAME,
29 UNITY8_PATH_ROOT,32 UNITY8_PATH_ROOT,
30 UNITY8_DASH_PATH_ROOT,33 UNITY8_DASH_PATH_ROOT,
31 APP_WIN_NAME,34 unlock_unity,
32)35)
3336
3437
35__all__ = [38__all__ = [
39 'APP_WIN_NAME',
36 'close_all_apps',40 'close_all_apps',
37 'close_app',41 'close_app',
38 'ensure_unity_running_and_greeter_hidden',42 'ensure_unity_running_and_greeter_hidden',
39 'ensure_unity_stopped',43 'ensure_unity_stopped',
40 'get_dash',44 'get_dash',
45 'get_unity_pid',
41 'launch_application_from_launcher',46 'launch_application_from_launcher',
47 'lock_unity',
42 'PROC_NAME',48 'PROC_NAME',
43 'UNITY8_PATH_ROOT',49 'UNITY8_PATH_ROOT',
44 'UNITY8_DASH_PATH_ROOT',50 'UNITY8_DASH_PATH_ROOT',
45 'APP_WIN_NAME',51 'unlock_unity',
46]52]
4753
=== modified file 'ubuntu_system_tests/helpers/unity8/settings_wizard.py'
--- ubuntu_system_tests/helpers/unity8/settings_wizard.py 2016-02-03 10:40:06 +0000
+++ ubuntu_system_tests/helpers/unity8/settings_wizard.py 2016-07-15 14:58:58 +0000
@@ -16,9 +16,7 @@
16# You should have received a copy of the GNU General Public License16# You should have received a copy of the GNU General Public License
17# along with this program. If not, see <http://www.gnu.org/licenses/>17# along with this program. If not, see <http://www.gnu.org/licenses/>
1818
19import configparser
20import logging19import logging
21import os
22import re20import re
2321
24import autopilot22import autopilot
@@ -27,6 +25,9 @@
2725
28from ubuntu_system_tests.helpers.autopilot import (26from ubuntu_system_tests.helpers.autopilot import (
29 override_proxy_timeout, validate_dbus_object)27 override_proxy_timeout, validate_dbus_object)
28from ubuntu_system_tests.helpers.system_settings import (
29 is_reporting_enabled,
30)
30from ubuntu_system_tests.helpers.unity8 import UNITY8_PATH_ROOT31from ubuntu_system_tests.helpers.unity8 import UNITY8_PATH_ROOT
3132
32logger = logging.getLogger(__name__)33logger = logging.getLogger(__name__)
@@ -36,17 +37,6 @@
36 return current_page.get_root_instance().select_single(Wizard)37 return current_page.get_root_instance().select_single(Wizard)
3738
3839
39def reporting_page_included():
40 """ Detect if the reporting was set by default """
41 file = os.path.join('/', 'etc', 'writable', 'whoopsie')
42 if not os.path.isfile(file):
43 return True
44
45 config = configparser.ConfigParser()
46 config.read(file)
47 return 'report_metrics' not in config.options('General')
48
49
50class Wizard(UbuntuUIToolkitCustomProxyObjectBase):40class Wizard(UbuntuUIToolkitCustomProxyObjectBase):
51 """High-level helper to navigate through the pages of the wizard"""41 """High-level helper to navigate through the pages of the wizard"""
5242
@@ -489,7 +479,7 @@
489 @autopilot.logging.log_action(logger.info)479 @autopilot.logging.log_action(logger.info)
490 def continue_(self):480 def continue_(self):
491 self.pointing_device.click_object(self._get_continue_button())481 self.pointing_device.click_object(self._get_continue_button())
492 if reporting_page_included():482 if is_reporting_enabled():
493 return get_wizard(self).get_reporting_page()483 return get_wizard(self).get_reporting_page()
494 else:484 else:
495 return get_wizard(self).get_finished_page()485 return get_wizard(self).get_finished_page()
496486
=== modified file 'ubuntu_system_tests/helpers/unity8/shell.py'
--- ubuntu_system_tests/helpers/unity8/shell.py 2016-06-13 10:43:31 +0000
+++ ubuntu_system_tests/helpers/unity8/shell.py 2016-07-15 14:58:58 +0000
@@ -25,11 +25,8 @@
25 logging as autopilot_logging25 logging as autopilot_logging
26)26)
27import ubuntuuitoolkit27import ubuntuuitoolkit
28from unity8.shell.emulators import main_window
2928
30from ubuntu_system_tests.helpers.autopilot import validate_dbus_object29from ubuntu_system_tests.helpers.autopilot import validate_dbus_object
31from ubuntu_system_tests.helpers.indicators.message import NotificationsIndicatorPage, NotificationsIndicatorItem # NOQA
32from ubuntu_system_tests.helpers.notifications.utils import Notifications
33from ubuntu_system_tests.helpers.unity8 import (30from ubuntu_system_tests.helpers.unity8 import (
34 greeter as greeter_helpers, UNITY8_PATH_ROOT)31 greeter as greeter_helpers, UNITY8_PATH_ROOT)
3532
@@ -48,6 +45,7 @@
4845
49 @property46 @property
50 def main_window(self):47 def main_window(self):
48 from ubuntu_system_tests.helpers.unity8.shell_view import ShellView
51 return self.select_single(ShellView)49 return self.select_single(ShellView)
5250
53 @autopilot_logging.log_action(logger.debug)51 @autopilot_logging.log_action(logger.debug)
@@ -82,88 +80,3 @@
82 except exceptions.StateNotFoundError:80 except exceptions.StateNotFoundError:
83 # This is fine, it's already loaded81 # This is fine, it's already loaded
84 pass82 pass
85
86
87class ShellView(main_window.ShellView):
88 """Class to extend Unity8 main window ShellView."""
89
90 @classmethod
91 def validate_dbus_object(cls, path, state):
92 return validate_dbus_object(
93 path, state, UNITY8_PATH_ROOT, b'ShellView', title='Unity8')
94
95 def get_notifications_list(self):
96 """Return a list of notifications currently being displayed."""
97 return self.select_single(
98 Notifications, objectName='notificationList')
99
100 def get_notifications_panel(self):
101 """Return 'Notifications' panel object."""
102 return self._get_indicator_panel_item('indicator-messages')
103
104 def clear_notifications(self):
105 """
106 Clear all existing notifications from 'Notifications' indicator.
107
108 """
109 if self.is_new_notification_displayed():
110 self.open_indicator_page('indicator-messages').clear_all()
111 self.close_indicator_page()
112
113 def open_notifications_indicator(self):
114 """Swipe down to display the notifications indicator."""
115 return self.open_indicator_page('indicator-messages')
116
117 def is_new_notification_displayed(self):
118 """Return True if new notification message icon is displayed."""
119 return self.get_notifications_panel().is_new_message_displayed()
120
121 def get_passphrase_unlock_screen(self):
122 """Wait for input method to be in shown state and return lockscreen."""
123 from ubuntu_system_tests.helpers.unity8 import lock_screen
124 input_method = self.wait_select_single(
125 'InputMethod', objectName='inputMethod', visible=True)
126 input_method.state.wait_for('shown')
127 return self.select_single(lock_screen.PassphraseLockscreen)
128
129 def get_missed_call_snap_decision(self):
130 """Return missed call snap decision menu."""
131 from ubuntu_system_tests.helpers.snap_decision import missed_call
132 return self.select_single(
133 missed_call.SnapDecisionMenu, objectName='snapDecision',
134 visible=True)
135
136 def get_phone_stage(self):
137 from ubuntu_system_tests.helpers.unity8 import phone_stage
138 return self.select_single(phone_stage.PhoneStage, objectName='stage')
139
140 def swipe_to_show_app_switcher(self):
141 """Swipe from right edge to reveal task switcher."""
142 stage = self.get_phone_stage()
143 stage.swipe_to_top()
144 return stage
145
146 def get_current_focused_app(self):
147 """Return Id for current focused app."""
148 return self.select_single('Shell').focusedApplicationId
149
150 def _is_indicator_panel_opened(self):
151 indicator_page = self.wait_select_single('IndicatorsMenu')
152 return indicator_page.fullyOpened
153
154 def close_indicator_page(self):
155 """
156 Override the method to only try to close the indicator panel if its
157 not already.
158 """
159 if self._is_indicator_panel_opened():
160 super().close_indicator_page()
161
162 def is_indicator_item_hidden(self, indicator_name):
163 """
164 Return bool representing if the requested indicator item is hidden or
165 not.
166 """
167 item = self.select_single('IndicatorItem',
168 objectName=indicator_name + '-panelItem')
169 return item.hidden
17083
=== added file 'ubuntu_system_tests/helpers/unity8/shell_view.py'
--- ubuntu_system_tests/helpers/unity8/shell_view.py 1970-01-01 00:00:00 +0000
+++ ubuntu_system_tests/helpers/unity8/shell_view.py 2016-07-15 14:58:58 +0000
@@ -0,0 +1,116 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2
3#
4# Ubuntu System Tests
5# Copyright (C) 2015, 2016 Canonical
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20
21from unity8.shell.emulators import main_window
22
23from ubuntu_system_tests.helpers.autopilot import validate_dbus_object
24from ubuntu_system_tests.helpers.indicators.message import NotificationsIndicatorItem # NOQA
25from ubuntu_system_tests.helpers.notifications.utils import Notifications
26from ubuntu_system_tests.helpers.unity8 import UNITY8_PATH_ROOT
27
28
29class ShellView(main_window.ShellView):
30 """Class to extend Unity8 main window ShellView."""
31
32 @classmethod
33 def validate_dbus_object(cls, path, state):
34 return validate_dbus_object(
35 path, state, UNITY8_PATH_ROOT, b'ShellView', title='Unity8')
36
37 def get_notifications_list(self):
38 """Return a list of notifications currently being displayed."""
39 return self.select_single(
40 Notifications, objectName='notificationList')
41
42 def get_notifications_panel(self):
43 """Return 'Notifications' panel object."""
44 return self._get_indicator_panel_item('indicator-messages')
45
46 def clear_notifications(self):
47 """
48 Clear all existing notifications from 'Notifications' indicator.
49
50 """
51 if self.is_new_notification_displayed():
52 self.open_indicator_page('indicator-messages').clear_all()
53 self.close_indicator_page()
54
55 def open_notifications_indicator(self):
56 """Swipe down to display the notifications indicator."""
57 return self.open_indicator_page('indicator-messages')
58
59 def is_new_notification_displayed(self):
60 """Return True if new notification message icon is displayed."""
61 return self.get_notifications_panel().is_new_message_displayed()
62
63 def get_passphrase_unlock_screen(self):
64 """Wait for input method to be in shown state and return lockscreen."""
65 from ubuntu_system_tests.helpers.unity8 import lock_screen
66 input_method = self.wait_select_single(
67 'InputMethod', objectName='inputMethod', visible=True)
68 input_method.state.wait_for('shown')
69 return self.select_single(lock_screen.PassphraseLockscreen)
70
71 def get_missed_call_snap_decision(self):
72 """Return missed call snap decision menu."""
73 from ubuntu_system_tests.helpers.snap_decision import missed_call
74 return self.select_single(
75 missed_call.SnapDecisionMenu, objectName='snapDecision',
76 visible=True)
77
78 def get_phone_stage(self):
79 from ubuntu_system_tests.helpers.unity8 import phone_stage
80 return self.select_single(phone_stage.PhoneStage, objectName='stage')
81
82 def swipe_to_show_app_switcher(self):
83 """Swipe from right edge to reveal task switcher."""
84 stage = self.get_phone_stage()
85 stage.swipe_to_top()
86 return stage
87
88 def get_settings_wizard(self):
89 """Return settings wizard custom proxy object."""
90 from ubuntu_system_tests.helpers.unity8.settings_wizard import Wizard
91 return self.select_single(Wizard)
92
93 def get_current_focused_app(self):
94 """Return Id for current focused app."""
95 return self.select_single('Shell').focusedApplicationId
96
97 def _is_indicator_panel_opened(self):
98 indicator_page = self.wait_select_single('IndicatorsMenu')
99 return indicator_page.fullyOpened
100
101 def close_indicator_page(self):
102 """
103 Override the method to only try to close the indicator panel if its
104 not already.
105 """
106 if self._is_indicator_panel_opened():
107 super().close_indicator_page()
108
109 def is_indicator_item_hidden(self, indicator_name):
110 """
111 Return bool representing if the requested indicator item is hidden or
112 not.
113 """
114 item = self.select_single('IndicatorItem',
115 objectName=indicator_name + '-panelItem')
116 return item.hidden
0117
=== modified file 'ubuntu_system_tests/helpers/unity8/utils.py'
--- ubuntu_system_tests/helpers/unity8/utils.py 2016-06-02 11:07:46 +0000
+++ ubuntu_system_tests/helpers/unity8/utils.py 2016-07-15 14:58:58 +0000
@@ -18,17 +18,22 @@
18# along with this program. If not, see <http://www.gnu.org/licenses/>.18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#19#
2020
21from ubuntuuitoolkit import UbuntuUIToolkitCustomProxyObjectBase
22from unity8 import process_helpers
23
24from autopilot import introspection
25from autopilot.matchers import Eventually21from autopilot.matchers import Eventually
26from testtools.matchers import Equals22from testtools.matchers import Equals
2723
28from ubuntu_system_tests.helpers import context24from ubuntu_system_tests.helpers import (
29from ubuntu_system_tests.helpers import timer25 context,
26 processes,
27 timer,
28 try_import,
29)
30from ubuntu_system_tests.helpers.autopilot import (
31 get_proxy_object_for_existing_app,
32)
30from ubuntu_system_tests.helpers.unity8 import greeter33from ubuntu_system_tests.helpers.unity8 import greeter
3134
35process_helpers = try_import('unity8.process_helpers')
36
32PROC_NAME = 'unity8'37PROC_NAME = 'unity8'
33UNITY8_PATH_ROOT = b'unity8'38UNITY8_PATH_ROOT = b'unity8'
34UNITY8_DASH_PATH_ROOT = b'unity8-dash'39UNITY8_DASH_PATH_ROOT = b'unity8-dash'
@@ -37,30 +42,38 @@
3742
38def ensure_unity_stopped():43def ensure_unity_stopped():
39 if _is_unity8_running():44 if _is_unity8_running():
40 process_helpers.stop_job('unity8')45 processes.stop_job('unity8')
41 Eventually(Equals(False), timeout=300).match(_is_unity8_running)46 Eventually(Equals(False), timeout=300).match(_is_unity8_running)
4247
4348
44def ensure_unity_running_and_greeter_hidden():49def ensure_unity_running_and_greeter_hidden():
45 if not _is_unity8_running():50 if not _is_unity8_running():
46 process_helpers.start_job('unity8')51 processes.start_job('unity8')
47 greeter.wait_for_greeter()52 greeter.wait_for_greeter()
4853
49 greeter.hide_greeter_with_dbus()54 greeter.hide_greeter_with_dbus()
5055
5156
57def get_unity_pid():
58 return process_helpers._get_unity_pid()
59
60
61def lock_unity():
62 process_helpers.lock_unity()
63
64
65def unlock_unity():
66 process_helpers.unlock_unity()
67
68
52def _is_unity8_running():69def _is_unity8_running():
53 return process_helpers.is_job_running('unity8')70 return processes.is_job_running('unity8')
5471
5572
56def get_dash():73def get_dash():
57 """Return the Unity8 Dash autopilot custom proxy object."""74 """Return the Unity8 Dash autopilot custom proxy object."""
58 from ubuntu_system_tests.helpers.unity8.dash import Dash75 from ubuntu_system_tests.helpers.unity8.dash import Dash
59 pid = process_helpers.get_job_pid('unity8-dash')76 dash_proxy = get_proxy_object_for_existing_app('unity8-dash')
60 dash_proxy = introspection.get_proxy_object_for_existing_process(
61 pid=pid,
62 emulator_base=UbuntuUIToolkitCustomProxyObjectBase,
63 )
64 return dash_proxy.select_single(Dash)77 return dash_proxy.select_single(Dash)
6578
6679
6780
=== modified file 'ubuntu_system_tests/helpers/utils.py'
--- ubuntu_system_tests/helpers/utils.py 2016-06-02 12:50:05 +0000
+++ ubuntu_system_tests/helpers/utils.py 2016-07-15 14:58:58 +0000
@@ -18,9 +18,43 @@
18# along with this program. If not, see <http://www.gnu.org/licenses/>.18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#19#
2020
21import logging
21import time22import time
2223
23from collections import deque24from collections import deque
25from importlib import import_module
26from inspect import stack
27
28logger = logging.getLogger(__name__)
29
30
31def try_import(name, package=None):
32 """
33 Import named module from package and return it or DummyObject if not found.
34
35 This method is used in cases where an import is made but should not raise
36 an ImportError if the module is not found. The main usage for this is
37 where an autopilot package is not installed on the host, but it is still
38 required to list all availble tests on the host. In this case the test
39 module must import successfully, but won't actually be executed so it is
40 not neccessary to have the dependency installed.
41
42 If a DummyObject is returned this allows any attributes or methods to be
43 imported from the DummyObject without error.
44
45 :param name: Absolute or relative name of module to import.
46 :param package: If name is relative, package must specify the name of the
47 package to import from.
48 :return: Imported module or DummyObject if it doesn't exist.
49
50 """
51 try:
52 return import_module(name, package)
53 except ImportError as e:
54 logger.warn(e.msg)
55 logger.warn('DummyObject created for module: {m} at: {i}'.format(
56 m=name, i=_get_caller_info()))
57 return DummyObject()
2458
2559
26def wait_until(predicate, *args, timeout=10, period=1, stop_event=None,60def wait_until(predicate, *args, timeout=10, period=1, stop_event=None,
@@ -105,9 +139,49 @@
105 return bool(result)139 return bool(result)
106140
107141
142def _get_caller_info(stack_level=2):
143 """Return info string about the caller of the calling function.
144
145 :param stack_level: Number of level up the call stack to check.
146 :return: String info showing file path and line number.
147 """
148 caller = stack()[stack_level]
149 return '{path}:{line}'.format(path=caller[1], line=caller[2])
150
151
108class AttrDict(dict):152class AttrDict(dict):
109 """ Class used to access to the dict keys as parameters """153 """ Class used to access to the dict keys as parameters """
110154
111 def __init__(self, *args, **kwargs):155 def __init__(self, *args, **kwargs):
112 super(AttrDict, self).__init__(*args, **kwargs)156 super(AttrDict, self).__init__(*args, **kwargs)
113 self.__dict__ = self157 self.__dict__ = self
158
159
160class DummyObject:
161 """
162 Class used to create objects with dummy attributes and methods.
163
164 This is used when an object is required to return a dummy attribute value
165 or method result rather than raise a AttributeError or TypeError
166 exception.
167
168 This class can be used to create objects that support nested attributes
169 and methods.
170
171 """
172
173 def __init__(self, *args, **kwargs):
174 pass
175
176 def __getattribute__(self, name):
177 """Return a refernce to self for every attribute value to support
178 nested attributes."""
179 logger.warn('Accessing DummyObject attribute: {n} from: {f}'.format(
180 n=name, f=_get_caller_info()))
181 return self
182
183 def __call__(self, *args, **kwargs):
184 """Return a reference to self for every function call to support
185 nested function calls."""
186 logger.warn('DummyObject call from: {}'.format(_get_caller_info()))
187 return self
114188
=== modified file 'ubuntu_system_tests/helpers/webapp/ebay.py'
--- ubuntu_system_tests/helpers/webapp/ebay.py 2016-05-06 22:37:58 +0000
+++ ubuntu_system_tests/helpers/webapp/ebay.py 2016-07-15 14:58:58 +0000
@@ -18,11 +18,14 @@
18# along with this program. If not, see <http://www.gnu.org/licenses/>.18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#19#
2020
21from selenium.webdriver.support.ui import WebDriverWait21from ubuntu_system_tests.helpers import (
2222 try_import,
23from ubuntu_system_tests.helpers import webapp23 webapp,
24)
24from ubuntu_system_tests.helpers.webapp import BasePage25from ubuntu_system_tests.helpers.webapp import BasePage
2526
27WebDriverWait = try_import('selenium.webdriver.support.ui').WebDriverWait
28
26WEBAPP_NAME = 'eBay'29WEBAPP_NAME = 'eBay'
27WEBAPP_PACKAGE = 'com.ubuntu.developer.webapps.webapp-ebay'30WEBAPP_PACKAGE = 'com.ubuntu.developer.webapps.webapp-ebay'
28WEBAPP_WIN_ID = 'com.ubuntu.developer.webapps.webapp-ebay_webapp-ebay'31WEBAPP_WIN_ID = 'com.ubuntu.developer.webapps.webapp-ebay_webapp-ebay'
2932
=== modified file 'ubuntu_system_tests/helpers/webapp/here.py'
--- ubuntu_system_tests/helpers/webapp/here.py 2016-05-06 22:37:58 +0000
+++ ubuntu_system_tests/helpers/webapp/here.py 2016-07-15 14:58:58 +0000
@@ -20,14 +20,17 @@
2020
21import re21import re
2222
23from selenium.common.exceptions import TimeoutException23from ubuntu_system_tests.helpers import (
24from selenium.webdriver.common.by import By24 try_import,
25from selenium.webdriver.support import expected_conditions as EC25 webapp,
26from selenium.webdriver.support.ui import WebDriverWait26)
27
28from ubuntu_system_tests.helpers import webapp
29from ubuntu_system_tests.helpers.webapp import BasePage27from ubuntu_system_tests.helpers.webapp import BasePage
3028
29TimeoutException = try_import('selenium.common.exceptions').TimeoutException
30By = try_import('selenium.webdriver.common.by').By
31EC = try_import('selenium.webdriver.support.expected_conditions')
32WebDriverWait = try_import('selenium.webdriver.support.ui').WebDriverWait
33
31WEBAPP_NAME = 'HERE Maps'34WEBAPP_NAME = 'HERE Maps'
32WEBAPP_PACKAGE = 'com.nokia.heremaps'35WEBAPP_PACKAGE = 'com.nokia.heremaps'
33WEBAPP_WIN_ID = 'com.nokia.heremaps_here'36WEBAPP_WIN_ID = 'com.nokia.heremaps_here'
3437
=== modified file 'ubuntu_system_tests/helpers/webapp/utils.py'
--- ubuntu_system_tests/helpers/webapp/utils.py 2016-06-09 19:56:51 +0000
+++ ubuntu_system_tests/helpers/webapp/utils.py 2016-07-15 14:58:58 +0000
@@ -24,17 +24,20 @@
24import os24import os
25import time25import time
2626
27from selenium import webdriver27from ubuntu_system_tests.helpers import (
28from selenium.webdriver.chrome.options import Options28 autopilot,
29from selenium.webdriver.common.touch_actions import TouchActions29 processes,
3030 try_import,
31from ubuntu_system_tests.helpers import autopilot31)
32from ubuntu_system_tests.helpers import processes
33from ubuntu_system_tests.helpers.scopes.apps import (32from ubuntu_system_tests.helpers.scopes.apps import (
34 launch_application_from_apps_scope33 launch_application_from_apps_scope
35)34)
36from ubuntu_system_tests.helpers import wait_until35from ubuntu_system_tests.helpers import wait_until
3736
37webdriver = try_import('selenium.webdriver')
38Options = webdriver.chrome.options.Options
39TouchActions = webdriver.common.touch_actions.TouchActions
40
38DEFAULT_WEBVIEW_INSPECTOR_IP = '127.0.0.1'41DEFAULT_WEBVIEW_INSPECTOR_IP = '127.0.0.1'
39DEFAULT_WEBVIEW_INSPECTOR_PORT = 922142DEFAULT_WEBVIEW_INSPECTOR_PORT = 9221
4043
@@ -138,7 +141,7 @@
138 :returns: a string containing the chromedriver executable path141 :returns: a string containing the chromedriver executable path
139 """142 """
140 base_deps_dir = ''143 base_deps_dir = ''
141 default_path = 'usr/lib/*/oxide-qt/chromedriver'144 default_path = 'usr/lib/chromium-browser/chromedriver'
142 adt_artifacts = os.path.dirname(os.getenv('ADT_ARTIFACTS', default=''))145 adt_artifacts = os.path.dirname(os.getenv('ADT_ARTIFACTS', default=''))
143146
144 # This check is to avoid using a dependencies dir which has not been147 # This check is to avoid using a dependencies dir which has not been
145148
=== modified file 'ubuntu_system_tests/helpers/webbrowser/fixture_setup.py'
--- ubuntu_system_tests/helpers/webbrowser/fixture_setup.py 2016-03-28 17:58:25 +0000
+++ ubuntu_system_tests/helpers/webbrowser/fixture_setup.py 2016-07-15 14:58:58 +0000
@@ -24,9 +24,11 @@
24import time24import time
2525
26import fixtures26import fixtures
27from ubuntuuitoolkit import fixture_setup as ubuntuuitoolkit_fixtures
2827
29from ubuntu_system_tests.helpers import sqlite28from ubuntu_system_tests.helpers import (
29 sqlite,
30 try_import,
31)
30from ubuntu_system_tests.helpers.backup_restore_fixture import (32from ubuntu_system_tests.helpers.backup_restore_fixture import (
31 BackupRestoreFixture)33 BackupRestoreFixture)
32from ubuntu_system_tests.helpers.download_manager import (34from ubuntu_system_tests.helpers.download_manager import (
@@ -37,6 +39,8 @@
37from ubuntu_system_tests.helpers.media import BackupRestoreLocalMediaFixture39from ubuntu_system_tests.helpers.media import BackupRestoreLocalMediaFixture
38from ubuntu_system_tests.helpers.webbrowser import APP40from ubuntu_system_tests.helpers.webbrowser import APP
3941
42ubuntuuitoolkit_fixtures = try_import('ubuntuuitoolkit.fixture_setup')
43
4044
41class WebbrowserTestEnvironment(fixtures.Fixture):45class WebbrowserTestEnvironment(fixtures.Fixture):
42 """Fixture to prepare webbrowser test environment."""46 """Fixture to prepare webbrowser test environment."""
4347
=== modified file 'ubuntu_system_tests/selftests/test_commands.py'
--- ubuntu_system_tests/selftests/test_commands.py 2016-07-04 09:20:08 +0000
+++ ubuntu_system_tests/selftests/test_commands.py 2016-07-15 14:58:58 +0000
@@ -66,7 +66,16 @@
6666
67 self.assertNotIn('-s', command)67 self.assertNotIn('-s', command)
6868
69 def test_adt_run_must_be_called_with_short_timeout(self):69
70@mock.patch('ubuntu_system_tests.common.ssh.get_ssh_config_commands')
71class BuildAdtRunCommandTestCase(selftests.ConfigBaseTestCase):
72
73 def setUp(self):
74 super().setUp()
75 self.config_stack = config.UbuntuSystemTestsConfig()
76
77 def test_adt_run_must_be_called_with_short_timeout(
78 self, mock_ssh_config_commands):
70 self.set_config_values()79 self.set_config_values()
7180
72 command = commands.build_adt_run_test_command(81 command = commands.build_adt_run_test_command(
@@ -75,20 +84,26 @@
7584
76 run_arguments, _ = command.split('---')85 run_arguments, _ = command.split('---')
77 self.assertIn('--timeout-short=600', run_arguments)86 self.assertIn('--timeout-short=600', run_arguments)
87 mock_ssh_config_commands.assert_called_once_with()
7888
79 def test_adt_run_command_no_rw_file_mount(self):89 def test_adt_run_command_no_rw_file_mount(
90 self, mock_ssh_config_commands):
80 self.set_config_values()91 self.set_config_values()
81 run_cmd = ' '.join(commands.build_adt_run_test_command(92 run_cmd = ' '.join(commands.build_adt_run_test_command(
82 self.config_stack, config.KEY_DEFAULT))93 self.config_stack, config.KEY_DEFAULT))
83 self.assertNotIn('mount -o remount,rw /', run_cmd)94 self.assertNotIn('mount -o remount,rw /', run_cmd)
95 mock_ssh_config_commands.assert_called_once_with()
8496
85 def test_adt_run_command_ro_file_mount(self):97 def test_adt_run_command_ro_file_mount(
98 self, mock_ssh_config_commands):
86 self.set_config_values()99 self.set_config_values()
87 run_cmd = ' '.join(commands.build_adt_run_test_command(100 run_cmd = ' '.join(commands.build_adt_run_test_command(
88 self.config_stack, config.KEY_DEFAULT))101 self.config_stack, config.KEY_DEFAULT))
89 self.assertIn('mount -o remount,ro /', run_cmd)102 self.assertIn('mount -o remount,ro /', run_cmd)
103 mock_ssh_config_commands.assert_called_once_with()
90104
91 def test_adt_run_with_serial(self):105 def test_adt_run_with_serial(
106 self, mock_ssh_config_commands):
92 serial = 'test_serial'107 serial = 'test_serial'
93 self.set_config_values(device_serial=serial)108 self.set_config_values(device_serial=serial)
94109
@@ -98,8 +113,10 @@
98113
99 _, adb_arguments = command.split('ssh -s adb --')114 _, adb_arguments = command.split('ssh -s adb --')
100 self.assertIn('-s test_serial', adb_arguments)115 self.assertIn('-s test_serial', adb_arguments)
116 mock_ssh_config_commands.assert_called_once_with()
101117
102 def test_adt_run_without_serial(self):118 def test_adt_run_without_serial(
119 self, mock_ssh_config_commands):
103 self.set_config_values(device_serial='')120 self.set_config_values(device_serial='')
104121
105 command = commands.build_adt_run_test_command(122 command = commands.build_adt_run_test_command(
@@ -108,8 +125,10 @@
108125
109 _, adb_arguments = command.split('ssh -s adb --')126 _, adb_arguments = command.split('ssh -s adb --')
110 self.assertNotIn('-s test_serial', adb_arguments)127 self.assertNotIn('-s test_serial', adb_arguments)
128 mock_ssh_config_commands.assert_called_once_with()
111129
112 def test_adt_run_command_with_network_ready_creates_no_network(self):130 def test_adt_run_command_with_network_ready_creates_no_network(
131 self, mock_ssh_config_commands):
113 self.set_config_values()132 self.set_config_values()
114133
115 command = commands.build_adt_run_test_command(134 command = commands.build_adt_run_test_command(
@@ -117,8 +136,10 @@
117136
118 self.assertFalse(check_any_item_in_list_startswith_value(137 self.assertFalse(check_any_item_in_list_startswith_value(
119 command, 'nmcli device wifi connect'))138 command, 'nmcli device wifi connect'))
139 mock_ssh_config_commands.assert_called_once_with()
120140
121 def test_adt_run_command_with_default_parameters_creates_network(self):141 def test_adt_run_command_with_default_parameters_creates_network(
142 self, mock_ssh_config_commands):
122 self.set_config_values()143 self.set_config_values()
123144
124 command = commands.build_adt_run_test_command(145 command = commands.build_adt_run_test_command(
@@ -126,19 +147,24 @@
126147
127 self.assertTrue(check_any_item_in_list_startswith_value(148 self.assertTrue(check_any_item_in_list_startswith_value(
128 command, 'nmcli device wifi connect'))149 command, 'nmcli device wifi connect'))
150 mock_ssh_config_commands.assert_called_once_with()
129151
130 def test_enabling_verbose_option(self):152 def test_enabling_verbose_option(
153 self, mock_ssh_config_commands):
131 self.set_config_values()154 self.set_config_values()
132 command = commands.build_adt_run_test_command(155 command = commands.build_adt_run_test_command(
133 self.config_stack, config.KEY_DEFAULT, verbose=True)156 self.config_stack, config.KEY_DEFAULT, verbose=True)
134 self.assertTrue(check_any_item_in_list_contains_value(command, '-ddd'))157 self.assertTrue(check_any_item_in_list_contains_value(command, '-ddd'))
158 mock_ssh_config_commands.assert_called_once_with()
135159
136 def test_verbose_disabled_by_default(self):160 def test_verbose_disabled_by_default(
161 self, mock_ssh_config_commands):
137 self.set_config_values()162 self.set_config_values()
138 command = commands.build_adt_run_test_command(163 command = commands.build_adt_run_test_command(
139 self.config_stack, config.KEY_DEFAULT)164 self.config_stack, config.KEY_DEFAULT)
140 self.assertFalse(165 self.assertFalse(
141 check_any_item_in_list_contains_value(command, '-ddd'))166 check_any_item_in_list_contains_value(command, '-ddd'))
167 mock_ssh_config_commands.assert_called_once_with()
142168
143169
144class SetupCommandTestCase(selftests.ConfigBaseTestCase):170class SetupCommandTestCase(selftests.ConfigBaseTestCase):
145171
=== modified file 'ubuntu_system_tests/selftests/test_tests_to_run.py'
--- ubuntu_system_tests/selftests/test_tests_to_run.py 2016-06-06 09:53:20 +0000
+++ ubuntu_system_tests/selftests/test_tests_to_run.py 2016-07-15 14:58:58 +0000
@@ -133,7 +133,7 @@
133 'ubuntu_system_tests.helpers.unity8.utils.greeter',133 'ubuntu_system_tests.helpers.unity8.utils.greeter',
134 new_callable=FakeGreeterHelpers)134 new_callable=FakeGreeterHelpers)
135@mock.patch(135@mock.patch(
136 'ubuntu_system_tests.helpers.unity8.utils.process_helpers',136 'ubuntu_system_tests.helpers.unity8.utils.processes',
137 new_callable=FakeProcessHelpers)137 new_callable=FakeProcessHelpers)
138class EnsureUnityInRequiredStateTestCase(unittest.TestCase):138class EnsureUnityInRequiredStateTestCase(unittest.TestCase):
139139
140140
=== modified file 'ubuntu_system_tests/tests/base.py'
--- ubuntu_system_tests/tests/base.py 2016-07-13 09:57:44 +0000
+++ ubuntu_system_tests/tests/base.py 2016-07-15 14:58:58 +0000
@@ -32,46 +32,58 @@
32 logging as autopilot_logging,32 logging as autopilot_logging,
33 testcase33 testcase
34)34)
35from autopilot._fixtures import OSKAlwaysEnabled
36from autopilot.introspection import _object_registry as object_registry35from autopilot.introspection import _object_registry as object_registry
37from ubuntuuitoolkit import fixture_setup
38from unity8 import process_helpers
3936
40from ubuntu_system_tests.helpers import autopilot37from ubuntu_system_tests.helpers import (
41from ubuntu_system_tests.helpers import context38 autopilot,
42from ubuntu_system_tests.helpers import images39 context,
43from ubuntu_system_tests.helpers import mir40 images,
41 mir,
42 try_import,
43)
44from ubuntu_system_tests.helpers.location.fixture_setup import (44from ubuntu_system_tests.helpers.location.fixture_setup import (
45 SetLocationAccessRequests)45 SetLocationAccessRequests)
46from ubuntu_system_tests.helpers.notifications import sim_pin_observer46from ubuntu_system_tests.helpers.notifications import sim_pin_observer
47from ubuntu_system_tests.helpers import ofono47from ubuntu_system_tests.helpers import ofono
48from ubuntu_system_tests.helpers.processes import wait_for_job_spawned48from ubuntu_system_tests.helpers.processes import (
49 start_job,
50 wait_for_job_spawned,
51)
49from ubuntu_system_tests.helpers import screen52from ubuntu_system_tests.helpers import screen
50from ubuntu_system_tests.helpers.timeout import timeout53from ubuntu_system_tests.helpers.timeout import timeout
51from ubuntu_system_tests.helpers import unity854from ubuntu_system_tests.helpers.unity8 import (
52from ubuntu_system_tests.helpers.unity8 import get_dash55 ensure_unity_running_and_greeter_hidden,
53from ubuntu_system_tests.helpers.unity8 import sensors56 ensure_unity_stopped,
54from ubuntu_system_tests.helpers.unity8.shell import Unity8 # NOQA57 get_dash,
58 get_unity_pid,
59 PROC_NAME,
60 sensors,
61)
55from ubuntu_system_tests.helpers import wait_until62from ubuntu_system_tests.helpers import wait_until
56from ubuntu_system_tests.helpers import webapp63from ubuntu_system_tests.helpers.webapp import (
64 DEFAULT_WEBVIEW_INSPECTOR_IP,
65 DEFAULT_WEBVIEW_INSPECTOR_PORT,
66)
5767
58# Any test name ending with this will leave device locked68# Any test name ending with this will leave device locked
59TEST_ID_DEVICE_LOCKED = 'device_locked'69TEST_ID_DEVICE_LOCKED = 'device_locked'
6070
61logger = logging.getLogger(__name__)71logger = logging.getLogger(__name__)
6272
73fixture_setup = try_import('ubuntuuitoolkit.fixture_setup')
74
6375
64class BaseUbuntuSystemTestCase(testcase.AutopilotTestCase):76class BaseUbuntuSystemTestCase(testcase.AutopilotTestCase):
6577
66 @classmethod78 @classmethod
67 def setUpClass(cls):79 def setUpClass(cls):
68 unity8.ensure_unity_stopped()80 ensure_unity_stopped()
69 super().setUpClass()81 super().setUpClass()
7082
71 @classmethod83 @classmethod
72 def tearDownClass(cls):84 def tearDownClass(cls):
73 super().tearDownClass()85 super().tearDownClass()
74 unity8.ensure_unity_running_and_greeter_hidden()86 ensure_unity_running_and_greeter_hidden()
7587
76 def setUp(self, allow_scopes_location=True):88 def setUp(self, allow_scopes_location=True):
77 super().setUp()89 super().setUp()
@@ -87,6 +99,7 @@
87 context.shared.retry_time = 1000099 context.shared.retry_time = 10000
88100
89 def _get_unity8_proxy_object(self):101 def _get_unity8_proxy_object(self):
102 from ubuntu_system_tests.helpers.unity8.shell import Unity8 # NOQA
90 return autopilot.get_job_proxy_object('unity8')103 return autopilot.get_job_proxy_object('unity8')
91104
92 @autopilot_logging.log_action(logger.info)105 @autopilot_logging.log_action(logger.info)
@@ -114,8 +127,6 @@
114 self._remove_autopilot_keyboard()127 self._remove_autopilot_keyboard()
115 self._reset_keyboard()128 self._reset_keyboard()
116 self._enable_osk_for_uitk()129 self._enable_osk_for_uitk()
117 # Workaround for bug lp:1474444
118 self.useFixture(OSKAlwaysEnabled())
119 # Disable setting touch visualization due to bug:130 # Disable setting touch visualization due to bug:
120 # https://bugs.launchpad.net/bugs/1602600131 # https://bugs.launchpad.net/bugs/1602600
121 # This should be re-enabled once an alternative method is provided.132 # This should be re-enabled once an alternative method is provided.
@@ -155,11 +166,11 @@
155 args = ['QT_LOAD_TESTABILITY=1']166 args = ['QT_LOAD_TESTABILITY=1']
156 if no_wait:167 if no_wait:
157 args.append('--no-wait')168 args.append('--no-wait')
158 process_helpers.start_job(unity8.PROC_NAME, *args)169 start_job(PROC_NAME, *args)
159 if no_wait:170 if no_wait:
160 # just wait for job to be spawned rather than fully running171 # just wait for job to be spawned rather than fully running
161 wait_for_job_spawned(unity8.PROC_NAME)172 wait_for_job_spawned(PROC_NAME)
162 context.shared.unity_pid = process_helpers._get_unity_pid()173 context.shared.unity_pid = get_unity_pid()
163174
164 def _enable_osk_for_uitk(self):175 def _enable_osk_for_uitk(self):
165 """Enable use of the OSK with uitk helpers."""176 """Enable use of the OSK with uitk helpers."""
@@ -231,7 +242,7 @@
231 :returns: The proxy object for the Unity8 shell242 :returns: The proxy object for the Unity8 shell
232243
233 """244 """
234 unity8.ensure_unity_stopped()245 ensure_unity_stopped()
235 unity_proxy = self.launch_unity(fake_sensors=fake_sensors)246 unity_proxy = self.launch_unity(fake_sensors=fake_sensors)
236 if self.device_unlock_required():247 if self.device_unlock_required():
237 unity_proxy.unlock()248 unity_proxy.unlock()
@@ -281,6 +292,5 @@
281 """292 """
282 self.useFixture(fixture_setup.InitctlEnvironmentVariable(293 self.useFixture(fixture_setup.InitctlEnvironmentVariable(
283 global_=True,294 global_=True,
284 UBUNTU_WEBVIEW_DEVTOOLS_HOST=webapp.DEFAULT_WEBVIEW_INSPECTOR_IP,295 UBUNTU_WEBVIEW_DEVTOOLS_HOST=DEFAULT_WEBVIEW_INSPECTOR_IP,
285 UBUNTU_WEBVIEW_DEVTOOLS_PORT=str(296 UBUNTU_WEBVIEW_DEVTOOLS_PORT=str(DEFAULT_WEBVIEW_INSPECTOR_PORT)))
286 webapp.DEFAULT_WEBVIEW_INSPECTOR_PORT)))
287297
=== modified file 'ubuntu_system_tests/tests/test_add_contact.py'
--- ubuntu_system_tests/tests/test_add_contact.py 2016-06-30 13:45:35 +0000
+++ ubuntu_system_tests/tests/test_add_contact.py 2016-07-15 14:58:58 +0000
@@ -20,9 +20,10 @@
20from autopilot.matchers import Eventually20from autopilot.matchers import Eventually
21from testtools.matchers import Equals21from testtools.matchers import Equals
2222
23from address_book_app.address_book.data import Phone, Contact23from ubuntu_system_tests.helpers.addressbook import (
2424 AddressBook,
25from ubuntu_system_tests.helpers.addressbook import AddressBook25 get_test_contact,
26)
26from ubuntu_system_tests.tests import base27from ubuntu_system_tests.tests import base
27from ubuntu_system_tests.helpers.addressbook import (28from ubuntu_system_tests.helpers.addressbook import (
28 fixture_setup as addressbook_fixtures)29 fixture_setup as addressbook_fixtures)
@@ -47,18 +48,11 @@
47 unity_proxy.unlock()48 unity_proxy.unlock()
48 self.useFixture(addressbook_fixtures.AddressBookTestEnvironment())49 self.useFixture(addressbook_fixtures.AddressBookTestEnvironment())
4950
50 @staticmethod
51 def get_test_contact():
52 mobile_number = Phone(type_='Mobile', number=TYPED_MOBILE)
53 return Contact(
54 first_name=FIRST_NAME, last_name=LAST_NAME,
55 phones=[mobile_number])
56
57 def test_add_contact_with_name_and_number(self):51 def test_add_contact_with_name_and_number(self):
58 self.addressbook_app.launch_from_scope(return_proxy=False)52 self.addressbook_app.launch_from_scope(return_proxy=False)
59 address_book = self.addressbook_app.proxy_object.main_window53 address_book = self.addressbook_app.proxy_object.main_window
6054
61 test_contact = self.get_test_contact()55 test_contact = get_test_contact(FIRST_NAME, LAST_NAME, TYPED_MOBILE)
62 test_contact_name = (56 test_contact_name = (
63 test_contact.first_name + ' ' + test_contact.last_name)57 test_contact.first_name + ' ' + test_contact.last_name)
6458
6559
=== modified file 'ubuntu_system_tests/tests/test_calls.py'
--- ubuntu_system_tests/tests/test_calls.py 2016-07-15 09:44:25 +0000
+++ ubuntu_system_tests/tests/test_calls.py 2016-07-15 14:58:58 +0000
@@ -45,7 +45,9 @@
45)45)
46from ubuntu_system_tests.helpers.autopilot import input46from ubuntu_system_tests.helpers.autopilot import input
47from ubuntu_system_tests.helpers.data import load_test_metadata47from ubuntu_system_tests.helpers.data import load_test_metadata
48from ubuntu_system_tests.helpers.dialer_app import fixture_setup as dialer_fixture_setup # NOQA48from ubuntu_system_tests.helpers.dialer_app import (
49 fixture_setup as dialer_fixture_setup
50)
49from ubuntu_system_tests.helpers import indicators51from ubuntu_system_tests.helpers import indicators
50from ubuntu_system_tests.helpers.indicators import(52from ubuntu_system_tests.helpers.indicators import(
51 network as network_indicator53 network as network_indicator
5254
=== modified file 'ubuntu_system_tests/tests/test_messaging_sms.py'
--- ubuntu_system_tests/tests/test_messaging_sms.py 2016-03-02 12:20:50 +0000
+++ ubuntu_system_tests/tests/test_messaging_sms.py 2016-07-15 14:58:58 +0000
@@ -37,7 +37,6 @@
37 fixture_setup as network_fixture37 fixture_setup as network_fixture
38)38)
39from ubuntu_system_tests.helpers import ofono39from ubuntu_system_tests.helpers import ofono
40from ubuntu_system_tests.helpers.indicators.message import NotificationsIndicatorPage, NotificationsIndicatorItem # NOQA
41from ubuntu_system_tests.helpers.system_settings import SIM_1, SIM_ASK40from ubuntu_system_tests.helpers.system_settings import SIM_1, SIM_ASK
42from ubuntu_system_tests.helpers.uid import b64_uuid41from ubuntu_system_tests.helpers.uid import b64_uuid
43from ubuntu_system_tests.helpers import webbrowser42from ubuntu_system_tests.helpers import webbrowser
4443
=== modified file 'ubuntu_system_tests/tests/test_settings_wizard.py'
--- ubuntu_system_tests/tests/test_settings_wizard.py 2016-05-06 16:39:14 +0000
+++ ubuntu_system_tests/tests/test_settings_wizard.py 2016-07-15 14:58:58 +0000
@@ -22,9 +22,10 @@
22 is_agps_supported, is_wifi_supported22 is_agps_supported, is_wifi_supported
23)23)
24from ubuntu_system_tests.helpers import testbed24from ubuntu_system_tests.helpers import testbed
25from ubuntu_system_tests.helpers.system_settings import (
26 is_reporting_enabled,
27)
25from ubuntu_system_tests.helpers.unity8.fixture_setup import SettingsWizard28from ubuntu_system_tests.helpers.unity8.fixture_setup import SettingsWizard
26from ubuntu_system_tests.helpers.unity8 import settings_wizard
27from ubuntu_system_tests.helpers.unity8.settings_wizard import Wizard
2829
29from ubuntu_system_tests.tests import base30from ubuntu_system_tests.tests import base
3031
@@ -65,7 +66,7 @@
6566
66 def _get_settings_wizard(self):67 def _get_settings_wizard(self):
67 """Wait for the settings wizard to appear and return Wizard object"""68 """Wait for the settings wizard to appear and return Wizard object"""
68 return self.unity.wait_select_single(Wizard)69 return self.unity.main_window.get_settings_wizard()
6970
70 def _test_language_page(self):71 def _test_language_page(self):
71 """Get the language page, check default language and continue"""72 """Get the language page, check default language and continue"""
@@ -181,7 +182,7 @@
181 self.config[KEY_WIFI_SSID],182 self.config[KEY_WIFI_SSID],
182 self.config[KEY_WIFI_PASSWORD])183 self.config[KEY_WIFI_PASSWORD])
183184
184 if settings_wizard.reporting_page_included():185 if is_reporting_enabled():
185 # Validate the reporting page when it is part of the wizard186 # Validate the reporting page when it is part of the wizard
186 reporting_page = self._test_location_support(187 reporting_page = self._test_location_support(
187 location_supported, next_page)188 location_supported, next_page)
188189
=== modified file 'ubuntu_system_tests/tests/test_tutorial.py'
--- ubuntu_system_tests/tests/test_tutorial.py 2015-05-21 18:15:40 +0000
+++ ubuntu_system_tests/tests/test_tutorial.py 2016-07-15 14:58:58 +0000
@@ -21,13 +21,11 @@
21from autopilot.matchers import Eventually21from autopilot.matchers import Eventually
22from testtools.matchers import Equals22from testtools.matchers import Equals
2323
24from unity8.shell import fixture_setup24from ubuntu_system_tests.helpers import try_import
25
26# unused import to load the tutorial custom proxy objects.
27from unity8.shell.emulators import tutorial # NOQA
28
29from ubuntu_system_tests.tests import base25from ubuntu_system_tests.tests import base
3026
27fixture_setup = try_import('unity8.shell.fixture_setup')
28
3129
32class TutorialTestCase(base.BaseUbuntuSystemTestCase):30class TutorialTestCase(base.BaseUbuntuSystemTestCase):
3331
@@ -36,6 +34,9 @@
36 self.useFixture(fixture_setup.Tutorial(True))34 self.useFixture(fixture_setup.Tutorial(True))
3735
38 def test_complete_tutorial(self):36 def test_complete_tutorial(self):
37 # TODO: This test needs to be re-written for the new tutorial.
38 # unused import to load the tutorial custom proxy objects.
39 from unity8.shell.emulators import tutorial # NOQA
39 unity = self.launch_unity()40 unity = self.launch_unity()
4041
41 greeter = unity.main_window.get_greeter()42 greeter = unity.main_window.get_greeter()
4243
=== modified file 'ubuntu_system_tests/tests/test_ubuntu_keyboard.py'
--- ubuntu_system_tests/tests/test_ubuntu_keyboard.py 2016-02-12 15:42:55 +0000
+++ ubuntu_system_tests/tests/test_ubuntu_keyboard.py 2016-07-15 14:58:58 +0000
@@ -20,8 +20,6 @@
20from autopilot.matchers import Eventually20from autopilot.matchers import Eventually
21from testtools.matchers import Equals21from testtools.matchers import Equals
2222
23from ubuntu_keyboard.emulators.keyboard import Keyboard as UbuntuKeyboard
24
25from ubuntu_system_tests.tests import base23from ubuntu_system_tests.tests import base
26from ubuntu_system_tests.helpers.messaging import(24from ubuntu_system_tests.helpers.messaging import(
27 fixture_setup as messaging_fixture25 fixture_setup as messaging_fixture
@@ -48,6 +46,7 @@
48 self.unity_proxy = self.restart_unity()46 self.unity_proxy = self.restart_unity()
49 self.useFixture(messaging_fixture.SetDefaultSIM())47 self.useFixture(messaging_fixture.SetDefaultSIM())
50 self.messaging_app = messaging_helpers.launch_messaging_app()48 self.messaging_app = messaging_helpers.launch_messaging_app()
49 self.osk = osk_helpers.get_keyboard()
5150
52 def _focus_message_input_field_to_invoke_keyboard(self):51 def _focus_message_input_field_to_invoke_keyboard(self):
53 # Due to some reason, using the proxy object with uitk emulator base,52 # Due to some reason, using the proxy object with uitk emulator base,
@@ -55,7 +54,7 @@
55 # settings are reset during the test. Getting the proxy object without54 # settings are reset during the test. Getting the proxy object without
56 # custom emulator base, solves the issue. --om26er 16-12-201555 # custom emulator base, solves the issue. --om26er 16-12-2015
57 messaging_app_raw_proxy = messaging_helpers.get_messaging_app_proxy(56 messaging_app_raw_proxy = messaging_helpers.get_messaging_app_proxy(
58 base=None)57 raw_proxy=True)
59 return messaging_helpers.focus_message_input_field(58 return messaging_helpers.focus_message_input_field(
60 messaging_app_raw_proxy, self.messaging_app.pointing_device)59 messaging_app_raw_proxy, self.messaging_app.pointing_device)
6160
@@ -81,12 +80,11 @@
81 self.assertThat(lambda: osk_helpers.is_keyboard_shifted(),80 self.assertThat(lambda: osk_helpers.is_keyboard_shifted(),
82 Eventually(Equals(True)))81 Eventually(Equals(True)))
8382
84 keyboard = UbuntuKeyboard()83 self.osk.type('Hello my friend. ')
85 keyboard.type('Hello my friend. ')
86 self.assertThat(lambda: osk_helpers.is_keyboard_shifted(),84 self.assertThat(lambda: osk_helpers.is_keyboard_shifted(),
87 Eventually(Equals(True)))85 Eventually(Equals(True)))
8886
89 keyboard.type('\b')87 self.osk.type('\b')
90 self.assertThat(lambda: osk_helpers.is_keyboard_shifted(),88 self.assertThat(lambda: osk_helpers.is_keyboard_shifted(),
91 Eventually(Equals(False)))89 Eventually(Equals(False)))
9290
@@ -117,20 +115,19 @@
117 6. Press a space and type 'i' and ensure that the word 'I' is shown115 6. Press a space and type 'i' and ensure that the word 'I' is shown
118 capitalized as bold116 capitalized as bold
119 """117 """
120 osk = UbuntuKeyboard()118 self.osk.type(INITIAL_TEXT)
121 osk.type(INITIAL_TEXT)
122 proxy = osk_helpers.get_ubuntu_keyboard_proxy()119 proxy = osk_helpers.get_ubuntu_keyboard_proxy()
123 word_ribbon_list = proxy.keyboard.word_ribbon_list120 word_ribbon_list = proxy.keyboard.word_ribbon_list
124121
125 suggestions_list = word_ribbon_list.get_suggested_words()122 suggestions_list = word_ribbon_list.get_suggested_words()
126 self._assert_words_in_ribbon(suggestions_list, EXPECTED_WORDS)123 self._assert_words_in_ribbon(suggestions_list, EXPECTED_WORDS)
127124
128 osk.type(' ')125 self.osk.type(' ')
129 self.assertThat(self.input_field.text, Eventually(Equals(SENTENCE_1)))126 self.assertThat(self.input_field.text, Eventually(Equals(SENTENCE_1)))
130 self.assertThat(lambda: word_ribbon_list.is_suggestions_list_empty(),127 self.assertThat(lambda: word_ribbon_list.is_suggestions_list_empty(),
131 Eventually(Equals(True)))128 Eventually(Equals(True)))
132129
133 osk.type(UNIQUE_WORD_1)130 self.osk.type(UNIQUE_WORD_1)
134 self.assertThat(lambda: word_ribbon_list.is_text_bold(UNIQUE_WORD_1),131 self.assertThat(lambda: word_ribbon_list.is_text_bold(UNIQUE_WORD_1),
135 Eventually(Equals(True)))132 Eventually(Equals(True)))
136 word_ribbon_list.tap_suggested_word(text=UNIQUE_WORD_1)133 word_ribbon_list.tap_suggested_word(text=UNIQUE_WORD_1)
@@ -138,10 +135,10 @@
138 self.assertThat(self.input_field.text,135 self.assertThat(self.input_field.text,
139 Eventually(Equals(expected_text)))136 Eventually(Equals(expected_text)))
140137
141 osk.type(UNIQUE_WORD_2)138 self.osk.type(UNIQUE_WORD_2)
142 self.assertThat(lambda: word_ribbon_list.is_text_bold(UNIQUE_WORD_2),139 self.assertThat(lambda: word_ribbon_list.is_text_bold(UNIQUE_WORD_2),
143 Eventually(Equals(True)))140 Eventually(Equals(True)))
144141
145 osk.type(' i')142 self.osk.type(' i')
146 self.assertThat(lambda: word_ribbon_list.is_text_bold('I'),143 self.assertThat(lambda: word_ribbon_list.is_text_bold('I'),
147 Eventually(Equals(True)))144 Eventually(Equals(True)))
148145
=== modified file 'ubuntu_system_tests/tests/test_with_dialer.py'
--- ubuntu_system_tests/tests/test_with_dialer.py 2016-02-03 22:25:18 +0000
+++ ubuntu_system_tests/tests/test_with_dialer.py 2016-07-15 14:58:58 +0000
@@ -20,9 +20,11 @@
20from autopilot.matchers import Eventually20from autopilot.matchers import Eventually
21from testtools.matchers import Equals21from testtools.matchers import Equals
2222
23from unity8 import process_helpers as unity_helpers
24
25from ubuntu_system_tests.helpers import dialer_app23from ubuntu_system_tests.helpers import dialer_app
24from ubuntu_system_tests.helpers.unity8 import (
25 lock_unity,
26 unlock_unity,
27)
26from ubuntu_system_tests.tests import base28from ubuntu_system_tests.tests import base
2729
2830
@@ -44,8 +46,8 @@
44 self.assertThat(self.dialer_app.contacts_page.active,46 self.assertThat(self.dialer_app.contacts_page.active,
45 Eventually(Equals(True)))47 Eventually(Equals(True)))
4648
47 unity_helpers.lock_unity()49 lock_unity()
48 unity_helpers.unlock_unity()50 unlock_unity()
4951
50 self.assertThat(self.dialer_app.contacts_page.active,52 self.assertThat(self.dialer_app.contacts_page.active,
51 Eventually(Equals(True)))53 Eventually(Equals(True)))
5254
=== modified file 'ubuntu_system_tests/tests/test_with_webbrowser.py'
--- ubuntu_system_tests/tests/test_with_webbrowser.py 2016-05-26 10:40:07 +0000
+++ ubuntu_system_tests/tests/test_with_webbrowser.py 2016-07-15 14:58:58 +0000
@@ -26,8 +26,6 @@
26from autopilot.matchers import Eventually26from autopilot.matchers import Eventually
27from testtools.matchers import Equals27from testtools.matchers import Equals
2828
29from ubuntu_keyboard.emulators import keyboard
30
31from ubuntu_system_tests.helpers import autopilot29from ubuntu_system_tests.helpers import autopilot
32from ubuntu_system_tests.helpers.data import load_test_metadata30from ubuntu_system_tests.helpers.data import load_test_metadata
33from ubuntu_system_tests.helpers import file_system as fs31from ubuntu_system_tests.helpers import file_system as fs
@@ -390,10 +388,6 @@
390 self.browser.copy_url_text()388 self.browser.copy_url_text()
391389
392 messaging_app = messaging.launch_messaging_app_from_launcher()390 messaging_app = messaging.launch_messaging_app_from_launcher()
393 # Apparently the OSK stays visible if the app was switched while
394 # the keyboard was on screen. Reported: LP: 1505630
395 keyboard.Keyboard().dismiss()
396
397 text_entry = messaging_app.paste_text_in_message_field()391 text_entry = messaging_app.paste_text_in_message_field()
398 self.assertThat(392 self.assertThat(
399 text_entry.text,393 text_entry.text,
400394
=== modified file 'ubuntu_system_tests/tests/webapps/base.py'
--- ubuntu_system_tests/tests/webapps/base.py 2016-06-02 13:30:35 +0000
+++ ubuntu_system_tests/tests/webapps/base.py 2016-07-15 14:58:58 +0000
@@ -18,10 +18,10 @@
18# along with this program. If not, see <http://www.gnu.org/licenses/>.18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#19#
2020
21from ubuntu_system_tests.tests import base21from ubuntu_system_tests.tests.base import BaseUbuntuSystemTestCase
2222
2323
24class BaseWebAppTestCase(base.BaseUbuntuSystemTestCase):24class BaseWebAppTestCase(BaseUbuntuSystemTestCase):
25 """ Base class to be used for all the WebApp tests """25 """ Base class to be used for all the WebApp tests """
2626
27 def setUp(self):27 def setUp(self):

Subscribers

People subscribed via source and target branches

to all changes: