Merge lp:~renatofilho/address-book-app/autopilot-remove-contact into lp:address-book-app

Proposed by Renato Araujo Oliveira Filho
Status: Rejected
Rejected by: Renato Araujo Oliveira Filho
Proposed branch: lp:~renatofilho/address-book-app/autopilot-remove-contact
Merge into: lp:address-book-app
Prerequisite: lp:~renatofilho/address-book-app/autopilot-edit-contacts
Diff against target: 142 lines (+82/-2)
4 files modified
src/imports/ContactList/ContactListPage.qml (+3/-0)
src/imports/Ubuntu/Contacts/ContactDelegate.qml (+2/-0)
src/imports/Ubuntu/Contacts/DialogButtons.qml (+2/-2)
tests/autopilot/address_book_app/tests/test_remove_contact.py (+75/-0)
To merge this branch: bzr merge lp:~renatofilho/address-book-app/autopilot-remove-contact
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Omer Akram (community) Approve
Review via email: mp+195777@code.launchpad.net

Commit message

Added test for remove contacts.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:128
http://jenkins.qa.ubuntu.com/job/address-book-app-ci/303/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-amd64-ci/13
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-armhf-ci/13
        deb: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-armhf-ci/13/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-i386-ci/13
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/855
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/843/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/770
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/855
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/855/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/843
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/843/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/3447/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/1536

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/address-book-app-ci/303/rebuild

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
Omer Akram (om26er) wrote :

Please merge it with trunk, has conflicts. otherwise code looks fine to me.

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Omer Akram (om26er) wrote :

Fine by me.

review: Approve
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)

Unmerged revisions

130. By Renato Araujo Oliveira Filho

Merged mainline.

129. By Renato Araujo Oliveira Filho

Merged parent branch.

128. By Renato Araujo Oliveira Filho

Updated swipe to delete test to check if the removed contact was the correct one.

127. By Renato Araujo Oliveira Filho

