Merge lp:~iahmad/ubuntu-ui-toolkit/ap_testcases_for_picker into lp:ubuntu-ui-toolkit
- ap_testcases_for_picker
- Merge into trunk
Status: | Work in progress |
---|---|
Proposed branch: | lp:~iahmad/ubuntu-ui-toolkit/ap_testcases_for_picker |
Merge into: | lp:ubuntu-ui-toolkit |
Diff against target: |
217 lines (+157/-2) 3 files modified
examples/ubuntu-ui-toolkit-gallery/Pickers.qml (+5/-0) tests/autopilot/ubuntuuitoolkit/tests/__init__.py (+3/-2) tests/autopilot/ubuntuuitoolkit/tests/gallery/test_picker.py (+149/-0) |
To merge this branch: | bzr merge lp:~iahmad/ubuntu-ui-toolkit/ap_testcases_for_picker |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Needs Fixing | |
Chris Gagnon (community) | Needs Fixing | ||
Ubuntu SDK team | Pending | ||
Review via email: mp+192021@code.launchpad.net |
Commit message
fixing review comments
Description of the change
PS Jenkins bot (ps-jenkins) wrote : | # |
Chris Gagnon (chris.gagnon) wrote : | # |
if you use setUp you don't have to have duplicate code to open the page multiple times, see mp lp:~chris.gagnon/ubuntu-ui-toolkit/ap_testcases_for_picker_with_setup/+merge/192037
Doc strings are needed for describing what the test is testing for.
example:
"""circular picker must have a circular property equal to True and must ..."""
Don't hardcode the margin on line LP#52, maybe use instead:
use def flick(self, flickable, direction, delta=40, margin=10):
Otherwise it looks like good initial tests that can be expanded on later with the ap emulators. (I haven't tested this on the phone yet)
Chris Gagnon (chris.gagnon) wrote : | # |
don't import all of time if you just need sleep.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:793
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:794
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:795
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:795
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
I Ahmad (iahmad) wrote : | # |
I ll wait for Jenkins bot to clear it first.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:795
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Francis Ginther (fginther) wrote : | # |
Iftikhar, the test runner is now fixed so that it does not mistakenly pass tests that do not complete. As you can see from the above, the autopilot test is getting stuck in some infinite loop and the tests now time out.
Unmerged revisions
- 795. By I Ahmad
-
fixing the review comments about time import and doc string
- 794. By I Ahmad
-
merge from chris gagnon branch to move the common code to setUp
- 793. By I Ahmad
-
missed the import for time module
- 792. By I Ahmad
-
catchup with trunk
- 791. By I Ahmad
-
flick margin adjustment
- 790. By I Ahmad
-
fixing pyflake warnings
- 789. By I Ahmad
-
work around for missing wait_select_
single( ) method of AP - 788. By I Ahmad
-
Added AP tests for Picker control and assigned object names to Picker example
Preview Diff
1 | === modified file 'examples/ubuntu-ui-toolkit-gallery/Pickers.qml' | |||
2 | --- examples/ubuntu-ui-toolkit-gallery/Pickers.qml 2013-09-12 07:54:12 +0000 | |||
3 | +++ examples/ubuntu-ui-toolkit-gallery/Pickers.qml 2013-10-22 06:08:21 +0000 | |||
4 | @@ -26,6 +26,7 @@ | |||
5 | 26 | TemplateRow { | 26 | TemplateRow { |
6 | 27 | title: i18n.tr("Linear") | 27 | title: i18n.tr("Linear") |
7 | 28 | Picker { | 28 | Picker { |
8 | 29 | objectName: "picker_linear" | ||
9 | 29 | circular: false | 30 | circular: false |
10 | 30 | model: ["Line1", "Line2", "Line3", "Line4", "Line5", "Line6", "Line7", "Line8", "Line9", "Line10"] | 31 | model: ["Line1", "Line2", "Line3", "Line4", "Line5", "Line6", "Line7", "Line8", "Line9", "Line10"] |
11 | 31 | 32 | ||
12 | @@ -43,6 +44,7 @@ | |||
13 | 43 | TemplateRow { | 44 | TemplateRow { |
14 | 44 | title: i18n.tr("Circular") | 45 | title: i18n.tr("Circular") |
15 | 45 | Picker { | 46 | Picker { |
16 | 47 | objectName: "picker_circular" | ||
17 | 46 | delegate: PickerDelegate { | 48 | delegate: PickerDelegate { |
18 | 47 | Label { | 49 | Label { |
19 | 48 | text: modelData | 50 | text: modelData |
20 | @@ -66,6 +68,7 @@ | |||
21 | 66 | TemplateRow { | 68 | TemplateRow { |
22 | 67 | title: i18n.tr("Infinite") | 69 | title: i18n.tr("Infinite") |
23 | 68 | Picker { | 70 | Picker { |
24 | 71 | objectName: "picker_infinite" | ||
25 | 69 | id: picker | 72 | id: picker |
26 | 70 | model: ListModel {} | 73 | model: ListModel {} |
27 | 71 | circular: false | 74 | circular: false |
28 | @@ -101,6 +104,7 @@ | |||
29 | 101 | TemplateRow { | 104 | TemplateRow { |
30 | 102 | title: i18n.tr("Clock") | 105 | title: i18n.tr("Clock") |
31 | 103 | Dialer { | 106 | Dialer { |
32 | 107 | objectName: "dialer_clock" | ||
33 | 104 | size: units.gu(20) | 108 | size: units.gu(20) |
34 | 105 | handSpace: units.gu(4) | 109 | handSpace: units.gu(4) |
35 | 106 | minimumValue: 0 | 110 | minimumValue: 0 |
36 | @@ -138,6 +142,7 @@ | |||
37 | 138 | TemplateRow { | 142 | TemplateRow { |
38 | 139 | title: i18n.tr("Overlay") | 143 | title: i18n.tr("Overlay") |
39 | 140 | Dialer { | 144 | Dialer { |
40 | 145 | objectName: "dialer_overlay" | ||
41 | 141 | size: units.gu(20) | 146 | size: units.gu(20) |
42 | 142 | handSpace: units.gu(4) | 147 | handSpace: units.gu(4) |
43 | 143 | 148 | ||
44 | 144 | 149 | ||
45 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/__init__.py' | |||
46 | --- tests/autopilot/ubuntuuitoolkit/tests/__init__.py 2013-10-21 07:44:03 +0000 | |||
47 | +++ tests/autopilot/ubuntuuitoolkit/tests/__init__.py 2013-10-22 06:08:21 +0000 | |||
48 | @@ -203,12 +203,13 @@ | |||
49 | 203 | def flick(self, flickable, direction, delta=40): | 203 | def flick(self, flickable, direction, delta=40): |
50 | 204 | """This funcito flicks the page from middle to the given direction.""" | 204 | """This funcito flicks the page from middle to the given direction.""" |
51 | 205 | x, y, w, h = flickable.globalRect | 205 | x, y, w, h = flickable.globalRect |
52 | 206 | margin = 10 | ||
53 | 206 | if direction == FlickDirection.UP: | 207 | if direction == FlickDirection.UP: |
55 | 207 | self.pointing_device.drag(x + w / 2, y + h / 2, x + w / 2, | 208 | self.pointing_device.drag(x + margin, y + h / 2, x + margin, |
56 | 208 | y + h / 2 - delta) | 209 | y + h / 2 - delta) |
57 | 209 | flickable.flicking.wait_for(False) | 210 | flickable.flicking.wait_for(False) |
58 | 210 | elif direction == FlickDirection.DOWN: | 211 | elif direction == FlickDirection.DOWN: |
60 | 211 | self.pointing_device.drag(x + w / 2, y + h / 2, x + w / 2, | 212 | self.pointing_device.drag(x + margin, y + h / 2, x + margin, |
61 | 212 | y + h / 2 + delta) | 213 | y + h / 2 + delta) |
62 | 213 | flickable.flicking.wait_for(False) | 214 | flickable.flicking.wait_for(False) |
63 | 214 | else: | 215 | else: |
64 | 215 | 216 | ||
65 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_picker.py' | |||
66 | --- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_picker.py 1970-01-01 00:00:00 +0000 | |||
67 | +++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_picker.py 2013-10-22 06:08:21 +0000 | |||
68 | @@ -0,0 +1,149 @@ | |||
69 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | ||
70 | 2 | # | ||
71 | 3 | # Copyright (C) 2012, 2013 Canonical Ltd. | ||
72 | 4 | # | ||
73 | 5 | # This program is free software; you can redistribute it and/or modify | ||
74 | 6 | # it under the terms of the GNU Lesser General Public License as published by | ||
75 | 7 | # the Free Software Foundation; version 3. | ||
76 | 8 | # | ||
77 | 9 | # This program is distributed in the hope that it will be useful, | ||
78 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
79 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
80 | 12 | # GNU Lesser General Public License for more details. | ||
81 | 13 | # | ||
82 | 14 | # You should have received a copy of the GNU Lesser General Public License | ||
83 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
84 | 16 | |||
85 | 17 | """Tests for the Ubuntu UI Toolkit Gallery - OptionSelector component""" | ||
86 | 18 | |||
87 | 19 | from time import sleep | ||
88 | 20 | from autopilot.matchers import Eventually | ||
89 | 21 | from testtools.matchers import Equals | ||
90 | 22 | from ubuntuuitoolkit.tests.gallery import GalleryTestCase | ||
91 | 23 | from ubuntuuitoolkit.tests import FlickDirection | ||
92 | 24 | |||
93 | 25 | |||
94 | 26 | class Direction: | ||
95 | 27 | """Enum for Circular Picker direction.""" | ||
96 | 28 | |||
97 | 29 | BACKWARD, FORWARD = range(0, 2) | ||
98 | 30 | |||
99 | 31 | |||
100 | 32 | class PickerTests(GalleryTestCase): | ||
101 | 33 | """Generic tests for the Gallery""" | ||
102 | 34 | |||
103 | 35 | def setUp(self): | ||
104 | 36 | super(PickerTests, self).setUp() | ||
105 | 37 | item = "Pickers" | ||
106 | 38 | self.loadItem(item) | ||
107 | 39 | self.checkPageHeader(item) | ||
108 | 40 | |||
109 | 41 | def test_picker_dialer(self): | ||
110 | 42 | dialer_clock = self.getObject('dialer_clock') | ||
111 | 43 | #Flick upward to reveal the hidden ui element. | ||
112 | 44 | flickable = self.main_view.select_single('QQuickFlickable') | ||
113 | 45 | self.assertIsNotNone(flickable) | ||
114 | 46 | self.reveal_item_by_flick(dialer_clock, flickable, FlickDirection.UP) | ||
115 | 47 | self.assertThat(flickable.flicking, Eventually(Equals(False))) | ||
116 | 48 | #TODO: Need to add more testing logic. | ||
117 | 49 | |||
118 | 50 | def test_picker_dialerhand(self): | ||
119 | 51 | dialer_overlay = self.getObject('dialer_overlay') | ||
120 | 52 | #Flick upward to reveal the hidden ui element. | ||
121 | 53 | flickable = self.main_view.select_single('QQuickFlickable') | ||
122 | 54 | self.assertIsNotNone(flickable) | ||
123 | 55 | self.reveal_item_by_flick(dialer_overlay, flickable, FlickDirection.UP) | ||
124 | 56 | self.assertThat(flickable.flicking, Eventually(Equals(False))) | ||
125 | 57 | #TODO: Need to add more testing logic. | ||
126 | 58 | |||
127 | 59 | def test_picker_linear_picker(self): | ||
128 | 60 | """Testing the linear picker""" | ||
129 | 61 | |||
130 | 62 | linear = self.getObject('picker_linear') | ||
131 | 63 | self.assertThat(linear.circular, Equals(False)) | ||
132 | 64 | listview = linear.select_single('QQuickListView') | ||
133 | 65 | self.assertIsNotNone(listview) | ||
134 | 66 | count = listview.count | ||
135 | 67 | for i in range(0, count): | ||
136 | 68 | line = linear.select_single('Label', text='Line' + str(i + 1)) | ||
137 | 69 | self.assertIsNotNone(line) | ||
138 | 70 | self.pointing_device.click_object(line) | ||
139 | 71 | linear = self.getObject('picker_linear') | ||
140 | 72 | self.assertThat(linear.selectedIndex, Eventually(Equals(i))) | ||
141 | 73 | |||
142 | 74 | try: | ||
143 | 75 | #try finding the next item. | ||
144 | 76 | line = linear.select_single('Label', text='Line' + str(count + 1)) | ||
145 | 77 | self.assertIsNone(line) | ||
146 | 78 | except: | ||
147 | 79 | pass | ||
148 | 80 | |||
149 | 81 | def test_picker_circular_picker(self): | ||
150 | 82 | """Testing the circular picker""" | ||
151 | 83 | |||
152 | 84 | circular = self.getObject('picker_circular') | ||
153 | 85 | self.assertThat(circular.circular, Equals(True)) | ||
154 | 86 | selectedIndex = circular.selectedIndex | ||
155 | 87 | #it seems picker needs some time to move to seletected index | ||
156 | 88 | #this requires uses of wait_select_single method in autopilot | ||
157 | 89 | #At time of writing this test, method is in trunk but not yet released. | ||
158 | 90 | #So I am looping it here to mimick the wait and will update | ||
159 | 91 | #once autopilot wait_select_single method becomes available. | ||
160 | 92 | for i in range(0, 10): | ||
161 | 93 | try: | ||
162 | 94 | line = circular.select_single('Label', | ||
163 | 95 | text='Line ' | ||
164 | 96 | + str(selectedIndex)) | ||
165 | 97 | self.assertIsNotNone(line) | ||
166 | 98 | except: | ||
167 | 99 | sleep(1) | ||
168 | 100 | |||
169 | 101 | self.pointing_device.click_object(line) | ||
170 | 102 | |||
171 | 103 | pathview = circular.select_single('QQuickPathView') | ||
172 | 104 | self.assertIsNotNone(pathview) | ||
173 | 105 | count = pathview.count | ||
174 | 106 | direction_to_move = (Direction.BACKWARD | ||
175 | 107 | if selectedIndex <= count / 2 | ||
176 | 108 | else Direction.FORWARD) | ||
177 | 109 | |||
178 | 110 | #Test logic should be independent of test data but it doesn't | ||
179 | 111 | #look possible here, so have to rely on test data values in list | ||
180 | 112 | if direction_to_move == Direction.BACKWARD: | ||
181 | 113 | for i in range(selectedIndex, -2, -1): | ||
182 | 114 | line = circular.select_single('Label', | ||
183 | 115 | text='Line ' + str(i % count)) | ||
184 | 116 | self.assertIsNotNone(line) | ||
185 | 117 | self.pointing_device.click_object(line) | ||
186 | 118 | self.assertThat(circular.selectedIndex, | ||
187 | 119 | Eventually(Equals(i % count))) | ||
188 | 120 | else: | ||
189 | 121 | for i in range(selectedIndex, count + 2): | ||
190 | 122 | line = circular.select_single('Label', | ||
191 | 123 | text='Line ' + str(i % count)) | ||
192 | 124 | self.assertIsNotNone(line) | ||
193 | 125 | self.pointing_device.click_object(line) | ||
194 | 126 | self.assertThat(circular.selectedIndex, | ||
195 | 127 | Eventually(Equals(i % count))) | ||
196 | 128 | |||
197 | 129 | def test_picker_infinite_picker(self): | ||
198 | 130 | """Testing the infinite picker""" | ||
199 | 131 | |||
200 | 132 | infinite = self.getObject('picker_infinite') | ||
201 | 133 | self.assertThat(infinite.circular, Equals(False)) | ||
202 | 134 | |||
203 | 135 | #Flick upward to reveal the hidden ui element. | ||
204 | 136 | flickable = self.main_view.select_single('QQuickFlickable') | ||
205 | 137 | self.assertIsNotNone(flickable) | ||
206 | 138 | self.reveal_item_by_flick(infinite, flickable, FlickDirection.UP) | ||
207 | 139 | self.assertThat(flickable.flicking, Eventually(Equals(False))) | ||
208 | 140 | |||
209 | 141 | listview = infinite.select_single('QQuickListView') | ||
210 | 142 | self.assertIsNotNone(listview) | ||
211 | 143 | count = listview.count | ||
212 | 144 | for i in range(0, count + 10): | ||
213 | 145 | line = infinite.select_single('Label', text='Line ' + str(i)) | ||
214 | 146 | self.assertIsNotNone(line) | ||
215 | 147 | self.pointing_device.click_object(line) | ||
216 | 148 | infinite = self.getObject('picker_infinite') | ||
217 | 149 | self.assertThat(infinite.selectedIndex, Eventually(Equals(i))) |
FAILED: Continuous integration, rev:792 /code.launchpad .net/~iahmad/ ubuntu- ui-toolkit/ ap_testcases_ for_picker/ +merge/ 192021/ +edit-commit- message
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http:// jenkins. qa.ubuntu. com/job/ ubuntu- ui-toolkit- ci/1031/ jenkins. qa.ubuntu. com/job/ generic- mediumtests- saucy-vm/ 465/console jenkins. qa.ubuntu. com/job/ generic- mediumtests- touch/3120/ console jenkins. qa.ubuntu. com/job/ ubuntu- ui-toolkit- saucy-amd64- ci/888/ console jenkins. qa.ubuntu. com/job/ ubuntu- ui-toolkit- saucy-armhf- ci/888/ console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-i386/ 4613/console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-armhf/ 3122/console
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: 10.97.0. 26:8080/ job/ubuntu- ui-toolkit- ci/1031/ rebuild
http://