Merge lp:~om26er/unity8/launcher_integration_test into lp:unity8

Proposed by Omer Akram
Status: Superseded
Proposed branch: lp:~om26er/unity8/launcher_integration_test
Merge into: lp:unity8
Diff against target: 135 lines (+107/-0)
3 files modified
tests/autopilot/unity8/shell/emulators/launcher.py (+7/-0)
tests/autopilot/unity8/shell/fixture_setup.py (+46/-0)
tests/autopilot/unity8/shell/tests/test_launcher.py (+54/-0)
To merge this branch: bzr merge lp:~om26er/unity8/launcher_integration_test
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Leo Arias (community) Needs Fixing
Víctor R. Ruiz (community) Needs Fixing
Review via email: mp+224701@code.launchpad.net

This proposal has been superseded by a proposal from 2014-07-09.

Commit message

Autopilot: launch application from the launcher

Description of the change

Autopilot: launch application from the launcher

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Víctor R. Ruiz (vrruiz) wrote :

Please, use docstrings whenever possible. Specially, document a little bit what LauncherIcon class and its methods do.

review: Needs Fixing
986. By Omer Akram

merge trunk

987. By Omer Akram

add docstring for fixture class.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Víctor R. Ruiz (vrruiz) wrote :

Sorry, Omer. Can you describe in docstrings what the _backup_launcher_icons, _set_launcher_icons and _add_messaging_app_icon_to_launcher do? Something like "Calls to blahblah via DBus to blahblahblah".

Also, if possible, for portability would be better to use dbus python module than doing calls to the system (what if gdbus command is not available?).

review: Needs Fixing
Revision history for this message
Omer Akram (om26er) wrote :

> Sorry, Omer. Can you describe in docstrings what the _backup_launcher_icons,
> _set_launcher_icons and _add_messaging_app_icon_to_launcher do? Something like
> "Calls to blahblah via DBus to blahblahblah".

They all are private methods, I don't think docstrings are necessary for them.
>
> Also, if possible, for portability would be better to use dbus python module
> than doing calls to the system (what if gdbus command is not available?).

Need to investigate more on that, can you give pointers on where to look, probably an example would help.

Revision history for this message
Víctor R. Ruiz (vrruiz) wrote :
988. By Omer Akram

merge trunk

989. By Omer Akram

don't call gdbus, use the python api to talk to accountsservice.

990. By Omer Akram

change cleanUp call

Revision history for this message
Omer Akram (om26er) wrote :

> There is a nice tutorial here: http://dbus.freedesktop.org/doc/dbus-
> python/doc/tutorial.html

Thanks for that. Now I am using python for dbus call.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
991. By Omer Akram

Dummy commit for CI

992. By Omer Akram

fix crazy

993. By Omer Akram

give the messaging-app more time to start

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Leo Arias (elopio) wrote :

Omer, please take a look at the existing branches in review before writing a new one, or consult with ubuntu-qa.
You duplicated some of the work I did here: https://code.launchpad.net/~elopio/unity8/test_open_app_from_launcher/+merge/225112

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
994. By Omer Akram

remove newly added test, seems some of that is already done elsewhere.

995. By Omer Akram

merge open_app_launcher test branch

996. By Omer Akram

merge trunk

Unmerged revisions

996. By Omer Akram

merge trunk

995. By Omer Akram

merge open_app_launcher test branch

994. By Omer Akram

remove newly added test, seems some of that is already done elsewhere.

993. By Omer Akram

give the messaging-app more time to start

992. By Omer Akram

fix crazy

991. By Omer Akram

Dummy commit for CI

990. By Omer Akram

change cleanUp call

989. By Omer Akram

don't call gdbus, use the python api to talk to accountsservice.

988. By Omer Akram

merge trunk

987. By Omer Akram

