Merge lp:~veebers/unity8/ap_make_use_of_helpers_in_tests into lp:unity8

Proposed by Christopher Lee
Status: Merged
Approved by: Michał Sawicz
Approved revision: 481
Merged at revision: 541
Proposed branch: lp:~veebers/unity8/ap_make_use_of_helpers_in_tests
Merge into: lp:unity8
Prerequisite: lp:~veebers/unity8/adding_unlock_emulator
Diff against target: 452 lines (+111/-101)
4 files modified
tests/autopilot/unity8/process_helpers.py (+67/-40)
tests/autopilot/unity8/shell/tests/__init__.py (+8/-21)
tests/autopilot/unity8/shell/tests/test_hud.py (+11/-10)
tests/autopilot/unity8/shell/tests/test_notifications.py (+25/-30)
To merge this branch: bzr merge lp:~veebers/unity8/ap_make_use_of_helpers_in_tests
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Michał Sawicz Approve
Review via email: mp+191575@code.launchpad.net

Commit message

Unity8 tests now make use of the helper functions (added in the pre-req branch) so that the helper functions are tested as part of daily business.

Description of the change

Unity8 tests now make use of the helper functions (added in the pre-req branch) so that the helper functions are tested as part of daily business.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:477
http://jenkins.qa.ubuntu.com/job/unity8-ci/1444/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-saucy/5081
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-touch/3023/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-saucy/2312
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-amd64-ci/467
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1444
        deb: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1444/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-i386-ci/1443
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-saucy/1249
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/956
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/956/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/3025
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/3025/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/2531/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/2577/console
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/83
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/84

Click here to trigger a rebuild:
http://10.97.0.26:8080/job/unity8-ci/1444/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

9 +def unlock_unity(unity_proxy_obj=None):

Please add to docstring.

=====

62 +def restart_unity_with_testability(args=None):

64 + if args is None:
65 + args = []

75 +def restart_unity(args=None):

101 + if args is None:
102 + args = []

Any reason for not going (args=[]) in arguments?

review: Needs Fixing
Revision history for this message
Michał Sawicz (saviq) wrote :

Hey, can we have an update on this?

478. By Christopher Lee

Merge Trunk

479. By Christopher Lee

Fix use of empty lists and add better docstrings.

Revision history for this message
Christopher Lee (veebers) wrote :

Sorry for the delay Michał, have updated with fixes for outlined issues.

480. By Christopher Lee

Cleanup logging and print output.

Revision history for this message
Michał Sawicz (saviq) wrote :

133 + universal_newlines=False,

That's the default, any reason why we want this explicitly? Or maybe you meant True?

review: Needs Information
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 :

FAILED: Continuous integration, rev:480
http://jenkins.qa.ubuntu.com/job/unity8-ci/1645/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/736
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/724/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/247
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/168
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/169
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/169/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/168
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/670
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/736
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/736/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/724
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/724/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/3353/console
    SUCCESS: http://s-jenkins:8080/job/touch-flash-device/1442

Click here to trigger a rebuild:
http://s-jenkins:8080/job/unity8-ci/1645/rebuild

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
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

91 +def restart_unity_normally():
92 + restart_unity()

Wonder if we need this at all? And if we do, should it not pass *args through?

review: Needs Information
481. By Christopher Lee

Fix issues raised in MR; removed un-needed function, fixed docstring, fix typo for universal_newlines

Revision history for this message
Christopher Lee (veebers) wrote :

@Michał hmm, good point. Designed to be a nicety but adds noise, removed.

I also fixed a couple of other smaller issues, one that you pointed out earlier.

Revision history for this message
Michał Sawicz (saviq) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:481
http://jenkins.qa.ubuntu.com/job/unity8-ci/1676/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/882
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/869
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/310
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/199
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/200
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/200/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/199
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/793
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/882
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/882/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/869
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/869/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/3470
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/1559

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/1676/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Christopher Lee (veebers) wrote :

