Merge lp:~elopio/ubuntu-ui-toolkit/clean_toggles2 into lp:ubuntu-ui-toolkit

Proposed by Leo Arias
Status: Merged
Approved by: Zoltan Balogh
Approved revision: 815
Merge reported by: Leo Arias
Merged at revision: not available
Proposed branch: lp:~elopio/ubuntu-ui-toolkit/clean_toggles2
Merge into: lp:ubuntu-ui-toolkit
Prerequisite: lp:~elopio/ubuntu-ui-toolkit/clean_toggles
Diff against target: 182 lines (+101/-44)
3 files modified
tests/autopilot/ubuntuuitoolkit/emulators.py (+22/-9)
tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py (+0/-35)
tests/autopilot/ubuntuuitoolkit/tests/gallery/test_toggles.py (+79/-0)
To merge this branch: bzr merge lp:~elopio/ubuntu-ui-toolkit/clean_toggles2
Reviewer Review Type Date Requested Status
Zoltan Balogh Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+193376@code.launchpad.net

Commit message

Cleaned up the gallery toggles autopilot tests.

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

Merged with parent branch.

814. By Leo Arias

Fixed pep8 errors.

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

Fixed pep8 error.

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

FAILED: Continuous integration, rev:815
http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-ci/1137/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/245
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/237/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-trusty-amd64-ci/85
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-trusty-armhf-ci/85
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-trusty-armhf-ci/85/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/235
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/245
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/245/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/237
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/237/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/2858
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/2909/console
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/763
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/762

Click here to trigger a rebuild:
http://10.97.0.26:8080/job/ubuntu-ui-toolkit-ci/1137/rebuild

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

PASSED: Continuous integration, rev:815
http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-ci/1140/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/256
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/248
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-trusty-amd64-ci/88
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-trusty-armhf-ci/88
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-trusty-armhf-ci/88/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/245
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/256
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/256/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/248
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/248/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/2867
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/2919
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/782
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/779

Click here to trigger a rebuild:
http://10.97.0.26:8080/job/ubuntu-ui-toolkit-ci/1140/rebuild

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

PASSED: Continuous integration, rev:815
http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-ci/1144/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/273
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/264
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-trusty-amd64-ci/92
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-trusty-armhf-ci/92
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-trusty-armhf-ci/92/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/259
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/273
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/273/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/264
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/264/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/2882
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/2933
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/810
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/811

Click here to trigger a rebuild:
http://10.97.0.26:8080/job/ubuntu-ui-toolkit-ci/1144/rebuild

