Merge lp:~elopio/unity8/test_open_dash into lp:unity8

Proposed by Leo Arias
Status: Superseded
Proposed branch: lp:~elopio/unity8/test_open_dash
Merge into: lp:unity8
Prerequisite: lp:~elopio/unity8/flake8
Diff against target: 154 lines (+64/-20)
5 files modified
tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py (+8/-0)
tests/autopilot/unity8/shell/emulators/launcher.py (+34/-13)
tests/autopilot/unity8/shell/emulators/main_window.py (+19/-3)
tests/autopilot/unity8/shell/tests/disabled_test_hud.py (+1/-2)
tests/autopilot/unity8/shell/tests/test_notifications.py (+2/-2)
To merge this branch: bzr merge lp:~elopio/unity8/test_open_dash
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Albert Astals Cid (community) Needs Fixing
Review via email: mp+224553@code.launchpad.net

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

Commit message

Added autopilot helpers and tests for the launcher and dash icon.

Description of the change

This branch adds the helpers we need to make a regression test for bug #1090358, so that even with the osk open we can go back to the dash with the icon.

 * Are there any related MPs required for this MP to build/function as expected? Please list.

Only the prerequisite that fixes static errors: https://code.launchpad.net/~elopio/unity8/flake8

 * Did you perform an exploratory manual test run of your code change and any related functionality?

More or less. I didn't change any functionality, but I did run the tests I added and did some exploratory on the related properties and components.

 * Did you make sure that your branch does not contain spurious tags?

Yes I did.

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?

No debian changes.

 * If you changed the UI, has there been a design review?

No UI changes.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~elopio/unity8/test_open_dash updated
990. By Leo Arias

Merged with prerequisite.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~elopio/unity8/test_open_dash updated
991. By Leo Arias

Merged with staging.

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)
lp:~elopio/unity8/test_open_dash updated
992. By Leo Arias

Removed the tests for some code paths and preconditions for the life cycle test.

993. By Leo Arias

Remove the swipe to the left.

994. By Leo Arias

