Merge lp:~dandrader/unity8/fixShellTests into lp:unity8

Proposed by Daniel d'Andrada on 2015-06-18
Status: Merged
Approved by: Michael Zanetti on 2015-06-22
Approved revision: no longer in the source branch.
Merged at revision: 1828
Proposed branch: lp:~dandrader/unity8/fixShellTests
Merge into: lp:unity8
Diff against target: 488 lines (+117/-139) (has conflicts)
9 files modified
po/de.po (+5/-0)
po/it.po (+5/-0)
tests/autopilot/unity8/application_lifecycle/tests/__init__.py (+2/-2)
tests/autopilot/unity8/greeter/__init__.py (+52/-0)
tests/autopilot/unity8/indicators/tests/__init__.py (+1/-1)
tests/autopilot/unity8/process_helpers.py (+9/-96)
tests/autopilot/unity8/shell/tests/test_emulators.py (+2/-2)
tests/autopilot/unity8/shell/tests/test_notifications.py (+22/-22)
tests/qmltests/tst_Shell.qml (+19/-16)
Text conflict in po/de.po
Text conflict in po/it.po
Text conflict in tests/qmltests/tst_Shell.qml
To merge this branch: bzr merge lp:~dandrader/unity8/fixShellTests
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing on 2015-06-18
Michael Zanetti (community) 2015-06-18 Approve on 2015-06-18
Review via email: mp+262323@code.launchpad.net

Commit Message

Fix Shell tests

Description of the Change

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

* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes. Shell tests now pass.

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

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

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

* Did you have a look at the warnings when running tests? Can they be reduced?
Not applicable.

To post a comment you must log in.
Daniel d'Andrada (dandrader) wrote :

Side stage apps don't display correctly for some reason. But at least the tests now pass.

Michael Zanetti (mzanetti) wrote :

ok. tests are passing. I've tested current trunk on Nexus7, side stage works there. Not really happy with it not working in tryShell atm, but I'm ok with addressing that in a different branch.

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

yes

 * Did CI run pass? If not, please explain why.

qmltests currently disabled by infrastructure issues

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

yes

review: Approve
Daniel d'Andrada (dandrader) wrote :

On 18/06/15 09:50, Michael Zanetti wrote:
> ok. tests are passing. I've tested current trunk on Nexus7, side stage works there. Not really happy with it not working in tryShell atm, but I'm ok with addressing that in a different branch.
At least you can still try the side stage in "make tryOrientedShell" and
"make tryTabletStage"...

lp:~dandrader/unity8/fixShellTests updated on 2015-06-18
1811. By Daniel d'Andrada on 2015-06-18

Merge lp:~josharenson/unity8/qa_helpers

1812. By Daniel d'Andrada on 2015-06-18

Fix Shell tests

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'po/de.po'
2--- po/de.po 2015-06-19 05:01:47 +0000
3+++ po/de.po 2015-06-22 10:06:27 +0000
4@@ -15,8 +15,13 @@
5 "Content-Type: text/plain; charset=UTF-8\n"
6 "Content-Transfer-Encoding: 8bit\n"
7 "Plural-Forms: nplurals=2; plural=n != 1;\n"
8+<<<<<<< TREE
9 "X-Launchpad-Export-Date: 2015-06-19 05:01+0000\n"
10 "X-Generator: Launchpad (build 17570)\n"
11+=======
12+"X-Launchpad-Export-Date: 2015-06-18 05:07+0000\n"
13+"X-Generator: Launchpad (build 17570)\n"
14+>>>>>>> MERGE-SOURCE
15
16 #: plugins/LightDM/Greeter.cpp:112
17 msgid "Password: "
18
19=== modified file 'po/it.po'
20--- po/it.po 2015-06-19 05:01:47 +0000
21+++ po/it.po 2015-06-22 10:06:27 +0000
22@@ -15,8 +15,13 @@
23 "Content-Type: text/plain; charset=UTF-8\n"
24 "Content-Transfer-Encoding: 8bit\n"
25 "Plural-Forms: nplurals=2; plural=n != 1;\n"
26+<<<<<<< TREE
27 "X-Launchpad-Export-Date: 2015-06-19 05:01+0000\n"
28 "X-Generator: Launchpad (build 17570)\n"
29+=======
30+"X-Launchpad-Export-Date: 2015-06-18 05:07+0000\n"
31+"X-Generator: Launchpad (build 17570)\n"
32+>>>>>>> MERGE-SOURCE
33
34 #: plugins/LightDM/Greeter.cpp:112
35 msgid "Password: "
36
37=== modified file 'tests/autopilot/unity8/application_lifecycle/tests/__init__.py'
38--- tests/autopilot/unity8/application_lifecycle/tests/__init__.py 2015-02-23 17:29:04 +0000
39+++ tests/autopilot/unity8/application_lifecycle/tests/__init__.py 2015-06-22 10:06:27 +0000
40@@ -31,8 +31,8 @@
41 super().setUp()
42 self._qml_mock_enabled = False
43 self._data_dirs_mock_enabled = False
44- unity_proxy = self.launch_unity()
45- process_helpers.unlock_unity(unity_proxy)
46+ self.launch_unity()
47+ process_helpers.unlock_unity()
48
49 def create_test_application(self):
50 desktop_file_dict = fixture_setup.DEFAULT_DESKTOP_FILE_DICT
51
52=== modified file 'tests/autopilot/unity8/greeter/__init__.py'
53--- tests/autopilot/unity8/greeter/__init__.py 2015-03-23 23:40:27 +0000
54+++ tests/autopilot/unity8/greeter/__init__.py 2015-06-22 10:06:27 +0000
55@@ -0,0 +1,52 @@
56+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
57+#
58+# Unity Autopilot Test Suite
59+# Copyright (C) 2015 Canonical
60+#
61+# This program is free software: you can redistribute it and/or modify
62+# it under the terms of the GNU General Public License as published by
63+# the Free Software Foundation, either version 3 of the License, or
64+# (at your option) any later version.
65+#
66+# This program is distributed in the hope that it will be useful,
67+# but WITHOUT ANY WARRANTY; without even the implied warranty of
68+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
69+# GNU General Public License for more details.
70+#
71+# You should have received a copy of the GNU General Public License
72+# along with this program. If not, see <http://www.gnu.org/licenses/>.
73+#
74+
75+import dbus
76+
77+from autopilot.matchers import Eventually
78+from testtools.matchers import Equals
79+
80+
81+def hide_greeter_with_dbus():
82+ dbus_proxy = _get_greeter_dbus_proxy()
83+ if _is_greeter_active():
84+ dbus_proxy.HideGreeter()
85+
86+
87+def show_greeter_with_dbus():
88+ dbus_proxy = _get_greeter_dbus_proxy()
89+ if not _is_greeter_active():
90+ dbus_proxy.ShowGreeter()
91+
92+
93+def wait_for_greeter():
94+ Eventually(Equals(True), timeout=300).match(_is_greeter_active)
95+
96+
97+def _get_greeter_dbus_proxy():
98+ bus = dbus.SessionBus()
99+ return bus.get_object('com.canonical.UnityGreeter', '/')
100+
101+
102+def _is_greeter_active():
103+ try:
104+ dbus_proxy = _get_greeter_dbus_proxy()
105+ return dbus_proxy.Get('com.canonical.UnityGreeter', 'IsActive')
106+ except:
107+ return False
108
109=== modified file 'tests/autopilot/unity8/indicators/tests/__init__.py'
110--- tests/autopilot/unity8/indicators/tests/__init__.py 2015-05-11 14:36:03 +0000
111+++ tests/autopilot/unity8/indicators/tests/__init__.py 2015-06-22 10:06:27 +0000
112@@ -31,7 +31,7 @@
113 def setUp(self):
114 super().setUp()
115 self.unity_proxy = self.launch_unity()
116- process_helpers.unlock_unity(self.unity_proxy)
117+ process_helpers.unlock_unity()
118
119
120 class DeviceIndicatorTestCase(IndicatorTestCase):
121
122=== modified file 'tests/autopilot/unity8/process_helpers.py'
123--- tests/autopilot/unity8/process_helpers.py 2015-05-11 14:36:03 +0000
124+++ tests/autopilot/unity8/process_helpers.py 2015-06-22 10:06:27 +0000
125@@ -19,14 +19,11 @@
126
127 import logging
128 import subprocess
129-import dbus
130
131 import ubuntuuitoolkit
132-from autopilot.exceptions import ProcessSearchError
133 from autopilot.introspection import get_proxy_object_for_existing_process
134
135-from unity8.shell import emulators
136-from unity8.shell.emulators import main_window as main_window_emulator
137+from unity8 import greeter
138
139 logger = logging.getLogger(__name__)
140
141@@ -39,104 +36,20 @@
142 pass
143
144
145-def unlock_unity(unity_proxy_obj=None):
146+def unlock_unity():
147 """Helper function that attempts to unlock the unity greeter.
148
149- If unity_proxy_object is None create a proxy object by querying for the
150- running unity process.
151- Otherwise re-use the passed proxy object.
152-
153- :raises RuntimeError: if the greeter attempts and fails to be unlocked.
154-
155- :raises RuntimeWarning: when the greeter cannot be found because it is
156- already unlocked.
157- :raises CannotAccessUnity: if unity is not introspectable or cannot be
158- found on dbus.
159- :raises CannotAccessUnity: if unity's upstart status is not "start" or the
160- upstart job cannot be found at all.
161-
162 """
163- if unity_proxy_obj is None:
164- try:
165- pid = get_unity_pid()
166- unity = _get_unity_proxy_object(pid)
167- main_window = unity.select_single(main_window_emulator.QQuickView)
168- except ProcessSearchError as e:
169- raise CannotAccessUnity(
170- "Cannot introspect unity, make sure that it has been started "
171- "with testability. Perhaps use the function "
172- "'restart_unity_with_testability' this module provides."
173- "(%s)"
174- % str(e)
175- )
176- else:
177- main_window = unity_proxy_obj.select_single(
178- main_window_emulator.QQuickView)
179-
180- greeter = main_window.get_greeter()
181- if greeter.created is False:
182- raise RuntimeWarning("Greeter appears to be already unlocked.")
183-
184- bus = dbus.SessionBus()
185- dbus_proxy = bus.get_object("com.canonical.UnityGreeter", "/")
186- try:
187- dbus_proxy.HideGreeter()
188- except dbus.DBusException:
189- logger.info("Failed to unlock greeter")
190- raise
191- else:
192- greeter.created.wait_for(False)
193- logger.info("Greeter unlocked, continuing.")
194-
195-
196-def lock_unity(unity_proxy_obj=None):
197+ greeter.wait_for_greeter()
198+ greeter.hide_greeter_with_dbus()
199+
200+
201+def lock_unity():
202 """Helper function that attempts to lock unity greeter.
203
204- If unity_proxy_object is None create a proxy object by querying for the
205- running unity process.
206- Otherwise re-use the passed proxy object.
207-
208- :raises RuntimeError: if the greeter attempts and fails to be locked.
209-
210- :raises RuntimeWarning: when the greeter is found because it is
211- already locked.
212- :raises CannotAccessUnity: if unity is not introspectable or cannot be
213- found on dbus.
214- :raises CannotAccessUnity: if unity's upstart status is not "start" or the
215- upstart job cannot be found at all.
216-
217 """
218- if unity_proxy_obj is None:
219- try:
220- pid = get_unity_pid()
221- unity = _get_unity_proxy_object(pid)
222- main_window = unity.select_single(main_window_emulator.QQuickView)
223- except ProcessSearchError as e:
224- raise CannotAccessUnity(
225- "Cannot introspect unity, make sure that it has been started "
226- "with testability. Perhaps use the function "
227- "'restart_unity_with_testability' this module provides."
228- "(%s)"
229- % str(e)
230- )
231- else:
232- main_window = unity_proxy_obj.select_single(
233- main_window_emulator.QQuickView)
234-
235- greeter = main_window.get_greeter()
236- if greeter.created is True:
237- raise RuntimeWarning("Greeter appears to be already locked.")
238-
239- bus = dbus.SessionBus()
240- dbus_proxy = bus.get_object("com.canonical.UnityGreeter", "/")
241- try:
242- dbus_proxy.ShowGreeter()
243- except dbus.DBusException:
244- logger.info("Failed to lock greeter")
245- raise
246- else:
247- greeter.created.wait_for(True)
248- logger.info("Greeter locked, continuing.")
249+ greeter.show_greeter_with_dbus()
250+ greeter.wait_for_greeter()
251
252
253 def restart_unity_with_testability(*args):
254
255=== modified file 'tests/autopilot/unity8/shell/tests/test_emulators.py'
256--- tests/autopilot/unity8/shell/tests/test_emulators.py 2015-05-20 14:22:15 +0000
257+++ tests/autopilot/unity8/shell/tests/test_emulators.py 2015-06-22 10:06:27 +0000
258@@ -41,8 +41,8 @@
259
260 def setUp(self):
261 super().setUp()
262- unity_proxy = self.launch_unity()
263- process_helpers.unlock_unity(unity_proxy)
264+ self.launch_unity()
265+ process_helpers.unlock_unity()
266
267
268 class DashEmulatorTestCase(tests.DashBaseTestCase):
269
270=== modified file 'tests/autopilot/unity8/shell/tests/test_notifications.py'
271--- tests/autopilot/unity8/shell/tests/test_notifications.py 2015-04-17 21:58:16 +0000
272+++ tests/autopilot/unity8/shell/tests/test_notifications.py 2015-06-22 10:06:27 +0000
273@@ -119,8 +119,8 @@
274
275 def test_interactive(self):
276 """Interactive notification must react upon click on itself."""
277- unity_proxy = self.launch_unity()
278- unlock_unity(unity_proxy)
279+ self.launch_unity()
280+ unlock_unity()
281
282 notify_list = self._get_notifications_list()
283
284@@ -156,8 +156,8 @@
285 """Snap-decision with three actions should use
286 one-over two button layout.
287 """
288- unity_proxy = self.launch_unity()
289- unlock_unity(unity_proxy)
290+ self.launch_unity()
291+ unlock_unity()
292
293 summary = "Theatre at Ferria Stadium"
294 body = "at Ferria Stadium in Bilbao, Spain\n07578545317"
295@@ -197,8 +197,8 @@
296 """Snap-decision should block input to shell
297 without greeter/lockscreen.
298 """
299- unity_proxy = self.launch_unity()
300- unlock_unity(unity_proxy)
301+ self.launch_unity()
302+ unlock_unity()
303
304 summary = "Incoming file"
305 body = "Frank would like to send you the file: essay.pdf"
306@@ -421,8 +421,8 @@
307
308 def test_icon_summary_body(self):
309 """Notification must display the expected summary and body text."""
310- unity_proxy = self.launch_unity()
311- unlock_unity(unity_proxy)
312+ self.launch_unity()
313+ unlock_unity()
314
315 notify_list = self._get_notifications_list()
316
317@@ -458,8 +458,8 @@
318 def test_icon_summary(self):
319 """Notification must display the expected summary and secondary
320 icon."""
321- unity_proxy = self.launch_unity()
322- unlock_unity(unity_proxy)
323+ self.launch_unity()
324+ unlock_unity()
325
326 notify_list = self._get_notifications_list()
327
328@@ -491,8 +491,8 @@
329 def test_urgency_order(self):
330 """Notifications must be displayed in order according to their
331 urgency."""
332- unity_proxy = self.launch_unity()
333- unlock_unity(unity_proxy)
334+ self.launch_unity()
335+ unlock_unity()
336
337 notify_list = self._get_notifications_list()
338
339@@ -578,8 +578,8 @@
340
341 def test_summary_and_body(self):
342 """Notification must display the expected summary- and body-text."""
343- unity_proxy = self.launch_unity()
344- unlock_unity(unity_proxy)
345+ self.launch_unity()
346+ unlock_unity()
347
348 notify_list = self._get_notifications_list()
349
350@@ -603,8 +603,8 @@
351
352 def test_summary_only(self):
353 """Notification must display only the expected summary-text."""
354- unity_proxy = self.launch_unity()
355- unlock_unity(unity_proxy)
356+ self.launch_unity()
357+ unlock_unity()
358
359 notify_list = self._get_notifications_list()
360
361@@ -621,8 +621,8 @@
362 def test_update_notification_same_layout(self):
363 """Notification must allow updating its contents while being
364 displayed."""
365- unity_proxy = self.launch_unity()
366- unlock_unity(unity_proxy)
367+ self.launch_unity()
368+ unlock_unity()
369
370 notify_list = self._get_notifications_list()
371
372@@ -660,8 +660,8 @@
373 def test_update_notification_layout_change(self):
374 """Notification must allow updating its contents and layout while
375 being displayed."""
376- unity_proxy = self.launch_unity()
377- unlock_unity(unity_proxy)
378+ self.launch_unity()
379+ unlock_unity()
380
381 notify_list = self._get_notifications_list()
382
383@@ -709,8 +709,8 @@
384 """ use the create notification script to get a notification dialog.
385 Check that the arguments passed to the script match the fields. """
386
387- unity_proxy = self.launch_unity()
388- unlock_unity(unity_proxy)
389+ self.launch_unity()
390+ unlock_unity()
391
392 summary = 'Helper summary'
393 body = 'Helper body'
394
395=== modified file 'tests/qmltests/tst_Shell.qml'
396--- tests/qmltests/tst_Shell.qml 2015-06-15 22:40:10 +0000
397+++ tests/qmltests/tst_Shell.qml 2015-06-22 10:06:27 +0000
398@@ -81,9 +81,15 @@
399 property bool itemDestroyed: false
400 sourceComponent: Component {
401 Shell {
402+<<<<<<< TREE
403 property string shellMode: "full-greeter" /* default */
404
405 usageScenario: "phone"
406+=======
407+ property string shellMode: "full-greeter" /* default */
408+
409+ usageScenario: usageScenarioSelector.model[usageScenarioSelector.selectedIndex]
410+>>>>>>> MERGE-SOURCE
411 orientation: Qt.PortraitOrientation
412 primaryOrientation: Qt.PortraitOrientation
413 nativeOrientation: Qt.PortraitOrientation
414@@ -151,14 +157,11 @@
415 }
416 }
417 ListItem.ItemSelector {
418- id: usageModeSelector
419+ id: usageScenarioSelector
420 anchors { left: parent.left; right: parent.right }
421 activeFocusOnPress: false
422- text: "Usage mode"
423- model: ["Staged", "Windowed"]
424- onSelectedIndexChanged: {
425- GSettingsController.setUsageMode(model[selectedIndex]);
426- }
427+ text: "Usage scenario"
428+ model: ["phone", "tablet", "desktop"]
429 }
430 MouseTouchEmulationCheckbox {
431 id: mouseEmulation
432@@ -725,7 +728,7 @@
433
434 tryCompare(webApp.session.surface, "activeFocus", true);
435
436- GSettingsController.setUsageMode("Windowed");
437+ shell.usageScenario = "desktop";
438
439 // check that the desktop stage and window have been loaded
440 {
441@@ -735,7 +738,7 @@
442
443 tryCompare(webApp.session.surface, "activeFocus", true);
444
445- GSettingsController.setUsageMode("Staged");
446+ shell.usageScenario = "tablet";
447
448 // check that the tablet stage and app surface delegate have been loaded
449 {
450@@ -1205,30 +1208,30 @@
451
452 function test_stageLoader_data() {
453 return [
454- {tag: "phone", source: "Stages/PhoneStage.qml", formFactor: "phone", usageMode: "Staged"},
455- {tag: "tablet", source: "Stages/TabletStage.qml", formFactor: "tablet", usageMode: "Staged"},
456- {tag: "desktop", source: "Stages/DesktopStage.qml", formFactor: "tablet", usageMode: "Windowed"}
457+ {tag: "phone", source: "Stages/PhoneStage.qml", formFactor: "phone", usageScenario: "phone"},
458+ {tag: "tablet", source: "Stages/TabletStage.qml", formFactor: "tablet", usageScenario: "tablet"},
459+ {tag: "desktop", source: "Stages/DesktopStage.qml", formFactor: "tablet", usageScenario: "desktop"}
460 ]
461 }
462
463 function test_stageLoader(data) {
464- GSettingsController.setUsageMode(data.usageMode);
465 loadShell(data.formFactor);
466+ shell.usageScenario = data.usageScenario;
467 var stageLoader = findChild(shell, "applicationsDisplayLoader");
468 verify(String(stageLoader.source).indexOf(data.source) >= 0);
469 }
470
471 function test_launcherInverted_data() {
472 return [
473- {tag: "phone", formFactor: "phone", usageMode: "Staged", launcherInverted: true},
474- {tag: "tablet", formFactor: "tablet", usageMode: "Staged", launcherInverted: true},
475- {tag: "desktop", formFactor: "tablet", usageMode: "Windowed", launcherInverted: false}
476+ {tag: "phone", formFactor: "phone", usageScenario: "phone", launcherInverted: true},
477+ {tag: "tablet", formFactor: "tablet", usageScenario: "tablet", launcherInverted: true},
478+ {tag: "desktop", formFactor: "tablet", usageScenario: "desktop", launcherInverted: false}
479 ]
480 }
481
482 function test_launcherInverted(data) {
483- GSettingsController.setUsageMode(data.usageMode);
484 loadShell(data.formFactor);
485+ shell.usageScenario = data.usageScenario;
486
487 var launcher = findChild(shell, "launcher");
488 compare(launcher.inverted, data.launcherInverted);

Subscribers

People subscribed via source and target branches