Merge lp:~om26er/address-book-app/test_collapse into lp:address-book-app

Proposed by Omer Akram
Status: Needs review
Proposed branch: lp:~om26er/address-book-app/test_collapse
Merge into: lp:address-book-app
Prerequisite: lp:~om26er/address-book-app/abook_navigation_favorites
Diff against target: 105 lines (+85/-0)
3 files modified
tests/autopilot/address_book_app/emulators/contact_list_page.py (+27/-0)
tests/autopilot/address_book_app/tests/test_collapse.py (+48/-0)
tests/data/vcard.vcf (+10/-0)
To merge this branch: bzr merge lp:~om26er/address-book-app/test_collapse
Reviewer Review Type Date Requested Status
Leo Arias (community) Needs Fixing
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+211505@code.launchpad.net

Commit message

autopilot: add test to make sure contact list expansion and collision is intact.

Description of the change

autopilot: add test to make sure contact list expansion and collision is intact.

To post a comment you must log in.
167. By Omer Akram

merge with prereq branch

168. By Omer Akram

add docstring and a connect to make it clear why we are using sleep

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:166
http://jenkins.qa.ubuntu.com/job/address-book-app-ci/459/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-amd64-ci/169
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-armhf-ci/169
        deb: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-armhf-ci/169/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-i386-ci/169
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4019
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3604/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3509
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4060
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4060/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3606
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3606/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5935/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/4909

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

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

FAILED: Continuous integration, rev:168
http://jenkins.qa.ubuntu.com/job/address-book-app-ci/461/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-amd64-ci/171
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-armhf-ci/171
        deb: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-armhf-ci/171/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-i386-ci/171
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4023
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3608/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3513
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4064
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4064/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3610
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3610/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5938/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/4914

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Leo Arias (elopio) wrote :

I left some comments inline.
This makes me wonder if it should be a QML test for the list component. It would be ok to make it an autopilot test only if the QML test is too complex.

review: Needs Fixing

Unmerged revisions

168. By Omer Akram

add docstring and a connect to make it clear why we are using sleep

167. By Omer Akram

merge with prereq branch

166. By Omer Akram

bring in Allan's collapse test case and adapt it to altest changes

165. By Omer Akram

make dummy backend code reusable by other test cases

164. By Omer Akram

remove unused test code, fix things

163. By Omer Akram

remove syncevolution dep

162. By Omer Akram

fix pep8 and pyflakes warnings for test_favorite, did not touch other modules

161. By Omer Akram

remove unused test code

160. By Omer Akram

don't use memory backend for favorite tests, use the new dummy backend from the service

159. By Omer Akram

merge new-fav-list branch

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/address_book_app/emulators/contact_list_page.py'
2--- tests/autopilot/address_book_app/emulators/contact_list_page.py 2014-03-18 12:37:36 +0000
3+++ tests/autopilot/address_book_app/emulators/contact_list_page.py 2014-03-18 12:37:36 +0000
4@@ -214,3 +214,30 @@
5 except StateNotFoundError:
6 logger.error("Favorite contact {} not found.".format(name))
7 return False
8+
9+ def get_header_by_letter(self, header_letter):
10+ """Get the index header by its letter string (text), e.g. 'B'
11+
12+ :param header_letter: Index letter text, e.g. 'B'
13+ :raises StateNotFoundError: if header letter not found
14+ """
15+ return self.wait_select_single('Header',
16+ text=header_letter,
17+ visible=True)
18+
19+ def click_header_by_letter(self, header_letter):
20+ """Click the index header by its letter string (text), e.g. 'B'
21+
22+ :param header_letter: Index letter text, e.g. 'B'
23+ :raises StateNotFoundError: if header letter not found
24+ """
25+ header = self.get_header_by_letter(header_letter)
26+ self.pointing_device.click_object(header)
27+
28+ def is_expanded(self):
29+ """Is the ContactListView expanded?
30+
31+ :raises StateNotFoundError: if the ContactListView is not found
32+ """
33+ contact_list_view = self.wait_select_single('ContactListView')
34+ return contact_list_view.expanded == True
35
36=== added file 'tests/autopilot/address_book_app/tests/test_collapse.py'
37--- tests/autopilot/address_book_app/tests/test_collapse.py 1970-01-01 00:00:00 +0000
38+++ tests/autopilot/address_book_app/tests/test_collapse.py 2014-03-18 12:37:36 +0000
39@@ -0,0 +1,48 @@
40+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
41+# Copyright 2014 Canonical
42+#
43+# This program is free software: you can redistribute it and/or modify it
44+# under the terms of the GNU General Public License version 3, as published
45+# by the Free Software Foundation.
46+
47+"""Tests of collapsing/expanding address-book-app contacts list"""
48+
49+from __future__ import absolute_import
50+
51+from autopilot.introspection.dbus import StateNotFoundError
52+from autopilot.matchers import Eventually
53+from testtools.matchers import Equals
54+
55+from address_book_app.tests import DummyServiceBackendSetup
56+from address_book_app.emulators.contact_list_page import ContactListPage
57+
58+import time
59+
60+
61+class TestCollapse(DummyServiceBackendSetup):
62+ """Test for collapsing and expanding the contacts list"""
63+
64+ def setUp(self):
65+ super(TestCollapse, self).setUp()
66+
67+ def test_contract_and_expand_list(self):
68+ """Ensure contacts list can be expanded and collapsed."""
69+ contact_list_page = self.main_window.get_contact_list_page()
70+ contact_list_page.get_contact_by_name('Zack Constantine')
71+ contact_list_page.click_header_by_letter('T')
72+ # bit of a wait here
73+ self.assertThat(lambda: contact_list_page.is_expanded(),
74+ Eventually(Equals(False)))
75+ # just also verify that contacts are visible (one is enough)
76+ self.assertRaises(
77+ StateNotFoundError,
78+ lambda : contact_list_page.get_contact_by_name('Zack Constantine'))
79+ contact_list_page.click_header_by_letter('Z')
80+ self.assertThat(lambda: contact_list_page.is_expanded(),
81+ Eventually(Equals(True)))
82+
83+ # Using a 1 second sleep here because currently the .expanded
84+ # property is not reliable
85+ time.sleep(1)
86+ contact_list_page.get_contact_by_name('teste teste2')
87+ contact_list_page.get_contact_by_name('Zack Constantine')
88
89=== modified file 'tests/data/vcard.vcf'
90--- tests/data/vcard.vcf 2013-12-12 15:55:57 +0000
91+++ tests/data/vcard.vcf 2014-03-18 12:37:36 +0000
92@@ -28,3 +28,13 @@
93 TEL:111111
94 CATEGORIES:T
95 END:VCARD
96+BEGIN:VCARD
97+VERSION:3.0
98+UID:0d753ce1005dde92f69e4ddb62222240639113a3
99+X-QTPROJECT-EXTENDED-DETAIL:CLIENTPIDMAP;[\n "1"\n]\n
100+N:Constantine;Zack;;;
101+FN:Zack Constantine
102+X-QTPROJECT-FAVORITE:false;0
103+TEL:98878
104+CATEGORIES:T
105+END:VCARD

Subscribers

People subscribed via source and target branches