Merge lp:~martin-borho/ubuntu-weather-app/sdk_emulator into lp:ubuntu-weather-app/obsolete.trunk

Proposed by Martin Borho
Status: Merged
Approved by: Nicholas Skaggs
Approved revision: 90
Merged at revision: 85
Proposed branch: lp:~martin-borho/ubuntu-weather-app/sdk_emulator
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 602 lines (+98/-225)
9 files modified
debian/control (+1/-0)
tests/autopilot/ubuntu_weather_app/emulators.py (+40/-0)
tests/autopilot/ubuntu_weather_app/emulators/__init__.py (+0/-17)
tests/autopilot/ubuntu_weather_app/emulators/ubuntusdk.py (+0/-157)
tests/autopilot/ubuntu_weather_app/tests/__init__.py (+15/-7)
tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py (+21/-28)
tests/autopilot/ubuntu_weather_app/tests/test_mainview.py (+5/-3)
tests/autopilot/ubuntu_weather_app/tests/test_settings.py (+13/-9)
tests/autopilot/ubuntu_weather_app/tests/weatherdata.py (+3/-4)
To merge this branch: bzr merge lp:~martin-borho/ubuntu-weather-app/sdk_emulator
Reviewer Review Type Date Requested Status
Nicholas Skaggs (community) Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+178832@code.launchpad.net

Commit message

integrated toolkit emulator from SDK, updated test data

Description of the change

- Integrated toolkit emulator from SDK
- Updated test data with new internal format version

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Well, I'm getting some failures off the cuff on my box, going to try on the device if I can.

89. By Martin Borho

added more assertions to improve test stability

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
90. By Martin Borho