Added test for remove contacts.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/imports/ContactList/ContactListPage.qml'
2--- src/imports/ContactList/ContactListPage.qml 2013-12-17 23:47:28 +0000
3+++ src/imports/ContactList/ContactListPage.qml 2014-01-15 12:23:31 +0000
4@@ -140,6 +140,8 @@
5
6 locked: contactList.isInSelectionMode
7 ToolbarButton {
8+ objectName: "select"
9+
10 action: Action {
11 objectName: "selectButton"
12 text: i18n.tr("Select")
13@@ -149,6 +151,7 @@
14 }
15 ToolbarButton {
16 objectName: "Add"
17+
18 action: Action {
19 text: i18n.tr("Add")
20 iconSource: "artwork:/add.png"
21
22=== modified file 'src/imports/Ubuntu/Contacts/ContactDelegate.qml'
23--- src/imports/Ubuntu/Contacts/ContactDelegate.qml 2013-12-12 15:55:19 +0000
24+++ src/imports/Ubuntu/Contacts/ContactDelegate.qml 2014-01-15 12:23:31 +0000
25@@ -32,6 +32,7 @@
26 property int titleDetail: ContactDetail.Name
27 property variant titleFields: [ Name.FirstName, Name.LastName ]
28 property bool detailsShown: false
29+ readonly property alias text: name.text
30
31 signal contactClicked(var index, var contact)
32 signal pressAndHold(var index, var contact)
33@@ -42,6 +43,7 @@
34
35 ListItem.Empty {
36 id: delegate
37+ objectName: "listItem"
38
39 height: units.gu(6)
40 showDivider: false
41
42=== modified file 'src/imports/Ubuntu/Contacts/DialogButtons.qml'
43--- src/imports/Ubuntu/Contacts/DialogButtons.qml 2013-12-12 15:55:19 +0000
44+++ src/imports/Ubuntu/Contacts/DialogButtons.qml 2014-01-15 12:23:31 +0000
45@@ -31,7 +31,7 @@
46
47 Button {
48 id: reject
49- objectName: "DialogButtons.rejectButton"
50+ objectName: root.visible ? "DialogButtons.rejectButton" : ""
51
52 action: Action {
53 text: i18n.tr("Cancel")
54@@ -47,7 +47,7 @@
55
56 Button {
57 id: accept
58- objectName: "DialogButtons.acceptButton"
59+ objectName: root.visible ? "DialogButtons.acceptButton" : ""
60
61 action: Action {
62 text: i18n.tr("Done")
63
64=== added file 'tests/autopilot/address_book_app/tests/test_remove_contact.py'
65--- tests/autopilot/address_book_app/tests/test_remove_contact.py 1970-01-01 00:00:00 +0000
66+++ tests/autopilot/address_book_app/tests/test_remove_contact.py 2014-01-15 12:23:31 +0000
67@@ -0,0 +1,75 @@
68+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
69+# Copyright 2013 Canonical
70+#
71+# This program is free software: you can redistribute it and/or modify it
72+# under the terms of the GNU General Public License version 3, as published
73+# by the Free Software Foundation.
74+
75+"""Tests for the Addressbook App"""
76+
77+from __future__ import absolute_import
78+
79+from testtools.matchers import Equals
80+from autopilot.matchers import Eventually
81+
82+from address_book_app.tests import AddressBookAppTestCase
83+
84+
85+class TestRemoveContact(AddressBookAppTestCase):
86+ """ Tests remove contact """
87+
88+ def test_swipe_to_delete_contact(self):
89+ self.add_contact("Fulano", "de Tal")
90+ self.add_contact("Fulano2", "de Tal2")
91+ self.add_contact("Fulano3", "de Tal3")
92+
93+ # swipe to delete a specific contact
94+ contacts = self.main_window.select_many("ContactDelegate")
95+ for contact in contacts:
96+ if contact.text == "Fulano2 de Tal2":
97+ list_item = contact.select_single("Empty", objectName="listItem")
98+ list_item.swipe_to_delete()
99+ list_item.confirm_removal()
100+
101+ # check if contact removed was the correct one
102+ list_view = self.main_window.select_single(
103+ "ContactListView",
104+ objectName="contactListView")
105+ self.assertThat(list_view.count, Eventually(Equals(2)))
106+
107+ contacts = self.main_window.select_many("ContactDelegate")
108+ remaining = ["Fulano de Tal", "Fulano3 de Tal3"]
109+ for contact in contacts:
110+ if contact.text in remaining:
111+ remaining.remove(contact.text)
112+ self.assertThat(len(remaining), Equals(0))
113+
114+ def test_delete_selected_contact(self):
115+ self.add_contact("Fulano", "de Tal")
116+ self.add_contact("Fulano2", "de Tal2")
117+ self.add_contact("Fulano3", "de Tal3")
118+
119+ # enter select mode
120+ self.main_window.open_toolbar().click_button("select")
121+
122+ # select two contacts
123+ contacts = self.main_window.select_many("ContactDelegate")
124+ for contact in contacts:
125+ if contact.text in ["Fulano2 de Tal2", "Fulano3 de Tal3"]:
126+ self.pointing_device.click_object(contact)
127+
128+ # delete
129+ list_view = self.main_window.select_single(
130+ "ContactListView",
131+ objectName="contactListView")
132+ accept_button = list_view.select_single(
133+ "Button",
134+ objectName="DialogButtons.acceptButton")
135+ self.pointing_device.click_object(accept_button)
136+
137+ # check if contact was removed
138+ self.assertThat(list_view.count, Eventually(Equals(1)))
139+
140+ # check if remaining contact is the correct one
141+ contacts = self.main_window.select_many("ContactDelegate")
142+ self.assertThat(contacts[0].text, Eventually(Equals("Fulano de Tal")))

Subscribers

People subscribed via source and target branches