Merge lp:~canonical-platform-qa/address-book-app/autopilot-get_contacts into lp:address-book-app

Proposed by Leo Arias
Status: Superseded
Proposed branch: lp:~canonical-platform-qa/address-book-app/autopilot-get_contacts
Merge into: lp:address-book-app
Diff against target: 611 lines (+185/-162)
12 files modified
po/address-book-app.pot (+16/-11)
src/imports/ContactList/ContactListPage.qml (+2/-0)
src/imports/Ubuntu/Contacts/ContactDelegate.qml (+1/-0)
src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml (+16/-6)
src/imports/Ubuntu/Contacts/ContactSimpleListView.qml (+1/-0)
tests/autopilot/address_book_app/__init__.py (+3/-11)
tests/autopilot/address_book_app/pages/_contact_list_page.py (+92/-91)
tests/autopilot/address_book_app/tests/__init__.py (+1/-2)
tests/autopilot/address_book_app/tests/test_create_new_from_uri.py (+0/-1)
tests/autopilot/address_book_app/tests/test_delete_contact.py (+49/-38)
tests/autopilot/address_book_app/tests/test_multiple_pick_mode.py (+2/-1)
tests/autopilot/address_book_app/tests/test_single_pick_mode.py (+2/-1)
To merge this branch: bzr merge lp:~canonical-platform-qa/address-book-app/autopilot-get_contacts
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Canonical Platform QA Team Pending
Ubuntu Phablet Team Pending
Review via email: mp+233104@code.launchpad.net

This proposal has been superseded by a proposal from 2014-09-04.

Commit message

Cleaned the contact list page autopilot helper.

To post a comment you must log in.
300. By Leo Arias

Merged with trunk.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) :
301. By Leo Arias

Use an alias for the log actions

Revision history for this message
Leo Arias (elopio) wrote :

Pushed. Thanks for the review.

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)
302. By Leo Arias

Merged with staging.

303. By Leo Arias

Reverted the changes on po.

304. By Leo Arias

Reverted the changes on po.

305. By Leo Arias

