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

Subscribers

People subscribed via source and target branches