on xenial help sign in
autopilot 1.4 update
15b2b34chris.gagnon
tests/autopilot/unity8/shell/emulators/create_interactive_notification.pymode 100755 → 100644

Only the mode changed.

tests/autopilot/unity8/shell/emulators/dash.py+9−18
@@ -18,44 +18,35 @@
18#
18#
19
19
20from unity8.shell.emulators import UnityEmulatorBase
20from unity8.shell.emulators import UnityEmulatorBase
21−from time import sleep
21+
22
22
23class Dash(UnityEmulatorBase):
23class Dash(UnityEmulatorBase):
24
24
25 """An emulator that understands the Dash."""
25 """An emulator that understands the Dash."""
26
26
27 def get_home_applications_grid(self):
27 def get_home_applications_grid(self):
28− for i in range(1,10):
29− get_grid = self.get_scope('home').select_single(
28+ get_grid = self.get_scope('home').wait_select_single(
30− "GenericFilterGrid",
29+ "GenericFilterGrid",
31− objectName="applications.scope"
30+ objectName="applications.scope"
32− )
31+ )
33− if get_grid != None:
34− break
35− sleep(1)
36 return get_grid
32 return get_grid
37
33
38 def get_application_icon(self, text):
34 def get_application_icon(self, text):
39 """Returns a 'Tile' icon that has the text 'text' from the application
35 """Returns a 'Tile' icon that has the text 'text' from the application
40 grid.
36 grid.
41
37
42− Will return None if the icon isn't found.
43−
44 :param text: String containing the text of the icon to search for.
38 :param text: String containing the text of the icon to search for.
45
39
46 """
40 """
47 app_grid = self.get_home_applications_grid()
41 app_grid = self.get_home_applications_grid()
48− for i in range(1,10):
49− resp_grid = app_grid.select_single('ResponsiveGridView')
42+ resp_grid = app_grid.wait_select_single('ResponsiveGridView')
50− if resp_grid != None:
51− break
52− sleep(1)
53 return resp_grid.select_single('Tile', text=text)
43 return resp_grid.select_single('Tile', text=text)
54
44
55 def get_scope(self, scope_name='home'):
45 def get_scope(self, scope_name='home'):
56− dash_content = self.select_single(
46+ dash_content = self.wait_select_single(
57 'QQuickListView',
47 'QQuickListView',
58 objectName='dashContentList'
48 objectName='dashContentList'
59 )
49 )
60 scope_id = "%s.scope" % scope_name
50 scope_id = "%s.scope" % scope_name
51+ return dash_content.wait_select_single(
61− return dash_content.select_single('QQuickLoader', scopeId=scope_id)
52+ 'QQuickLoader', scopeId=scope_id)
tests/autopilot/unity8/shell/emulators/greeter.py+2−1
@@ -40,4 +40,5 @@ class Greeter(UnityEmulatorBase):
40 self.created.wait_for(False)
40 self.created.wait_for(False)
41
41
42 def get_prompt(self):
42 def get_prompt(self):
43+ return self.wait_select_single(
43− return self.select_single("TextField", objectName="passwordInput")
44+ "TextField", objectName="passwordInput")
tests/autopilot/unity8/shell/emulators/hud.py+9−4
@@ -26,6 +26,7 @@ from autopilot.input import Touch
26
26
27SwipeCoords = namedtuple('SwipeCoords', 'start_x end_x start_y end_y')
27SwipeCoords = namedtuple('SwipeCoords', 'start_x end_x start_y end_y')
28
28
29+
29class Hud(UnityEmulatorBase, DragMixin):
30class Hud(UnityEmulatorBase, DragMixin):
30
31
31 """An emulator that understands the Hud."""
32 """An emulator that understands the Hud."""
@@ -34,13 +35,16 @@ class Hud(UnityEmulatorBase, DragMixin):
34 """Swipes open the Hud."""
35 """Swipes open the Hud."""
35 self.touch = Touch.create()
36 self.touch = Touch.create()
36
37
37− window = self.get_root_instance().select_single('QQuickView')
38+ window = self.get_root_instance().wait_select_single('QQuickView')
38− hud_show_button = window.select_single("HudButton")
39+ hud_show_button = window.wait_select_single("HudButton")
39
40
40 swipe_coords = self.get_button_swipe_coords(window, hud_show_button)
41 swipe_coords = self.get_button_swipe_coords(window, hud_show_button)
41
42
42 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
43 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
43− self._drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.end_y)
44+ self._drag(swipe_coords.start_x,
45+ swipe_coords.start_y,
46+ swipe_coords.start_x,
47+ swipe_coords.end_y)
44 try:
48 try:
45 hud_show_button.opacity.wait_for(1.0)
49 hud_show_button.opacity.wait_for(1.0)
46 self.touch.release()
50 self.touch.release()
@@ -74,6 +78,7 @@ class Hud(UnityEmulatorBase, DragMixin):
74 start_x = int(main_view.x + (main_view.width / 2))
78 start_x = int(main_view.x + (main_view.width / 2))
75 end_x = start_x
79 end_x = start_x
76 start_y = main_view.y + (main_view.height - 3)
80 start_y = main_view.y + (main_view.height - 3)
81+ end_y = main_view.y + int(
77− end_y = main_view.y + int(hud_show_button.y + (hud_show_button.height/2))
82+ hud_show_button.y + (hud_show_button.height/2))
78
83
79 return SwipeCoords(start_x, end_x, start_y, end_y)
84 return SwipeCoords(start_x, end_x, start_y, end_y)
tests/autopilot/unity8/shell/emulators/launcher.py+1−1
@@ -29,7 +29,7 @@ class Launcher(UnityEmulatorBase):
29 """Swipes open the launcher."""
29 """Swipes open the launcher."""
30 touch = Touch.create()
30 touch = Touch.create()
31
31
32− view = self.get_root_instance().select_single('QQuickView')
32+ view = self.get_root_instance().wait_select_single('QQuickView')
33 start_x = view.x + 1
33 start_x = view.x + 1
34 start_y = view.y + view.height / 2
34 start_y = view.y + view.height / 2
35 stop_x = start_x + self.panelWidth + 1
35 stop_x = start_x + self.panelWidth + 1
tests/autopilot/unity8/shell/emulators/main_window.py+18−16
@@ -32,64 +32,66 @@ class MainWindow(object):
32
32
33 def get_qml_view(self):
33 def get_qml_view(self):
34 """Get the main QML view"""
34 """Get the main QML view"""
35− return self.app.select_single("QQuickView")
35+ return self.app.wait_select_single("QQuickView")
36
36
37 def get_greeter(self):
37 def get_greeter(self):
38 return self.app.select_single(Greeter)
38 return self.app.select_single(Greeter)
39
39
40 def get_greeter_content_loader(self):
40 def get_greeter_content_loader(self):
41− return self.app.select_single(
41+ return self.app.wait_select_single(
42 "QQuickLoader",
42 "QQuickLoader",
43 objectName="greeterContentLoader"
43 objectName="greeterContentLoader"
44 )
44 )
45
45
46 def get_login_loader(self):
46 def get_login_loader(self):
47+ return self.app.wait_select_single(
47− return self.app.select_single("QQuickLoader", objectName="loginLoader")
48+ "QQuickLoader", objectName="loginLoader")
48
49
49 def get_login_list(self):
50 def get_login_list(self):
50− return self.app.select_single("LoginList")
51+ return self.app.wait_select_single("LoginList")
51
52
52 def get_hud(self):
53 def get_hud(self):
53− return self.app.select_single(Hud)
54+ return self.app.wait_select_single(Hud)
54
55
55 def get_hud_showable(self):
56 def get_hud_showable(self):
57+ return self.app.wait_select_single(
56− return self.app.select_single("Showable", objectName="hudShowable")
58+ "Showable", objectName="hudShowable")
57
59
58 def get_hud_show_button(self):
60 def get_hud_show_button(self):
59− return self.app.select_single("HudButton")
61+ return self.app.wait_select_single("HudButton")
60
62
61 def get_hud_edge_drag_area(self):
63 def get_hud_edge_drag_area(self):
62− return self.app.select_single(objectName="hudDragArea")
64+ return self.app.wait_select_single(objectName="hudDragArea")
63
65
64 def get_dash(self):
66 def get_dash(self):
65− return self.app.select_single(Dash)
67+ return self.app.wait_select_single(Dash)
66
68
67 def get_dash_home_applications_grid(self):
69 def get_dash_home_applications_grid(self):
68− return self.app.select_single(
70+ return self.app.wait_select_single(
69 "ApplicationsFilterGrid",
71 "ApplicationsFilterGrid",
70 objectName="dashHomeApplicationsGrid"
72 objectName="dashHomeApplicationsGrid"
71 )
73 )
72
74
73 def get_bottombar(self):
75 def get_bottombar(self):
74− return self.app.select_single("Bottombar")
76+ return self.app.wait_select_single("Bottombar")
75
77
76 def get_launcher(self):
78 def get_launcher(self):
77− return self.app.select_single(Launcher)
79+ return self.app.wait_select_single(Launcher)
78
80
79 def get_pinPadLoader(self):
81 def get_pinPadLoader(self):
80− return self.app.select_single(
82+ return self.app.wait_select_single(
81 "QQuickLoader",
83 "QQuickLoader",
82 objectName="pinPadLoader"
84 objectName="pinPadLoader"
83 )
85 )
84
86
85 def get_pinPadButton(self, buttonId):
87 def get_pinPadButton(self, buttonId):
86− return self.app.select_single(
88+ return self.app.wait_select_single(
87 "PinPadButton",
89 "PinPadButton",
88 objectName="pinPadButton%i" % buttonId
90 objectName="pinPadButton%i" % buttonId
89 )
91 )
90
92
91 def get_lockscreen(self):
93 def get_lockscreen(self):
92− return self.app.select_single("Lockscreen")
94+ return self.app.wait_select_single("Lockscreen")
93
95
94 def get_pinentryField(self):
96 def get_pinentryField(self):
95− return self.app.select_single(objectName="pinentryField")
97+ return self.app.wait_select_single(objectName="pinentryField")
tests/autopilot/unity8/shell/tests/__init__.py+39−19
@@ -34,7 +34,7 @@ import logging
34import os.path
34import os.path
35import subprocess
35import subprocess
36import sys
36import sys
37−from testtools.matchers import Equals, NotEquals
37+from testtools.matchers import Equals
38
38
39from unity8 import (
39from unity8 import (
40 get_lib_path,
40 get_lib_path,
@@ -53,7 +53,7 @@ logger = logging.getLogger(__name__)
53UNITYSHELL_GSETTINGS_SCHEMA = "org.compiz.unityshell"
53UNITYSHELL_GSETTINGS_SCHEMA = "org.compiz.unityshell"
54UNITYSHELL_GSETTINGS_PATH = "/org/compiz/profiles/unity/plugins/unityshell/"
54UNITYSHELL_GSETTINGS_PATH = "/org/compiz/profiles/unity/plugins/unityshell/"
55UNITYSHELL_LAUNCHER_KEY = "launcher-hide-mode"
55UNITYSHELL_LAUNCHER_KEY = "launcher-hide-mode"
56−UNITYSHELL_LAUNCHER_MODE = 1 # launcher hidden
56+UNITYSHELL_LAUNCHER_MODE = 1 # launcher hidden
57
57
58
58
59def _get_device_emulation_scenarios(devices='All'):
59def _get_device_emulation_scenarios(devices='All'):
@@ -93,17 +93,25 @@ class UnityTestCase(AutopilotTestCase):
93 ], stderr=subprocess.STDOUT)
93 ], stderr=subprocess.STDOUT)
94 except subprocess.CalledProcessError, e:
94 except subprocess.CalledProcessError, e:
95 sys.stderr.write(
95 sys.stderr.write(
96− "Error: `initctl status unity8` failed, most probably the unity8 session could not be found:\n\n"
96+ "Error: `initctl status unity8` failed, most probably the "
97+ "unity8 session could not be found:\n\n"
97 "{0}\n"
98 "{0}\n"
98− "Please install unity8 or copy data/unity8.conf to {1}\n".format(
99+ "Please install unity8 or copy data/unity8.conf to "
100+ "{1}\n".format(
99 e.output,
101 e.output,
100− os.path.join(os.getenv("XDG_CONFIG_HOME", os.path.join(os.getenv("HOME"), ".config")), "upstart")
102+ os.path.join(os.getenv("XDG_CONFIG_HOME",
103+ os.path.join(os.getenv("HOME"),
104+ ".config")
105+ ),
106+ "upstart")
101− ))
107+ )
108+ )
102 sys.exit(1)
109 sys.exit(1)
103
110
104 if "start/" in output:
111 if "start/" in output:
105 sys.stderr.write(
112 sys.stderr.write(
106− "Error: Unity is currently running, these tests require it to be 'stopped'.\n"
113+ "Error: Unity is currently running, these tests require it to "
114+ "be 'stopped'.\n"
107 "Please run this command before running these tests: \n"
115 "Please run this command before running these tests: \n"
108 "initctl stop unity8\n"
116 "initctl stop unity8\n"
109 )
117 )
@@ -111,11 +119,17 @@ class UnityTestCase(AutopilotTestCase):
111
119
112 def setUp(self):
120 def setUp(self):
113 super(UnityTestCase, self).setUp()
121 super(UnityTestCase, self).setUp()
122+ if (Gio is not None and
123+ UNITYSHELL_GSETTINGS_SCHEMA in
114− if Gio is not None and UNITYSHELL_GSETTINGS_SCHEMA in Gio.Settings.list_relocatable_schemas():
124+ Gio.Settings.list_relocatable_schemas()):
125+
115 # Hide Unity launcher
126 # Hide Unity launcher
127+ self._unityshell_schema = Gio.Settings.new_with_path(
116− self._unityshell_schema = Gio.Settings.new_with_path(UNITYSHELL_GSETTINGS_SCHEMA, UNITYSHELL_GSETTINGS_PATH)
128+ UNITYSHELL_GSETTINGS_SCHEMA, UNITYSHELL_GSETTINGS_PATH)
117− self._launcher_hide_mode = self._unityshell_schema.get_int(UNITYSHELL_LAUNCHER_KEY)
129+ self._launcher_hide_mode = self._unityshell_schema.get_int(
130+ UNITYSHELL_LAUNCHER_KEY)
131+ self._unityshell_schema.set_int(
118− self._unityshell_schema.set_int(UNITYSHELL_LAUNCHER_KEY, UNITYSHELL_LAUNCHER_MODE)
132+ UNITYSHELL_LAUNCHER_KEY, UNITYSHELL_LAUNCHER_MODE)
119 self.addCleanup(self._reset_launcher)
133 self.addCleanup(self._reset_launcher)
120
134
121 self._proxy = None
135 self._proxy = None
@@ -136,7 +150,8 @@ class UnityTestCase(AutopilotTestCase):
136
150
137 def _reset_launcher(self):
151 def _reset_launcher(self):
138 """Reset Unity launcher hide mode"""
152 """Reset Unity launcher hide mode"""
153+ self._unityshell_schema.set_int(
139− self._unityshell_schema.set_int(UNITYSHELL_LAUNCHER_KEY, self._launcher_hide_mode)
154+ UNITYSHELL_LAUNCHER_KEY, self._launcher_hide_mode)
140
155
141 def _setup_display_details(self):
156 def _setup_display_details(self):
142 scale_divisor = self._determine_geometry()
157 scale_divisor = self._determine_geometry()
@@ -217,7 +232,8 @@ class UnityTestCase(AutopilotTestCase):
217 def _upstart_reset_env(self, key, value):
232 def _upstart_reset_env(self, key, value):
218 logger.info("Resetting upstart env %s to %s", key, value)
233 logger.info("Resetting upstart env %s to %s", key, value)
219 if value is None:
234 if value is None:
235+ subprocess.call(
220− subprocess.call(["/sbin/initctl", "unset-env", key], stderr=subprocess.STDOUT)
236+ ["/sbin/initctl", "unset-env", key], stderr=subprocess.STDOUT)
221 else:
237 else:
222 subprocess.call([
238 subprocess.call([
223 "/sbin/initctl",
239 "/sbin/initctl",
@@ -244,9 +260,13 @@ class UnityTestCase(AutopilotTestCase):
244 self._setup_extra_mock_environment_patch()
260 self._setup_extra_mock_environment_patch()
245
261
246 # FIXME: we shouldn't be doing this
262 # FIXME: we shouldn't be doing this
247− # $MIR_SOCKET, fallback to $XDG_RUNTIME_DIR/mir_socket and /tmp/mir_socket as last resort
263+ # $MIR_SOCKET, fallback to $XDG_RUNTIME_DIR/mir_socket and
264+ # /tmp/mir_socket as last resort
248 try:
265 try:
266+ os.unlink(
267+ os.getenv('MIR_SOCKET',
249− os.unlink(os.getenv('MIR_SOCKET', os.path.join(os.getenv('XDG_RUNTIME_DIR', "/tmp"), "mir_socket")))
268+ os.path.join(os.getenv('XDG_RUNTIME_DIR', "/tmp"),
269+ "mir_socket")))
250 except OSError:
270 except OSError:
251 pass
271 pass
252 try:
272 try:
@@ -281,8 +301,8 @@ class UnityTestCase(AutopilotTestCase):
281 "unity8",
301 "unity8",
282 binary_arg,
302 binary_arg,
283 extra_args
303 extra_args
284− ] + ["%s=%s" % (k,v) for k,v in self._environment.iteritems()],
304+ ] + ["%s=%s" % (k, v) for k, v in self._environment.iteritems()],
285− stderr=subprocess.STDOUT)
305+ stderr=subprocess.STDOUT)
286
306
287 self.addCleanup(self._cleanup_launching_upstart_unity)
307 self.addCleanup(self._cleanup_launching_upstart_unity)
288
308
@@ -296,7 +316,8 @@ class UnityTestCase(AutopilotTestCase):
296 def _cleanup_launching_upstart_unity(self):
316 def _cleanup_launching_upstart_unity(self):
297 logger.info("Stopping unity")
317 logger.info("Stopping unity")
298 try:
318 try:
319+ subprocess.check_output(
299− subprocess.check_output(["/sbin/initctl", "stop", "unity8"], stderr=subprocess.STDOUT)
320+ ["/sbin/initctl", "stop", "unity8"], stderr=subprocess.STDOUT)
300 except subprocess.CalledProcessError:
321 except subprocess.CalledProcessError:
301 logger.warning("Appears unity was already stopped!")
322 logger.warning("Appears unity was already stopped!")
302
323
@@ -367,7 +388,6 @@ class UnityTestCase(AutopilotTestCase):
367
388
368 def get_dash(self):
389 def get_dash(self):
369 dash = self._proxy.select_single(Dash)
390 dash = self._proxy.select_single(Dash)
370− self.assertThat(dash, NotEquals(None))
371 return dash
391 return dash
372
392
373 @property
393 @property
tests/autopilot/unity8/shell/tests/test_notifications.py+43−43
@@ -45,7 +45,7 @@ class NotificationsBase(UnityTestCase):
45 """Given an icons file name returns the full path (either system or
45 """Given an icons file name returns the full path (either system or
46 source tree.
46 source tree.
47
47
48− Consider the graphics directory as root so for example (runnign tests
48+ Consider the graphics directory as root so for example (running tests
49 from installed unity8-autopilot package):
49 from installed unity8-autopilot package):
50 >>> self.get_icon_path('clock.png')
50 >>> self.get_icon_path('clock.png')
51 /usr/share/unity8/graphics/clock.png
51 /usr/share/unity8/graphics/clock.png
@@ -63,7 +63,7 @@ class NotificationsBase(UnityTestCase):
63
63
64 def _get_notifications_list(self):
64 def _get_notifications_list(self):
65 main_view = self.main_window.get_qml_view()
65 main_view = self.main_window.get_qml_view()
66− return main_view.select_single(
66+ return main_view.wait_select_single(
67 "QQuickListView",
67 "QQuickListView",
68 objectName='notificationList'
68 objectName='notificationList'
69 )
69 )
@@ -145,8 +145,8 @@ class InteractiveNotificationBase(NotificationsBase):
145 hints,
145 hints,
146 )
146 )
147
147
148+ get_notification = lambda: notify_list.wait_select_single(
148− get_notification = lambda: notify_list.select_single('Notification', objectName='notification1')
149+ 'Notification', objectName='notification1')
149− self.assertThat(get_notification, Eventually(NotEquals(None)))
150 notification = get_notification()
150 notification = get_notification()
151
151
152 self.touch.tap_object(
152 self.touch.tap_object(
@@ -156,7 +156,8 @@ class InteractiveNotificationBase(NotificationsBase):
156 self.assert_notification_action_id_was_called('action_id')
156 self.assert_notification_action_id_was_called('action_id')
157
157
158 def test_sd_incoming_call(self):
158 def test_sd_incoming_call(self):
159− """Rejecting a call should make notification expand and offer more options."""
159+ """Rejecting a call should make notification expand and
160+ offer more options."""
160 self.launch_unity()
161 self.launch_unity()
161 greeter = self.main_window.get_greeter()
162 greeter = self.main_window.get_greeter()
162 greeter.swipe()
163 greeter.swipe()
@@ -191,8 +192,8 @@ class InteractiveNotificationBase(NotificationsBase):
191 hints
192 hints
192 )
193 )
193
194
195+ get_notification = lambda: notify_list.wait_select_single(
194− get_notification = lambda: notify_list.select_single('Notification', objectName='notification1')
196+ 'Notification', objectName='notification1')
195− self.assertThat(get_notification, Eventually(NotEquals(None)))
196 notification = get_notification()
197 notification = get_notification()
197 self._assert_notification(notification, None, None, True, True, 1.0)
198 self._assert_notification(notification, None, None, True, True, 1.0)
198 initial_height = notification.height
199 initial_height = notification.height
@@ -200,8 +201,10 @@ class InteractiveNotificationBase(NotificationsBase):
200 self.assertThat(
201 self.assertThat(
201 notification.height,
202 notification.height,
202 Eventually(Equals(initial_height +
203 Eventually(Equals(initial_height +
204+ 3 * notification.select_single(
203− 3 * notification.select_single(objectName="buttonColumn").spacing +
205+ objectName="buttonColumn").spacing +
204− 3 * notification.select_single(objectName="button4").height)))
206+ 3 * notification.select_single(
207+ objectName="button4").height)))
205 self.touch.tap_object(notification.select_single(objectName="button4"))
208 self.touch.tap_object(notification.select_single(objectName="button4"))
206 self.assert_notification_action_id_was_called("action_decline_4")
209 self.assert_notification_action_id_was_called("action_decline_4")
207
210
@@ -360,13 +363,13 @@ class EphemeralNotificationsTests(NotificationsBase):
360
363
361 notification.show()
364 notification.show()
362
365
366+ notification = lambda: notify_list.wait_select_single(
363− get_notification = lambda: notify_list.select_single('Notification', objectName='notification1')
367+ 'Notification', objectName='notification1')
364− self.assertThat(get_notification, Eventually(NotEquals(None)))
365− notification = get_notification()
366− self._assert_notification(notification, summary, body, True, True, 1.0)
368+ self._assert_notification(notification(), summary, body, True, True, 1.0)
367
369
368 def test_icon_summary(self):
370 def test_icon_summary(self):
369− """Notification must display the expected summary and secondary icon."""
371+ """Notification must display the expected summary and secondary
372+ icon."""
370 self.launch_unity()
373 self.launch_unity()
371 greeter = self.main_window.get_greeter()
374 greeter = self.main_window.get_greeter()
372 greeter.swipe()
375 greeter.swipe()
@@ -391,11 +394,11 @@ class EphemeralNotificationsTests(NotificationsBase):
391
394
392 notification.show()
395 notification.show()
393
396
397+ notification = lambda: notify_list.wait_select_single(
394− get_notification = lambda: notify_list.select_single('Notification', objectName='notification1')
398+ 'Notification', objectName='notification1')
395− self.assertThat(get_notification, Eventually(NotEquals(None)))
399+
396− notification = get_notification()
397 self._assert_notification(
400 self._assert_notification(
398− notification,
401+ notification(),
399 summary,
402 summary,
400 None,
403 None,
401 False,
404 False,
@@ -404,7 +407,8 @@ class EphemeralNotificationsTests(NotificationsBase):
404 )
407 )
405
408
406 def test_urgency_order(self):
409 def test_urgency_order(self):
407− """Notifications must be displayed in order according to their urgency."""
410+ """Notifications must be displayed in order according to their
411+ urgency."""
408 self.launch_unity()
412 self.launch_unity()
409 greeter = self.main_window.get_greeter()
413 greeter = self.main_window.get_greeter()
410 greeter.swipe()
414 greeter.swipe()
@@ -448,11 +452,10 @@ class EphemeralNotificationsTests(NotificationsBase):
448 )
452 )
449 notification_critical.show()
453 notification_critical.show()
450
454
451− get_notification = lambda: notify_list.select_single(
455+ get_notification = lambda: notify_list.wait_select_single(
452 'Notification',
456 'Notification',
453 summary=summary_critical
457 summary=summary_critical
454 )
458 )
455− self.assertThat(get_notification, Eventually(NotEquals(None)))
456
459
457 notification = get_notification()
460 notification = get_notification()
458 self._assert_notification(
461 self._assert_notification(
@@ -464,11 +467,10 @@ class EphemeralNotificationsTests(NotificationsBase):
464 1.0
467 1.0
465 )
468 )
466
469
467− get_normal_notification = lambda: notify_list.select_single(
470+ get_normal_notification = lambda: notify_list.wait_select_single(
468 'Notification',
471 'Notification',
469 summary=summary_normal
472 summary=summary_normal
470 )
473 )
471− self.assertThat(get_normal_notification, Eventually(NotEquals(None)))
472 notification = get_normal_notification()
474 notification = get_normal_notification()
473 self._assert_notification(
475 self._assert_notification(
474 notification,
476 notification,
@@ -479,11 +481,10 @@ class EphemeralNotificationsTests(NotificationsBase):
479 1.0
481 1.0
480 )
482 )
481
483
482− get_low_notification = lambda: notify_list.select_single(
484+ get_low_notification = lambda: notify_list.wait_select_single(
483 'Notification',
485 'Notification',
484 summary=summary_low
486 summary=summary_low
485 )
487 )
486− self.assertThat(get_low_notification, Eventually(NotEquals(None)))
487 notification = get_low_notification()
488 notification = get_low_notification()
488 self._assert_notification(
489 self._assert_notification(
489 notification,
490 notification,
@@ -508,9 +509,8 @@ class EphemeralNotificationsTests(NotificationsBase):
508 notification = self._create_ephemeral_notification(summary, body)
509 notification = self._create_ephemeral_notification(summary, body)
509 notification.show()
510 notification.show()
510
511
512+ notification = notify_list.wait_select_single(
511− get_notification = lambda: notify_list.select_single('Notification', objectName='notification1')
513+ 'Notification', objectName='notification1')
512− self.assertThat(get_notification, Eventually(NotEquals(None)))
513− notification = get_notification()
514 self._assert_notification(
514 self._assert_notification(
515 notification,
515 notification,
516 summary,
516 summary,
@@ -533,14 +533,14 @@ class EphemeralNotificationsTests(NotificationsBase):
533 notification = self._create_ephemeral_notification(summary)
533 notification = self._create_ephemeral_notification(summary)
534 notification.show()
534 notification.show()
535
535
536+ notification = notify_list.wait_select_single(
536− get_notification = lambda: notify_list.select_single('Notification', objectName='notification1')
537+ 'Notification', objectName='notification1')
537− self.assertThat(get_notification, Eventually(NotEquals(None)))
538− notification = get_notification()
539
538
540 self._assert_notification(notification, summary, '', False, False, 1.0)
539 self._assert_notification(notification, summary, '', False, False, 1.0)
541
540
542 def test_update_notification_same_layout(self):
541 def test_update_notification_same_layout(self):
543− """Notification must allow updating its contents while being displayed."""
542+ """Notification must allow updating its contents while being
543+ displayed."""
544 self.launch_unity()
544 self.launch_unity()
545 greeter = self.main_window.get_greeter()
545 greeter = self.main_window.get_greeter()
546 greeter.swipe()
546 greeter.swipe()
@@ -558,8 +558,8 @@ class EphemeralNotificationsTests(NotificationsBase):
558 )
558 )
559 notification.show()
559 notification.show()
560
560
561− get_notification = lambda: notify_list.select_single('Notification', summary=summary)
561+ get_notification = lambda: notify_list.wait_select_single(
562− self.assertThat(get_notification, Eventually(NotEquals(None)))
562+ 'Notification', summary=summary)
563 self._assert_notification(
563 self._assert_notification(
564 get_notification(),
564 get_notification(),
565 summary,
565 summary,
@@ -575,11 +575,11 @@ class EphemeralNotificationsTests(NotificationsBase):
575 icon_path = self._get_icon_path('avatars/amanda.png')
575 icon_path = self._get_icon_path('avatars/amanda.png')
576 notification.update(summary, body, icon_path)
576 notification.update(summary, body, icon_path)
577 notification.show()
577 notification.show()
578− self.assertThat(get_notification, Eventually(NotEquals(None)))
579 self._assert_notification(get_notification(), summary, body)
578 self._assert_notification(get_notification(), summary, body)
580
579
581 def test_update_notification_layout_change(self):
580 def test_update_notification_layout_change(self):
582− """Notification must allow updating its contents and layout while being displayed."""
581+ """Notification must allow updating its contents and layout while
582+ being displayed."""
583 self.launch_unity()
583 self.launch_unity()
584 greeter = self.main_window.get_greeter()
584 greeter = self.main_window.get_greeter()
585 greeter.swipe()
585 greeter.swipe()
@@ -603,8 +603,8 @@ class EphemeralNotificationsTests(NotificationsBase):
603 )
603 )
604 notification.show()
604 notification.show()
605
605
606+ get_notification = lambda: notify_list.wait_select_single(
606− get_notification = lambda: notify_list.select_single('Notification', objectName='notification1')
607+ 'Notification', objectName='notification1')
607− self.assertThat(get_notification, Eventually(NotEquals(None)))
608 self._assert_notification(
608 self._assert_notification(
609 get_notification(),
609 get_notification(),
610 summary,
610 summary,
@@ -645,8 +645,8 @@ class EphemeralNotificationsTests(NotificationsBase):
645
645
646 notification.show()
646 notification.show()
647
647
648+ get_notification = lambda: notify_list.wait_select_single(
648− get_notification = lambda: notify_list.select_single('Notification', objectName='notification1')
649+ 'Notification', objectName='notification1')
649− self.assertThat(get_notification, Eventually(NotEquals(None)))
650 notification = get_notification()
650 notification = get_notification()
651 self._assert_notification(
651 self._assert_notification(
652 notification,
652 notification,
@@ -662,7 +662,8 @@ class EphemeralNotificationsTests(NotificationsBase):
662 'Did you watch the air-race in Oshkosh last week?',
662 'Did you watch the air-race in Oshkosh last week?',
663 'Phil owned the place like no one before him!',
663 'Phil owned the place like no one before him!',
664 'Did really everything in the race work according to regulations?',
664 'Did really everything in the race work according to regulations?',
665− 'Somehow I think to remember Burt Williams did cut corners and was not punished for this.',
665+ 'Somehow I think to remember Burt Williams did cut corners and '
666+ 'was not punished for this.',
666 'Hopefully the referees will watch the videos of the race.',
667 'Hopefully the referees will watch the videos of the race.',
667 'Burt could get fined with US$ 50000 for that rule-violation :)'
668 'Burt could get fined with US$ 50000 for that rule-violation :)'
668 ]
669 ]
@@ -677,11 +678,10 @@ class EphemeralNotificationsTests(NotificationsBase):
677 hints=[('x-canonical-append', 'true')]
678 hints=[('x-canonical-append', 'true')]
678 )
679 )
679 notification.show()
680 notification.show()
680− get_notification = lambda: notify_list.select_single(
681+ get_notification = lambda: notify_list.wait_select_single(
681 'Notification',
682 'Notification',
682 objectName='notification1'
683 objectName='notification1'
683 )
684 )
684− self.assertThat(get_notification, Eventually(NotEquals(None)))
685 notification = get_notification()
685 notification = get_notification()
686 self._assert_notification(
686 self._assert_notification(
687 notification,
687 notification,