Merge lp:~tiagosh/messaging-app/open-individual-chat into lp:messaging-app

Proposed by Tiago Salem Herrmann
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 366
Merged at revision: 404
Proposed branch: lp:~tiagosh/messaging-app/open-individual-chat
Merge into: lp:messaging-app
Diff against target: 261 lines (+87/-15)
5 files modified
debian/control (+1/-0)
src/qml/Messages.qml (+20/-3)
tests/autopilot/messaging_app/emulators.py (+7/-3)
tests/autopilot/messaging_app/fixture_setup.py (+36/-0)
tests/autopilot/messaging_app/tests/test_messaging.py (+23/-9)
To merge this branch: bzr merge lp:~tiagosh/messaging-app/open-individual-chat
Reviewer Review Type Date Requested Status
Gustavo Pichorim Boiko (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+260195@code.launchpad.net

Commit message

Start conversation with individual participants of a group chat.

Description of the change

Start conversation with individual participants of a group chat.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
363. By Tiago Salem Herrmann

Use mock for the notification system

364. By Tiago Salem Herrmann

Add autopilot test

365. By Tiago Salem Herrmann

fix pep8
add comment to test

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
366. By Tiago Salem Herrmann

merge trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2015-06-01 18:01:53 +0000
3+++ debian/control 2015-06-10 13:17:42 +0000
4@@ -55,6 +55,7 @@
5 libqt5widgets5,
6 messaging-app (>= ${binary:Version}),
7 python3-autopilot,
8+ python3-dbusmock,
9 ubuntu-ui-toolkit-autopilot,
10 ofono-phonesim-autostart,
11 Description: autopilot tests for messaging-app
12
13=== modified file 'src/qml/Messages.qml'
14--- src/qml/Messages.qml 2015-06-01 18:01:53 +0000
15+++ src/qml/Messages.qml 2015-06-10 13:17:42 +0000
16@@ -358,8 +358,13 @@
17 height: childrenRect.height
18 width: popover.width
19 ListItem.Standard {
20- id: listItem
21+ id: participant
22+ objectName: "participant%1".arg(index)
23 text: contactWatcher.isUnknown ? contactWatcher.identifier : contactWatcher.alias
24+ onClicked: {
25+ PopupUtils.close(popover)
26+ mainView.startChat(contactWatcher.identifier)
27+ }
28 }
29 ContactWatcher {
30 id: contactWatcher
31@@ -545,7 +550,7 @@
32 Action {
33 objectName: "groupChatAction"
34 iconName: "contact-group"
35- onTriggered: PopupUtils.open(participantsPopover, messages.header)
36+ onTriggered: PopupUtils.open(participantsPopover, screenTop)
37 }
38 ]
39 },
40@@ -684,6 +689,18 @@
41 onTriggered: eventModel.fetchMore()
42 }
43
44+ // this item is used as parent of the participants popup. using
45+ // messages.header as parent was hanging the app
46+ Item {
47+ id: screenTop
48+ anchors {
49+ top: parent.top
50+ left: parent.left
51+ right: parent.right
52+ }
53+ height: 0
54+ }
55+
56 MessagesListView {
57 id: messageList
58 objectName: "messageList"
59@@ -692,7 +709,7 @@
60 // because of the header
61 clip: true
62 anchors {
63- top: parent.top
64+ top: screenTop.bottom
65 left: parent.left
66 right: parent.right
67 bottom: bottomPanel.top
68
69=== modified file 'tests/autopilot/messaging_app/emulators.py'
70--- tests/autopilot/messaging_app/emulators.py 2015-06-01 20:15:03 +0000
71+++ tests/autopilot/messaging_app/emulators.py 2015-06-10 13:17:42 +0000
72@@ -372,15 +372,19 @@
73 message.confirm_removal()
74
75 @autopilot_logging.log_action(logger.info)
76- def send_message(self, number, message):
77+ def send_message(self, numbers, message):
78 """Write a new message and send it.
79
80- :param number: number of the contact to send message to.
81+ :param numbers: phone numbers of contacts to send message to.
82 :param message: the message to be sent.
83
84 """
85 self.start_new_message()
86- self.type_contact_phone_num(number)
87+ # type address number
88+ for number in numbers:
89+ self.type_contact_phone_num(number)
90+ self.keyboard.press_and_release("Enter")
91+
92 self.type_message(message)
93 old_message_count = self.get_multiple_selection_list_view().count
94 self.click_send_button()
95
96=== modified file 'tests/autopilot/messaging_app/fixture_setup.py'
97--- tests/autopilot/messaging_app/fixture_setup.py 2015-06-01 20:15:03 +0000
98+++ tests/autopilot/messaging_app/fixture_setup.py 2015-06-10 13:17:42 +0000
99@@ -12,6 +12,8 @@
100 import subprocess
101 import shutil
102 import tempfile
103+import dbusmock
104+from autopilot.platform import model
105
106 import fixtures
107 from ubuntuuitoolkit import fixture_setup
108@@ -36,6 +38,7 @@
109 else:
110 self.useFixture(UseDefaultConfiguration())
111 self.useFixture(RespawnService())
112+ self.useFixture(MockNotificationSystem())
113
114
115 class FillCustomSmsHistory(fixtures.Fixture):
116@@ -173,6 +176,39 @@
117 subprocess.call(['mc-tool', 'reconnect', 'ofono/ofono/account0'])
118
119
120+class MockNotificationSystem(fixtures.Fixture):
121+
122+ def setUp(self):
123+ super().setUp()
124+
125+ # only mock the notification system on desktop, on ubuntu touch the
126+ # notification dbus service is embedded into unity
127+ if model() == 'Desktop':
128+ self.addCleanup(self._stop_mock)
129+ self._kill_notification_service()
130+ # start the mock service
131+ (self.process, self.obj) = \
132+ dbusmock.DBusTestCase.spawn_server_template(
133+ 'notification_daemon')
134+ else:
135+ self.addCleanup(self._clear_existing_notifications)
136+
137+ def _stop_mock(self):
138+ self.process.terminate()
139+ self.process.wait()
140+
141+ def _kill_notification_service(self):
142+ """Kill the notification daemon."""
143+ subprocess.call(['pkill', '-f', 'notify-osd'])
144+
145+ def _clear_existing_notifications(self):
146+ """Kill processes that might be displaying notifications"""
147+ bus = dbus.SessionBus()
148+ indicator = bus.get_object('com.canonical.TelephonyServiceIndicator',
149+ '/com/canonical/TelephonyServiceIndicator')
150+ indicator.ClearNotifications()
151+
152+
153 class UseMemoryContactBackend(fixtures.Fixture):
154
155 def setUp(self):
156
157=== modified file 'tests/autopilot/messaging_app/tests/test_messaging.py'
158--- tests/autopilot/messaging_app/tests/test_messaging.py 2015-06-01 18:01:53 +0000
159+++ tests/autopilot/messaging_app/tests/test_messaging.py 2015-06-10 13:17:42 +0000
160@@ -88,7 +88,7 @@
161 """Verify we can write and send a new text message"""
162 phone_num = '123'
163 message = 'hello from Ubuntu'
164- self.main_view.send_message(phone_num, message)
165+ self.main_view.send_message([phone_num], message)
166
167 # switch back to main page with thread list
168 self.main_view.close_osk()
169@@ -110,7 +110,7 @@
170 """Verify we can delete a message with a long press on the message"""
171 phone_num = '555-555-4321'
172 message = 'delete me'
173- bubble = self.main_view.send_message(phone_num, message)
174+ bubble = self.main_view.send_message([phone_num], message)
175
176 self.main_view.close_osk()
177
178@@ -127,7 +127,7 @@
179 """Verify we can cancel deleting a message with a long press"""
180 phone_num = '5555551234'
181 message = 'do not delete'
182- bubble = self.main_view.send_message(phone_num, message)
183+ bubble = self.main_view.send_message([phone_num], message)
184
185 self.main_view.close_osk()
186
187@@ -160,7 +160,7 @@
188 """Verify we can use the toolbar to delete a message"""
189 phone_num = '555-555-4321'
190 message = 'delete me'
191- bubble = self.main_view.send_message(phone_num, message)
192+ bubble = self.main_view.send_message([phone_num], message)
193
194 self.main_view.close_osk()
195
196@@ -175,7 +175,7 @@
197 """Verify we only delete messages that have been selected"""
198 phone_num = '555-555-4321'
199 message = 'delete me'
200- self.main_view.send_message(phone_num, message)
201+ self.main_view.send_message([phone_num], message)
202
203 self.main_view.close_osk()
204
205@@ -215,7 +215,7 @@
206 """Verify we can cancel deleting a message thread"""
207 phone_num = '123'
208 message = 'hello from Ubuntu'
209- self.main_view.send_message(phone_num, message)
210+ self.main_view.send_message([phone_num], message)
211
212 # switch back to main page with thread list
213 self.main_view.close_osk()
214@@ -246,7 +246,7 @@
215 """Verify we can delete a message thread"""
216 phone_num = '123'
217 message = 'hello from Ubuntu'
218- self.main_view.send_message(phone_num, message)
219+ self.main_view.send_message([phone_num], message)
220
221 # switch back to main page with thread list
222 self.main_view.close_osk()
223@@ -287,7 +287,7 @@
224 """Verify we can delete a message by swiping right"""
225 phone_num = '555-555-4321'
226 message = 'delete me okay'
227- self.main_view.send_message(phone_num, message)
228+ self.main_view.send_message([phone_num], message)
229
230 # delete message
231 self.main_view.delete_message(message)
232@@ -319,6 +319,20 @@
233 expectedMessage = 'message %s' % i
234 self.assertThat(messages[i][1], Equals(expectedMessage))
235
236+ def test_open_new_conversation_with_group_participant(self):
237+ recipient_list = ["123", "321"]
238+ self.main_view.send_message(recipient_list, "hello from Ubuntu")
239+ self.main_view.click_header_action('groupChatAction')
240+
241+ participant = self.main_view.select_single(
242+ objectName='participant1')
243+ self.pointing_device.click_object(participant)
244+
245+ # We use 'title' here because participants is variant and not
246+ # accessible from here
247+ self.main_view.wait_select_single(emulators.Messages,
248+ title=recipient_list[1])
249+
250
251 class MessagingTestCaseWithExistingThread(MessagingAppTestCase):
252
253@@ -497,7 +511,7 @@
254 """Verify if the tutorial appears after send a message"""
255 phone_num = '123'
256 message = 'hello from Ubuntu'
257- self.main_view.send_message(phone_num, message)
258+ self.main_view.send_message([phone_num], message)
259 self.main_view.close_osk()
260
261 swipe_item_demo = self.main_view.get_swipe_item_demo()

Subscribers

People subscribed via source and target branches