Remove the object name from the delegates.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'po/address-book-app.pot'
2--- po/address-book-app.pot 2014-08-25 17:33:19 +0000
3+++ po/address-book-app.pot 2014-09-04 15:01:53 +0000
4@@ -8,7 +8,7 @@
5 msgstr ""
6 "Project-Id-Version: address-book-app\n"
7 "Report-Msgid-Bugs-To: \n"
8-"POT-Creation-Date: 2014-08-25 14:32-0300\n"
9+"POT-Creation-Date: 2014-08-30 17:19-0300\n"
10 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Language-Team: LANGUAGE <LL@li.org>\n"
13@@ -27,7 +27,7 @@
14 msgid "+ Create New"
15 msgstr ""
16
17-#: ../src/imports/ContactEdit/ContactEditor.qml:308
18+#: ../src/imports/ContactEdit/ContactEditor.qml:307
19 msgid "Add Field"
20 msgstr ""
21
22@@ -67,7 +67,7 @@
23 msgid "Are you sure that you want to remove this contact?"
24 msgstr ""
25
26-#: ../src/imports/ContactEdit/ContactEditor.qml:399
27+#: ../src/imports/ContactEdit/ContactEditor.qml:398
28 #: ../src/imports/ContactList/ContactListPage.qml:422
29 #: ../src/imports/MainWindow.qml:133
30 msgid "Cancel"
31@@ -102,7 +102,7 @@
32 msgid "Country"
33 msgstr ""
34
35-#: ../src/imports/ContactEdit/ContactEditor.qml:356
36+#: ../src/imports/ContactEdit/ContactEditor.qml:355
37 #: ../src/imports/ContactList/ContactListPage.qml:267
38 #: ../src/imports/ContactList/ContactListPage.qml:487
39 msgid "Delete"
40@@ -149,12 +149,13 @@
41 msgid "First name"
42 msgstr ""
43
44-#: ../src/imports/Ubuntu/Contacts/ContactListView.qml:425
45+#: ../src/imports/Ubuntu/Contacts/MostCalledList.qml:63
46 msgid "Frequently called"
47 msgstr ""
48
49+#. TRANSLATORS: This refers to home landline phone label
50 #: ../src/imports/Ubuntu/Contacts/ContactDetailGroupWithTypeBase.qml:115
51-#: ../src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:103
52+#: ../src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:105
53 msgid "Home"
54 msgstr ""
55
56@@ -194,7 +195,8 @@
57 msgid "MSN"
58 msgstr ""
59
60-#: ../src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:107
61+#. TRANSLATORS: This refers to mobile/cellphone phone label
62+#: ../src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:113
63 msgid "Mobile"
64 msgstr ""
65
66@@ -219,8 +221,9 @@
67 msgid "Organization"
68 msgstr ""
69
70+#. TRANSLATORS: This refers to any other phone label
71 #: ../src/imports/Ubuntu/Contacts/ContactDetailGroupWithTypeBase.qml:117
72-#: ../src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:111
73+#: ../src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:121
74 msgid "Other"
75 msgstr ""
76
77@@ -252,7 +255,7 @@
78 msgid "Role"
79 msgstr ""
80
81-#: ../src/imports/ContactEdit/ContactEditor.qml:412
82+#: ../src/imports/ContactEdit/ContactEditor.qml:411
83 msgid "Save"
84 msgstr ""
85
86@@ -306,12 +309,14 @@
87 msgid "Touch"
88 msgstr ""
89
90+#. TRANSLATORS: This refers to landline work phone label
91 #: ../src/imports/Ubuntu/Contacts/ContactDetailGroupWithTypeBase.qml:116
92-#: ../src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:105
93+#: ../src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:109
94 msgid "Work"
95 msgstr ""
96
97-#: ../src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:109
98+#. TRANSLATORS: This refers to mobile/cellphone work phone label
99+#: ../src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:117
100 msgid "Work Mobile"
101 msgstr ""
102
103
104=== modified file 'src/imports/ContactList/ContactListPage.qml'
105--- src/imports/ContactList/ContactListPage.qml 2014-08-15 21:50:20 +0000
106+++ src/imports/ContactList/ContactListPage.qml 2014-09-04 15:01:53 +0000
107@@ -397,6 +397,7 @@
108 iconName: "search"
109 onTriggered: {
110 mainPage.state = (mainPage.state === "newphone" ? "newphoneSearching" : "searching")
111+ contactList.showAllContacts()
112 searchField.forceActiveFocus()
113 }
114 }
115@@ -422,6 +423,7 @@
116 text: i18n.tr("Cancel")
117 onTriggered: {
118 contactList.forceActiveFocus()
119+ mainPage.head.sections.selectedIndex = 0
120 mainPage.state = (mainPage.state === "newphoneSearching" ? "newphone" : "default")
121 }
122 }
123
124=== modified file 'src/imports/Ubuntu/Contacts/ContactDelegate.qml'
125--- src/imports/Ubuntu/Contacts/ContactDelegate.qml 2014-07-31 08:00:56 +0000
126+++ src/imports/Ubuntu/Contacts/ContactDelegate.qml 2014-09-04 15:01:53 +0000
127@@ -96,6 +96,7 @@
128
129 Label {
130 id: name
131+ objectName: "nameLabel"
132
133 anchors {
134 left: avatar.right
135
136=== modified file 'src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml'
137--- src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml 2014-07-27 01:11:49 +0000
138+++ src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml 2014-09-04 15:01:53 +0000
139@@ -100,15 +100,25 @@
140 }
141
142 Component.onCompleted: {
143- append({"value": "Home", "label": i18n.dtr("address-book-app", "Home"), "icon": null,
144+ append({"value": "Home",
145+ // TRANSLATORS: This refers to home landline phone label
146+ "label": i18n.dtr("address-book-app", "Home"), "icon": null,
147 "context": QtContacts.ContactDetail.ContextHome, "subType": QtContacts.PhoneNumber.Voice })
148- append({"value": "Work", "label": i18n.dtr("address-book-app", "Work"), "icon": null,
149- "context": QtContacts.ContactDetail.ContextWork, "subType": QtContacts.PhoneNumber.Voice })
150- append({"value": "Mobile", "label": i18n.dtr("address-book-app", "Mobile"), "icon": null,
151+ append({"value": "Work",
152+ // TRANSLATORS: This refers to landline work phone label
153+ "label": i18n.dtr("address-book-app", "Work"), "icon": null,
154+ "context": QtContacts.ContactDetail.ContextWork, "subType": QtContacts.PhoneNumber.Voice })
155+ append({"value": "Mobile",
156+ // TRANSLATORS: This refers to mobile/cellphone phone label
157+ "label": i18n.dtr("address-book-app", "Mobile"), "icon": null,
158 "context": -1, "subType": QtContacts.PhoneNumber.Mobile })
159- append({"value": "Mobile-Work", "label": i18n.dtr("address-book-app", "Work Mobile"), "icon": null,
160+ append({"value": "Mobile-Work",
161+ // TRANSLATORS: This refers to mobile/cellphone work phone label
162+ "label": i18n.dtr("address-book-app", "Work Mobile"), "icon": null,
163 "context": QtContacts.ContactDetail.ContextWork, "subType": QtContacts.PhoneNumber.Mobile })
164- append({"value": "Other", "label": i18n.dtr("address-book-app", "Other"), "icon": null,
165+ append({"value": "Other",
166+ // TRANSLATORS: This refers to any other phone label
167+ "label": i18n.dtr("address-book-app", "Other"), "icon": null,
168 "context": QtContacts.ContactDetail.ContextOther, "subType": QtContacts.PhoneNumber.Voice })
169 loaded()
170 }
171
172=== modified file 'src/imports/Ubuntu/Contacts/ContactSimpleListView.qml'
173--- src/imports/Ubuntu/Contacts/ContactSimpleListView.qml 2014-08-18 19:03:13 +0000
174+++ src/imports/Ubuntu/Contacts/ContactSimpleListView.qml 2014-09-04 15:01:53 +0000
175@@ -279,6 +279,7 @@
176 onFlickStarted: view.currentIndex = -1
177 listDelegate: ContactDelegate {
178 id: contactDelegate
179+ objectName: 'contactDelegate' + index
180
181 property var removalAnimation
182
183
184=== modified file 'tests/autopilot/address_book_app/__init__.py'
185--- tests/autopilot/address_book_app/__init__.py 2014-08-01 22:04:48 +0000
186+++ tests/autopilot/address_book_app/__init__.py 2014-09-04 15:01:53 +0000
187@@ -75,9 +75,9 @@
188 objectName="contactViewPage")
189
190 def get_contact_list_pick_page(self):
191- pages = self.select_many("ContactListPage",
192- objectName="contactListPage")
193- for p in pages:
194+ contact_list_pages = self.select_many(
195+ pages.ContactListPage, objectName='contactListPage')
196+ for p in contact_list_pages:
197 if p.pickMode:
198 return p
199 return None
200@@ -128,14 +128,6 @@
201 self.click_action_button("save")
202 bottom_swipe_page.isCollapsed.wait_for(True)
203
204- def done_selection(self, actionName):
205- """
206- Press the 'doneSelection' button
207- """
208- bottom_swipe_page = self.get_contact_list_page()
209- self.click_action_button(actionName)
210- bottom_swipe_page.isCollapsed.wait_for(True)
211-
212 def get_toolbar(self):
213 """Override base class so we get our expected Toolbar subclass."""
214 return self.select_single(ubuntuuitoolkit.Toolbar)
215
216=== modified file 'tests/autopilot/address_book_app/pages/_contact_list_page.py'
217--- tests/autopilot/address_book_app/pages/_contact_list_page.py 2014-08-28 20:28:39 +0000
218+++ tests/autopilot/address_book_app/pages/_contact_list_page.py 2014-09-04 15:01:53 +0000
219@@ -19,23 +19,22 @@
220 import logging
221 import time
222
223-from autopilot.introspection.dbus import StateNotFoundError
224+import autopilot.logging
225+import ubuntuuitoolkit
226
227 from address_book_app.pages import _common, _contact_view
228
229
230-LOGGER = logging.getLogger(__name__)
231+logger = logging.getLogger(__name__)
232+log_action_info = autopilot.logging.log_action(logging.info)
233+log_action_debug = autopilot.logging.log_action(logging.debug)
234
235
236 class ContactListPage(_common.PageWithHeader, _common.PageWithBottomEdge):
237- """ ContactListPage emulator class """
238-
239- def __init__(self, *args):
240- self.contacts = None
241- self.items = []
242- self.selected_items = []
243- super(ContactListPage, self).__init__(*args)
244-
245+
246+ """Autopilot helper for the Contact List page."""
247+
248+ @log_action_info
249 def open_contact(self, index):
250 """Open the page with the contact information.
251
252@@ -43,96 +42,98 @@
253 :return: The page with the contact information.
254
255 """
256- contacts = self.get_contacts()
257- contact_delegate = contacts[index]
258+ contact_delegate = self._get_contact_delegate(index)
259 self.pointing_device.click_object(contact_delegate)
260 contact_delegate.state.wait_for('expanded')
261- details_button = contact_delegate.wait_select_single(objectName="infoIcon")
262+ details_button = contact_delegate.wait_select_single(
263+ objectName='infoIcon')
264 self.pointing_device.click_object(details_button)
265 return self.get_root_instance().select_single(
266 _contact_view.ContactView, objectName='contactViewPage')
267
268- def _get_list_view(self):
269- return self.wait_select_single("ContactListView",
270- objectName="contactListView")
271-
272- def get_contacts(self):
273- """
274- Returns a list of ContactDelegate objects and populate
275- self.items
276- """
277- time.sleep(1)
278- self.contacts = self.select_many("ContactDelegate")
279- self.items = []
280- for contact in self.contacts:
281- if contact.visible:
282- item = contact.select_single("QQuickRectangle",
283- objectName="mainItem")
284- self.items.append(item)
285- return self.contacts
286-
287- def start_selection(self, idx):
288- view = self._get_list_view()
289- if not view.isInSelectionMode:
290- self.get_contacts()
291- self.selected_items.append(self.items[idx])
292- self.pointing_device.move_to_object(self.contacts[idx])
293- self.pointing_device.press()
294- time.sleep(2.0)
295- self.pointing_device.release()
296- view.isInSelectionMode.wait_for(True)
297- else:
298- self.selected_items.append(self.items[idx])
299- self.pointing_device.click_object(self.items[idx])
300-
301-
302- def select_contacts_by_index(self, indices):
303+ def _get_contact_delegate(self, index):
304+ return self.select_single(
305+ 'ContactDelegate',
306+ objectName='contactDelegate{}'.format(index),
307+ visible=True
308+ )
309+
310+ @log_action_info
311+ def select_contacts(self, indices):
312 """ Select contacts corresponding to the list of index in indices
313
314 :param indices: List of integers
315+
316 """
317- self.deselect_all()
318+ self._deselect_all()
319 if len(indices) > 0:
320- self.start_selection(indices[0])
321-
322- # Select matching indices
323- for idx in indices[1:]:
324- self.selected_items.append(self.items[idx])
325- self.pointing_device.click_object(self.items[idx])
326-
327- def deselect_all(self):
328- """Deselect every contacts"""
329- contacts = self.select_many("ContactDelegate")
330- self.selected_items = []
331- for contact in contacts:
332- if contact.selected:
333- mark = contact.select_single("QQuickRectangle",
334- objectName="selectionMark")
335- self.pointing_device.click_object(mark)
336-
337- def click_button(self, parent, objectname):
338- """Press a button that matches objectname
339-
340- :param objectname: Name of the object
341- """
342- if parent:
343- obj = parent
344+ view = self._get_list_view()
345+ if not view.isInSelectionMode:
346+ self._start_selection(indices[0])
347+ indices = indices[1:]
348+
349+ for index in indices:
350+ contact = self._get_contact_delegate(index)
351+ self.pointing_device.click_object(contact)
352+
353+ @log_action_debug
354+ def _deselect_all(self):
355+ """Deselect all contacts."""
356+ view = self._get_list_view()
357+ if view.isInSelectionMode:
358+ contacts = self.select_many('ContactDelegate', visible=True)
359+ for contact in contacts:
360+ if contact.selected:
361+ logger.info('Deselect {}.'.format(contact.objectName))
362+ self.pointing_device.click_object(contact)
363 else:
364- obj = self
365- try:
366- buttons = obj.select_many("Button",
367- objectName=objectname)
368- for button in buttons:
369- if button.visible:
370- self.pointing_device.click_object(button)
371- except StateNotFoundError:
372- LOGGER.error(
373- 'Button with objectName "{0}" not found.'.format(objectname)
374- )
375- raise
376-
377- def delete(self, main_window):
378- main_window.done_selection("delete")
379- dialog = main_window.wait_select_single("RemoveContactsDialog",
380- objectName="removeContactsDialog")
381- self.click_button(main_window, "removeContactsDialog.Yes")
382+ logger.debug('The page is not in selection mode.')
383+
384+ def _start_selection(self, index):
385+ # TODO change this for click_object once the press duration
386+ # parameter is added. See http://pad.lv/1268782
387+ contact = self._get_contact_delegate(index)
388+ self.pointing_device.move_to_object(contact)
389+ self.pointing_device.press()
390+ time.sleep(2.0)
391+ self.pointing_device.release()
392+ view = self._get_list_view()
393+ view.isInSelectionMode.wait_for(True)
394+
395+ def _get_list_view(self):
396+ return self.wait_select_single(
397+ 'ContactListView', objectName='contactListView')
398+
399+ @log_action_info
400+ def delete_selected_contacts(self):
401+ self.get_header().click_action_button('delete')
402+ self.isCollapsed.wait_for(True)
403+ dialog = self.get_root_instance().wait_select_single(
404+ RemoveContactsDialog, objectName='removeContactsDialog')
405+ dialog.confirm_removal()
406+
407+ def get_contacts(self):
408+ """Return a list with the names of the contacts."""
409+ contact_delegates = self.select_many('ContactDelegate', visible=True)
410+ contact_delegates = sorted(
411+ contact_delegates,
412+ key=lambda delegate: delegate.globalRect.y)
413+
414+ name_labels = [
415+ delegate.select_single('Label', objectName='nameLabel') for
416+ delegate in contact_delegates
417+ ]
418+ return [label.text for label in name_labels]
419+
420+
421+class RemoveContactsDialog(
422+ ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
423+
424+ """Autopilot helper for the Remove Contacts dialog."""
425+
426+ @autopilot.logging.log_action(logger.debug)
427+ def confirm_removal(self):
428+ button = self.select_single(
429+ 'Button', objectName='removeContactsDialog.Yes')
430+ self.pointing_device.click_object(button)
431+ self.wait_until_destroyed()
432
433=== modified file 'tests/autopilot/address_book_app/tests/__init__.py'
434--- tests/autopilot/address_book_app/tests/__init__.py 2014-07-18 00:49:35 +0000
435+++ tests/autopilot/address_book_app/tests/__init__.py 2014-09-04 15:01:53 +0000
436@@ -52,7 +52,7 @@
437 os.environ['QTCONTACTS_MANAGER_OVERRIDE'] = 'galera'
438 os.environ['ADDRESS_BOOK_APP_ICON_THEME'] = 'ubuntu-mobile'
439 vcard_data = ""
440- if AddressBookAppTestCase.PRELOAD_VCARD:
441+ if self.PRELOAD_VCARD:
442 # Use vcard from source tree and fallback on installed vcard (from
443 # address-book-app-autopilot package)
444 if os.path.exists(AddressBookAppTestCase.VCARD_PATH_DEV):
445@@ -76,7 +76,6 @@
446 self.launch_click_installed()
447
448 AddressBookAppTestCase.ARGS = []
449- AddressBookAppTestCase.PRELOAD_VCARD = False
450 self.main_window.visible.wait_for(True)
451 self.app = address_book_app.AddressBookApp(self.app_proxy)
452
453
454=== modified file 'tests/autopilot/address_book_app/tests/test_create_new_from_uri.py'
455--- tests/autopilot/address_book_app/tests/test_create_new_from_uri.py 2014-06-08 13:55:29 +0000
456+++ tests/autopilot/address_book_app/tests/test_create_new_from_uri.py 2014-09-04 15:01:53 +0000
457@@ -19,7 +19,6 @@
458
459 def setUp(self):
460 self.ARGS.append("addressbook:///create?phone=1234567890")
461- AddressBookAppTestCase.PRELOAD_VCARD = False
462 super(TestCreateNewContactFromURI, self).setUp()
463
464 def test_save_new_contact(self):
465
466=== modified file 'tests/autopilot/address_book_app/tests/test_delete_contact.py'
467--- tests/autopilot/address_book_app/tests/test_delete_contact.py 2014-05-22 13:42:45 +0000
468+++ tests/autopilot/address_book_app/tests/test_delete_contact.py 2014-09-04 15:01:53 +0000
469@@ -1,41 +1,58 @@
470 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
471
472-"""Tests for the Addressbook App"""
473-
474-# Copyright 2014 Canonical
475+# Copyright (C) 2014 Canonical Ltd.
476 #
477-# This program is free software: you can redistribute it and/or modify it
478-# under the terms of the GNU General Public License version 3, as published
479+# This program is free software; you can redistribute it and/or modify
480+# it under the terms of the GNU General Public License version 3, as published
481 # by the Free Software Foundation.
482-
483-from testtools.matchers import Equals
484-from address_book_app.tests import AddressBookAppTestCase
485-
486-
487-class TestDeleteSelectContact(AddressBookAppTestCase):
488+#
489+# This program is distributed in the hope that it will be useful,
490+# but WITHOUT ANY WARRANTY; without even the implied warranty of
491+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
492+# GNU General Public License for more details.
493+#
494+# You should have received a copy of the GNU General Public License
495+# along with this program. If not, see <http://www.gnu.org/licenses/>.
496+
497+"""Delete tests for the Addressbook App."""
498+
499+from address_book_app import tests
500+
501+
502+class TestDeleteSelectContact(tests.AddressBookAppTestCase):
503+
504 """
505 Delete a contact using pick mode and verify the behavior of Cancel and
506 Delete actions
507 """
508+
509+ PRELOAD_VCARD = True
510+
511+ ALL_CONTACTS = [
512+ 'teste test34',
513+ 'teste teste2',
514+ 'teste3 teste3',
515+ ]
516+
517 scenarios = [
518- ("single_cancel", {
519- "select": [1],
520- "action": "cancel"}),
521- ("multiple_cancel", {
522- "select": [1, 2],
523- "action": "cancel"}),
524- ("single_delete", {
525- "select": [1],
526- "action": "delete"}),
527- ("multiple_delete", {
528- "select": [1, 2],
529- "action": "delete"}),
530+ ('single_cancel', {
531+ 'select': [ALL_CONTACTS[1]],
532+ 'action': 'cancel',
533+ 'expected_result': ALL_CONTACTS}),
534+ ('multiple_cancel', {
535+ 'select': [ALL_CONTACTS[1], ALL_CONTACTS[2]],
536+ 'action': 'cancel',
537+ 'expected_result': ALL_CONTACTS}),
538+ ('single_delete', {
539+ 'select': [ALL_CONTACTS[1]],
540+ 'action': 'delete',
541+ 'expected_result': [ALL_CONTACTS[0], ALL_CONTACTS[2]]}),
542+ ('multiple_delete', {
543+ 'select': [ALL_CONTACTS[1], ALL_CONTACTS[2]],
544+ 'action': 'delete',
545+ 'expected_result': [ALL_CONTACTS[0]]}),
546 ]
547
548- def setUp(self):
549- AddressBookAppTestCase.PRELOAD_VCARD = True
550- super(TestDeleteSelectContact, self).setUp()
551-
552 def test_select(self):
553 """
554 Delete a contact in pick mode
555@@ -45,19 +62,13 @@
556 contact in the list before and after the action.
557 Note that it doesn't check which contact has been deleted.
558 """
559- listpage = self.app.main_window.get_contact_list_page()
560- contacts_before = listpage.get_contacts()
561+ list_page = self.app.main_window.get_contact_list_page()
562
563- listpage.select_contacts_by_index(self.select)
564- deleted = []
565+ indices = [self.ALL_CONTACTS.index(name) for name in self.select]
566+ list_page.select_contacts(indices)
567 if self.action == "cancel":
568 self.app.main_window.cancel()
569 elif self.action == "delete":
570- listpage.delete(self.app.main_window)
571- deleted = self.select
572+ list_page.delete_selected_contacts()
573
574- contacts_after = listpage.get_contacts()
575- # TODO:
576- # - Verify which contact have been deleted
577- self.assertThat(len(contacts_after), Equals(len(contacts_before) -
578- len(deleted)))
579+ self.assertEqual(list_page.get_contacts(), self.expected_result)
580
581=== modified file 'tests/autopilot/address_book_app/tests/test_multiple_pick_mode.py'
582--- tests/autopilot/address_book_app/tests/test_multiple_pick_mode.py 2014-07-25 20:51:16 +0000
583+++ tests/autopilot/address_book_app/tests/test_multiple_pick_mode.py 2014-09-04 15:01:53 +0000
584@@ -16,9 +16,10 @@
585 class TestMultiplePickerMode(AddressBookAppTestCase):
586 """ Tests app in single picker mode"""
587
588+ PRELOAD_VCARD = True
589+
590 def setUp(self):
591 self.ARGS.append("addressbook:///pick?single=false")
592- AddressBookAppTestCase.PRELOAD_VCARD = True
593 super(TestMultiplePickerMode, self).setUp()
594
595 def test_select_contacts(self):
596
597=== modified file 'tests/autopilot/address_book_app/tests/test_single_pick_mode.py'
598--- tests/autopilot/address_book_app/tests/test_single_pick_mode.py 2014-07-26 01:37:57 +0000
599+++ tests/autopilot/address_book_app/tests/test_single_pick_mode.py 2014-09-04 15:01:53 +0000
600@@ -16,9 +16,10 @@
601 class TestSinglePickerMode(AddressBookAppTestCase):
602 """ Tests app in single picker mode"""
603
604+ PRELOAD_VCARD = True
605+
606 def setUp(self):
607 AddressBookAppTestCase.ARGS.append("addressbook:///pick?single=true")
608- AddressBookAppTestCase.PRELOAD_VCARD = True
609 super(TestSinglePickerMode, self).setUp()
610
611 def test_select_single_contact(self):

Subscribers

People subscribed via source and target branches