review: Approve (continuous-integration)
Revision history for this message
Zoltan Balogh (bzoltan) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/ubuntuuitoolkit/emulators.py'
2--- tests/autopilot/ubuntuuitoolkit/emulators.py 2013-10-31 08:45:20 +0000
3+++ tests/autopilot/ubuntuuitoolkit/emulators.py 2013-10-31 08:45:20 +0000
4@@ -329,26 +329,39 @@
5 class CheckBox(UbuntuUIToolkitEmulatorBase):
6 """CheckBox Autopilot emulator."""
7
8- def check(self):
9- """Check a CheckBox, if its not already checked."""
10+ def check(self, time_out=10):
11+ """Check a CheckBox, if its not already checked.
12+
13+ :parameter time_out: number of seconds to wait for the CheckBox to be
14+ checked. Default is 10.
15+
16+ """
17 if not self.checked:
18- self.change_state()
19-
20- def uncheck(self):
21- """Uncheck a CheckBox, if its not already unchecked."""
22+ self.change_state(time_out)
23+
24+ def uncheck(self, time_out=10):
25+ """Uncheck a CheckBox, if its not already unchecked.
26+
27+ :parameter time_out: number of seconds to wait for the CheckBox to be
28+ unchecked. Default is 10.
29+
30+ """
31 if self.checked:
32- self.change_state()
33+ self.change_state(time_out)
34
35- def change_state(self):
36+ def change_state(self, time_out=10):
37 """Change the state of a CheckBox.
38
39 If it is checked, it will be unchecked. If it is unchecked, it will be
40 checked.
41
42+ :parameter time_out: number of seconds to wait for the CheckBox state
43+ to change. Default is 10.
44+
45 """
46 original_state = self.checked
47 self.pointing_device.click_object(self)
48- self.checked.wait_for(not original_state)
49+ self.checked.wait_for(not original_state, time_out)
50
51
52 class Empty(UbuntuUIToolkitEmulatorBase):
53
54=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py'
55--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py 2013-10-07 13:11:40 +0000
56+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py 2013-10-31 08:45:20 +0000
57@@ -37,41 +37,6 @@
58 self.loadItem(item)
59 self.checkPageHeader(item)
60
61- def test_toggles(self):
62- item = "Toggles"
63- self.checkListItem(item)
64- self.loadItem(item)
65- self.checkPageHeader(item)
66-
67- # check default states
68- item_data = [
69- ["checkbox_unchecked", False, True],
70- ["checkbox_checked", True, True],
71- ["checkbox_disabled_unchecked", False, False],
72- ["checkbox_disabled_checked", True, False],
73- ["switch_unchecked", False, True],
74- ["switch_checked", True, True],
75- ["switch_disabled_unchecked", False, False],
76- ["switch_disabled_checked", True, False]
77- ]
78-
79- for data in item_data:
80- objName = data[0]
81- objChecked = data[1]
82- objEnabled = data[2]
83-
84- obj = self.getObject(objName)
85- self.assertThat(obj.checked, Equals(objChecked))
86- self.assertThat(obj.enabled, Equals(objEnabled))
87-
88- # try to interact with objects
89- self.tap(objName)
90-
91- if (obj.enabled):
92- self.assertThat(obj.checked, Not(Equals(objChecked)))
93- else:
94- self.assertThat(obj.checked, Equals(objChecked))
95-
96 def test_slider(self):
97 item = "Slider"
98 self.loadItem(item)
99
100=== added file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_toggles.py'
101--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_toggles.py 1970-01-01 00:00:00 +0000
102+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_toggles.py 2013-10-31 08:45:20 +0000
103@@ -0,0 +1,79 @@
104+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
105+#
106+# Copyright (C) 2012, 2013 Canonical Ltd.
107+#
108+# This program is free software; you can redistribute it and/or modify
109+# it under the terms of the GNU Lesser General Public License as published by
110+# the Free Software Foundation; version 3.
111+#
112+# This program is distributed in the hope that it will be useful,
113+# but WITHOUT ANY WARRANTY; without even the implied warranty of
114+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
115+# GNU Lesser General Public License for more details.
116+#
117+# You should have received a copy of the GNU Lesser General Public License
118+# along with this program. If not, see <http://www.gnu.org/licenses/>.
119+
120+from ubuntuuitoolkit import emulators
121+from ubuntuuitoolkit.tests import gallery
122+
123+from testtools.matchers import Equals
124+
125+
126+class EnabledTogglesTestCase(gallery.GalleryTestCase):
127+
128+ scenarios = [
129+ ('checkbox unchecked', dict(
130+ object_name='checkbox_unchecked', initial_state=False)),
131+ ('checkbox checked', dict(
132+ object_name='checkbox_checked', initial_state=True)),
133+ ('switch unchecked', dict(
134+ object_name='switch_unchecked', initial_state=False)),
135+ ('switch checked', dict(
136+ object_name='switch_checked', initial_state=True))
137+ ]
138+
139+ def setUp(self):
140+ super(EnabledTogglesTestCase, self).setUp()
141+ item = "Toggles"
142+ self.checkListItem(item)
143+ self.loadItem(item)
144+ self.checkPageHeader(item)
145+
146+ def test_change_toggles_state(self):
147+ toggle = self.main_view.select_single(
148+ emulators.CheckBox, objectName=self.object_name)
149+ self.assertThat(toggle.enabled, Equals(True))
150+ self.assertThat(toggle.checked, Equals(self.initial_state))
151+
152+ toggle.change_state(time_out=1)
153+ self.assertThat(toggle.checked, Equals(not self.initial_state))
154+
155+
156+class DisabledTogglesTestCase(gallery.GalleryTestCase):
157+
158+ scenarios = [
159+ ('checkbox disabled unchecked', dict(
160+ object_name='checkbox_disabled_unchecked', initial_state=False)),
161+ ('checkbox disabled checked', dict(
162+ object_name='checkbox_disabled_checked', initial_state=True)),
163+ ('switch disabled unchecked', dict(
164+ object_name='switch_disabled_unchecked', initial_state=False)),
165+ ('switch disabled checked', dict(
166+ object_name='switch_disabled_checked', initial_state=True))
167+ ]
168+
169+ def setUp(self):
170+ super(DisabledTogglesTestCase, self).setUp()
171+ item = "Toggles"
172+ self.checkListItem(item)
173+ self.loadItem(item)
174+ self.checkPageHeader(item)
175+
176+ def test_change_toggles_state(self):
177+ toggle = self.main_view.select_single(
178+ emulators.CheckBox, objectName=self.object_name)
179+ self.assertThat(toggle.enabled, Equals(False))
180+ self.assertThat(toggle.checked, Equals(self.initial_state))
181+
182+ self.assertRaises(AssertionError, toggle.change_state, time_out=1)

Subscribers

People subscribed via source and target branches

to status/vote changes: