Merge lp:~elopio/messaging-app/swipe_to_delete into lp:messaging-app

Proposed by Leo Arias
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 117
Merged at revision: 118
Proposed branch: lp:~elopio/messaging-app/swipe_to_delete
Merge into: lp:messaging-app
Diff against target: 179 lines (+33/-94)
2 files modified
tests/autopilot/messaging_app/emulators.py (+33/-58)
tests/autopilot/messaging_app/tests/test_messaging.py (+0/-36)
To merge this branch: bzr merge lp:~elopio/messaging-app/swipe_to_delete
Reviewer Review Type Date Requested Status
Gustavo Pichorim Boiko (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+223142@code.launchpad.net

Commit message

Removed the tests that swipe to the left. Updated the tests to use the swipe_to_delete helper from the toolkit.

Description of the change

The new version of ubuntu ui toolkit that's ready in a silo to land removed the swipe to delete from left to right. We need to update the test.

Are there any related MPs required for this MP to build/function as expected? Please list.

No. But there's a branch in progress that will throw a nice exception if we try to do the swipe to the left on the tests: https://code.launchpad.net/~elopio/ubuntu-ui-toolkit/deprecate_swipe_to_left/+merge/223008

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)

Yes.

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?

Yes. I ran the tests with the new toolkit.

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/<package-name>) on device or emulator?

Just the autopilot tests of the messaging app, in the phone and in utopic desktop. No other things will be affected by this change.

If you changed the UI, was the change specified/approved by design?

No UI changes.

If you changed the packaging (debian), did you subscribe a core-dev to this MP?

No packaging changes.

To post a comment you must log in.
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: Needs Fixing (continuous-integration)
116. By Leo Arias

Merged with trunk.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
117. By Leo Arias

Merged with 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 :

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?
Yes

Did CI run pass? If not, please explain why.
No, but the failure is not related to the changes in this MR.

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
Yes

Code looks good and tests work fine on the device.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/messaging_app/emulators.py'
2--- tests/autopilot/messaging_app/emulators.py 2014-06-10 19:19:10 +0000
3+++ tests/autopilot/messaging_app/emulators.py 2014-06-17 17:53:30 +0000
4@@ -46,7 +46,7 @@
5 :parameter phone_number: the phone_number of message thread
6
7 """
8- return self.wait_select_single("ThreadDelegate",
9+ return self.wait_select_single(ThreadDelegate,
10 phoneNumber=phone_number)
11
12 def get_message(self, text):
13@@ -57,7 +57,7 @@
14 """
15
16 time.sleep(2) # message is not always found on slow emulator
17- for message in self.select_many('MessageDelegate'):
18+ for message in self.select_many(MessageDelegate):
19 for item in self.select_many('Label'):
20 if "text" in item.get_properties():
21 if item.get_properties()['text'] == text:
22@@ -329,68 +329,26 @@
23 """Click the header action 'Cancel' on Messages view"""
24 self.get_header().click_custom_back_button()
25
26- def delete_thread(self, phone_number, direction='right'):
27- """Delete thread containing specified phone number
28+ def delete_thread(self, phone_number):
29+ """Delete thread containing specified phone number.
30
31 :parameter phone_number: phone number of thread to delete
32 :parameter direction: right or left, the direction to swipe to delete
33 """
34-
35 thread = self.get_thread_from_number(phone_number)
36- delete = self.swipe_to_delete(thread, direction=direction)
37- delete_button = delete.wait_select_single('QQuickImage', visible=True)
38- self.pointing_device.click_object(delete_button)
39- thread.wait_until_destroyed()
40-
41- def delete_message(self, text, direction='right'):
42- """Deletes message with specified text
43-
44- :parameter text: the text of the message you want to delete
45- :parameter direction: right or left, the direction to swipe to delete
46+ thread.swipe_to_delete()
47+ thread.confirm_removal()
48+
49+ def delete_message(self, text):
50+ """Deletes message with specified text.
51+
52+ :parameter text: the text of the message you want to delete.
53+ :parameter direction: right or left, the direction to swipe to delete.
54+
55 """
56-
57 message = self.get_message(text)
58- delete = self.swipe_to_delete(message, direction=direction)
59- delete_button = delete.wait_select_single('QQuickImage', visible=True)
60- self.pointing_device.click_object(delete_button)
61- message.wait_until_destroyed()
62-
63- def swipe_to_delete(self, obj, direction='right', offset=.1):
64- """Swipe and objet left or right
65-
66- :parameter direction: right or left, the direction to swipe
67- :parameter offset: the ammount of space to offset at start of swipe
68- """
69-
70- x, y, w, h = obj.globalRect
71-
72- s_rx = x + (w * offset)
73- e_rx = w
74-
75- s_lx = w - (w * offset)
76- e_lx = w * offset
77-
78- sy = y + (h / 2)
79-
80- if (direction == 'right'):
81- self.pointing_device.drag(s_rx, sy, e_rx, sy)
82- # wait for animation
83- time.sleep(.5)
84- return self.wait_select_single('QQuickItem',
85- objectName='confirmRemovalDialog',
86- visible=True)
87- elif (direction == 'left'):
88- self.pointing_device.drag(s_lx, sy, e_lx, sy)
89- # wait for animation
90- time.sleep(.5)
91- return self.wait_select_single('QQuickItem',
92- objectName='confirmRemovalDialog',
93- visible=True)
94- else:
95- raise EmulatorException(
96- 'Invalid direction "{0}" used on swipe to delete function '
97- 'direction can be right or left'.format(direction)
98- )
99+ message.swipe_to_delete()
100+ message.confirm_removal()
101
102
103 class PageWithBottomEdge(MainView):
104@@ -429,7 +387,7 @@
105 @autopilot_logging.log_action(logger.info)
106 def open_thread(self, participants):
107 thread = self.select_single(
108- 'ThreadDelegate', objectName='thread{}'.format(participants))
109+ ThreadDelegate, objectName='thread{}'.format(participants))
110 self.pointing_device.click_object(thread)
111 root = self.get_root_instance()
112 return root.wait_select_single(Messages, threadId=thread.threadId)
113@@ -489,3 +447,20 @@
114 'Label', objectName='messageText').text
115 messages.append((date, text))
116 return messages
117+
118+
119+class ThreadDelegate(toolkit_emulators.Empty):
120+ """Autopilot helper for ThreadDelegate."""
121+
122+
123+class MessageDelegate(toolkit_emulators.UbuntuUIToolkitEmulatorBase):
124+ """Autopilot helper for the MessageDelegate."""
125+
126+ def swipe_to_delete(self):
127+ self._get_internal_list_item().swipe_to_delete()
128+
129+ def _get_internal_list_item(self):
130+ return self.select_single(toolkit_emulators.Empty)
131+
132+ def confirm_removal(self):
133+ self._get_internal_list_item().confirm_removal()
134
135=== modified file 'tests/autopilot/messaging_app/tests/test_messaging.py'
136--- tests/autopilot/messaging_app/tests/test_messaging.py 2014-06-06 21:32:41 +0000
137+++ tests/autopilot/messaging_app/tests/test_messaging.py 2014-06-17 17:53:30 +0000
138@@ -452,42 +452,6 @@
139 self.main_view.delete_message(message)
140 self.assertThat(list_view.count, Eventually(Equals(0)))
141
142- def test_delete_message_thread_swipe_left(self):
143- """Verify we can delete a message thread by swiping left"""
144- # receive an sms message
145- helpers.receive_sms('0815', 'hello to Ubuntu')
146-
147- # verify that we got the message
148- self.assertThat(self.thread_list.count, Eventually(Equals(1)))
149-
150- # delete thread by swiping
151- self.main_view.delete_thread('0815', direction='right')
152- self.assertThat(self.thread_list.count, Eventually(Equals(0)))
153-
154- def test_delete_message_swipe_left(self):
155- """Verify we can delete a message by swiping left"""
156- self.main_view.start_new_message()
157- self.assertThat(self.thread_list.visible, Eventually(Equals(False)))
158-
159- # type address number
160- phone_num = '555-555-4321'
161- self.main_view.type_contact_phone_num(phone_num)
162- # type message
163- message = 'delete me okay'
164- self.main_view.type_message(message)
165-
166- # send
167- self.main_view.click_send_button()
168-
169- # verify that we get a bubble with our message
170- list_view = self.main_view.get_multiple_selection_list_view()
171- self.assertThat(list_view.count, Eventually(Equals(1)))
172- self.main_view.get_message(message)
173-
174- #delete message
175- self.main_view.delete_message(message, direction='left')
176- self.assertThat(list_view.count, Eventually(Equals(0)))
177-
178
179 class MessagingTestCaseWithExistingThread(BaseMessagingTestCase):
180

Subscribers

People subscribed via source and target branches