Brough back the is_launcher_open.

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: Approve (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Text conflict in tests/autopilot/unity8/shell/emulators/main_window.py
1 conflicts encountered.

review: Needs Fixing
lp:~elopio/unity8/test_open_dash updated
995. By Leo Arias

Merged with trunk.

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: Approve (continuous-integration)

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py'
2--- tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py 2014-06-11 15:36:51 +0000
3+++ tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py 2014-07-10 14:20:25 +0000
4@@ -115,3 +115,11 @@
5 self.launch_upstart_application(application_name)
6 self.assertThat(greeter.created, Eventually(Equals(False)))
7 self.assert_current_focused_application(application_name)
8+
9+ def test_click_dash_icon_must_unfocus_application(self):
10+ application_name = self.launch_fake_app()
11+ self.assert_current_focused_application(application_name)
12+
13+ self.main_window.show_dash_from_launcher()
14+
15+ self.assert_current_focused_application('')
16
17=== modified file 'tests/autopilot/unity8/shell/emulators/launcher.py'
18--- tests/autopilot/unity8/shell/emulators/launcher.py 2013-11-01 13:59:50 +0000
19+++ tests/autopilot/unity8/shell/emulators/launcher.py 2014-07-10 14:20:25 +0000
20@@ -1,7 +1,7 @@
21 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
22 #
23 # Unity Autopilot Test Suite
24-# Copyright (C) 2012-2013 Canonical
25+# Copyright (C) 2012, 2013, 2014 Canonical
26 #
27 # This program is free software: you can redistribute it and/or modify
28 # it under the terms of the GNU General Public License as published by
29@@ -17,22 +17,43 @@
30 # along with this program. If not, see <http://www.gnu.org/licenses/>.
31 #
32
33-from unity8.shell.emulators import UnityEmulatorBase
34-from autopilot.input import Touch
35-
36-
37-class Launcher(UnityEmulatorBase):
38+import logging
39+
40+import autopilot.logging
41+
42+from unity8.shell import emulators
43+
44+
45+logger = logging.getLogger(__name__)
46+
47+
48+class Launcher(emulators.UnityEmulatorBase):
49
50 """An emulator that understands the Launcher."""
51
52+ @autopilot.logging.log_action(logger.debug)
53 def show(self):
54- """Swipes open the launcher."""
55- touch = Touch.create()
56+ """Show the launcher swiping it to the right."""
57+ if not self.shown:
58+ self._swipe_to_show_launcher()
59+ self.shown.wait_for(True)
60+ else:
61+ logger.debug('The launcher is already opened.')
62
63+ def _swipe_to_show_launcher(self):
64 view = self.get_root_instance().select_single('QQuickView')
65+ start_y = stop_y = view.y + view.height // 2
66+
67 start_x = view.x + 1
68- start_y = view.y + view.height / 2
69- stop_x = start_x + self.panelWidth + 1
70- stop_y = start_y
71- touch.drag(start_x, start_y, stop_x, stop_y)
72- self.shown.wait_for(True)
73+ stop_x = start_x + self.panelWidth - 1
74+
75+ self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
76+
77+ @autopilot.logging.log_action(logger.debug)
78+ def click_dash_icon(self):
79+ if self.shown:
80+ dash_icon = self.select_single(
81+ 'QQuickImage', objectName='dashItem')
82+ self.pointing_device.click_object(dash_icon)
83+ else:
84+ raise emulators.UnityEmulatorException('The launcher is closed.')
85
86=== modified file 'tests/autopilot/unity8/shell/emulators/main_window.py'
87--- tests/autopilot/unity8/shell/emulators/main_window.py 2014-07-09 13:16:20 +0000
88+++ tests/autopilot/unity8/shell/emulators/main_window.py 2014-07-10 14:20:25 +0000
89@@ -67,9 +67,6 @@
90 def get_bottombar(self):
91 return self.select_single("Bottombar")
92
93- def get_launcher(self):
94- return self.select_single(Launcher)
95-
96 def get_pinPadLoader(self):
97 return self.select_single(
98 "QQuickLoader",
99@@ -134,3 +131,22 @@
100 @autopilot_logging.log_action(logger.info)
101 def search(self, query):
102 self.get_dash().enter_search_query(query)
103+
104+ @autopilot_logging.log_action(logger.info)
105+ def show_dash_from_launcher(self):
106+ """Open the dash clicking the dash icon on the launcher."""
107+ launcher = self.open_launcher()
108+ launcher.click_dash_icon()
109+ return self.get_dash()
110+
111+ @autopilot_logging.log_action(logger.info)
112+ def open_launcher(self):
113+ launcher = self._get_launcher()
114+ launcher.show()
115+ return launcher
116+
117+ def _get_launcher(self):
118+ return self.select_single(Launcher)
119+
120+ def is_launcher_open(self):
121+ return self._get_launcher().shown
122
123=== modified file 'tests/autopilot/unity8/shell/tests/disabled_test_hud.py'
124--- tests/autopilot/unity8/shell/tests/disabled_test_hud.py 2014-06-18 01:52:15 +0000
125+++ tests/autopilot/unity8/shell/tests/disabled_test_hud.py 2014-07-10 14:20:25 +0000
126@@ -184,12 +184,11 @@
127 unity_proxy = self.launch_unity()
128 unlock_unity(unity_proxy)
129 hud = self.main_window.get_hud()
130- launcher = self.main_window.get_launcher()
131
132 self._launch_test_app_from_app_screen()
133
134 hud.show()
135- launcher.show()
136+ self.main_window.open_launcher()
137
138 self.assertThat(hud.shown, Eventually(Equals(False)))
139
140
141=== modified file 'tests/autopilot/unity8/shell/tests/test_notifications.py'
142--- tests/autopilot/unity8/shell/tests/test_notifications.py 2014-07-07 08:51:33 +0000
143+++ tests/autopilot/unity8/shell/tests/test_notifications.py 2014-07-10 14:20:25 +0000
144@@ -242,8 +242,8 @@
145 # the shell)
146 time.sleep(1)
147 self.main_window.show_dash_swiping()
148- launcher = self.main_window.get_launcher()
149- self.assertThat(launcher.shown, Eventually(Equals(False)))
150+ self.assertThat(
151+ self.main_window.is_launcher_open, Eventually(Equals(False)))
152
153 # verify and interact with the triggered snap-decision notification
154 notify_list = self._get_notifications_list()

Subscribers

People subscribed via source and target branches