Merge lp:~nskaggs/ubuntu-clock-app/convert-aptests-to-sdk into lp:ubuntu-clock-app/saucy
- convert-aptests-to-sdk
- Merge into saucy
Status: | Merged |
---|---|
Approved by: | Nicholas Skaggs |
Approved revision: | 172 |
Merged at revision: | 166 |
Proposed branch: | lp:~nskaggs/ubuntu-clock-app/convert-aptests-to-sdk |
Merge into: | lp:ubuntu-clock-app/saucy |
Diff against target: |
600 lines (+159/-250) 8 files modified
debian/control (+2/-1) tests/autopilot/ubuntu_clock_app/emulators.py (+100/-0) tests/autopilot/ubuntu_clock_app/emulators/__init__.py (+0/-17) tests/autopilot/ubuntu_clock_app/emulators/main_window.py (+0/-112) tests/autopilot/ubuntu_clock_app/tests/__init__.py (+11/-58) tests/autopilot/ubuntu_clock_app/tests/test_clock.py (+2/-2) tests/autopilot/ubuntu_clock_app/tests/test_stopwatch.py (+14/-14) tests/autopilot/ubuntu_clock_app/tests/test_timer.py (+30/-46) |
To merge this branch: | bzr merge lp:~nskaggs/ubuntu-clock-app/convert-aptests-to-sdk |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Nekhelesh Ramananthan | Approve | ||
Leo Arias (community) | code review | Approve | |
Review via email: mp+179062@code.launchpad.net |
Commit message
This converts the clock testcase to the sdk emulator, and cleans up the functions. It should be much more robust now.
Atm, depends on https:/
Description of the change
This converts the clock testcase to the sdk emulator, and cleans up the functions. It should be much more robust now.
Atm, depends on https:/
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
Leo Arias (elopio) : | # |
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:170
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:171
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Nekhelesh Ramananthan (nik90) wrote : | # |
After adding the ubuntu-
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
- 172. By Nicholas Skaggs
-
d'oh! fix the init launch to launch clock not dropping letters ;-(
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:172
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'debian/control' | |||
2 | --- debian/control 2013-05-27 07:43:41 +0000 | |||
3 | +++ debian/control 2013-08-12 17:47:04 +0000 | |||
4 | @@ -16,7 +16,7 @@ | |||
5 | 16 | qtdeclarative5-ubuntu-ui-toolkit-plugin | qt-components-ubuntu, | 16 | qtdeclarative5-ubuntu-ui-toolkit-plugin | qt-components-ubuntu, |
6 | 17 | qtdeclarative5-localstorage-plugin, | 17 | qtdeclarative5-localstorage-plugin, |
7 | 18 | qtdeclarative5-qtquick2-plugin, | 18 | qtdeclarative5-qtquick2-plugin, |
9 | 19 | qtdeclarative5-xmllistmodel-plugin, | 19 | qtdeclarative5-xmllistmodel-plugin, |
10 | 20 | Description: Clock application | 20 | Description: Clock application |
11 | 21 | Ubuntu Core Clock application which provides Stopwatch, Timer, Alarm and Clock functionalities. | 21 | Ubuntu Core Clock application which provides Stopwatch, Timer, Alarm and Clock functionalities. |
12 | 22 | 22 | ||
13 | @@ -24,6 +24,7 @@ | |||
14 | 24 | Architecture: all | 24 | Architecture: all |
15 | 25 | Depends: libautopilot-qt, | 25 | Depends: libautopilot-qt, |
16 | 26 | libqt5test5, | 26 | libqt5test5, |
17 | 27 | ubuntu-ui-toolkit-autopilot, | ||
18 | 27 | ubuntu-clock-app (= ${source:Version}), | 28 | ubuntu-clock-app (= ${source:Version}), |
19 | 28 | Description: Autopilot tests for Ubuntu Clock Application | 29 | Description: Autopilot tests for Ubuntu Clock Application |
20 | 29 | This package contains autopilot tests for the Ubuntu Clock application. | 30 | This package contains autopilot tests for the Ubuntu Clock application. |
21 | 30 | 31 | ||
22 | === removed directory 'tests/autopilot/ubuntu_clock_app/emulators' | |||
23 | === added file 'tests/autopilot/ubuntu_clock_app/emulators.py' | |||
24 | --- tests/autopilot/ubuntu_clock_app/emulators.py 1970-01-01 00:00:00 +0000 | |||
25 | +++ tests/autopilot/ubuntu_clock_app/emulators.py 2013-08-12 17:47:04 +0000 | |||
26 | @@ -0,0 +1,100 @@ | |||
27 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | ||
28 | 2 | # | ||
29 | 3 | # Copyright (C) 2013 Canonical Ltd. | ||
30 | 4 | # | ||
31 | 5 | # This program is free software; you can redistribute it and/or modify | ||
32 | 6 | # it under the terms of the GNU Lesser General Public License as published by | ||
33 | 7 | # the Free Software Foundation; version 3. | ||
34 | 8 | # | ||
35 | 9 | # This program is distributed in the hope that it will be useful, | ||
36 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
37 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
38 | 12 | # GNU Lesser General Public License for more details. | ||
39 | 13 | # | ||
40 | 14 | # You should have received a copy of the GNU Lesser General Public License | ||
41 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
42 | 16 | |||
43 | 17 | from ubuntuuitoolkit import emulators as toolkit_emulators | ||
44 | 18 | |||
45 | 19 | |||
46 | 20 | class MainView(toolkit_emulators.MainView): | ||
47 | 21 | def get_stopwatch_tab_button(self): | ||
48 | 22 | """Returns the stopwatch tab.""" | ||
49 | 23 | return self.select_single("AbstractButton", buttonIndex=3) | ||
50 | 24 | |||
51 | 25 | def get_stopwatch_label(self): | ||
52 | 26 | """Returns the select for the stopwatch label""" | ||
53 | 27 | return self.select_single("Label", objectName="labelStopwatch") | ||
54 | 28 | |||
55 | 29 | def get_stopwatch_button(self): | ||
56 | 30 | """Returns the select for the stopwatch button""" | ||
57 | 31 | return self.select_single("AnalogStopwatch", objectName="buttonStopwatch") | ||
58 | 32 | |||
59 | 33 | def get_lap_button(self): | ||
60 | 34 | """Returns the select for the lap button""" | ||
61 | 35 | return self.select_single("Button", objectName="lapButton") | ||
62 | 36 | |||
63 | 37 | def get_reset_button(self): | ||
64 | 38 | """Returns the select for the reset button""" | ||
65 | 39 | return self.select_single("ImageButton", objectName="resetButton") | ||
66 | 40 | |||
67 | 41 | def get_laps(self): | ||
68 | 42 | """Returns the select for the lap count""" | ||
69 | 43 | return self.select_single("ListModel", objectName="laps") | ||
70 | 44 | |||
71 | 45 | def get_timer_tab_button(self): | ||
72 | 46 | """Returns the timer tab.""" | ||
73 | 47 | return self.select_single("AbstractButton", buttonIndex=2) | ||
74 | 48 | |||
75 | 49 | def get_toolbar_timer(self): | ||
76 | 50 | """Returns the toolbar of timer tab""" | ||
77 | 51 | return self.select_single("ToolbarItems") | ||
78 | 52 | |||
79 | 53 | def get_toolbar_timer_button(self, button_idx): | ||
80 | 54 | """Returns a button of toolbar of timer tab""" | ||
81 | 55 | toolbar = self.select_single("ToolbarItems") | ||
82 | 56 | button = toolbar.get_children() | ||
83 | 57 | return button[button_idx] | ||
84 | 58 | |||
85 | 59 | def get_toolbar_timer_add_preset_button(self): | ||
86 | 60 | """Returns the button for add preset of toolbar of timer tab""" | ||
87 | 61 | return self.get_toolbar_timer_button(1) | ||
88 | 62 | |||
89 | 63 | def get_timer_name_preset(self): | ||
90 | 64 | """Returns the TextField where insert the name of the preset""" | ||
91 | 65 | return self.select_single("TextField", objectName="namePreset") | ||
92 | 66 | |||
93 | 67 | def get_timer_hour_hand(self): | ||
94 | 68 | """Returns the hour hand of clock in timer tab""" | ||
95 | 69 | return self.select_single("AnalogTouchHand", objectName="hourHand") | ||
96 | 70 | |||
97 | 71 | def get_timer_clock_center_label(self): | ||
98 | 72 | """Returns the label in the center of clock""" | ||
99 | 73 | return self.select_single("Label", objectName="addPresetTextDone") | ||
100 | 74 | |||
101 | 75 | def get_preset_label_text(self): | ||
102 | 76 | """Returns the label with the preset text""" | ||
103 | 77 | preset = self.select_many("Label", objectName="presetTextLabel") | ||
104 | 78 | return preset[0] #last preset, the one created by autopilot | ||
105 | 79 | |||
106 | 80 | def get_preset_label_timer(self): | ||
107 | 81 | """Returns the label with the preset timer""" | ||
108 | 82 | preset = self.select_many("Label", objectName="presetTimerLabel") | ||
109 | 83 | return preset[0] #last preset, the one created by autopilot | ||
110 | 84 | |||
111 | 85 | def get_label_timer(self): | ||
112 | 86 | """Return the label with the timer countdown""" | ||
113 | 87 | return self.select_single("Label", objectName="labelTimer") | ||
114 | 88 | |||
115 | 89 | def get_num_of_presets(self): | ||
116 | 90 | """Returns the number of presets in the timer page.""" | ||
117 | 91 | timer_page = self.select_single("TimerPage") | ||
118 | 92 | return int(timer_page.select_single("QQuickListView").count) | ||
119 | 93 | |||
120 | 94 | def get_first_preset_list_item(self): | ||
121 | 95 | """Returns the first preset list item in the timer page.""" | ||
122 | 96 | return self.select_single("Standard", objectName="preset0") | ||
123 | 97 | |||
124 | 98 | def get_time_label(self): | ||
125 | 99 | """Return the label with the timer countdown""" | ||
126 | 100 | return self.select_single("Label", objectName="currentTimeLabel") | ||
127 | 0 | 101 | ||
128 | === removed file 'tests/autopilot/ubuntu_clock_app/emulators/__init__.py' | |||
129 | --- tests/autopilot/ubuntu_clock_app/emulators/__init__.py 2013-05-27 07:48:32 +0000 | |||
130 | +++ tests/autopilot/ubuntu_clock_app/emulators/__init__.py 1970-01-01 00:00:00 +0000 | |||
131 | @@ -1,17 +0,0 @@ | |||
132 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | ||
133 | 2 | # | ||
134 | 3 | # Copyright (C) 2013 Canonical Ltd | ||
135 | 4 | # | ||
136 | 5 | # This program is free software: you can redistribute it and/or modify | ||
137 | 6 | # it under the terms of the GNU General Public License version 3 as | ||
138 | 7 | # published by the Free Software Foundation. | ||
139 | 8 | # | ||
140 | 9 | # This program is distributed in the hope that it will be useful, | ||
141 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
142 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
143 | 12 | # GNU General Public License for more details. | ||
144 | 13 | # | ||
145 | 14 | # You should have received a copy of the GNU General Public License | ||
146 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
147 | 16 | # | ||
148 | 17 | # Authored by: Renato Araujo Oliveira Filho <renato@canonical.com> | ||
149 | 18 | 0 | ||
150 | === removed file 'tests/autopilot/ubuntu_clock_app/emulators/main_window.py' | |||
151 | --- tests/autopilot/ubuntu_clock_app/emulators/main_window.py 2013-08-07 13:39:51 +0000 | |||
152 | +++ tests/autopilot/ubuntu_clock_app/emulators/main_window.py 1970-01-01 00:00:00 +0000 | |||
153 | @@ -1,112 +0,0 @@ | |||
154 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | ||
155 | 2 | # | ||
156 | 3 | # Copyright (C) 2013 Canonical Ltd | ||
157 | 4 | # | ||
158 | 5 | # This program is free software: you can redistribute it and/or modify | ||
159 | 6 | # it under the terms of the GNU General Public License version 3 as | ||
160 | 7 | # published by the Free Software Foundation. | ||
161 | 8 | # | ||
162 | 9 | # This program is distributed in the hope that it will be useful, | ||
163 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
164 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
165 | 12 | # GNU General Public License for more details. | ||
166 | 13 | # | ||
167 | 14 | # You should have received a copy of the GNU General Public License | ||
168 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
169 | 16 | # | ||
170 | 17 | # Authored by: Renato Araujo Oliveira Filho <renato@canonical.com> | ||
171 | 18 | # Nekhelesh Ramananthan <krnekhelesh@gmail.com> | ||
172 | 19 | |||
173 | 20 | |||
174 | 21 | class MainWindow(object): | ||
175 | 22 | """An emulator class that makes it easy to interact with the clock-app.""" | ||
176 | 23 | |||
177 | 24 | def __init__(self, app): | ||
178 | 25 | self.app = app | ||
179 | 26 | |||
180 | 27 | def get_qml_view(self): | ||
181 | 28 | """Get the main QML view""" | ||
182 | 29 | return self.app.select_single("QQuickView") | ||
183 | 30 | |||
184 | 31 | def get_object(self, typeName, name): | ||
185 | 32 | return self.app.select_single(typeName, objectName=name) | ||
186 | 33 | |||
187 | 34 | def get_object_by_id(self, typeName, objectId): | ||
188 | 35 | return self.app.select_single(typeName, id=objectId) | ||
189 | 36 | |||
190 | 37 | def get_stopwatch_tab_button(self): | ||
191 | 38 | """Returns the stopwatch tab.""" | ||
192 | 39 | return self.app.select_single("AbstractButton", buttonIndex=3) | ||
193 | 40 | |||
194 | 41 | def get_stopwatch_label(self): | ||
195 | 42 | """Returns the select for the stopwatch label""" | ||
196 | 43 | return self.app.select_single("Label", objectName="labelStopwatch") | ||
197 | 44 | |||
198 | 45 | def get_stopwatch_button(self): | ||
199 | 46 | """Returns the select for the stopwatch button""" | ||
200 | 47 | return self.app.select_single("AnalogStopwatch", objectName="buttonStopwatch") | ||
201 | 48 | |||
202 | 49 | def get_lap_button(self): | ||
203 | 50 | """Returns the select for the lap button""" | ||
204 | 51 | return self.app.select_single("Button", objectName="lapButton") | ||
205 | 52 | |||
206 | 53 | def get_reset_button(self): | ||
207 | 54 | """Returns the select for the reset button""" | ||
208 | 55 | return self.app.select_single("ImageButton", objectName="resetButton") | ||
209 | 56 | |||
210 | 57 | def get_laps(self): | ||
211 | 58 | """Returns the select for the lap count""" | ||
212 | 59 | return self.app.select_single("ListModel", objectName="laps") | ||
213 | 60 | |||
214 | 61 | def get_timer_tab_button(self): | ||
215 | 62 | """Returns the timer tab.""" | ||
216 | 63 | return self.app.select_single("AbstractButton", buttonIndex=2) | ||
217 | 64 | |||
218 | 65 | def get_toolbar_timer(self): | ||
219 | 66 | """Returns the toolbar of timer tab""" | ||
220 | 67 | return self.app.select_single("ToolbarItems") | ||
221 | 68 | |||
222 | 69 | def get_toolbar_timer_button(self, button_idx): | ||
223 | 70 | """Returns a button of toolbar of timer tab""" | ||
224 | 71 | toolbar = self.app.select_single("ToolbarItems") | ||
225 | 72 | button = toolbar.get_children() | ||
226 | 73 | return button[button_idx] | ||
227 | 74 | |||
228 | 75 | def get_toolbar_timer_add_preset_button(self): | ||
229 | 76 | """Returns the button for add preset of toolbar of timer tab""" | ||
230 | 77 | return self.get_toolbar_timer_button(1) | ||
231 | 78 | |||
232 | 79 | def get_timer_name_preset(self): | ||
233 | 80 | """Returns the TextField where insert the name of the preset""" | ||
234 | 81 | return self.app.select_single("TextField", objectName="namePreset") | ||
235 | 82 | |||
236 | 83 | def get_timer_hour_hand(self): | ||
237 | 84 | """Returns the hour hand of clock in timer tab""" | ||
238 | 85 | return self.app.select_single("AnalogTouchHand", objectName="hourHand") | ||
239 | 86 | |||
240 | 87 | def get_timer_clock_center_label(self): | ||
241 | 88 | """Returns the label in the center of clock""" | ||
242 | 89 | return self.app.select_single("Label", objectName="addPresetTextDone") | ||
243 | 90 | |||
244 | 91 | def get_preset_label_text(self): | ||
245 | 92 | """Returns the label with the preset text""" | ||
246 | 93 | preset = self.app.select_many("Label", objectName="presetTextLabel") | ||
247 | 94 | return preset[0] #last preset, the one created by autopilot | ||
248 | 95 | |||
249 | 96 | def get_preset_label_timer(self): | ||
250 | 97 | """Returns the label with the preset timer""" | ||
251 | 98 | preset = self.app.select_many("Label", objectName="presetTimerLabel") | ||
252 | 99 | return preset[0] #last preset, the one created by autopilot | ||
253 | 100 | |||
254 | 101 | def get_label_timer(self): | ||
255 | 102 | """Return the label with the timer countdown""" | ||
256 | 103 | return self.app.select_single("Label", objectName="labelTimer") | ||
257 | 104 | |||
258 | 105 | def get_num_of_presets(self): | ||
259 | 106 | """Returns the number of presets in the timer page.""" | ||
260 | 107 | timer_page = self.app.select_single("TimerPage") | ||
261 | 108 | return timer_page.select_single("QQuickListView").count | ||
262 | 109 | |||
263 | 110 | def get_first_preset_list_item(self): | ||
264 | 111 | """Returns the first preset list item in the timer page.""" | ||
265 | 112 | return self.app.select_single("Standard", objectName="preset0") | ||
266 | 113 | 0 | ||
267 | === modified file 'tests/autopilot/ubuntu_clock_app/tests/__init__.py' | |||
268 | --- tests/autopilot/ubuntu_clock_app/tests/__init__.py 2013-08-07 15:48:05 +0000 | |||
269 | +++ tests/autopilot/ubuntu_clock_app/tests/__init__.py 2013-08-12 17:47:04 +0000 | |||
270 | @@ -28,13 +28,13 @@ | |||
271 | 28 | from autopilot.matchers import Eventually | 28 | from autopilot.matchers import Eventually |
272 | 29 | from testtools.matchers import GreaterThan | 29 | from testtools.matchers import GreaterThan |
273 | 30 | 30 | ||
276 | 31 | from ubuntu_clock_app.emulators.main_window import MainWindow | 31 | from ubuntuuitoolkit import emulators as toolkit_emulators |
277 | 32 | 32 | from ubuntu_clock_app import emulators | |
278 | 33 | 33 | ||
279 | 34 | class ClockAppTestCase(AutopilotTestCase): | 34 | class ClockAppTestCase(AutopilotTestCase): |
280 | 35 | 35 | ||
281 | 36 | """A common test case class that provides several useful methods for | 36 | """A common test case class that provides several useful methods for |
283 | 37 | clock-app tests. | 37 | calendar-app tests. |
284 | 38 | 38 | ||
285 | 39 | """ | 39 | """ |
286 | 40 | if model() == 'Desktop': | 40 | if model() == 'Desktop': |
287 | @@ -56,65 +56,18 @@ | |||
288 | 56 | self.app = self.launch_test_application( | 56 | self.app = self.launch_test_application( |
289 | 57 | "qmlscene", | 57 | "qmlscene", |
290 | 58 | self.local_location, | 58 | self.local_location, |
292 | 59 | app_type='qt') | 59 | app_type='qt', |
293 | 60 | emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase) | ||
294 | 60 | 61 | ||
295 | 61 | def launch_test_installed(self): | 62 | def launch_test_installed(self): |
296 | 62 | self.app = self.launch_test_application( | 63 | self.app = self.launch_test_application( |
297 | 63 | "qmlscene", | 64 | "qmlscene", |
298 | 64 | "/usr/share/ubuntu-clock-app/ubuntu-clock-app.qml", | 65 | "/usr/share/ubuntu-clock-app/ubuntu-clock-app.qml", |
351 | 65 | "--desktop_file_hint=/usr/share/applications/ubuntu-clock-app.desktop", | 66 | "--desktop_file_hint=/usr/share/applications/" |
352 | 66 | app_type='qt') | 67 | "ubuntu-clock-app.desktop", |
353 | 67 | 68 | app_type='qt', | |
354 | 68 | def get_toolbar(self): | 69 | emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase) |
303 | 69 | return self.app.select_single("Toolbar") | ||
304 | 70 | |||
305 | 71 | #shamelessly pulled and adapted from the ubuntusdk emulator unmerged code, 6 Aug 13 | ||
306 | 72 | #need to migrate to ubuntusdk emulator | ||
307 | 73 | def get_tabs(self): | ||
308 | 74 | return self.app.select_single("TabBar") | ||
309 | 75 | |||
310 | 76 | def switch_to_next_tab(self): | ||
311 | 77 | """Open the next tab.""" | ||
312 | 78 | self.pointing_device.click_object(self._get_current_tab_button()) | ||
313 | 79 | self.pointing_device.click_object(self._get_next_tab_button()) | ||
314 | 80 | |||
315 | 81 | def _get_current_tab_button(self): | ||
316 | 82 | tabs = self.get_tabs() | ||
317 | 83 | #return tabs.tabs.select_many('AbstractButton', selected=True) <--- can't do this | ||
318 | 84 | #clock has 8 buttons, a duplicate of each tab for some reason. | ||
319 | 85 | #Sometimes 2 buttons are shown as selected. If this is the case, we want the second one. | ||
320 | 86 | #Looping through them in this horrible way accomplishes our goal | ||
321 | 87 | buttons = tabs.select_many('AbstractButton') | ||
322 | 88 | for button in buttons: | ||
323 | 89 | if button.selected == True: | ||
324 | 90 | selectedButton = button | ||
325 | 91 | return selectedButton | ||
326 | 92 | |||
327 | 93 | def _get_next_tab_button(self): | ||
328 | 94 | current_index = self._get_current_tab_button().buttonIndex | ||
329 | 95 | next_index = (current_index + 1) % self._get_number_of_tab_buttons() | ||
330 | 96 | return self._get_tab_buttons()[next_index] | ||
331 | 97 | |||
332 | 98 | def _get_number_of_tab_buttons(self): | ||
333 | 99 | return len(self._get_tab_buttons()) | ||
334 | 100 | |||
335 | 101 | def _get_tab_buttons(self): | ||
336 | 102 | tabs = self.get_tabs() | ||
337 | 103 | return tabs.select_many('AbstractButton') | ||
338 | 104 | |||
339 | 105 | def move_to_stopwatch_tab(self): | ||
340 | 106 | #stopwatch is 3 tabs over from clock | ||
341 | 107 | #we really need better tab support to support moving to tab based on objectName | ||
342 | 108 | self.switch_to_next_tab() | ||
343 | 109 | self.switch_to_next_tab() | ||
344 | 110 | self.switch_to_next_tab() | ||
345 | 111 | |||
346 | 112 | def move_to_timer_tab(self): | ||
347 | 113 | #timer is 2 tabs over from clock | ||
348 | 114 | #we really need better tab support to support moving to tab based on objectName | ||
349 | 115 | self.switch_to_next_tab() | ||
350 | 116 | self.switch_to_next_tab() | ||
355 | 117 | 70 | ||
356 | 118 | @property | 71 | @property |
359 | 119 | def main_window(self): | 72 | def main_view(self): |
360 | 120 | return MainWindow(self.app) | 73 | return self.app.select_single(emulators.MainView) |
361 | 121 | 74 | ||
362 | === modified file 'tests/autopilot/ubuntu_clock_app/tests/test_clock.py' | |||
363 | --- tests/autopilot/ubuntu_clock_app/tests/test_clock.py 2013-05-27 07:48:32 +0000 | |||
364 | +++ tests/autopilot/ubuntu_clock_app/tests/test_clock.py 2013-08-12 17:47:04 +0000 | |||
365 | @@ -35,14 +35,14 @@ | |||
366 | 35 | def setUp(self): | 35 | def setUp(self): |
367 | 36 | super(TestClock, self).setUp() | 36 | super(TestClock, self).setUp() |
368 | 37 | self.assertThat( | 37 | self.assertThat( |
370 | 38 | self.main_window.get_qml_view().visible, Eventually(Equals(True))) | 38 | self.main_view.visible, Eventually(Equals(True))) |
371 | 39 | 39 | ||
372 | 40 | def tearDown(self): | 40 | def tearDown(self): |
373 | 41 | super(TestClock, self).tearDown() | 41 | super(TestClock, self).tearDown() |
374 | 42 | 42 | ||
375 | 43 | """ Test if the clock labels contains the correct time """ | 43 | """ Test if the clock labels contains the correct time """ |
376 | 44 | def test_label_value(self): | 44 | def test_label_value(self): |
378 | 45 | label = self.main_window.get_object("Label", "currentTimeLabel") | 45 | label = self.main_view.get_time_label() |
379 | 46 | 46 | ||
380 | 47 | # TODO: investigate a way to get the system wide format for time | 47 | # TODO: investigate a way to get the system wide format for time |
381 | 48 | # and compare the values | 48 | # and compare the values |
382 | 49 | 49 | ||
383 | === modified file 'tests/autopilot/ubuntu_clock_app/tests/test_stopwatch.py' | |||
384 | --- tests/autopilot/ubuntu_clock_app/tests/test_stopwatch.py 2013-08-07 16:18:35 +0000 | |||
385 | +++ tests/autopilot/ubuntu_clock_app/tests/test_stopwatch.py 2013-08-12 17:47:04 +0000 | |||
386 | @@ -32,13 +32,12 @@ | |||
387 | 32 | In the testfarm, the application may take some time to show up.""" | 32 | In the testfarm, the application may take some time to show up.""" |
388 | 33 | def setUp(self): | 33 | def setUp(self): |
389 | 34 | super(TestStopwatch, self).setUp() | 34 | super(TestStopwatch, self).setUp() |
397 | 35 | self.assertThat(self.main_window.get_qml_view().visible, Eventually(Equals(True))) | 35 | self.assertThat( |
398 | 36 | 36 | self.main_view.visible, Eventually(Equals(True))) | |
399 | 37 | self.move_to_stopwatch_tab() | 37 | |
400 | 38 | 38 | #move to stopwatch tab | |
401 | 39 | # Test if the current Tab is the Stopwatch Tab | 39 | #ignoring the emulator tab functions until fixed |
402 | 40 | CurrentTab = self.main_window.get_object("Tab", "StopwatchTab") | 40 | self.main_view.switch_to_tab("StopwatchTab") |
396 | 41 | self.assertThat(CurrentTab.title, Eventually(Equals("Stopwatch"))) | ||
403 | 42 | 41 | ||
404 | 43 | def tearDown(self): | 42 | def tearDown(self): |
405 | 44 | super(TestStopwatch, self).tearDown() | 43 | super(TestStopwatch, self).tearDown() |
406 | @@ -46,23 +45,24 @@ | |||
407 | 46 | def test_start_stop_reset_stopwatch(self): | 45 | def test_start_stop_reset_stopwatch(self): |
408 | 47 | """Test to check the proper functioning of the start/stop/reset of stopwatch""" | 46 | """Test to check the proper functioning of the start/stop/reset of stopwatch""" |
409 | 48 | 47 | ||
411 | 49 | start_stop_button = self.main_window.get_stopwatch_button() | 48 | start_stop_button = self.main_view.get_stopwatch_button() |
412 | 50 | self.assertThat(lambda: start_stop_button, Eventually(NotEquals(None))) | 49 | self.assertThat(lambda: start_stop_button, Eventually(NotEquals(None))) |
414 | 51 | stopwatch_label = self.main_window.get_stopwatch_label() | 50 | stopwatch_label = self.main_view.get_stopwatch_label() |
415 | 52 | self.assertThat(lambda: stopwatch_label, Eventually(NotEquals(None))) | 51 | self.assertThat(lambda: stopwatch_label, Eventually(NotEquals(None))) |
417 | 53 | reset_button = self.main_window.get_reset_button() | 52 | reset_button = self.main_view.get_reset_button() |
418 | 54 | self.assertThat(lambda: reset_button, Eventually(NotEquals(None))) | 53 | self.assertThat(lambda: reset_button, Eventually(NotEquals(None))) |
419 | 55 | 54 | ||
420 | 56 | # Press the start button to start the stopwatch | 55 | # Press the start button to start the stopwatch |
421 | 56 | stopwatch_label_before = self.main_view.get_stopwatch_label().text | ||
422 | 57 | self.assertThat(lambda: stopwatch_label_before, Eventually(NotEquals(None))) | ||
423 | 57 | self.pointing_device.click_object(start_stop_button) | 58 | self.pointing_device.click_object(start_stop_button) |
424 | 58 | self.assertThat(stopwatch_label.text, Eventually(NotEquals("00:00.0"))) | 59 | self.assertThat(stopwatch_label.text, Eventually(NotEquals("00:00.0"))) |
425 | 59 | 60 | ||
426 | 60 | # Press stop and check if the stopwatch has indeed stopped | 61 | # Press stop and check if the stopwatch has indeed stopped |
427 | 61 | stopwatch_label_before = self.main_window.get_stopwatch_label().text | ||
428 | 62 | self.pointing_device.click_object(start_stop_button) | 62 | self.pointing_device.click_object(start_stop_button) |
432 | 63 | self.assertThat(stopwatch_label_before, NotEquals(self.main_window.get_stopwatch_label().text)) | 63 | self.assertThat(stopwatch_label_before, NotEquals(self.main_view.get_stopwatch_label().text)) |
433 | 64 | stopwatch_label_after = lambda: self.main_window.get_stopwatch_label().text | 64 | stopwatch_label_after = lambda: self.main_view.get_stopwatch_label().text |
434 | 65 | self.assertThat(stopwatch_label_after, Eventually(Equals(self.main_window.get_stopwatch_label().text))) | 65 | self.assertThat(stopwatch_label_after, Eventually(Equals(self.main_view.get_stopwatch_label().text))) |
435 | 66 | 66 | ||
436 | 67 | # Press reset and check if the stopwatch has been resetted | 67 | # Press reset and check if the stopwatch has been resetted |
437 | 68 | self.pointing_device.click_object(reset_button) | 68 | self.pointing_device.click_object(reset_button) |
438 | 69 | 69 | ||
439 | === modified file 'tests/autopilot/ubuntu_clock_app/tests/test_timer.py' | |||
440 | --- tests/autopilot/ubuntu_clock_app/tests/test_timer.py 2013-08-07 16:18:35 +0000 | |||
441 | +++ tests/autopilot/ubuntu_clock_app/tests/test_timer.py 2013-08-12 17:47:04 +0000 | |||
442 | @@ -33,17 +33,17 @@ | |||
443 | 33 | In the testfarm, the application may take some time to show up.""" | 33 | In the testfarm, the application may take some time to show up.""" |
444 | 34 | def setUp(self): | 34 | def setUp(self): |
445 | 35 | super(TestTimer, self).setUp() | 35 | super(TestTimer, self).setUp() |
453 | 36 | self.assertThat(self.main_window.get_qml_view().visible, Eventually(Equals(True))) | 36 | self.assertThat( |
454 | 37 | 37 | self.main_view.visible, Eventually(Equals(True))) | |
455 | 38 | self.move_to_timer_tab() | 38 | |
456 | 39 | 39 | #move to timer tab | |
457 | 40 | # Test if the current Tab is the Timer Tab | 40 | #ignoring the emulator tab functions until fixed |
458 | 41 | CurrentTab = self.main_window.get_object("Tab", "TimerTab") | 41 | self.main_view.switch_to_tab("TimerTab") |
452 | 42 | self.assertThat(CurrentTab.title, Eventually(Equals("Timer"))) | ||
459 | 43 | 42 | ||
460 | 44 | 43 | ||
461 | 45 | def drag_page_up_to_show_input_box(self): | 44 | def drag_page_up_to_show_input_box(self): |
463 | 46 | timer_page = self.app.select_single("TimerPage") | 45 | timer_page = self.select_single("TimerPage") |
464 | 46 | self.assertThat(timer_page, Eventually(NotEquals(None))) | ||
465 | 47 | 47 | ||
466 | 48 | x, y, w, h = timer_page.globalRect | 48 | x, y, w, h = timer_page.globalRect |
467 | 49 | tx = x + (w / 2) | 49 | tx = x + (w / 2) |
468 | @@ -55,7 +55,8 @@ | |||
469 | 55 | Eventually(Equals(False))) | 55 | Eventually(Equals(False))) |
470 | 56 | 56 | ||
471 | 57 | def drag_page_down_to_previous_state(self): | 57 | def drag_page_down_to_previous_state(self): |
473 | 58 | timer_page = self.app.select_single("TimerPage") | 58 | timer_page = self.select_single("TimerPage") |
474 | 59 | self.assertThat(timer_page, Eventually(NotEquals(None))) | ||
475 | 59 | 60 | ||
476 | 60 | x, y, w, h = timer_page.globalRect | 61 | x, y, w, h = timer_page.globalRect |
477 | 61 | tx = x + (w / 2) | 62 | tx = x + (w / 2) |
478 | @@ -66,46 +67,24 @@ | |||
479 | 66 | timer_page.select_single("AnimationContainer").moving, | 67 | timer_page.select_single("AnimationContainer").moving, |
480 | 67 | Eventually(Equals(False))) | 68 | Eventually(Equals(False))) |
481 | 68 | 69 | ||
482 | 69 | |||
483 | 70 | def open_toolbar(self): | ||
484 | 71 | toolbar = self.get_toolbar() | ||
485 | 72 | |||
486 | 73 | x, y, w, h = toolbar.globalRect | ||
487 | 74 | tx = x + (w / 2) | ||
488 | 75 | ty = y + (h - (h / 8)) | ||
489 | 76 | |||
490 | 77 | self.pointing_device.drag(tx, ty, tx, ty - h) | ||
491 | 78 | self.assertThat(toolbar.animating, Eventually(Equals(False))) | ||
492 | 79 | #self.assertThat(toolbar.state, Eventually(Equals("spread"))) | ||
493 | 80 | |||
494 | 81 | def close_toolbar(self): | ||
495 | 82 | toolbar = self.get_toolbar() | ||
496 | 83 | |||
497 | 84 | x, y, w, h = toolbar.globalRect | ||
498 | 85 | tx = x + (w / 2) | ||
499 | 86 | ty = y + (h - (h / 8)) | ||
500 | 87 | |||
501 | 88 | self.pointing_device.drag(tx, ty - h, tx, ty) | ||
502 | 89 | self.assertThat(toolbar.animating, Eventually(Equals(False))) | ||
503 | 90 | #self.assertThat(toolbar.state, Eventually(NotEquals("spread"))) | ||
504 | 91 | |||
505 | 92 | def test_add_preset(self): | 70 | def test_add_preset(self): |
506 | 93 | """Test to check if button to add a preset working""" | 71 | """Test to check if button to add a preset working""" |
507 | 94 | 72 | ||
508 | 95 | # Show the toolbar | 73 | # Show the toolbar |
510 | 96 | self.open_toolbar() | 74 | self.main_view.open_toolbar() |
511 | 97 | 75 | ||
512 | 98 | # Click the add preset button | 76 | # Click the add preset button |
514 | 99 | add_preset_button = self.main_window.get_toolbar_timer_add_preset_button() | 77 | add_preset_button = self.main_view.get_toolbar_timer_add_preset_button() |
515 | 78 | self.assertThat(lambda: add_preset_button, Eventually(NotEquals(None))) | ||
516 | 100 | self.pointing_device.click_object(add_preset_button) | 79 | self.pointing_device.click_object(add_preset_button) |
517 | 101 | 80 | ||
518 | 102 | #For now close the toolbar due to https://bugs.launchpad.net/ubuntu-clock-app/+bug/1209024 | 81 | #For now close the toolbar due to https://bugs.launchpad.net/ubuntu-clock-app/+bug/1209024 |
520 | 103 | self.close_toolbar() | 82 | self.main_view.close_toolbar() |
521 | 104 | 83 | ||
522 | 105 | # Write in the label | 84 | # Write in the label |
523 | 106 | if model() != "Desktop": | 85 | if model() != "Desktop": |
524 | 107 | self.drag_page_up_to_show_input_box() | 86 | self.drag_page_up_to_show_input_box() |
526 | 108 | label = self.main_window.get_timer_name_preset() | 87 | label = self.main_view.get_timer_name_preset() |
527 | 109 | self.assertThat(lambda: label, Eventually(NotEquals(None))) | 88 | self.assertThat(lambda: label, Eventually(NotEquals(None))) |
528 | 110 | self.pointing_device.click_object(label) | 89 | self.pointing_device.click_object(label) |
529 | 111 | self.assertThat(label.focus, Eventually(Equals(True))) | 90 | self.assertThat(label.focus, Eventually(Equals(True))) |
530 | @@ -116,20 +95,22 @@ | |||
531 | 116 | self.drag_page_down_to_previous_state() | 95 | self.drag_page_down_to_previous_state() |
532 | 117 | 96 | ||
533 | 118 | # Set hour | 97 | # Set hour |
535 | 119 | hour = self.main_window.get_timer_hour_hand() | 98 | hour = self.main_view.get_timer_hour_hand() |
536 | 120 | self.assertThat(lambda: hour, Eventually(NotEquals(None))) | 99 | self.assertThat(lambda: hour, Eventually(NotEquals(None))) |
537 | 121 | x, y, w, h = hour.globalRect | 100 | x, y, w, h = hour.globalRect |
538 | 122 | tx = x + (w / 2) | 101 | tx = x + (w / 2) |
539 | 123 | ty = y + (h / 2) | 102 | ty = y + (h / 2) |
540 | 124 | self.pointing_device.drag(tx, ty - (h / 4), tx + (w / 2), ty + (h / 2)) | 103 | self.pointing_device.drag(tx, ty - (h / 4), tx + (w / 2), ty + (h / 2)) |
541 | 125 | 104 | ||
543 | 126 | num_of_presets_old = int(self.main_window.get_num_of_presets()) | 105 | num_of_presets_old = self.main_view.get_num_of_presets() |
544 | 106 | self.assertThat(lambda: num_of_presets_old, Eventually(NotEquals(None))) | ||
545 | 127 | # Press "Done" button | 107 | # Press "Done" button |
547 | 128 | label = self.main_window.get_timer_clock_center_label() | 108 | label = self.main_view.get_timer_clock_center_label() |
548 | 109 | self.assertThat(lambda: label, Eventually(NotEquals(None))) | ||
549 | 129 | self.pointing_device.click_object(label) | 110 | self.pointing_device.click_object(label) |
550 | 130 | 111 | ||
551 | 131 | # Check if the preset has been saved | 112 | # Check if the preset has been saved |
553 | 132 | self.assertThat(self.main_window.get_num_of_presets(), | 113 | self.assertThat(self.main_view.get_num_of_presets, |
554 | 133 | Eventually(Equals(num_of_presets_old+1))) | 114 | Eventually(Equals(num_of_presets_old+1))) |
555 | 134 | 115 | ||
556 | 135 | def test_delete_preset(self): | 116 | def test_delete_preset(self): |
557 | @@ -138,8 +119,9 @@ | |||
558 | 138 | # Create a new preset | 119 | # Create a new preset |
559 | 139 | self.test_add_preset() | 120 | self.test_add_preset() |
560 | 140 | 121 | ||
563 | 141 | num_of_presets_old = int(self.main_window.get_num_of_presets()) | 122 | num_of_presets_old = self.main_view.get_num_of_presets() |
564 | 142 | first_preset = self.main_window.get_first_preset_list_item() | 123 | self.assertThat(lambda: num_of_presets_old, Eventually(NotEquals(None))) |
565 | 124 | first_preset = self.main_view.get_first_preset_list_item() | ||
566 | 143 | self.assertThat(lambda: first_preset, Eventually(NotEquals(None))) | 125 | self.assertThat(lambda: first_preset, Eventually(NotEquals(None))) |
567 | 144 | 126 | ||
568 | 145 | if model() != "Desktop": | 127 | if model() != "Desktop": |
569 | @@ -151,7 +133,7 @@ | |||
570 | 151 | self.pointing_device.drag(tx, ty, w - w / 8, ty) | 133 | self.pointing_device.drag(tx, ty, w - w / 8, ty) |
571 | 152 | 134 | ||
572 | 153 | # Check has been deleted | 135 | # Check has been deleted |
574 | 154 | self.assertThat(self.main_window.get_num_of_presets(), | 136 | self.assertThat(self.main_view.get_num_of_presets, |
575 | 155 | Eventually(Equals(num_of_presets_old-1))) | 137 | Eventually(Equals(num_of_presets_old-1))) |
576 | 156 | 138 | ||
577 | 157 | def test_run_preset(self): | 139 | def test_run_preset(self): |
578 | @@ -161,7 +143,7 @@ | |||
579 | 161 | self.test_add_preset() | 143 | self.test_add_preset() |
580 | 162 | 144 | ||
581 | 163 | # Click to select the preset | 145 | # Click to select the preset |
583 | 164 | first_preset = self.main_window.get_first_preset_list_item() | 146 | first_preset = self.main_view.get_first_preset_list_item() |
584 | 165 | self.assertThat(lambda: first_preset, Eventually(NotEquals(None))) | 147 | self.assertThat(lambda: first_preset, Eventually(NotEquals(None))) |
585 | 166 | if model() != "Desktop": | 148 | if model() != "Desktop": |
586 | 167 | self.drag_page_up_to_show_input_box() | 149 | self.drag_page_up_to_show_input_box() |
587 | @@ -171,9 +153,11 @@ | |||
588 | 171 | self.drag_page_down_to_previous_state() | 153 | self.drag_page_down_to_previous_state() |
589 | 172 | 154 | ||
590 | 173 | # Click to start the preset | 155 | # Click to start the preset |
592 | 174 | label = self.main_window.get_timer_clock_center_label() | 156 | label = self.main_view.get_timer_clock_center_label() |
593 | 157 | self.assertThat(lambda: label, Eventually(NotEquals(None))) | ||
594 | 175 | self.pointing_device.click_object(label) | 158 | self.pointing_device.click_object(label) |
595 | 176 | 159 | ||
596 | 177 | # Check if timer is started | 160 | # Check if timer is started |
598 | 178 | label_timer = self.main_window.get_label_timer() | 161 | label_timer = self.main_view.get_label_timer() |
599 | 162 | self.assertThat(lambda: label_timer, Eventually(NotEquals(None))) | ||
600 | 179 | self.assertThat(label_timer.text, Eventually(NotEquals("23:00:00"))) | 163 | self.assertThat(label_timer.text, Eventually(NotEquals("23:00:00"))) |
FAILED: Continuous integration, rev:170 91.189. 93.70:8080/ job/ubuntu- clock-app- ci/26/ 91.189. 93.70:8080/ job/generic- mediumtests/ 316 91.189. 93.70:8080/ job/ubuntu- clock-app- precise- amd64-ci/ 12 91.189. 93.70:8080/ job/ubuntu- clock-app- quantal- amd64-ci/ 26 91.189. 93.70:8080/ job/ubuntu- clock-app- raring- amd64-ci/ 26 91.189. 93.70:8080/ job/ubuntu- clock-app- saucy-amd64- ci/12
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/ubuntu- clock-app- ci/26/rebuild
http://