For the most recent CI run:

  - autopilot-testrunner-otto-trusty failed as the screen (not unity, the unity7 env it's being run on) was locked and was stuck at the password prompt.

  - Still looking at the qmltests, see if we can get them a little more stable.

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/autopilot/unity8/process_helpers.py'
--- tests/autopilot/unity8/process_helpers.py 2013-10-16 04:08:49 +0000
+++ tests/autopilot/unity8/process_helpers.py 2013-11-19 20:53:31 +0000
@@ -21,18 +21,25 @@
21 get_proxy_object_for_existing_process,21 get_proxy_object_for_existing_process,
22 ProcessSearchError,22 ProcessSearchError,
23)23)
24import logging
24import subprocess25import subprocess
25from unity8.shell.emulators import UnityEmulatorBase26from unity8.shell.emulators import UnityEmulatorBase
26from unity8.shell.emulators.main_window import MainWindow27from unity8.shell.emulators.main_window import MainWindow
2728
29logger = logging.getLogger(__name__)
30
2831
29class CannotAccessUnity(Exception):32class CannotAccessUnity(Exception):
30 pass33 pass
3134
3235
33def unlock_unity():36def unlock_unity(unity_proxy_obj=None):
34 """Helper function that attempts to unlock the unity greeter.37 """Helper function that attempts to unlock the unity greeter.
3538
39 If unity_proxy_object is None create a proxy object by querying for the
40 running unity process.
41 Otherwise re-use the passed proxy object.
42
36 :raises RuntimeError: if the greeter attempts and fails to be unlocked.43 :raises RuntimeError: if the greeter attempts and fails to be unlocked.
3744
38 :raises RuntimeWarning: when the greeter cannot be found because it is45 :raises RuntimeWarning: when the greeter cannot be found because it is
@@ -43,30 +50,42 @@
43 upstart job cannot be found at all.50 upstart job cannot be found at all.
4451
45 """52 """
46 pid = _get_unity_pid()53 if unity_proxy_obj is None:
47 try:54 try:
48 unity = get_proxy_object_for_existing_process(55 pid = _get_unity_pid()
49 pid=pid,56 unity = _get_unity_proxy_object(pid)
50 emulator_base=UnityEmulatorBase,57 main_window = MainWindow(unity)
51 )58 except ProcessSearchError as e:
52 main_window = MainWindow(unity)59 raise CannotAccessUnity(
5360 "Cannot introspect unity, make sure that it has been started "
54 greeter = main_window.get_greeter()61 "with testability. Perhaps use the function "
55 if greeter is None:62 "'restart_unity_with_testability' this module provides."
56 raise RuntimeWarning("Greeter appears to be already unlocked.")63 "(%s)"
57 greeter.swipe()64 % str(e)
58 except ProcessSearchError as e:65 )
59 raise CannotAccessUnity(66 else:
60 "Cannot introspect unity, make sure that it has been started "67 main_window = MainWindow(unity_proxy_obj)
61 "with testability. Perhaps use the function "68
62 "'restart_unity_with_testability' this module provides."69 greeter = main_window.get_greeter()
63 "(%s)"70 if greeter is None:
64 % str(e)71 raise RuntimeWarning("Greeter appears to be already unlocked.")
65 )72 greeter.swipe()
6673
6774
68def restart_unity_with_testability():75def restart_unity_with_testability(*args):
69 """Restarts (or just starts) unity8 with the testability driver loaded76 """Restarts (or starts) unity with testability enabled.
77
78 Passes *args arguments to the launched process.
79
80 """
81 args += ("QT_LOAD_TESTABILITY=1",)
82 return restart_unity(*args)
83
84
85def restart_unity(*args):
86 """Restarts (or starts) unity8 using the provided arguments.
87
88 Passes *args arguments to the launched process.
7089
71 :raises subprocess.CalledProcessError: if unable to stop or start the90 :raises subprocess.CalledProcessError: if unable to stop or start the
72 unity8 upstart job.91 unity8 upstart job.
@@ -75,27 +94,28 @@
75 status = _get_unity_status()94 status = _get_unity_status()
76 if "start/" in status:95 if "start/" in status:
77 try:96 try:
78 print("Stopping unity.")97 output = subprocess.check_output(['initctl', 'stop', 'unity8'])
79 subprocess.check_call([98 logger.info(output)
80 'initctl',
81 'stop',
82 'unity8',
83 ])
84 except subprocess.CalledProcessError as e:99 except subprocess.CalledProcessError as e:
85 e.args += ("Failed to stop running instance of unity8", )100 e.args += (
101 "Failed to stop running instance of unity8: %s" % e.output,
102 )
86 raise103 raise
87104
88 try:105 try:
89 print("Starting unity with testability.")106 command = ['initctl', 'start', 'unity8'] + list(args)
90 subprocess.check_call([107 output = subprocess.check_output(
91 'initctl',108 command,
92 'start',109 stderr=subprocess.STDOUT,
93 'unity8',110 universal_newlines=True,
94 'QT_LOAD_TESTABILITY=1',111 )
95 ])112 logger.info(output)
113 pid = _get_unity_pid()
96 except subprocess.CalledProcessError as e:114 except subprocess.CalledProcessError as e:
97 e.args += ("Failed to start unity8 with testability ", )115 e.args += ("Failed to start unity8: %s" % e.output,)
98 raise116 raise
117 else:
118 return _get_unity_proxy_object(pid)
99119
100120
101def _get_unity_status():121def _get_unity_status():
@@ -114,3 +134,10 @@
114 if not "start/" in status:134 if not "start/" in status:
115 raise CannotAccessUnity("Unity is not in the running state.")135 raise CannotAccessUnity("Unity is not in the running state.")
116 return int(status.split()[-1])136 return int(status.split()[-1])
137
138
139def _get_unity_proxy_object(pid):
140 return get_proxy_object_for_existing_process(
141 pid=pid,
142 emulator_base=UnityEmulatorBase,
143 )
117144
=== modified file 'tests/autopilot/unity8/shell/tests/__init__.py'
--- tests/autopilot/unity8/shell/tests/__init__.py 2013-11-01 13:59:50 +0000
+++ tests/autopilot/unity8/shell/tests/__init__.py 2013-11-19 20:53:31 +0000
@@ -28,7 +28,6 @@
28from autopilot.testcase import AutopilotTestCase28from autopilot.testcase import AutopilotTestCase
29from autopilot.matchers import Eventually29from autopilot.matchers import Eventually
30from autopilot.input import Touch30from autopilot.input import Touch
31from autopilot.introspection import get_proxy_object_for_existing_process
32from autopilot.display import Display31from autopilot.display import Display
33import logging32import logging
34import os.path33import os.path
@@ -43,7 +42,7 @@
43 get_default_extra_mock_libraries,42 get_default_extra_mock_libraries,
44 get_data_dirs43 get_data_dirs
45)44)
46from unity8.shell.emulators import UnityEmulatorBase45from unity8.process_helpers import restart_unity_with_testability
47from unity8.shell.emulators.dash import Dash46from unity8.shell.emulators.dash import Dash
48from unity8.shell.emulators.main_window import MainWindow47from unity8.shell.emulators.main_window import MainWindow
4948
@@ -105,7 +104,7 @@
105 ),104 ),
106 "upstart")105 "upstart")
107 )106 )
108 )107 )
109 sys.exit(1)108 sys.exit(1)
110109
111 if "start/" in output:110 if "start/" in output:
@@ -303,32 +302,20 @@
303302
304 binary_arg = "BINARY=%s" % binary_path303 binary_arg = "BINARY=%s" % binary_path
305 extra_args = "ARGS=%s" % " ".join(args)304 extra_args = "ARGS=%s" % " ".join(args)
306305 env_args = ["%s=%s" % (k, v) for k, v in self._environment.iteritems()]
307 output = subprocess.check_output(306 all_args = [binary_arg, extra_args] + env_args
308 [
309 "/sbin/initctl",
310 "start",
311 "unity8",
312 binary_arg,
313 extra_args,
314 ] + ["%s=%s" % (k, v) for k, v in self._environment.iteritems()],
315 stderr=subprocess.STDOUT,
316 )
317307
318 self.addCleanup(self._cleanup_launching_upstart_unity)308 self.addCleanup(self._cleanup_launching_upstart_unity)
319309
320 pid = int(output.split()[-1])310 return restart_unity_with_testability(*all_args)
321
322 return get_proxy_object_for_existing_process(
323 pid=pid,
324 emulator_base=UnityEmulatorBase,
325 )
326311
327 def _cleanup_launching_upstart_unity(self):312 def _cleanup_launching_upstart_unity(self):
328 logger.info("Stopping unity")313 logger.info("Stopping unity")
329 try:314 try:
330 subprocess.check_output(315 subprocess.check_output(
331 ["/sbin/initctl", "stop", "unity8"], stderr=subprocess.STDOUT)316 ["/sbin/initctl", "stop", "unity8"],
317 stderr=subprocess.STDOUT
318 )
332 except subprocess.CalledProcessError:319 except subprocess.CalledProcessError:
333 logger.warning("Appears unity was already stopped!")320 logger.warning("Appears unity was already stopped!")
334321
335322
=== modified file 'tests/autopilot/unity8/shell/tests/test_hud.py'
--- tests/autopilot/unity8/shell/tests/test_hud.py 2013-10-02 09:24:10 +0000
+++ tests/autopilot/unity8/shell/tests/test_hud.py 2013-11-19 20:53:31 +0000
@@ -19,6 +19,7 @@
1919
20from __future__ import absolute_import20from __future__ import absolute_import
2121
22from unity8.process_helpers import unlock_unity
22from unity8.shell import with_lightdm_mock, DragMixin23from unity8.shell import with_lightdm_mock, DragMixin
23from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios24from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
2425
@@ -38,8 +39,8 @@
38 The button must disappear when touching somewhere on the screen except the button itself.39 The button must disappear when touching somewhere on the screen except the button itself.
3940
40 """41 """
41 self.launch_unity()42 unity_proxy = self.launch_unity()
42 self.main_window.get_greeter().swipe()43 unlock_unity(unity_proxy)
43 window = self.main_window.get_qml_view()44 window = self.main_window.get_qml_view()
44 hud_show_button = self.main_window.get_hud_show_button()45 hud_show_button = self.main_window.get_hud_show_button()
45 edge_drag_area = self.main_window.get_hud_edge_drag_area()46 edge_drag_area = self.main_window.get_hud_edge_drag_area()
@@ -80,8 +81,8 @@
80 Test that the hud button stays on screen and tapping it opens the hud.81 Test that the hud button stays on screen and tapping it opens the hud.
8182
82 """83 """
83 self.launch_unity()84 unity_proxy = self.launch_unity()
84 self.main_window.get_greeter().swipe()85 unlock_unity(unity_proxy)
85 window = self.main_window.get_qml_view()86 window = self.main_window.get_qml_view()
86 hud_show_button = self.main_window.get_hud_show_button()87 hud_show_button = self.main_window.get_hud_show_button()
87 hud = self.main_window.get_hud()88 hud = self.main_window.get_hud()
@@ -117,8 +118,8 @@
117118
118 def test_hide_hud_click(self):119 def test_hide_hud_click(self):
119 """Tapping the close button of the Hud must dismiss it."""120 """Tapping the close button of the Hud must dismiss it."""
120 self.launch_unity()121 unity_proxy = self.launch_unity()
121 self.main_window.get_greeter().swipe()122 unlock_unity(unity_proxy)
122 hud = self.main_window.get_hud()123 hud = self.main_window.get_hud()
123124
124 self._launch_test_app_from_app_screen()125 self._launch_test_app_from_app_screen()
@@ -134,8 +135,8 @@
134 released downward.135 released downward.
135136
136 """137 """
137 self.launch_unity()138 unity_proxy = self.launch_unity()
138 self.main_window.get_greeter().swipe()139 unlock_unity(unity_proxy)
139 window = self.main_window.get_qml_view()140 window = self.main_window.get_qml_view()
140 hud = self.main_window.get_hud()141 hud = self.main_window.get_hud()
141142
@@ -152,8 +153,8 @@
152153
153 def test_launcher_hides_hud(self):154 def test_launcher_hides_hud(self):
154 """Opening the Launcher while the Hud is active must close the Hud."""155 """Opening the Launcher while the Hud is active must close the Hud."""
155 self.launch_unity()156 unity_proxy = self.launch_unity()
156 self.main_window.get_greeter().swipe()157 unlock_unity(unity_proxy)
157 hud = self.main_window.get_hud()158 hud = self.main_window.get_hud()
158 launcher = self.main_window.get_launcher()159 launcher = self.main_window.get_launcher()
159160
160161
=== modified file 'tests/autopilot/unity8/shell/tests/test_notifications.py'
--- tests/autopilot/unity8/shell/tests/test_notifications.py 2013-11-01 13:59:50 +0000
+++ tests/autopilot/unity8/shell/tests/test_notifications.py 2013-11-19 20:53:31 +0000
@@ -21,6 +21,7 @@
2121
22from __future__ import absolute_import22from __future__ import absolute_import
2323
24from unity8.process_helpers import unlock_unity
24from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios25from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
2526
26from testtools.matchers import Equals, NotEquals27from testtools.matchers import Equals, NotEquals
@@ -118,9 +119,8 @@
118119
119 def test_interactive(self):120 def test_interactive(self):
120 """Interactive notification must react upon click on itself."""121 """Interactive notification must react upon click on itself."""
121 self.launch_unity()122 unity_proxy = self.launch_unity()
122 greeter = self.main_window.get_greeter()123 unlock_unity(unity_proxy)
123 greeter.swipe()
124124
125 notify_list = self._get_notifications_list()125 notify_list = self._get_notifications_list()
126126
@@ -158,9 +158,8 @@
158 def test_sd_incoming_call(self):158 def test_sd_incoming_call(self):
159 """Rejecting a call should make notification expand and159 """Rejecting a call should make notification expand and
160 offer more options."""160 offer more options."""
161 self.launch_unity()161 unity_proxy = self.launch_unity()
162 greeter = self.main_window.get_greeter()162 unlock_unity(unity_proxy)
163 greeter.swipe()
164163
165 notify_list = self._get_notifications_list()164 notify_list = self._get_notifications_list()
166165
@@ -336,9 +335,8 @@
336335
337 def test_icon_summary_body(self):336 def test_icon_summary_body(self):
338 """Notification must display the expected summary and body text."""337 """Notification must display the expected summary and body text."""
339 self.launch_unity()338 unity_proxy = self.launch_unity()
340 greeter = self.main_window.get_greeter()339 unlock_unity(unity_proxy)
341 greeter.swipe()
342340
343 notify_list = self._get_notifications_list()341 notify_list = self._get_notifications_list()
344342
@@ -377,9 +375,8 @@
377 def test_icon_summary(self):375 def test_icon_summary(self):
378 """Notification must display the expected summary and secondary376 """Notification must display the expected summary and secondary
379 icon."""377 icon."""
380 self.launch_unity()378 unity_proxy = self.launch_unity()
381 greeter = self.main_window.get_greeter()379 unlock_unity(unity_proxy)
382 greeter.swipe()
383380
384 notify_list = self._get_notifications_list()381 notify_list = self._get_notifications_list()
385382
@@ -416,9 +413,8 @@
416 def test_urgency_order(self):413 def test_urgency_order(self):
417 """Notifications must be displayed in order according to their414 """Notifications must be displayed in order according to their
418 urgency."""415 urgency."""
419 self.launch_unity()416 unity_proxy = self.launch_unity()
420 greeter = self.main_window.get_greeter()417 unlock_unity(unity_proxy)
421 greeter.swipe()
422418
423 notify_list = self._get_notifications_list()419 notify_list = self._get_notifications_list()
424420
@@ -504,9 +500,8 @@
504500
505 def test_summary_and_body(self):501 def test_summary_and_body(self):
506 """Notification must display the expected summary- and body-text."""502 """Notification must display the expected summary- and body-text."""
507 self.launch_unity()503 unity_proxy = self.launch_unity()
508 greeter = self.main_window.get_greeter()504 unlock_unity(unity_proxy)
509 greeter.swipe()
510505
511 notify_list = self._get_notifications_list()506 notify_list = self._get_notifications_list()
512507
@@ -518,6 +513,7 @@
518513
519 notification = notify_list.wait_select_single(514 notification = notify_list.wait_select_single(
520 'Notification', objectName='notification1')515 'Notification', objectName='notification1')
516
521 self._assert_notification(517 self._assert_notification(
522 notification,518 notification,
523 summary,519 summary,
@@ -529,9 +525,8 @@
529525
530 def test_summary_only(self):526 def test_summary_only(self):
531 """Notification must display only the expected summary-text."""527 """Notification must display only the expected summary-text."""
532 self.launch_unity()528 unity_proxy = self.launch_unity()
533 greeter = self.main_window.get_greeter()529 unlock_unity(unity_proxy)
534 greeter.swipe()
535530
536 notify_list = self._get_notifications_list()531 notify_list = self._get_notifications_list()
537532
@@ -548,9 +543,8 @@
548 def test_update_notification_same_layout(self):543 def test_update_notification_same_layout(self):
549 """Notification must allow updating its contents while being544 """Notification must allow updating its contents while being
550 displayed."""545 displayed."""
551 self.launch_unity()546 unity_proxy = self.launch_unity()
552 greeter = self.main_window.get_greeter()547 unlock_unity(unity_proxy)
553 greeter.swipe()
554548
555 notify_list = self._get_notifications_list()549 notify_list = self._get_notifications_list()
556550
@@ -587,9 +581,8 @@
587 def test_update_notification_layout_change(self):581 def test_update_notification_layout_change(self):
588 """Notification must allow updating its contents and layout while582 """Notification must allow updating its contents and layout while
589 being displayed."""583 being displayed."""
590 self.launch_unity()584 unity_proxy = self.launch_unity()
591 greeter = self.main_window.get_greeter()585 unlock_unity(unity_proxy)
592 greeter.swipe()
593586
594 notify_list = self._get_notifications_list()587 notify_list = self._get_notifications_list()
595588
@@ -612,6 +605,7 @@
612605
613 get_notification = lambda: notify_list.wait_select_single(606 get_notification = lambda: notify_list.wait_select_single(
614 'Notification', objectName='notification1')607 'Notification', objectName='notification1')
608
615 self._assert_notification(609 self._assert_notification(
616 get_notification(),610 get_notification(),
617 summary,611 summary,
@@ -633,9 +627,8 @@
633627
634 def test_append_hint(self):628 def test_append_hint(self):
635 """Notification has to accumulate body-text using append-hint."""629 """Notification has to accumulate body-text using append-hint."""
636 self.launch_unity()630 unity_proxy = self.launch_unity()
637 greeter = self.main_window.get_greeter()631 unlock_unity(unity_proxy)
638 greeter.swipe()
639632
640 notify_list = self._get_notifications_list()633 notify_list = self._get_notifications_list()
641634
@@ -654,6 +647,7 @@
654647
655 get_notification = lambda: notify_list.wait_select_single(648 get_notification = lambda: notify_list.wait_select_single(
656 'Notification', objectName='notification1')649 'Notification', objectName='notification1')
650
657 notification = get_notification()651 notification = get_notification()
658 self._assert_notification(652 self._assert_notification(
659 notification,653 notification,
@@ -685,6 +679,7 @@
685 hints=[('x-canonical-append', 'true')]679 hints=[('x-canonical-append', 'true')]
686 )680 )
687 notification.show()681 notification.show()
682
688 get_notification = lambda: notify_list.wait_select_single(683 get_notification = lambda: notify_list.wait_select_single(
689 'Notification',684 'Notification',
690 objectName='notification1'685 objectName='notification1'

Subscribers

People subscribed via source and target branches