Merge lp:~nskaggs/stock-ticker-mobile-app/test-click-support into lp:stock-ticker-mobile-app
- test-click-support
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Nicholas Skaggs |
Approved revision: | 72 |
Merged at revision: | 65 |
Proposed branch: | lp:~nskaggs/stock-ticker-mobile-app/test-click-support |
Merge into: | lp:stock-ticker-mobile-app |
Diff against target: |
789 lines (+227/-312) 9 files modified
debian/control (+13/-2) debian/stock-ticker-mobile-app-autopilot.install (+1/-0) tests/autopilot/stock_ticker/emulators.py (+67/-0) tests/autopilot/stock_ticker/emulators/__init__.py (+0/-17) tests/autopilot/stock_ticker/emulators/ubuntusdk.py (+0/-153) tests/autopilot/stock_ticker/tests/__init__.py (+68/-23) tests/autopilot/stock_ticker/tests/test_Management_page.py (+20/-48) tests/autopilot/stock_ticker/tests/test_Subtabs.py (+41/-49) tests/autopilot/stock_ticker/tests/test_Toolbar_actions.py (+17/-20) |
To merge this branch: | bzr merge lp:~nskaggs/stock-ticker-mobile-app/test-click-support |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Robert Steckroth | Approve | ||
Stock Ticker Developers | Pending | ||
Review via email: mp+187950@code.launchpad.net |
Commit message
This converts everything to using ubuntuuitoolkit emulator for the autopilot tests as well as allows the app to be tested via a click package
Description of the change
This converts everything to using ubuntuuitoolkit emulator for the autopilot tests as well as allows the app to be tested via a click package
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:69
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:69
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:69
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 70. By Nicholas Skaggs
-
add multimedia required package, tweak db logging, set proper directory
- 71. By Nicholas Skaggs
-
fix test management
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:71
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 72. By Nicholas Skaggs
-
add autopilot packaging install file
Nicholas Skaggs (nskaggs) wrote : | # |
Robert, do you know why this might be failing? I'm unsure if something in the qml doesn't confirm so that it is unable to use the emulator.
Robert Steckroth (robertsteckroth) wrote : | # |
AUtopilot revamp is not working and approved for development.
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:72
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) : | # |
Nicholas Skaggs (nskaggs) wrote : | # |
Robert, I opened https:/
Preview Diff
1 | === modified file 'debian/control' |
2 | --- debian/control 2013-06-13 20:26:45 +0000 |
3 | +++ debian/control 2013-10-09 19:09:47 +0000 |
4 | @@ -1,5 +1,5 @@ |
5 | Source: stock-ticker-mobile-app |
6 | -Section: misc |
7 | +Section: misc |
8 | Priority: extra |
9 | Maintainer: Robert Steckroth, surgemcgee <RobertSteckroth@gmail.com> |
10 | Build-Depends: debhelper (>= 9) |
11 | @@ -15,9 +15,20 @@ |
12 | qtdeclarative5-qtquick2-plugin, |
13 | qtdeclarative5-ubuntu-ui-toolkit-plugin | qt-components-ubuntu, |
14 | qtdeclarative5-localstorage-plugin, |
15 | - qtdeclarative5-xmllistmodel-plugin |
16 | + qtdeclarative5-xmllistmodel-plugin, |
17 | + qtdeclarative5-qtmultimedia-plugin |
18 | Description: A stock trading app with charts, news, and management |
19 | Combining advanced features that are omitted from similar apps with a compact and easy to use design. |
20 | Features include: interactive charts, user customizations, sorting, section resizing, and search auto-complete. |
21 | |
22 | +Package: stock-ticker-mobile-app-autopilot |
23 | +Architecture: all |
24 | +Depends: libautopilot-qt, |
25 | + libqt5test5, |
26 | + stock-ticker-mobile-app (= ${source:Version}), |
27 | + python-dateutil, |
28 | + ubuntu-ui-toolkit-autopilot, |
29 | +Description: Autopilot tests for stock ticker Application |
30 | + This package contains autopilot tests for the stock ticker application. |
31 | + |
32 | |
33 | |
34 | === added file 'debian/stock-ticker-mobile-app-autopilot.install' |
35 | --- debian/stock-ticker-mobile-app-autopilot.install 1970-01-01 00:00:00 +0000 |
36 | +++ debian/stock-ticker-mobile-app-autopilot.install 2013-10-09 19:09:47 +0000 |
37 | @@ -0,0 +1,1 @@ |
38 | +tests/autopilot/stock_ticker/* usr/lib/python2.7/dist-packages/stock_ticker/ |
39 | |
40 | === removed directory 'tests/autopilot/stock_ticker/emulators' |
41 | === added file 'tests/autopilot/stock_ticker/emulators.py' |
42 | --- tests/autopilot/stock_ticker/emulators.py 1970-01-01 00:00:00 +0000 |
43 | +++ tests/autopilot/stock_ticker/emulators.py 2013-10-09 19:09:47 +0000 |
44 | @@ -0,0 +1,67 @@ |
45 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
46 | +# |
47 | +# Copyright (C) 2013 Canonical Ltd. |
48 | +# |
49 | +# This program is free software; you can redistribute it and/or modify |
50 | +# it under the terms of the GNU Lesser General Public License as published by |
51 | +# the Free Software Foundation; version 3. |
52 | +# |
53 | +# This program is distributed in the hope that it will be useful, |
54 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
55 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
56 | +# GNU Lesser General Public License for more details. |
57 | +# |
58 | +# You should have received a copy of the GNU Lesser General Public License |
59 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
60 | + |
61 | +from ubuntuuitoolkit import emulators as toolkit_emulators |
62 | + |
63 | + |
64 | +class MainView(toolkit_emulators.MainView): |
65 | + |
66 | + def move_subtabs_bar_up(self): |
67 | + """Moves the subtabs bar to a different location""" |
68 | + qmlView = self.select("QQuickView") |
69 | + sub_bar = self.select("QQuickRectangle", objectName='subTabsBar') |
70 | + button_width = sub_bar.select_single('UbuntuShape', objectName='detailsTab').width |
71 | + self.pointing_device.move_to_object(sub_bar) |
72 | + |
73 | + self.pointing_device.drag( self.pointing_device.x-button_width-5, self.pointing_device.y, |
74 | + self.pointing_device.x-button_width-5, qmlView.height*0.3) |
75 | + |
76 | + def flick_page_up(self, obj): |
77 | + """Moves the pointer around the charts sub tab""" |
78 | + startX = obj.x + 2 |
79 | + stopX = obj.x + obj.width - 2 |
80 | + lineY = obj.y + obj.height - 2 |
81 | + self.pointing_device.drag(startX, lineY, stopX/1.5, obj.y+2) |
82 | + |
83 | + def hold_page_down(self, obj): |
84 | + """Grabs and holds the provided object downwards""" |
85 | + |
86 | + self.pointing_device.move_to_object(obj) |
87 | + self.pointing_device.press() |
88 | + self.pointing_device.move(self.pointing_device.x, obj.y+obj.height+60) |
89 | + |
90 | + def release_mouse_press(self): |
91 | + """Releases the mouse pointer""" |
92 | + self.pointing_device.release() |
93 | + |
94 | + def flick_page_right(self, obj): |
95 | + """Drag the pointer to the right of the provided object""" |
96 | + startX = obj.x + 40 # add the chart left padding |
97 | + stopX = obj.width - 2 |
98 | + lineY = obj.y + obj.height - 2 |
99 | + self.pointing_device.drag(startX, lineY, stopX, lineY/1.5) |
100 | + |
101 | + def after_program_fully_loaded(self): |
102 | + """Returns when all of the applications ActivityIndicator.running state is False.""" |
103 | + |
104 | + add_activity_indicator = self.select('ActivityIndicator', objectName='addActivityIndicator') |
105 | + current_activity_indicator = self.select('ActivityIndicator', objectName='currentActivityIndicator') |
106 | + charts_activity_indicator = self.select('ActivityIndicator', objectName='chartsActivityIndicator') |
107 | + news_activity_indicator = self.select('ActivityIndicator', objectName='newsActivityIndicator') |
108 | + self.assertThat(add_activity_indicator.running, Eventually(Equals(False))) |
109 | + self.assertThat(current_activity_indicator.running, Eventually(Equals(False))) |
110 | + self.assertThat(charts_activity_indicator.running, Eventually(Equals(False))) |
111 | + self.assertThat(news_activity_indicator.running, Eventually(Equals(False))) |
112 | |
113 | === removed file 'tests/autopilot/stock_ticker/emulators/__init__.py' |
114 | --- tests/autopilot/stock_ticker/emulators/__init__.py 2013-07-08 21:08:59 +0000 |
115 | +++ tests/autopilot/stock_ticker/emulators/__init__.py 1970-01-01 00:00:00 +0000 |
116 | @@ -1,17 +0,0 @@ |
117 | -# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
118 | -# |
119 | -# Copyright (C) 2013 Canonical Ltd |
120 | -# |
121 | -# This program is free software: you can redistribute it and/or modify |
122 | -# it under the terms of the GNU General Public License version 3 as |
123 | -# published by the Free Software Foundation. |
124 | -# |
125 | -# This program is distributed in the hope that it will be useful, |
126 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
127 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
128 | -# GNU General Public License for more details. |
129 | -# |
130 | -# You should have received a copy of the GNU General Public License |
131 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
132 | -# |
133 | -# Authored by: Nicholas Skaggs <nicholas.skaggs@canonical.com> |
134 | |
135 | === removed file 'tests/autopilot/stock_ticker/emulators/ubuntusdk.py' |
136 | --- tests/autopilot/stock_ticker/emulators/ubuntusdk.py 2013-07-16 12:36:53 +0000 |
137 | +++ tests/autopilot/stock_ticker/emulators/ubuntusdk.py 1970-01-01 00:00:00 +0000 |
138 | @@ -1,153 +0,0 @@ |
139 | -# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
140 | -# |
141 | -# Copyright (C) 2013 Canonical Ltd |
142 | -# |
143 | -# This program is free software: you can redistribute it and/or modify |
144 | -# it under the terms of the GNU General Public License version 3 as |
145 | -# published by the Free Software Foundation. |
146 | -# |
147 | -# This program is distributed in the hope that it will be useful, |
148 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
149 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
150 | -# GNU General Public License for more details. |
151 | -# |
152 | -# You should have received a copy of the GNU General Public License |
153 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
154 | -# |
155 | -# Authored by: Nicholas Skaggs <nicholas.skaggs@canonical.com> |
156 | -# Robert Steckroth, Surgemcgee Bust0ut <RobertSteckroth@gmail.com> |
157 | - |
158 | -from testtools.matchers import Equals, NotEquals, Not, Is |
159 | -from autopilot.matchers import Eventually |
160 | -import time |
161 | - |
162 | - |
163 | -class ubuntusdk(object): |
164 | - """An emulator class that makes it easy to interact with the ubuntu sdk applications.""" |
165 | - |
166 | - def __init__(self, autopilot, app): |
167 | - self.app = app |
168 | - self.autopilot = autopilot |
169 | - |
170 | - def get_qml_view(self): |
171 | - """Get the main QML view""" |
172 | - return self.app.select_single("QQuickView") |
173 | - |
174 | - def switch_to_tab(self, tab): |
175 | - """Switch to the specified tab number""" |
176 | - tabs = self.app.select_single("Tabs", objectName="rootTabs") |
177 | - currentTab = tabs.selectedTabIndex |
178 | - |
179 | - #perform operations until tab == currentTab |
180 | - while tab != currentTab: |
181 | - if tab < currentTab: |
182 | - self._previous_tab() |
183 | - if tab > currentTab: |
184 | - self._next_tab() |
185 | - currentTab = tabs.selectedTabIndex |
186 | - |
187 | - def click_object(self, obj): |
188 | - self.autopilot.pointing_device.click_object(obj) |
189 | - |
190 | - def move_subtabs_bar_up(self): |
191 | - """Moves the subtabs bar to a different location""" |
192 | - qmlView = self.get_qml_view() |
193 | - sub_bar = self.app.select_single("QQuickRectangle", objectName='subTabsBar') |
194 | - button_width = sub_bar.select_single('UbuntuShape', objectName='detailsTab').width |
195 | - self.autopilot.pointing_device.move_to_object(sub_bar) |
196 | - |
197 | - self.autopilot.pointing_device.drag( self.autopilot.pointing_device.x-button_width-5, self.autopilot.pointing_device.y, |
198 | - self.autopilot.pointing_device.x-button_width-5, qmlView.height*0.3) |
199 | - |
200 | - |
201 | - def flick_page_up(self, obj): |
202 | - """Moves the pointer around the charts sub tab""" |
203 | - startX = obj.x + 2 |
204 | - stopX = obj.x + obj.width - 2 |
205 | - lineY = obj.y + obj.height - 2 |
206 | - self.autopilot.pointing_device.drag(startX, lineY, stopX/1.5, obj.y+2) |
207 | - |
208 | - def hold_page_down(self, obj): |
209 | - """Grabs and holds the provided object downwards""" |
210 | - |
211 | - self.autopilot.pointing_device.move_to_object(obj) |
212 | - self.autopilot.pointing_device.press() |
213 | - self.autopilot.pointing_device.move(self.autopilot.pointing_device.x, obj.y+obj.height+60) |
214 | - |
215 | - def release_mouse_press(self): |
216 | - """Releases the mouse pointer""" |
217 | - self.autopilot.pointing_device.release() |
218 | - |
219 | - |
220 | - def flick_page_right(self, obj): |
221 | - """Drag the pointer to the right of the provided object""" |
222 | - startX = obj.x + 40 # add the chart left padding |
223 | - stopX = obj.width - 2 |
224 | - lineY = obj.y + obj.height - 2 |
225 | - self.autopilot.pointing_device.drag(startX, lineY, stopX, lineY/1.5) |
226 | - |
227 | - def after_program_fully_loaded(self): |
228 | - """Returns when all of the applications ActivityIndicator.running state is False.""" |
229 | - |
230 | - add_activity_indicator = self.app.select_single('ActivityIndicator', objectName='addActivityIndicator') |
231 | - current_activity_indicator = self.app.select_single('ActivityIndicator', objectName='currentActivityIndicator') |
232 | - charts_activity_indicator = self.app.select_single('ActivityIndicator', objectName='chartsActivityIndicator') |
233 | - news_activity_indicator = self.app.select_single('ActivityIndicator', objectName='newsActivityIndicator') |
234 | - self.autopilot.assertThat(add_activity_indicator.running, Eventually(Equals(False))) |
235 | - self.autopilot.assertThat(current_activity_indicator.running, Eventually(Equals(False))) |
236 | - self.autopilot.assertThat(charts_activity_indicator.running, Eventually(Equals(False))) |
237 | - self.autopilot.assertThat(news_activity_indicator.running, Eventually(Equals(False))) |
238 | - |
239 | - |
240 | - def open_toolbar(self): |
241 | - """Open the toolbar""" |
242 | - qmlView = self.get_qml_view() |
243 | - |
244 | - lineX = qmlView.x + qmlView.width * 0.50 |
245 | - startY = qmlView.y + qmlView.height - 1 |
246 | - stopY = qmlView.y + qmlView.height * 0.95 |
247 | - |
248 | - self.autopilot.pointing_device.drag(lineX, startY, lineX, stopY) |
249 | - |
250 | - def hide_toolbar(self): |
251 | - """Hide the toolbar""" |
252 | - qmlView = self.get_qml_view() |
253 | - |
254 | - lineX = qmlView.x + qmlView.width * 0.50 |
255 | - startY = qmlView.y + qmlView.height * 0.95 |
256 | - stopY = qmlView.y + qmlView.height - 1 |
257 | - |
258 | - self.autopilot.pointing_device.drag(lineX, startY, lineX, stopY) |
259 | - |
260 | - def _previous_tab(self): |
261 | - """Switch to the previous tab""" |
262 | - qmlView = self.get_qml_view() |
263 | - |
264 | - startX = qmlView.x + 20 |
265 | - stopX = qmlView.width * .7 |
266 | - lineY = qmlView.y + 20 |
267 | - |
268 | - self.autopilot.pointing_device.drag(startX, lineY, stopX, lineY) |
269 | - self.autopilot.pointing_device.move(stopX-80, lineY) # move back into the previous tab |
270 | - self.autopilot.pointing_device.click() |
271 | - self.autopilot.pointing_device.click() |
272 | - time.sleep(1) # give the app time to move the title text into position |
273 | - |
274 | - def _next_tab(self): |
275 | - """Switch to the next tab""" |
276 | - qmlView = self.get_qml_view() |
277 | - |
278 | - startX = qmlView.x + qmlView.width * 0.90 |
279 | - stopX = qmlView.x + 20 |
280 | - lineY = qmlView.y + 20 |
281 | - |
282 | - self.autopilot.pointing_device.drag(startX, lineY, stopX, lineY) |
283 | - self.autopilot.pointing_device.move(stopX+20, lineY) |
284 | - self.autopilot.pointing_device.click() |
285 | - self.autopilot.pointing_device.click() |
286 | - time.sleep(1) # give the app time to move the title text into position |
287 | - |
288 | - |
289 | - |
290 | - |
291 | - |
292 | |
293 | === modified file 'tests/autopilot/stock_ticker/tests/__init__.py' |
294 | --- tests/autopilot/stock_ticker/tests/__init__.py 2013-07-10 01:46:45 +0000 |
295 | +++ tests/autopilot/stock_ticker/tests/__init__.py 2013-10-09 19:09:47 +0000 |
296 | @@ -13,26 +13,29 @@ |
297 | # |
298 | # You should have received a copy of the GNU General Public License |
299 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
300 | -# |
301 | -# Authored by: Nicholas Skaggs <nicholas.skaggs@canonical.com> |
302 | - |
303 | |
304 | """Stock_ticker autopilot tests.""" |
305 | |
306 | import os.path |
307 | import os |
308 | +import shutil |
309 | +import logging |
310 | |
311 | from autopilot.input import Mouse, Touch, Pointer |
312 | from autopilot.platform import model |
313 | from autopilot.testcase import AutopilotTestCase |
314 | - |
315 | -from stock_ticker.emulators.ubuntusdk import ubuntusdk |
316 | +from autopilot.matchers import Eventually |
317 | +from testtools.matchers import GreaterThan, Equals |
318 | + |
319 | +from ubuntuuitoolkit import emulators as toolkit_emulators |
320 | +from stock_ticker import emulators |
321 | + |
322 | +logger = logging.getLogger(__name__) |
323 | + |
324 | |
325 | class StockTickerTestCase(AutopilotTestCase): |
326 | - |
327 | - """The package base class to provide ubuntu_sdk to the test_Clases with autopilot included and app assinged by autopilot (also used with ubuntu_sdk). |
328 | - |
329 | - """ |
330 | + """A common test case class that provides several useful methods for |
331 | + StockTicker tests.""" |
332 | |
333 | if model() == 'Desktop': |
334 | scenarios = [('with mouse', dict(input_device_class=Mouse))] |
335 | @@ -40,34 +43,76 @@ |
336 | scenarios = [('with touch', dict(input_device_class=Touch))] |
337 | |
338 | local_location = "../../Stock_Ticker.qml" |
339 | + installed_location = "/usr/share/stock-ticker-mobile-app/Stock_Tickers.qml" |
340 | + sqlite_dir = os.path.expanduser( |
341 | + "~/.local/share/stock-ticker-mobile-app/Databases") |
342 | + backup_dir = sqlite_dir + ".backup" |
343 | |
344 | def setUp(self): |
345 | + super(StockTickerTestCase, self).setUp() |
346 | self.pointing_device = Pointer(self.input_device_class.create()) |
347 | - super(StockTickerTestCase, self).setUp() |
348 | + |
349 | + #backup and wipe db's before testing |
350 | + self.temp_move_sqlite_db() |
351 | + self.addCleanup(self.restore_sqlite_db) |
352 | + |
353 | if os.path.exists(self.local_location): |
354 | self.launch_test_local() |
355 | - else: |
356 | + elif os.path.exists(self.installed_location): |
357 | self.launch_test_installed() |
358 | + else: |
359 | + self.launch_test_click() |
360 | |
361 | def launch_test_local(self): |
362 | self.app = self.launch_test_application( |
363 | "qmlscene", |
364 | self.local_location, |
365 | - app_type='qt') |
366 | + app_type='qt', |
367 | + emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase) |
368 | |
369 | def launch_test_installed(self): |
370 | self.app = self.launch_test_application( |
371 | "qmlscene", |
372 | - "/usr/share/stock-ticker-mobile-app/Stock_Ticker.qml", |
373 | - "--desktop_file_hint=/usr/share/applications/stock-ticker-app.desktop", |
374 | - app_type='qt') |
375 | + self.installed_location, |
376 | + "--desktop_file_hint=/usr/share/applications/" |
377 | + "stock-ticker-app.desktop", |
378 | + app_type='qt', |
379 | + emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase) |
380 | + |
381 | + def launch_test_click(self): |
382 | + self.app = self.launch_click_package( |
383 | + "com.ubuntu.stock-ticker-mobile", |
384 | + emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase) |
385 | + |
386 | + def temp_move_sqlite_db(self): |
387 | + try: |
388 | + shutil.rmtree(self.backup_dir) |
389 | + except: |
390 | + pass |
391 | + else: |
392 | + logger.warning("Prexisting backup database found and removed") |
393 | + |
394 | + try: |
395 | + shutil.move(self.sqlite_dir, self.backup_dir) |
396 | + except: |
397 | + logger.warning("No current database found") |
398 | + else: |
399 | + logger.debug("Backed up database") |
400 | + |
401 | + def restore_sqlite_db(self): |
402 | + if os.path.exists(self.backup_dir): |
403 | + if os.path.exists(self.sqlite_dir): |
404 | + try: |
405 | + shutil.rmtree(self.sqlite_dir) |
406 | + except: |
407 | + logger.error("Failed to remove test database and restore" / |
408 | + "database") |
409 | + return |
410 | + try: |
411 | + shutil.move(self.backup_dir, self.sqlite_dir) |
412 | + except: |
413 | + logger.error("Failed to restore database") |
414 | |
415 | @property |
416 | - def ubuntu_sdk(self): |
417 | - return ubuntusdk(self, self.app) |
418 | - |
419 | - |
420 | - |
421 | - |
422 | - |
423 | - |
424 | + def main_view(self): |
425 | + return self.app.select_single(emulators.MainView) |
426 | |
427 | === modified file 'tests/autopilot/stock_ticker/tests/test_Management_page.py' |
428 | --- tests/autopilot/stock_ticker/tests/test_Management_page.py 2013-07-16 02:12:46 +0000 |
429 | +++ tests/autopilot/stock_ticker/tests/test_Management_page.py 2013-10-09 19:09:47 +0000 |
430 | @@ -31,39 +31,28 @@ |
431 | def setUp(self): |
432 | super(TestManagementPage, self).setUp() |
433 | self.assertThat( |
434 | - self.ubuntu_sdk.get_qml_view().visible, Eventually(Equals(True))) |
435 | - |
436 | - def tearDown(self): |
437 | - super(TestManagementPage, self).tearDown() |
438 | - |
439 | - |
440 | + self.main_view.visible, Eventually(Equals(True))) |
441 | + |
442 | def test_add_remove_stock(self): |
443 | - """Tests adding a stock by typing it into the text feild, selecting it from the autocomplete drop down and clicking the add button in the listview.""" |
444 | - |
445 | - tabs = self.app.select_single("Tabs", objectName="rootTabs") |
446 | - |
447 | - self.ubuntu_sdk.switch_to_tab(1) |
448 | - self.assertThat(tabs.selectedTabIndex, Eventually(Equals(1))) |
449 | - |
450 | - self.ubuntu_sdk.after_program_fully_loaded() |
451 | - |
452 | - add_text_feild = self.app.select_single('TextField', objectName='addStockTextField') |
453 | - |
454 | - self.ubuntu_sdk.click_object(add_text_feild) |
455 | - |
456 | - self.ubuntu_sdk.autopilot.keyboard.press_and_release('End', delay=0.2) |
457 | - self.ubuntu_sdk.autopilot.keyboard.press_and_release(' ', delay=0.3) |
458 | - self.ubuntu_sdk.autopilot.keyboard.press_and_release('g', delay=0.3) |
459 | -# self.ubuntu_sdk.autopilot.keyboard.press_and_release('o', delay=0.3) |
460 | -# self.ubuntu_sdk.autopilot.keyboard.press_and_release('o', delay=0.3) |
461 | -# self.ubuntu_sdk.autopilot.keyboard.press_and_release('g', delay=0.3) |
462 | + """Tests adding a stock by typing it into the text field, selecting it from the autocomplete drop down and clicking the add button in the listview.""" |
463 | + self.main_view.switch_to_tab_by_index(1) |
464 | + |
465 | + self.main_view.after_program_fully_loaded() |
466 | + |
467 | + add_text_field = self.app.select_single('TextField', objectName='addStockTextField') |
468 | + |
469 | + self.pointing_device.click_object(add_text_field) |
470 | + |
471 | + self.keyboard.press_and_release('End', delay=0.2) |
472 | + self.keyboard.press_and_release(' ', delay=0.3) |
473 | + self.keyboard.press_and_release('g', delay=0.3) |
474 | |
475 | add_text_popover = self.app.select_single('Popover', objectName='autoCompletePopup') |
476 | self.assertThat(add_text_popover.visible, Eventually(Equals(True))) |
477 | |
478 | autocomplete_activity_indicator = add_text_popover.select_single('ActivityIndicator', objectName='autocompleteActivity') |
479 | self.assertThat(autocomplete_activity_indicator.running, Eventually(Equals(False))) |
480 | - |
481 | + |
482 | search_matches = add_text_popover.select_single('QQuickListView', objectName='matchListView') |
483 | |
484 | management_item = self.app.select_single('QQuickItem', objectName='managementAdd') |
485 | @@ -82,7 +71,7 @@ |
486 | |
487 | self.assertThat(search_match_name.text, Eventually(Equals('GOOG Google Inc. NASDAQ'))) |
488 | |
489 | - self.ubuntu_sdk.click_object(search_match_name) |
490 | + self.pointing_device.click_object(search_match_name) |
491 | |
492 | self.assertThat(management_listview.count, Eventually(Equals(add_list_count+1))) # the listElement was added to the management_listview |
493 | |
494 | @@ -90,7 +79,7 @@ |
495 | |
496 | cmpy_index = -1 |
497 | for o in management_delegate: |
498 | - add_list_item = o.select_single('QQuickText', objectName='companyNameText') |
499 | + add_list_item = o.select_single('QQuickText', objectName='companyNameText') |
500 | cmpy_index += 1 |
501 | if add_list_item and hasattr(add_list_item, 'text'): |
502 | if add_list_item.text == 'Google Inc.': |
503 | @@ -99,24 +88,7 @@ |
504 | self.assertThat(add_list_item.text, Eventually(Equals('Google Inc.'))) |
505 | |
506 | remove_button = management_delegate[cmpy_index].select_single('QQuickItem', objectName='removeButton') |
507 | - self.ubuntu_sdk.click_object(remove_button) |
508 | - |
509 | - |
510 | + self.pointing_device.click_object(remove_button) |
511 | + |
512 | + |
513 | self.assertThat(management_listview.count, Eventually(Equals(add_list_count))) |
514 | - |
515 | - |
516 | - |
517 | - |
518 | - |
519 | - |
520 | - |
521 | - |
522 | - |
523 | - |
524 | - |
525 | - |
526 | - |
527 | - |
528 | - |
529 | - |
530 | - |
531 | |
532 | === modified file 'tests/autopilot/stock_ticker/tests/test_Subtabs.py' |
533 | --- tests/autopilot/stock_ticker/tests/test_Subtabs.py 2013-07-16 02:12:46 +0000 |
534 | +++ tests/autopilot/stock_ticker/tests/test_Subtabs.py 2013-10-09 19:09:47 +0000 |
535 | @@ -32,54 +32,50 @@ |
536 | def setUp(self): |
537 | super(TestSubtabs, self).setUp() |
538 | self.assertThat( |
539 | - self.ubuntu_sdk.get_qml_view().visible, Eventually(Equals(True))) |
540 | - |
541 | - def tearDown(self): |
542 | - super(TestSubtabs, self).tearDown() |
543 | - |
544 | - |
545 | + self.main_view.visible, Eventually(Equals(True))) |
546 | + |
547 | def test_chart_subtab(self): |
548 | """Tests if the chart is visible and interacting with the user input.""" |
549 | |
550 | tabs = self.app.select_single("Tabs", objectName="rootTabs") |
551 | |
552 | - self.ubuntu_sdk.switch_to_tab(0) |
553 | + self.main_view.switch_to_tab(0) |
554 | self.assertThat(tabs.selectedTabIndex, Eventually(Equals(0))) |
555 | |
556 | - self.ubuntu_sdk.after_program_fully_loaded() |
557 | + self.main_view.after_program_fully_loaded() |
558 | |
559 | sub_bar = self.app.select_single("QQuickRectangle", objectName='subTabsBar') |
560 | charts_button = sub_bar.select_single('UbuntuShape', objectName='chartsTab') |
561 | details_button = sub_bar.select_single('UbuntuShape', objectName='detailsTab') |
562 | - |
563 | + |
564 | subtab_pages = self.app.select_single('QQuickItem', objectName='currentRectSizer').get_children() |
565 | |
566 | - self.ubuntu_sdk.click_object(details_button) |
567 | + self.pointing_device.click_object(details_button) |
568 | self.assertThat(subtab_pages[2].visible, Eventually(Equals(True))) |
569 | |
570 | - self.ubuntu_sdk.click_object(charts_button) |
571 | + self.pointing_device.click_object(charts_button) |
572 | |
573 | self.assertThat(subtab_pages[2].visible, Eventually(Equals(False))) |
574 | self.assertThat(subtab_pages[1].visible, Eventually(Equals(True))) |
575 | - |
576 | + |
577 | chart_dot = self.app.select_single('QQuickImage', objectName='chartDot') |
578 | chart_info = self.app.select_single('QQuickText', objectName='dayInfoText') |
579 | |
580 | - self.ubuntu_sdk.click_object(subtab_pages[1]) |
581 | + self.pointing_device.click_object(subtab_pages[1]) |
582 | |
583 | dot_x = chart_dot.x |
584 | info_text = chart_info.text |
585 | |
586 | |
587 | - self.ubuntu_sdk.move_subtabs_bar_up() |
588 | - |
589 | - self.ubuntu_sdk.flick_page_right(subtab_pages[1]) |
590 | - |
591 | - self.assertThat(chart_dot.x, NotEquals(dot_x)) |
592 | - |
593 | - self.assertThat(chart_info.text, NotEquals(info_text)) |
594 | - |
595 | - self.assertThat(dot_x < chart_dot.x, Equals(True)) |
596 | + self.main_view.move_subtabs_bar_up() |
597 | + |
598 | + self.main_view.flick_page_right(subtab_pages[1]) |
599 | + |
600 | + self.assertThat(chart_dot.x, NotEquals(dot_x)) |
601 | + |
602 | + self.assertThat(chart_info.text, NotEquals(info_text)) |
603 | + |
604 | + self.assertThat(dot_x < chart_dot.x, Equals(True)) |
605 | |
606 | |
607 | def test_details_subtab(self): |
608 | @@ -87,22 +83,22 @@ |
609 | |
610 | tabs = self.app.select_single("Tabs", objectName="rootTabs") |
611 | |
612 | - self.ubuntu_sdk.switch_to_tab(0) |
613 | + self.main_view.switch_to_tab(0) |
614 | self.assertThat(tabs.selectedTabIndex, Eventually(Equals(0))) |
615 | |
616 | - self.ubuntu_sdk.after_program_fully_loaded() |
617 | + self.main_view.after_program_fully_loaded() |
618 | |
619 | sub_bar = self.app.select_single("QQuickRectangle", objectName='subTabsBar') |
620 | |
621 | news_button = sub_bar.select_single('UbuntuShape', objectName='newsTab') |
622 | details_button = sub_bar.select_single('UbuntuShape', objectName='detailsTab') |
623 | - |
624 | + |
625 | subtab_pages = self.app.select_single('QQuickItem', objectName='currentRectSizer').get_children() |
626 | |
627 | - self.ubuntu_sdk.click_object(news_button) |
628 | + self.pointing_device.click_object(news_button) |
629 | self.assertThat(subtab_pages[3].visible, Eventually(Equals(True))) |
630 | |
631 | - self.ubuntu_sdk.click_object(details_button) |
632 | + self.pointing_device.click_object(details_button) |
633 | |
634 | self.assertThat(subtab_pages[3].visible, Eventually(Equals(False))) |
635 | self.assertThat(subtab_pages[2].visible, Eventually(Equals(True))) |
636 | @@ -113,12 +109,12 @@ |
637 | |
638 | self.assertThat(details_listview.contentY, Eventually(Equals(details_listview.contentY))) |
639 | |
640 | - self.ubuntu_sdk.move_subtabs_bar_up() |
641 | - self.ubuntu_sdk.hold_page_down(subtab_pages[2]) |
642 | - |
643 | - self.assertThat(details_listview.contentY, Eventually(NotEquals(contentY))) |
644 | - |
645 | - self.ubuntu_sdk.release_mouse_press() |
646 | + self.main_view.move_subtabs_bar_up() |
647 | + self.main_view.hold_page_down(subtab_pages[2]) |
648 | + |
649 | + self.assertThat(details_listview.contentY, Eventually(NotEquals(contentY))) |
650 | + |
651 | + self.main_view.release_mouse_press() |
652 | |
653 | self.assertThat(details_listview.contentY, Eventually(Equals(contentY))) |
654 | |
655 | @@ -126,25 +122,21 @@ |
656 | |
657 | def test_news_subtab(self): |
658 | """Tests if the details sub tab is visible and interacting with the user input.""" |
659 | - |
660 | - tabs = self.app.select_single("Tabs", objectName="rootTabs") |
661 | - |
662 | - self.ubuntu_sdk.switch_to_tab(0) |
663 | - self.assertThat(tabs.selectedTabIndex, Eventually(Equals(0))) |
664 | - |
665 | - self.ubuntu_sdk.after_program_fully_loaded() |
666 | + self.main_view.switch_to_tab_by_index(0) |
667 | + |
668 | + self.main_view.after_program_fully_loaded() |
669 | |
670 | sub_bar = self.app.select_single("QQuickRectangle", objectName='subTabsBar') |
671 | |
672 | news_button = sub_bar.select_single('UbuntuShape', objectName='newsTab') |
673 | details_button = sub_bar.select_single('UbuntuShape', objectName='detailsTab') |
674 | - |
675 | + |
676 | subtab_pages = self.app.select_single('QQuickItem', objectName='currentRectSizer').get_children() |
677 | |
678 | - self.ubuntu_sdk.click_object(details_button) |
679 | + self.pointing_device.click_object(details_button) |
680 | self.assertThat(subtab_pages[2].visible, Eventually(Equals(True))) |
681 | |
682 | - self.ubuntu_sdk.click_object(news_button) |
683 | + self.pointing_device.click_object(news_button) |
684 | |
685 | self.assertThat(subtab_pages[2].visible, Eventually(Equals(False))) |
686 | self.assertThat(subtab_pages[3].visible, Eventually(Equals(True))) |
687 | @@ -155,12 +147,12 @@ |
688 | |
689 | self.assertThat(news_listview.contentY, Eventually(Equals(contentY))) |
690 | |
691 | - self.ubuntu_sdk.move_subtabs_bar_up() |
692 | - self.ubuntu_sdk.hold_page_down(subtab_pages[3]) |
693 | - |
694 | - self.assertThat(news_listview.contentY, Eventually(NotEquals(contentY))) |
695 | - |
696 | - self.ubuntu_sdk.release_mouse_press() |
697 | + self.main_view.move_subtabs_bar_up() |
698 | + self.main_view.hold_page_down(subtab_pages[3]) |
699 | + |
700 | + self.assertThat(news_listview.contentY, Eventually(NotEquals(contentY))) |
701 | + |
702 | + self.main_view.release_mouse_press() |
703 | |
704 | self.assertThat(news_listview.contentY, Eventually(Equals(contentY))) |
705 | |
706 | |
707 | === modified file 'tests/autopilot/stock_ticker/tests/test_Toolbar_actions.py' |
708 | --- tests/autopilot/stock_ticker/tests/test_Toolbar_actions.py 2013-08-29 16:14:12 +0000 |
709 | +++ tests/autopilot/stock_ticker/tests/test_Toolbar_actions.py 2013-10-09 19:09:47 +0000 |
710 | @@ -31,19 +31,16 @@ |
711 | def setUp(self): |
712 | super(TestToolbar, self).setUp() |
713 | self.assertThat( |
714 | - self.ubuntu_sdk.get_qml_view().visible, Eventually(Equals(True))) |
715 | - |
716 | - def tearDown(self): |
717 | - super(TestToolbar, self).tearDown() # why doesn't this not exist in base test package class? |
718 | + self.main_view.visible, Eventually(Equals(True))) |
719 | |
720 | def _open_toolbar(self): |
721 | """Switches to the Watched tab and opens the toolbar""" |
722 | |
723 | tabs = self.app.select_single("Tabs", objectName="rootTabs") |
724 | - self.ubuntu_sdk.switch_to_tab(0) |
725 | + self.main_view.switch_to_tab(0) |
726 | self.assertThat(tabs.selectedTabIndex, Eventually(Equals(0))) |
727 | |
728 | - self.ubuntu_sdk.open_toolbar() |
729 | + self.main_view.open_toolbar() |
730 | |
731 | toolbar = self.app.select_single("Toolbar") |
732 | |
733 | @@ -51,45 +48,45 @@ |
734 | |
735 | return toolbar |
736 | |
737 | - |
738 | + |
739 | def test_application_reset(self): |
740 | """Tests if the sub tabs bar is resizing and if the appication resets back to the defaults.""" |
741 | |
742 | - self.ubuntu_sdk.after_program_fully_loaded() |
743 | + self.main_view.after_program_fully_loaded() |
744 | |
745 | - toolbar = self._open_toolbar() |
746 | + toolbar = self.main_view.open_toolbar() |
747 | toolbar_type = toolbar.select_single('ToolbarItems') |
748 | toolbar_all = toolbar_type.select_single('QQuickRow').get_children() |
749 | |
750 | - toolbar_item = {} |
751 | + toolbar_item = {} |
752 | for o in toolbar_all: |
753 | if o.objectName: |
754 | toolbar_item[o.objectName] = o |
755 | |
756 | - self.ubuntu_sdk.click_object(toolbar_item['resetData']) |
757 | + self.pointing_device.click_object(toolbar_item['resetData']) |
758 | reset_dialog = self.app.select_single('Dialog', objectName='resetDataDialog') |
759 | - self.ubuntu_sdk.click_object(reset_dialog.select_single('Button', objectName='resetConfirm')) |
760 | + self.pointing_device.click_object(reset_dialog.select_single('Button', objectName='resetConfirm')) |
761 | |
762 | - self.ubuntu_sdk.hide_toolbar() |
763 | + self.main_view.close_toolbar() |
764 | |
765 | top_window = self.app.select_single('QQuickItem', objectName='currentRectSizer') # going to set this and then make sure it back to its default height |
766 | top_window_height = top_window.height |
767 | - self.ubuntu_sdk.move_subtabs_bar_up() |
768 | + self.main_view.move_subtabs_bar_up() |
769 | self.assertThat(top_window_height, NotEquals(top_window.height)) |
770 | |
771 | |
772 | - self._open_toolbar() |
773 | - self.ubuntu_sdk.click_object(toolbar_item['resetData']) |
774 | + self.main_view.open_toolbar() |
775 | + self.pointing_device.click_object(toolbar_item['resetData']) |
776 | |
777 | reset_dialog_a = self.app.select_single('Dialog', objectName='resetDataDialog') # re-assign due to the way component wrapped objects behave |
778 | - self.ubuntu_sdk.click_object(reset_dialog_a.select_single('Button', objectName='resetConfirm')) |
779 | - |
780 | - self.ubuntu_sdk.hide_toolbar() |
781 | + self.pointing_device.click_object(reset_dialog_a.select_single('Button', objectName='resetConfirm')) |
782 | + |
783 | + self.main_view.close_toolbar() |
784 | |
785 | self.assertThat(top_window_height, Equals(top_window.height)) |
786 | |
787 | |
788 | - |
789 | + |
790 | |
791 | |
792 |
FAILED: Continuous integration, rev:69 91.189. 93.70:8080/ job/stock- ticker- mobile- app-ci/ 4/ 91.189. 93.70:8080/ job/stock- ticker- mobile- app-precise- amd64-ci/ 4/console 91.189. 93.70:8080/ job/stock- ticker- mobile- app-quantal- amd64-ci/ 4/console 91.189. 93.70:8080/ job/stock- ticker- mobile- app-raring- amd64-ci/ 4/console 91.189. 93.70:8080/ job/stock- ticker- mobile- app-saucy- amd64-ci/ 4/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/stock- ticker- mobile- app-ci/ 4/rebuild
http://