cleaned some test code, removed obsolete test

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Excellent Martin. Thanks for adding the extra asserts and cleanup!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2013-05-14 20:38:57 +0000
3+++ debian/control 2013-08-07 17:39:25 +0000
4@@ -26,5 +26,6 @@
5 libautopilot-qt,
6 libqt5test5,
7 libqt5widgets5,
8+ ubuntu-ui-toolkit-autopilot,
9 Description: Test package for the weather app
10 Autopilot tests for the weather app package
11
12=== removed directory 'tests/autopilot/ubuntu_weather_app/emulators'
13=== added file 'tests/autopilot/ubuntu_weather_app/emulators.py'
14--- tests/autopilot/ubuntu_weather_app/emulators.py 1970-01-01 00:00:00 +0000
15+++ tests/autopilot/ubuntu_weather_app/emulators.py 2013-08-07 17:39:25 +0000
16@@ -0,0 +1,40 @@
17+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
18+# Copyright 2013 Canonical
19+#
20+# This program is free software: you can redistribute it and/or modify it
21+# under the terms of the GNU General Public License version 3, as published
22+# by the Free Software Foundation.
23+#
24+# Authored by: Martin Borho <martin@borho.net>
25+
26+"""weather app autopilot tests and emulators - top level package."""
27+
28+from ubuntuuitoolkit import emulators as toolkit_emulators
29+
30+
31+class MainView(toolkit_emulators.MainView):
32+
33+ def get_object(self, typeName, name):
34+ """Get a specific object"""
35+ return self.select_single(typeName, objectName=name)
36+
37+ def get_objects(self, typeName, name):
38+ """Get more than one object"""
39+ return self.select_many(typeName, objectName=name)
40+
41+ def get_tabs(self):
42+ """Return the LocationTabs emulator of the MainView."""
43+ tabs = self.select_single(Tabs)
44+ assert tabs is not None, toolkit_emulators._NO_TABS_ERROR
45+ return tabs
46+
47+class Tabs(toolkit_emulators.UbuntuUIToolkitEmulatorBase):
48+ """LocationTabs Autopilot emulator."""
49+
50+ def get_current_tab(self):
51+ """Return the currently selected tab."""
52+ return self.select_many('LocationTab')[self.selectedTabIndex]
53+
54+ def get_number_of_tabs(self):
55+ """Return the number of tabs."""
56+ return len(self.select_many('LocationTab'))
57
58=== removed file 'tests/autopilot/ubuntu_weather_app/emulators/__init__.py'
59--- tests/autopilot/ubuntu_weather_app/emulators/__init__.py 2013-06-20 16:10:06 +0000
60+++ tests/autopilot/ubuntu_weather_app/emulators/__init__.py 1970-01-01 00:00:00 +0000
61@@ -1,17 +0,0 @@
62-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
63-#
64-# Copyright (C) 2013 Canonical Ltd
65-#
66-# This program is free software: you can redistribute it and/or modify
67-# it under the terms of the GNU General Public License version 3 as
68-# published by the Free Software Foundation.
69-#
70-# This program is distributed in the hope that it will be useful,
71-# but WITHOUT ANY WARRANTY; without even the implied warranty of
72-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
73-# GNU General Public License for more details.
74-#
75-# You should have received a copy of the GNU General Public License
76-# along with this program. If not, see <http://www.gnu.org/licenses/>.
77-#
78-# Authored by: Nicholas Skaggs <nicholas.skaggs@canonical.com>
79
80=== removed file 'tests/autopilot/ubuntu_weather_app/emulators/ubuntusdk.py'
81--- tests/autopilot/ubuntu_weather_app/emulators/ubuntusdk.py 2013-07-11 22:04:11 +0000
82+++ tests/autopilot/ubuntu_weather_app/emulators/ubuntusdk.py 1970-01-01 00:00:00 +0000
83@@ -1,157 +0,0 @@
84-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
85-#
86-# Copyright (C) 2013 Canonical Ltd
87-#
88-# This program is free software: you can redistribute it and/or modify
89-# it under the terms of the GNU General Public License version 3 as
90-# published by the Free Software Foundation.
91-#
92-# This program is distributed in the hope that it will be useful,
93-# but WITHOUT ANY WARRANTY; without even the implied warranty of
94-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
95-# GNU General Public License for more details.
96-#
97-# You should have received a copy of the GNU General Public License
98-# along with this program. If not, see <http://www.gnu.org/licenses/>.
99-#
100-# Authored by: Nicholas Skaggs <nicholas.skaggs@canonical.com>
101-
102-from testtools.matchers import Equals, NotEquals, Not, Is
103-from autopilot.matchers import Eventually
104-
105-class ubuntusdk(object):
106- """An emulator class that makes it easy to interact with the ubuntu sdk applications."""
107-
108- def __init__(self, autopilot, app):
109- self.app = app
110- self.autopilot = autopilot
111-
112- def get_qml_view(self):
113- """Get the main QML view"""
114- return self.app.select_single("QQuickView")
115-
116- def get_object(self, typeName, name):
117- """Get a specific object"""
118- return self.app.select_single(typeName, objectName=name)
119-
120- def get_objects(self, typeName, name):
121- """Get more than one object"""
122- return self.app.select_many(typeName, objectName=name)
123-
124- def get_tabs(self):
125- """Return all tabs"""
126- return self.app.select_single("Tabs")
127-
128- def switch_to_tab(self, tab):
129- """Switch to the specified tab number"""
130- tabs = self.get_tabs()
131- currentTab = tabs.selectedTabIndex
132-
133- #perform operations until tab == currentTab
134- while tab != currentTab:
135- if tab > currentTab:
136- self._next_tab()
137- if tab < currentTab:
138- self._previous_tab()
139- currentTab = tabs.selectedTabIndex
140-
141- def _previous_tab(self):
142- """Switch to the previous tab"""
143- qmlView = self.get_qml_view()
144-
145- startX = int(qmlView.x + qmlView.width * 0.10)
146- stopX = int(qmlView.x + qmlView.width * 0.45)
147- lineY = int(qmlView.y + qmlView.height * 0.05)
148-
149- self.autopilot.pointing_device.drag(startX, lineY, stopX, lineY)
150- self.autopilot.pointing_device.move(startX, lineY)
151- self.autopilot.pointing_device.click()
152- self.autopilot.pointing_device.click()
153-
154- def _next_tab(self):
155- """Switch to the next tab"""
156- qmlView = self.get_qml_view()
157-
158- startX = int(qmlView.x + qmlView.width * 0.45)
159- stopX = int(qmlView.x + qmlView.width * 0.10)
160- lineY = int(qmlView.y + qmlView.height * 0.05)
161-
162- self.autopilot.pointing_device.drag(startX, lineY, stopX, lineY)
163- self.autopilot.pointing_device.move(startX, lineY)
164- self.autopilot.pointing_device.click()
165- self.autopilot.pointing_device.click()
166-
167- def toggle_toolbar(self):
168- """Toggle the toolbar between revealed and hidden"""
169- #check and see if the toolbar is open or not
170- if self.get_toolbar().opened:
171- self.hide_toolbar()
172- else:
173- self.open_toolbar()
174-
175- def get_toolbar(self):
176- """Returns the toolbar in the main events view."""
177- return self.app.select_single("Toolbar")
178-
179- def get_toolbar_button(self, buttonObject):
180- """Returns the toolbar button with objectName buttonObject"""
181- toolbar = self.get_toolbar()
182- if not toolbar.opened:
183- self.open_toolbar()
184- buttonList = toolbar.select_many("ActionItem")
185- #old version is ToolbarButton
186- if not buttonList:
187- buttonList = toolbar.select_many("ToolbarButton")
188- for button in buttonList:
189- if button.objectName == buttonObject:
190- return button
191-
192- def click_toolbar_button(self, buttonObject):
193- """Clicks the toolbar button with objectName buttonObject"""
194- #The toolbar button is assumed to be the following format
195- #Toolbar {
196- # ...
197- # ActionItem {
198- # objectName: "name"
199- button = self.get_toolbar_button(buttonObject)
200- self.autopilot.pointing_device.click_object(button)
201- return button
202-
203- def open_toolbar(self):
204- """Open the toolbar"""
205- qmlView = self.get_qml_view()
206-
207- lineX = int(qmlView.x + qmlView.width * 0.50)
208- startY = int(qmlView.y + qmlView.height - 1)
209- stopY = int(qmlView.y + qmlView.height * 0.95)
210-
211- self.autopilot.pointing_device.drag(lineX, startY, lineX, stopY)
212-
213- def hide_toolbar(self):
214- """Hide the toolbar"""
215- qmlView = self.get_qml_view()
216-
217- lineX = int(qmlView.x + qmlView.width * 0.50)
218- startY = int(qmlView.y + qmlView.height * 0.95)
219- stopY = int(qmlView.y + qmlView.height - 1)
220-
221- self.autopilot.pointing_device.drag(lineX, startY, lineX, stopY)
222-
223- def set_popup_value(self, popover, button, value):
224- """Changes the given popover selector to the request value
225- At the moment this only works for values that are currently visible. To
226- access the remaining items, a help method to drag and recheck is needed."""
227- #The popover is assumed to be the following format
228- #Component {
229- # id: actionSelectionPopover
230- #
231- #ActionSelectionPopover {
232- # actions: ActionList {
233- # Action {
234-
235- popList = self.get_object("ActionSelectionPopover", popover)
236- itemList = popList.select_many("Label")
237- for item in itemList:
238- if item.text == value:
239- self.autopilot.pointing_device.click_object(item)
240- return item
241
242=== modified file 'tests/autopilot/ubuntu_weather_app/tests/__init__.py'
243--- tests/autopilot/ubuntu_weather_app/tests/__init__.py 2013-07-19 11:39:31 +0000
244+++ tests/autopilot/ubuntu_weather_app/tests/__init__.py 2013-08-07 17:39:25 +0000
245@@ -4,6 +4,8 @@
246 # This program is free software: you can redistribute it and/or modify it
247 # under the terms of the GNU General Public License version 3, as published
248 # by the Free Software Foundation.
249+#
250+# Authored by: Martin Borho <martin@borho.net>
251
252 """weather-app autopilot tests."""
253
254@@ -16,7 +18,8 @@
255 from autopilot.platform import model
256 from autopilot.testcase import AutopilotTestCase
257
258-from ubuntu_weather_app.emulators.ubuntusdk import ubuntusdk
259+from ubuntuuitoolkit import emulators as toolkit_emulators
260+from ubuntu_weather_app.emulators import MainView
261
262 class WeatherTestCase(AutopilotTestCase):
263
264@@ -51,18 +54,20 @@
265 self.app = self.launch_test_application(
266 self.qmlscene(),
267 self.local_location,
268- app_type='qt')
269+ app_type='qt',
270+ emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
271
272 def launch_test_installed(self):
273 self.app = self.launch_test_application(
274 self.qmlscene(),
275 "/usr/share/ubuntu-weather-app/ubuntu-weather-app.qml",
276 "--desktop_file_hint=/usr/share/applications/ubuntu-weather-app.desktop",
277- app_type='qt')
278+ app_type='qt',
279+ emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
280
281 def launch_and_quit_app(self):
282 self.launch_app()
283- self.main_window.get_qml_view().visible.wait_for(True)
284+ self.get_qml_view().visible.wait_for(True)
285
286 # When calling launch_app an instance of the spawned process
287 # control object will be stored in self.app.process, and a cleanup
288@@ -72,19 +77,22 @@
289 # the process during regular test setup.
290 self.doCleanups()
291
292+ def get_qml_view(self):
293+ return self.app.select_single("QQuickView")
294+
295 @property
296 def main_window(self):
297- return ubuntusdk(self, self.app)#MainWindow(self, self.app)
298+ return self.app.select_single(MainView)
299
300 class SheetMixin(object):
301 """A mixin to to give access to common sheet elements"""
302 def _click_sheet_confirm(self):
303 """Clicks the confirm button"""
304- self.pointing_device.click_object(self.main_window.app.select_many('Button')[1])
305+ self.pointing_device.click_object(self.main_window.select_many('Button')[1])
306
307 def _click_sheet_cancel(self):
308 """Clicks the cancel button"""
309- self.pointing_device.click_object(self.main_window.app.select_many('Button')[0])
310+ self.pointing_device.click_object(self.main_window.select_many('Button')[0])
311
312 class DatabaseMixin(object):
313
314
315=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py'
316--- tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py 2013-08-04 02:26:07 +0000
317+++ tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py 2013-08-07 17:39:25 +0000
318@@ -23,13 +23,14 @@
319 self.clean_db()
320 super(TestLocationManager, self).setUp()
321 self.assertThat(
322- self.main_window.get_qml_view().visible, Eventually(Equals(True)))
323+ self.get_qml_view().visible, Eventually(Equals(True)))
324
325 def _open_add_location_page(self):
326 """Opens the AddLocationPage"""
327 # click on listitem to open AddLocationPage
328 locationList = self.main_window.get_object('QQuickListView', 'LocationList')
329 addCityItem = locationList.get_children()[0]
330+ self.assertThat(lambda: addCityItem, Eventually(NotEquals(None)))
331 self.pointing_device.move_to_object(addCityItem)
332 self.pointing_device.click()
333
334@@ -54,8 +55,9 @@
335
336 # insert city name to search for
337 searchField = self.main_window.get_object("TextField", "SearchField")
338- self.pointing_device.move_to_object(searchField)
339- self.pointing_device.click()
340+ self.assertThat(lambda: searchField, Eventually(NotEquals(None)))
341+ self.pointing_device.click_object(searchField)
342+ self.assertThat(searchField.focus, Eventually(Equals(True)))
343 self.keyboard.type("London")
344 self.assertThat(searchField.text, Eventually(Equals("London")))
345 self.keyboard.press_and_release('Enter')
346@@ -63,14 +65,16 @@
347 # wait for results and click on the first item
348 resultsList = self.main_window.get_object('QQuickListView', 'SearchResultList')
349 self.assertThat(resultsList.visible, Eventually(Equals(True), timeout=30))
350- firstResult = resultsList.get_children()[0].get_children()[0]
351+ firstResult = self.main_window.get_object('Standard', 'searchResult0')
352+ self.assertThat(lambda: firstResult, Eventually(NotEquals(None)))
353 self.pointing_device.move_to_object(firstResult)
354 self.pointing_device.click()
355
356 # LocationManagerPage should be visible and "London" added
357 locationList = self.main_window.get_object('QQuickListView', 'LocationList')
358- addedItem = locationList.get_children()[0]
359- self.assertThat(addedItem.get_children()[1].text, Eventually(Equals("London")))
360+ addedItem = self.main_window.get_object('Standard', "existingLocation0")
361+ self.assertThat(lambda: addedItem, Eventually(NotEquals(None)))
362+ self.assertThat(addedItem.text, Eventually(Equals("London")))
363 self._click_sheet_confirm()
364
365 # back to locations, wait till data is loaded
366@@ -83,18 +87,15 @@
367 tabObjects = self.main_window.get_objects('LocationTab','LocationTab')
368 self.assertEqual(1, len(tabObjects))
369
370- def test_toolbar_hidden_when_no_location_is_defined(self):
371- """Toolbar is not visible when there's no location is defined"""
372- toolbar = self.main_window.get_toolbar()
373- self.assertThat(toolbar.opened, Eventually(Equals(False)))
374-
375 def test_search_city(self):
376 """Search for cities"""
377 self._open_add_location_page()
378
379 # insert city name to search for
380 searchField = self.main_window.get_object("TextField", "SearchField")
381+ self.assertThat(lambda: searchField, Eventually(NotEquals(None)))
382 self.pointing_device.click_object(searchField)
383+ self.assertThat(searchField.focus, Eventually(Equals(True)))
384 self.keyboard.type("London")
385 self.assertThat(searchField.text, Eventually(Equals("London")))
386 self.keyboard.press_and_release('Enter')
387@@ -103,10 +104,12 @@
388 resultsList = self.main_window.get_object('QQuickListView', 'SearchResultList')
389 self.assertThat(resultsList.visible, Eventually(Equals(True), timeout=30))
390 firstResult = self.select_single_retry("Standard", objectName="searchResult0")
391+ self.assertThat(lambda: firstResult, Eventually(NotEquals(None)))
392 self.assertThat(firstResult.text, Eventually(Equals("London, GB")))
393
394 # clear search field and do another search
395 clear_button = searchField.select_single("AbstractButton")
396+ self.assertThat(lambda: clear_button, Eventually(NotEquals(None)))
397 self.pointing_device.click_object(clear_button)
398 self.assertThat(searchField.text, Eventually(Equals("")))
399
400@@ -115,6 +118,7 @@
401 self.keyboard.press_and_release('Enter')
402 self.assertThat(resultsList.visible, Eventually(Equals(True), timeout=30))
403 firstResult = self.select_single_retry("Standard", objectName="searchResult0")
404+ self.assertThat(lambda: firstResult, Eventually(NotEquals(None)))
405 self.assertThat(firstResult.text, Eventually(Equals("Hamburg, DE")))
406
407 def test_cancel_adding_location(self):
408@@ -130,8 +134,9 @@
409
410 # insert city name to search for
411 searchField = self.main_window.get_object("TextField", "SearchField")
412- self.pointing_device.move_to_object(searchField)
413- self.pointing_device.click()
414+ self.assertThat(lambda: searchField, Eventually(NotEquals(None)))
415+ self.pointing_device.click_object(searchField)
416+ self.assertThat(searchField.focus, Eventually(Equals(True)))
417 self.keyboard.type("UbuntuCity") # Unfortunately, no UbuntuCity in the world
418 self.assertThat(searchField.text, Eventually(Equals("UbuntuCity")))
419 self.keyboard.press_and_release('Enter')
420@@ -146,27 +151,20 @@
421 self.clean_db()
422 self.launch_and_quit_app()
423 # add one location to storage
424- #self.save_locations_to_storage([locations_data[0]])
425 self.save_locations_to_storage(locations_data)
426 super(TestLocationManagerWithLocation, self).setUp()
427 self.assertThat(
428- self.main_window.get_qml_view().visible, Eventually(Equals(True)))
429+ self.get_qml_view().visible, Eventually(Equals(True)))
430
431 def _open_location_manager(self):
432 """Opens the location manager"""
433- toolbar = self.main_window.get_toolbar()
434- self.main_window.open_toolbar()
435- self.assertThat(toolbar.animating, Eventually(Equals(False)))
436- self.assertThat(toolbar.state, Eventually(Equals("spread")))
437- self.main_window.click_toolbar_button("EditButton")
438- location_manager_sheet = self.main_window.get_object(
439- "ComposerSheet", "LocationManagerSheet")
440- self.assertThat(location_manager_sheet.opacity, Eventually(Equals(1)))
441+ self.main_window.open_toolbar().click_button("EditButton")
442
443 def _swipe_location_to_remove(self):
444 """Swipe right to delete the first location"""
445 number_of_locations = self._get_number_of_locations()
446 firstLocation = self.app.select_single("Standard", objectName="existingLocation0")
447+ self.assertThat(lambda: firstLocation, Eventually(NotEquals(None)))
448
449 x, y, w, h = firstLocation.globalRect
450 tx = x + (w / 8)
451@@ -223,8 +221,3 @@
452 tabObjects = self.main_window.get_objects('LocationTab','LocationTab')
453 self.assertEqual(tabsSumStart, len(tabObjects))
454
455- def test_toolbar_opened_when_location_is_defined(self):
456- """Toolbar is visible since there's a location defined"""
457- self._open_location_manager()
458- toolbar = self.main_window.get_toolbar()
459- self.assertThat(toolbar.opened, Eventually(Equals(True)))
460
461=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_mainview.py'
462--- tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 2013-07-27 16:31:15 +0000
463+++ tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 2013-08-07 17:39:25 +0000
464@@ -4,6 +4,8 @@
465 # This program is free software: you can redistribute it and/or modify it
466 # under the terms of the GNU General Public License version 3, as published
467 # by the Free Software Foundation.
468+#
469+# Authored by: Martin Borho <martin@borho.net>
470
471 """Tests for Weather app"""
472
473@@ -26,7 +28,7 @@
474 self.save_locations_to_storage(locations_data)
475 super(TestMainView, self).setUp()
476 self.assertThat(
477- self.main_window.get_qml_view().visible, Eventually(Equals(True)))
478+ self.get_qml_view().visible, Eventually(Equals(True)))
479
480 def tearDown(self):
481 super(TestMainView, self).tearDown()
482@@ -42,7 +44,7 @@
483 self.assertThat(tabObjects[1].visible, Eventually(Equals(False)))
484 self.assertThat(tabObjects[0].title, Eventually(Equals("London")))
485 # switch to next tab
486- self.main_window.switch_to_tab(1)
487+ self.main_window.switch_to_tab_by_index(1)
488 self.assertThat(tabs.selectedTabIndex, Eventually(Equals(1)))
489 self.assertThat(tabObjects[0].visible, Eventually(Equals(False)))
490 self.assertThat(tabObjects[1].visible, Eventually(Equals(True)))
491@@ -55,7 +57,7 @@
492 tab2_curr_date = curr_dates[2].text
493
494 # refresh and wait till loading has finished
495- self.main_window.click_toolbar_button("RefreshButton")
496+ self.main_window.open_toolbar().click_button("RefreshButton")
497 load_indicator = self.main_window.get_object('ActivityIndicator', 'LoadingSpinner')
498 self.assertThat(load_indicator.running, Eventually(Equals(False)))
499
500
501=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_settings.py'
502--- tests/autopilot/ubuntu_weather_app/tests/test_settings.py 2013-07-27 16:31:15 +0000
503+++ tests/autopilot/ubuntu_weather_app/tests/test_settings.py 2013-08-07 17:39:25 +0000
504@@ -9,7 +9,7 @@
505
506 from __future__ import absolute_import
507
508-from testtools.matchers import Equals
509+from testtools.matchers import Equals, NotEquals
510 from autopilot.matchers import Eventually
511
512 from ubuntu_weather_app.tests import WeatherTestCase, DatabaseMixin, SheetMixin
513@@ -22,28 +22,27 @@
514 self.save_locations_to_storage(locations_data)
515 super(TestSettings, self).setUp()
516 self.assertThat(
517- self.main_window.get_qml_view().visible, Eventually(Equals(True)))
518+ self.get_qml_view().visible, Eventually(Equals(True)))
519
520 def _open_settings_sheet(self):
521 """Opens the settings sheet"""
522- self.main_window.open_toolbar()
523- self.assertThat(self.main_window.get_toolbar().opened, Eventually(Equals(True)))
524- self.main_window.click_toolbar_button("SettingsButton")
525+ self.main_window.open_toolbar().click_button("SettingsButton")
526
527 def _move_pointer_around(self):
528 """Helper method to move the pointer around, to assure selector is opened"""
529 sheet = self.main_window.get_object('ComposerSheet', 'SettingsSheet')
530+ self.assertThat(lambda: sheet, Eventually(NotEquals(None)))
531 self.pointing_device.move_to_object(sheet)
532
533 def _check_units(self, units):
534 """Checks selected units by values from the first location tab"""
535 current_temps = self.main_window.get_objects('QQuickText', 'CurrentTempText')
536 if units == "imperial":
537- self.assertThat(current_temps[0].text, Eventually(Equals(u'76°F')))
538- self.assertThat(current_temps[2].text, Eventually(Equals(u'78°F')))
539+ self.assertThat(current_temps[0].text, Eventually(Equals(u'70°F')))
540+ self.assertThat(current_temps[2].text, Eventually(Equals(u'72°F')))
541 else:
542- self.assertThat(current_temps[0].text, Eventually(Equals(u'25°C')))
543- self.assertThat(current_temps[2].text, Eventually(Equals(u'25°C')))
544+ self.assertThat(current_temps[0].text, Eventually(Equals(u'21°C')))
545+ self.assertThat(current_temps[2].text, Eventually(Equals(u'22°C')))
546
547 def test_switch_scale(self):
548 """Tests switching the scale in the settings"""
549@@ -59,6 +58,7 @@
550 # choose second option, fahrenheit
551 self._move_pointer_around()
552 imperial_option = units_selector.get_children()[3]
553+ self.assertThat(lambda: imperial_option, Eventually(NotEquals(None)))
554 self.pointing_device.click_object(imperial_option)
555 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
556 self._click_sheet_confirm()
557@@ -71,6 +71,7 @@
558 # switch back to metric values again
559 self._open_settings_sheet()
560 units_selector = self.main_window.get_object('ValueSelector', "UnitsSelector")
561+ self.assertThat(lambda: units_selector, Eventually(NotEquals(None)))
562 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
563 self.pointing_device.click_object(units_selector)
564 self.assertThat(units_selector.expanded, Eventually(Equals(True)))
565@@ -78,6 +79,7 @@
566 # click celsius option
567 self._move_pointer_around()
568 metric_option = units_selector.get_children()[4]
569+ self.assertThat(lambda: metric_option, Eventually(NotEquals(None)))
570 self.pointing_device.click_object(metric_option)
571
572 # confirm
573@@ -96,12 +98,14 @@
574 self._open_settings_sheet()
575
576 units_selector = self.main_window.get_object('ValueSelector', "UnitsSelector")
577+ self.assertThat(lambda: units_selector, Eventually(NotEquals(None)))
578 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
579 self.pointing_device.click_object(units_selector)
580
581 # choose second option, fahrenheit
582 self._move_pointer_around()
583 imperial_option = units_selector.get_children()[3]
584+ self.assertThat(lambda: imperial_option, Eventually(NotEquals(None)))
585 self.pointing_device.click_object(imperial_option)
586 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
587
588
589=== modified file 'tests/autopilot/ubuntu_weather_app/tests/weatherdata.py'
590--- tests/autopilot/ubuntu_weather_app/tests/weatherdata.py 2013-07-27 16:31:15 +0000
591+++ tests/autopilot/ubuntu_weather_app/tests/weatherdata.py 2013-08-07 17:39:25 +0000
592@@ -6,8 +6,7 @@
593 # by the Free Software Foundation.
594 locations_data = []
595
596-locations_data.append("""{"location":{"service_id":2643743,"name":"London","country":"GB","service":"openweathermap"},"db":{"updated":"2013-07-27T16:06:14.606Z","id":1},"format":20130727,"data":[{"date":"2013-07-27","timestamp":1374926400,"metric":{"tempMin":15.55,"tempMax":24.5},"imperial":{"tempMin":59.99,"tempMax":76.1},"pressure":1009.81,"humidity":63,"condition":{"id":502,"main":"Rain","description":"heavy intensity rain","icon":"10d"},"wind_speed":3.3,"wind_deg":101,"hourly":[],"current":{"timestamp":1374940874,"date":"2013-07-27 18:01","metric":{"temp":24.5},"imperial":{"temp":76.1},"humidity":64,"pressure":1004,"wind_speed_kmh":6.2,"wind_speed_mph":3.852494,"wind_deg":110,"condition":{"id":520,"main":"Rain","description":"light intensity shower rain","icon":"09d"},"service":"openweathermap","service_id":2643743}},{"date":"2013-07-28","timestamp":1375012800,"metric":{"tempMin":14.7,"tempMax":19.86},"imperial":{"tempMin":58.46,"tempMax":67.74799999999999},"pressure":1013.76,"humidity":91,"condition":{"id":501,"main":"Rain","description":"moderate rain","icon":"10d"},"wind_speed":4.46,"wind_deg":213,"hourly":[]},{"date":"2013-07-29","timestamp":1375099200,"metric":{"tempMin":14.67,"tempMax":17.63},"imperial":{"tempMin":58.406,"tempMax":63.733999999999995},"pressure":1016.16,"humidity":95,"condition":{"id":500,"main":"Rain","description":"light rain","icon":"10d"},"wind_speed":4.73,"wind_deg":213,"hourly":[]},{"date":"2013-07-30","timestamp":1375185600,"metric":{"tempMin":14.29,"tempMax":19.79},"imperial":{"tempMin":57.721999999999994,"tempMax":67.622},"pressure":1023.8,"humidity":70,"condition":{"id":500,"main":"Rain","description":"light rain","icon":"10d"},"wind_speed":3.98,"wind_deg":252,"hourly":[]},{"date":"2013-07-31","timestamp":1375272000,"metric":{"tempMin":15.19,"tempMax":24.08},"imperial":{"tempMin":59.342,"tempMax":75.344},"pressure":1021.26,"humidity":69,"condition":{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"},"wind_speed":4.3,"wind_deg":217,"hourly":[]},{"date":"2013-08-01","timestamp":1375358400,"metric":{"tempMin":19.05,"tempMax":28.47},"imperial":{"tempMin":66.28999999999999,"tempMax":83.24600000000001},"pressure":1018.91,"humidity":59,"condition":{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"},"wind_speed":3.45,"wind_deg":176,"hourly":[]},{"date":"2013-08-02","timestamp":1375444800,"metric":{"tempMin":14.26,"tempMax":18.83},"imperial":{"tempMin":57.668,"tempMax":65.894},"pressure":1016.86,"humidity":0,"condition":{"id":501,"main":"Rain","description":"moderate rain","icon":"10d"},"wind_speed":7.11,"wind_deg":207,"hourly":[]},{"date":"2013-08-03","timestamp":1375531200,"metric":{"tempMin":13.28,"tempMax":20.37},"imperial":{"tempMin":55.903999999999996,"tempMax":68.666},"pressure":1024.05,"humidity":0,"condition":{"id":500,"main":"Rain","description":"light rain","icon":"10d"},"wind_speed":3.05,"wind_deg":249,"hourly":[]},{"date":"2013-08-04","timestamp":1375617600,"metric":{"tempMin":14.07,"tempMax":21.59},"imperial":{"tempMin":57.326,"tempMax":70.862},"pressure":1020.85,"humidity":0,"condition":{"id":500,"main":"Rain","description":"light rain","icon":"10d"},"wind_speed":3.55,"wind_deg":165,"hourly":[]},{"date":"2013-08-05","timestamp":1375704000,"metric":{"tempMin":13.76,"tempMax":19.47},"imperial":{"tempMin":56.768,"tempMax":67.04599999999999},"pressure":1014.62,"humidity":0,"condition":{"id":501,"main":"Rain","description":"moderate rain","icon":"10d"},"wind_speed":5.38,"wind_deg":196,"hourly":[]}],"save":true}""")
597-
598-locations_data.append( """{"location":{"coord":{"lon":10,"lat":53.549999},"service_id":2911298,"name":"Hamburg","country":"DE","service":"openweathermap"},"db":{"updated":"2013-07-27T16:06:14.628Z","id":2},"format":20130727,"data":[{"date":"2013-07-27","timestamp":1374922800,"metric":{"tempMin":16.77,"tempMax":25.3},"imperial":{"tempMin":62.186,"tempMax":77.53999999999999},"pressure":1018.72,"humidity":66,"condition":{"id":501,"main":"Rain","description":"moderate rain","icon":"10d"},"wind_speed":2.15,"wind_deg":102,"hourly":[],"current":{"timestamp":1374940200,"date":"2013-07-27 17:50","metric":{"temp":25.3},"imperial":{"temp":77.53999999999999},"humidity":94,"pressure":1009,"wind_speed_kmh":6.2,"wind_speed_mph":3.852494,"wind_deg":240,"condition":{"id":200,"main":"Thunderstorm","description":"thunderstorm with light rain","icon":"11d"},"service":"openweathermap","service_id":2911298}},{"date":"2013-07-28","timestamp":1375009200,"metric":{"tempMin":17.73,"tempMax":22.74},"imperial":{"tempMin":63.914,"tempMax":72.93199999999999},"pressure":1020.48,"humidity":87,"condition":{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"},"wind_speed":6.21,"wind_deg":249,"hourly":[]},{"date":"2013-07-29","timestamp":1375095600,"metric":{"tempMin":15.53,"tempMax":23.35},"imperial":{"tempMin":59.954,"tempMax":74.03},"pressure":1024.02,"humidity":82,"condition":{"id":500,"main":"Rain","description":"light rain","icon":"10d"},"wind_speed":2.05,"wind_deg":172,"hourly":[]},{"date":"2013-07-30","timestamp":1375182000,"metric":{"tempMin":15.57,"tempMax":18.14},"imperial":{"tempMin":60.025999999999996,"tempMax":64.652},"pressure":1022.58,"humidity":95,"condition":{"id":501,"main":"Rain","description":"moderate rain","icon":"10d"},"wind_speed":7.5,"wind_deg":267,"hourly":[]},{"date":"2013-07-31","timestamp":1375268400,"metric":{"tempMin":15.09,"tempMax":23.08},"imperial":{"tempMin":59.162,"tempMax":73.544},"pressure":1028.48,"humidity":78,"condition":{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"},"wind_speed":5,"wind_deg":258,"hourly":[]},{"date":"2013-08-01","timestamp":1375354800,"metric":{"tempMin":19.15,"tempMax":27.67},"imperial":{"tempMin":66.47,"tempMax":81.80600000000001},"pressure":1030.67,"humidity":73,"condition":{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"},"wind_speed":0.85,"wind_deg":99,"hourly":[]},{"date":"2013-08-02","timestamp":1375441200,"metric":{"tempMin":13.19,"tempMax":18.78},"imperial":{"tempMin":55.742000000000004,"tempMax":65.804},"pressure":1022.53,"humidity":0,"condition":{"id":502,"main":"Rain","description":"heavy intensity rain","icon":"10d"},"wind_speed":6.02,"wind_deg":253,"hourly":[]},{"date":"2013-08-03","timestamp":1375527600,"metric":{"tempMin":14.58,"tempMax":21.82},"imperial":{"tempMin":58.244,"tempMax":71.27600000000001},"pressure":1027.5,"humidity":0,"condition":{"id":500,"main":"Rain","description":"light rain","icon":"10d"},"wind_speed":3.21,"wind_deg":261,"hourly":[]},{"date":"2013-08-04","timestamp":1375614000,"metric":{"tempMin":12.47,"tempMax":19.72},"imperial":{"tempMin":54.446,"tempMax":67.49600000000001},"pressure":1027.54,"humidity":0,"condition":{"id":500,"main":"Rain","description":"light rain","icon":"10d"},"wind_speed":2.71,"wind_deg":1,"hourly":[]},{"date":"2013-08-05","timestamp":1375700400,"metric":{"tempMin":13.23,"tempMax":21.94},"imperial":{"tempMin":55.814,"tempMax":71.492},"pressure":1023.33,"humidity":0,"condition":{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"},"wind_speed":2.09,"wind_deg":94,"hourly":[]}],"save":true}""")
599-
600+locations_data.append("""{"location":{"service_id":2643743,"name":"London","country":"GB","service":"openweathermap"},"db":{"updated":"2013-08-06T18:31:16.155Z","id":1},"format":20130801,"data":[{"date":"2013-08-06","timestamp":1375738207,"metric":{"tempMin":17.38,"tempMax":21.29,"windSpeed":5.22},"imperial":{"tempMin":63.284,"tempMax":70.322,"windSpeed":3.248,"rain":null},"pressure":1020.63,"humidity":58,"condition":{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"},"windDeg":272,"hourly":[],"current":{"timestamp":1375813805,"date":"2013-08-06 20:30","metric":{"temp":21.29,"windSpeed":null},"imperial":{"temp":70.322,"windSpeed":null,"rain":null},"humidity":56,"pressure":1013,"condition":{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"},"service":"openweathermap","service_id":2643743}},{"date":"2013-08-07","timestamp":1375876800,"metric":{"tempMin":14.25,"tempMax":22.14,"windSpeed":9.54},"imperial":{"tempMin":57.650000000000006,"tempMax":71.852,"windSpeed":5.936,"rain":null},"pressure":1019.36,"humidity":58,"condition":{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"},"windDeg":66,"hourly":[]},{"date":"2013-08-08","timestamp":1375963200,"metric":{"tempMin":13.13,"tempMax":22.86,"windSpeed":5.796},"imperial":{"tempMin":55.634,"tempMax":73.148,"windSpeed":3.6064000000000007,"rain":null},"pressure":1026.02,"humidity":58,"condition":{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"},"windDeg":357,"hourly":[]},{"date":"2013-08-09","timestamp":1376049600,"metric":{"tempMin":14.09,"tempMax":23.71,"windSpeed":12.276000000000002},"imperial":{"tempMin":57.362,"tempMax":74.678,"windSpeed":7.638400000000001,"rain":null},"pressure":1025.05,"humidity":56,"condition":{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"},"windDeg":260,"hourly":[]},{"date":"2013-08-10","timestamp":1376136000,"metric":{"tempMin":11.82,"tempMax":21.31,"windSpeed":9.395999999999999,"rain":1},"imperial":{"tempMin":53.275999999999996,"tempMax":70.358,"windSpeed":5.8464,"rain":0.03937007874015748},"pressure":1026.7,"humidity":69,"condition":{"id":500,"main":"Rain","description":"light rain","icon":"10d"},"windDeg":224,"hourly":[]},{"date":"2013-08-11","timestamp":1376222400,"metric":{"tempMin":15.38,"tempMax":22.5,"windSpeed":11.916},"imperial":{"tempMin":59.684,"tempMax":72.5,"windSpeed":7.4144000000000005,"rain":null},"pressure":1021.58,"humidity":61,"condition":{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"},"windDeg":255,"hourly":[]},{"date":"2013-08-12","timestamp":1376308800,"metric":{"tempMin":12.79,"tempMax":20.71,"windSpeed":14.148000000000001,"rain":1.14},"imperial":{"tempMin":55.022,"tempMax":69.278,"windSpeed":8.8032,"rain":0.04488188976377953},"pressure":1025.21,"humidity":0,"condition":{"id":500,"main":"Rain","description":"light rain","icon":"10d"},"windDeg":40,"hourly":[]},{"date":"2013-08-13","timestamp":1376395200,"metric":{"tempMin":11.61,"tempMax":22.22,"windSpeed":11.448,"rain":0.73},"imperial":{"tempMin":52.897999999999996,"tempMax":71.99600000000001,"windSpeed":7.123200000000001,"rain":0.02874015748031496},"pressure":1025.5,"humidity":0,"condition":{"id":500,"main":"Rain","description":"light rain","icon":"10d"},"windDeg":201,"hourly":[]},{"date":"2013-08-14","timestamp":1376481600,"metric":{"tempMin":16.09,"tempMax":22.97,"windSpeed":28.08,"rain":0.21},"imperial":{"tempMin":60.962,"tempMax":73.346,"windSpeed":17.472,"rain":0.00826771653543307},"pressure":1023.75,"humidity":0,"condition":{"id":500,"main":"Rain","description":"light rain","icon":"10d"},"windDeg":252,"hourly":[]},{"date":"2013-08-15","timestamp":1376568000,"metric":{"tempMin":14.36,"tempMax":22.61,"windSpeed":16.02,"rain":1.08},"imperial":{"tempMin":57.848,"tempMax":72.69800000000001,"windSpeed":9.968000000000002,"rain":0.042519685039370085},"pressure":1023.89,"humidity":0,"condition":{"id":500,"main":"Rain","description":"light rain","icon":"10d"},"windDeg":229,"hourly":[]}],"save":true}""")
601+
602+locations_data.append("""{"location":{"coord":{"lon":10,"lat":53.549999},"service_id":2911298,"name":"Hamburg","country":"DE","service":"openweathermap"},"db":{"updated":"2013-08-06T18:35:14.332Z","id":2},"format":20130801,"data":[{"date":"2013-08-06","timestamp":1375738207,"metric":{"tempMin":13.37,"tempMax":20,"windSpeed":18.18},"imperial":{"tempMin":56.066,"tempMax":68,"windSpeed":11.312000000000001,"rain":null},"pressure":1024.52,"humidity":55,"condition":{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"},"windDeg":302,"hourly":[],"current":{"timestamp":1375813203,"date":"2013-08-06 20:20","metric":{"temp":20,"windSpeed":null},"imperial":{"temp":68,"windSpeed":null,"rain":null},"humidity":64,"pressure":1015,"condition":{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"},"service":"openweathermap","service_id":2911298}},{"date":"2013-08-07","timestamp":1375873200,"metric":{"tempMin":11.38,"tempMax":16.98,"windSpeed":13.860000000000001,"rain":22},"imperial":{"tempMin":52.484,"tempMax":62.564,"windSpeed":8.624,"rain":0.8661417322834646},"pressure":1025.03,"humidity":100,"condition":{"id":502,"main":"Rain","description":"heavy intensity rain","icon":"10d"},"windDeg":7,"hourly":[]},{"date":"2013-08-08","timestamp":1375959600,"metric":{"tempMin":13.56,"tempMax":15.36,"windSpeed":15.515999999999998,"rain":13},"imperial":{"tempMin":56.408,"tempMax":59.647999999999996,"windSpeed":9.6544,"rain":0.5118110236220472},"pressure":1026.42,"humidity":100,"condition":{"id":502,"main":"Rain","description":"heavy intensity rain","icon":"10d"},"windDeg":31,"hourly":[]},{"date":"2013-08-09","timestamp":1376046000,"metric":{"tempMin":11.19,"tempMax":20.06,"windSpeed":14.436},"imperial":{"tempMin":52.141999999999996,"tempMax":68.108,"windSpeed":8.9824,"rain":null},"pressure":1030.49,"humidity":91,"condition":{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"},"windDeg":304,"hourly":[]},{"date":"2013-08-10","timestamp":1376132400,"metric":{"tempMin":13.81,"tempMax":21.32,"windSpeed":17.136},"imperial":{"tempMin":56.858000000000004,"tempMax":70.376,"windSpeed":10.6624,"rain":null},"pressure":1030.51,"humidity":80,"condition":{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"},"windDeg":250,"hourly":[]},{"date":"2013-08-11","timestamp":1376218800,"metric":{"tempMin":16.51,"tempMax":23.68,"windSpeed":22.715999999999998,"rain":3},"imperial":{"tempMin":61.718,"tempMax":74.624,"windSpeed":14.134400000000001,"rain":0.11811023622047245},"pressure":1024.9,"humidity":68,"condition":{"id":500,"main":"Rain","description":"light rain","icon":"10d"},"windDeg":238,"hourly":[]},{"date":"2013-08-12","timestamp":1376305200,"metric":{"tempMin":14.79,"tempMax":20.61,"windSpeed":10.044,"rain":0.59},"imperial":{"tempMin":58.622,"tempMax":69.098,"windSpeed":6.249600000000001,"rain":0.023228346456692913},"pressure":1028.45,"humidity":0,"condition":{"id":500,"main":"Rain","description":"light rain","icon":"10d"},"windDeg":275,"hourly":[]},{"date":"2013-08-13","timestamp":1376391600,"metric":{"tempMin":13.23,"tempMax":21.47,"windSpeed":5.184},"imperial":{"tempMin":55.814,"tempMax":70.646,"windSpeed":3.2256,"rain":null},"pressure":1029.35,"humidity":0,"condition":{"id":500,"main":"Rain","description":"light rain","icon":"10d"},"windDeg":48,"hourly":[]},{"date":"2013-08-14","timestamp":1376478000,"metric":{"tempMin":15.49,"tempMax":22.37,"windSpeed":7.704000000000001,"rain":0.33},"imperial":{"tempMin":59.882000000000005,"tempMax":72.266,"windSpeed":4.7936000000000005,"rain":0.01299212598425197},"pressure":1027.6,"humidity":0,"condition":{"id":500,"main":"Rain","description":"light rain","icon":"10d"},"windDeg":226,"hourly":[]},{"date":"2013-08-15","timestamp":1376564400,"metric":{"tempMin":15.3,"tempMax":23.26,"windSpeed":26.316},"imperial":{"tempMin":59.540000000000006,"tempMax":73.868,"windSpeed":16.3744,"rain":null},"pressure":1027.33,"humidity":0,"condition":{"id":500,"main":"Rain","description":"light rain","icon":"10d"},"windDeg":253,"hourly":[]}],"save":true}""")
603

Subscribers

People subscribed via source and target branches