on xenial help sign in
Merged Chris' branch making the notification ap-tests more robust for jenkins
commita95e396c9ebda26371cd6695eea0e0471b7dc5eb authorMirco Müller <mirco.mueller@ubuntu.com> dateThu 1 Aug 2013, 10:00 (13 years ago) parentc6a2cd0db5b4ce
1 file changed+15−9
tests/autopilot/unity8/shell/tests/test_notifications.py+15−9
tests/autopilot/unity8/shell/tests/test_notifications.py+15−9
@@ -83,20 +83,26 @@ class NotificationsBase(UnityTestCase):
8383 """
8484
8585 if summary is not None:
86− self.assertThat(notification.summary, Equals(summary))
86+ self.assertThat(notification.summary, Eventually(Equals(summary)))
8787
8888 if body is not None:
89− self.assertThat(notification.body, Equals(body))
89+ self.assertThat(notification.body, Eventually(Equals(body)))
9090
9191 if icon:
92− self.assertThat(notification.iconSource, NotEquals(""))
92+ self.assertThat(notification.iconSource, Eventually(NotEquals("")))
9393 else:
94− self.assertThat(notification.iconSource, Equals(""))
94+ self.assertThat(notification.iconSource, Eventually(Equals("")))
9595
9696 if secondary_icon:
97− self.assertThat(notification.secondaryIconSource, NotEquals(""))
97+ self.assertThat(
98+ notification.secondaryIconSource,
99+ Eventually(NotEquals(""))
100+ )
98101 else:
99− self.assertThat(notification.secondaryIconSource, Equals(""))
102+ self.assertThat(
103+ notification.secondaryIconSource,
104+ Eventually(Equals(""))
105+ )
100106
101107 if opacity is not None:
102108 self.assertThat(notification.opacity, Eventually(Equals(opacity)))
@@ -248,7 +254,8 @@ class InteractiveNotificationBase(NotificationsBase):
248254 action_string = "%s,%s" % (action_id, action_label)
249255 script_args.extend(['--action', action_string])
250256
251− command = [self._get_notify_script()] + script_args
257+ python_bin = subprocess.check_output(['which', 'python']).strip()
258+ command = [python_bin, self._get_notify_script()] + script_args
252259 logger.info("Launching snap-decision notification as: %s", command)
253260 self._notify_proc = subprocess.Popen(
254261 command,
@@ -551,7 +558,7 @@ class EphemeralNotificationsTests(NotificationsBase):
551558 )
552559 notification.show()
553560
554− get_notification = lambda: notify_list.select_single('Notification')
561+ get_notification = lambda: notify_list.select_single('Notification', summary=summary)
555562 self.assertThat(get_notification, Eventually(NotEquals(None)))
556563 self._assert_notification(
557564 get_notification(),
@@ -562,7 +569,6 @@ class EphemeralNotificationsTests(NotificationsBase):
562569 1.0
563570 )
564571
565− time.sleep(3)
566572 summary = 'Updated notification'
567573 body = 'Here the same bubble with new title- and body-text, even ' \
568574 'the icon can be changed on the update.'