add docstring for fixture class.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/unity8/shell/emulators/launcher.py'
2--- tests/autopilot/unity8/shell/emulators/launcher.py 2013-11-01 13:59:50 +0000
3+++ tests/autopilot/unity8/shell/emulators/launcher.py 2014-07-08 12:32:48 +0000
4@@ -36,3 +36,10 @@
5 stop_y = start_y
6 touch.drag(start_x, start_y, stop_x, stop_y)
7 self.shown.wait_for(True)
8+
9+ def tap_icon(self, name):
10+ """Tap an icon in the launcher."""
11+ touch = Touch.create()
12+
13+ icon = self.select_single('LauncherDelegate', objectName=name)
14+ touch.tap_object(icon)
15
16=== modified file 'tests/autopilot/unity8/shell/fixture_setup.py'
17--- tests/autopilot/unity8/shell/fixture_setup.py 2014-01-23 14:40:17 +0000
18+++ tests/autopilot/unity8/shell/fixture_setup.py 2014-07-08 12:32:48 +0000
19@@ -19,7 +19,9 @@
20
21 """Set up and clean up fixtures for the Unity acceptance tests."""
22
23+import dbus
24 import os
25+import subprocess
26 import sysconfig
27
28 import fixtures
29@@ -51,3 +53,47 @@
30 'Expected library path does not exists: %s.' % (
31 ld_library_path))
32 return ld_library_path
33+
34+
35+class LauncherIcon(fixtures.Fixture):
36+ """Fixture to setup launcher icons."""
37+
38+ def setUp(self):
39+ super(LauncherIcon, self).setUp()
40+ self._add_messaging_app_icon_to_launcher()
41+
42+ def _get_accounts_service_dbus_iface(self):
43+ bus = dbus.SystemBus()
44+ proxy = bus.get_object(
45+ 'org.freedesktop.Accounts',
46+ '/org/freedesktop/Accounts/User32011')
47+ return dbus.Interface(proxy, 'org.freedesktop.DBus.Properties')
48+
49+ def _backup_launcher_icons(self):
50+ manager = self._get_accounts_service_dbus_iface()
51+ self.backup = manager.Get(
52+ 'com.canonical.unity.AccountsService',
53+ 'launcher-items')
54+ self.addCleanup(self._set_launcher_icons, self.backup)
55+
56+ def _set_launcher_icons(self, icons_config):
57+ manager = self._get_accounts_service_dbus_iface()
58+ manager.Set(
59+ 'com.canonical.unity.AccountsService',
60+ 'launcher-items', icons_config)
61+
62+ def _add_messaging_app_icon_to_launcher(self):
63+ self._backup_launcher_icons()
64+
65+ messaging_icon = dbus.Array([dbus.Dictionary({
66+ dbus.String('count'): dbus.Int32(0, variant_level=1),
67+ dbus.String('countVisible'): dbus.Boolean(False, variant_level=1),
68+ dbus.String('name'): dbus.String('Messaging', variant_level=1),
69+ dbus.String('id'): dbus.String('messaging-app', variant_level=1),
70+ dbus.String('icon'): dbus.String('image://theme/messaging-app',
71+ variant_level=1)},
72+ signature=dbus.Signature('sv'))],
73+ signature=dbus.Signature('a{sv}'),
74+ variant_level=1)
75+
76+ self._set_launcher_icons(messaging_icon)
77
78=== added file 'tests/autopilot/unity8/shell/tests/test_launcher.py'
79--- tests/autopilot/unity8/shell/tests/test_launcher.py 1970-01-01 00:00:00 +0000
80+++ tests/autopilot/unity8/shell/tests/test_launcher.py 2014-07-08 12:32:48 +0000
81@@ -0,0 +1,54 @@
82+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
83+#
84+# Unity Autopilot Test Suite
85+# Copyright (C) 2014 Canonical
86+#
87+# This program is free software: you can redistribute it and/or modify
88+# it under the terms of the GNU General Public License as published by
89+# the Free Software Foundation, either version 3 of the License, or
90+# (at your option) any later version.
91+#
92+# This program is distributed in the hope that it will be useful,
93+# but WITHOUT ANY WARRANTY; without even the implied warranty of
94+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
95+# GNU General Public License for more details.
96+#
97+# You should have received a copy of the GNU General Public License
98+# along with this program. If not, see <http://www.gnu.org/licenses/>.
99+#
100+
101+"""Test for the Launcher."""
102+
103+from autopilot import platform
104+from autopilot.matchers import Eventually
105+from testtools import skipIf
106+from testtools.matchers import Equals
107+
108+from unity8 import process_helpers
109+from unity8.shell import tests, fixture_setup, disable_qml_mocking
110+
111+
112+@skipIf(
113+ platform.model() == 'Desktop',
114+ 'Needs platform APIs not available on desktop, yet.'
115+)
116+class LauncherTestCase(tests.UnityTestCase):
117+
118+ def setUp(self):
119+ self.useFixture(fixture_setup.LauncherIcon())
120+ super(LauncherTestCase, self).setUp()
121+
122+ @disable_qml_mocking
123+ def test_launcher_opens_app(self):
124+ """Make sure apps start from the launcher."""
125+ self.unity_proxy = self.launch_unity()
126+ process_helpers.unlock_unity(self.unity_proxy)
127+
128+ launcher = self.main_window.get_launcher()
129+ launcher.show()
130+ launcher.tap_icon('launcherDelegate0')
131+
132+ self.assertThat(
133+ self.main_window.get_current_focused_app_id,
134+ Eventually(Equals('messaging-app'), timeout=20)
135+ )

Subscribers

People subscribed via source and target branches