Merge lp:~paulliu/unity8/notification_helper into lp:unity8

Proposed by Ying-Chun Liu
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 1597
Merged at revision: 1624
Proposed branch: lp:~paulliu/unity8/notification_helper
Merge into: lp:unity8
Diff against target: 63 lines (+37/-0)
3 files modified
tests/autopilot/unity8/shell/__init__.py (+1/-0)
tests/autopilot/unity8/shell/emulators/main_window.py (+17/-0)
tests/autopilot/unity8/shell/tests/test_notifications.py (+19/-0)
To merge this branch: bzr merge lp:~paulliu/unity8/notification_helper
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) Approve
Allan LeSage (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Leo Arias (community) Approve
Review via email: mp+249211@code.launchpad.net

Commit message

Add Autopilot Notification helper.

Description of the change

Implement helper based on
http://people.canonical.com/~thomir/ueqa-code-proposals/proposals/indicator-power/index.html

 * 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
 * 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?
N/A
 * If you changed the UI, has there been a design review?
N/A

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1595. By Ying-Chun Liu

fix whitespace

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 :

There is tags that don't belong here, please fix

0.1+14.04.20140221-0ubuntu1 ?
0.1+14.04.20140306-0ubuntu1 ?
0.1+14.10.20140502-0ubuntu1 ?
0.2+14.10.20140701.2-0ubuntu1 ?
0.3+14.10.20140708-0ubuntu1 ?
0.4+14.10.20140918-0ubuntu1 ?
0.4+14.10.20140926-0ubuntu1 ?
0.4+15.04.20141104-0ubuntu1 ?
0.4+15.04.20141105-0ubuntu1 ?

review: Needs Fixing
Revision history for this message
Allan LeSage (allanlesage) wrote :

Some comments inline, let's get Leo's feedback too. . . .

review: Needs Fixing
Revision history for this message
Leo Arias (elopio) :
review: Needs Fixing
1596. By Ying-Chun Liu

Move to main_window.
Update test_notifications.

Revision history for this message
Albert Astals Cid (aacid) wrote :

Tags are gone, I'll leave the review up to Leo and Allan

review: Abstain
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Leo Arias (elopio) wrote :

Some minor pita style complaints.
This is good, thanks Paul!

review: Needs Fixing
1597. By Ying-Chun Liu

Fix minor issues.

Revision history for this message
Leo Arias (elopio) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Allan LeSage (allanlesage) wrote :

This is great, much cleaner, well done.

review: Approve
Revision history for this message
Albert Astals Cid (aacid) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?
No, it's a test change only and the users of the test code are happy :)

 * Did CI run pass?
No, known broken stuff

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

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/unity8/shell/__init__.py'
2--- tests/autopilot/unity8/shell/__init__.py 2015-01-21 13:50:14 +0000
3+++ tests/autopilot/unity8/shell/__init__.py 2015-02-17 15:42:02 +0000
4@@ -27,6 +27,7 @@
5
6 logger = logging.getLogger(__name__)
7
8+
9 def disable_qml_mocking(fn):
10 """Simple decorator that disables the QML mocks from being loaded."""
11 @wraps(fn)
12
13=== modified file 'tests/autopilot/unity8/shell/emulators/main_window.py'
14--- tests/autopilot/unity8/shell/emulators/main_window.py 2015-01-21 04:11:36 +0000
15+++ tests/autopilot/unity8/shell/emulators/main_window.py 2015-02-17 15:42:02 +0000
16@@ -174,3 +174,20 @@
17 'PinPadButton',
18 objectName='pinPadButton{}'.format(button_id)
19 )
20+
21+ @autopilot_logging.log_action(logger.info)
22+ def wait_for_notification(self):
23+ """Wait for a notification dialog to appear.
24+
25+ :return: An object for the notification dialog data.
26+ :raise StateNotFoundError: if the timeout expires when the
27+ notification has not appeared.
28+
29+ """
30+ notify_list = self.select_single('Notifications',
31+ objectName='notificationList')
32+ visible_notification = notify_list.wait_select_single('Notification',
33+ visible=True)
34+ return {'summary': visible_notification.summary,
35+ 'body': visible_notification.body,
36+ 'iconSource': visible_notification.iconSource}
37
38=== modified file 'tests/autopilot/unity8/shell/tests/test_notifications.py'
39--- tests/autopilot/unity8/shell/tests/test_notifications.py 2014-10-31 10:08:38 +0000
40+++ tests/autopilot/unity8/shell/tests/test_notifications.py 2015-02-17 15:42:02 +0000
41@@ -701,3 +701,22 @@
42 self.assertThat(get_notification, Eventually(NotEquals(None)))
43 self._assert_notification(
44 get_notification(), summary, body, False, False, 1.0)
45+
46+ def test_notification_helper(self):
47+ """ use the create notification script to get a notification dialog.
48+ Check that the arguments passed to the script match the fields. """
49+
50+ unity_proxy = self.launch_unity()
51+ unlock_unity(unity_proxy)
52+
53+ summary = 'Helper summary'
54+ body = 'Helper body'
55+
56+ notification = shell.create_ephemeral_notification(summary, body)
57+ notification.show()
58+
59+ notification_data = self.main_window.wait_for_notification()
60+
61+ self.assertThat(notification_data['summary'],
62+ Eventually(Equals(summary)))
63+ self.assertThat(notification_data['body'], Eventually(Equals(body)))

Subscribers

People subscribed via source and target branches