Merge lp:~nskaggs/ubuntu-weather-app/ap-tweaks into lp:ubuntu-weather-app/obsolete.trunk

Proposed by Nicholas Skaggs
Status: Merged
Approved by: Nicholas Skaggs
Approved revision: 215
Merged at revision: 215
Proposed branch: lp:~nskaggs/ubuntu-weather-app/ap-tweaks
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 925 lines (+160/-169)
4 files modified
tests/autopilot/ubuntu_weather_app/tests/__init__.py (+17/-26)
tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py (+52/-52)
tests/autopilot/ubuntu_weather_app/tests/test_mainview.py (+31/-31)
tests/autopilot/ubuntu_weather_app/tests/test_settings.py (+60/-60)
To merge this branch: bzr merge lp:~nskaggs/ubuntu-weather-app/ap-tweaks
Reviewer Review Type Date Requested Status
Leo Arias (community) code review Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Ubuntu Weather Developers Pending
Review via email: mp+209354@code.launchpad.net

Commit message

update tests to use more emulator standards

Description of the change

Work on some of the flakiness with tests, without total refactoring

To post a comment you must log in.
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

I dislike the whitespaces changes being flagged...

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
215. By Nicholas Skaggs

remove get_qml_view

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
Leo Arias (elopio) wrote :

A nice step forward. Thanks Nic.

review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/autopilot/ubuntu_weather_app/tests/__init__.py'
--- tests/autopilot/ubuntu_weather_app/tests/__init__.py 2014-02-26 17:08:11 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/__init__.py 2014-03-05 15:16:06 +0000
@@ -10,7 +10,6 @@
10"""weather-app autopilot tests."""10"""weather-app autopilot tests."""
1111
12import os.path12import os.path
13import glob
14import sqlite313import sqlite3
15import time14import time
16import logging15import logging
@@ -19,19 +18,20 @@
1918
20from autopilot.input import Mouse, Touch, Pointer19from autopilot.input import Mouse, Touch, Pointer
21from autopilot.platform import model20from autopilot.platform import model
22from autopilot.testcase import AutopilotTestCase
23from testtools.matchers import Equals, Is, Not21from testtools.matchers import Equals, Is, Not
24from autopilot.matchers import Eventually22from autopilot.matchers import Eventually
2523
24from ubuntuuitoolkit import (
25 base,
26 emulators as toolkit_emulators
27)
28from ubuntu_weather_app import emulators
26import ubuntu_weather_app29import ubuntu_weather_app
2730
28from ubuntuuitoolkit import emulators as toolkit_emulators
29from ubuntu_weather_app.emulators import MainView
30
31logger = logging.getLogger(__name__)31logger = logging.getLogger(__name__)
3232
3333
34class WeatherTestCase(AutopilotTestCase):34class WeatherTestCase(base.UbuntuUIToolkitAppTestCase):
3535
36 """A common test case class that provides several useful methods for36 """A common test case class that provides several useful methods for
37 weather app tests."""37 weather app tests."""
@@ -45,16 +45,10 @@
45 installed_location = "/usr/share/ubuntu-weather-app/ubuntu-weather-app.qml"45 installed_location = "/usr/share/ubuntu-weather-app/ubuntu-weather-app.qml"
4646
47 def setUp(self):47 def setUp(self):
48 super(WeatherTestCase, self).setUp()
48 self.pointing_device = Pointer(self.input_device_class.create())49 self.pointing_device = Pointer(self.input_device_class.create())
49 super(WeatherTestCase, self).setUp()
50 self.launch_app()50 self.launch_app()
5151
52 """Workaround to find the qmlscene binary via shell globbing.
53 This is needed since we can't rely on qt5-default being installed on
54 devices to make qmlscene available in the path"""
55 def qmlscene(self):
56 return glob.glob("/usr/lib/*/qt5/bin/qmlscene")[0]
57
58 def launch_app(self):52 def launch_app(self):
59 if os.path.exists(self.local_location):53 if os.path.exists(self.local_location):
60 logger.debug("Running via local installation")54 logger.debug("Running via local installation")
@@ -68,14 +62,14 @@
6862
69 def launch_test_local(self):63 def launch_test_local(self):
70 self.app = self.launch_test_application(64 self.app = self.launch_test_application(
71 self.qmlscene(),65 base.get_qmlscene_launch_command(),
72 self.local_location,66 self.local_location,
73 app_type='qt',67 app_type='qt',
74 emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)68 emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
7569
76 def launch_test_installed(self):70 def launch_test_installed(self):
77 self.app = self.launch_test_application(71 self.app = self.launch_test_application(
78 self.qmlscene(),72 base.get_qmlscene_launch_command(),
79 self.installed_location,73 self.installed_location,
80 app_type='qt',74 app_type='qt',
81 emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)75 emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
@@ -85,30 +79,27 @@
85 "com.ubuntu.weather",79 "com.ubuntu.weather",
86 emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)80 emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
8781
88 def get_qml_view(self):
89 return self.app.select_single("QQuickView")
90
91 """Test if tabs with data are present in tablet mode"""82 """Test if tabs with data are present in tablet mode"""
92 def _ensure_tablet_tabs_loaded(self):83 def _ensure_tablet_tabs_loaded(self):
93 self.assertThat(lambda: self.main_window.wait_select_single('QQuickRectangle', visible=True, objectName='SideLabel'), 84 self.assertThat(lambda: self.main_view.wait_select_single('QQuickRectangle', visible=True, objectName='SideLabel'),
94 Eventually(Not(Is(None)), timeout=60))85 Eventually(Not(Is(None)), timeout=60))
9586
96 @property87 @property
97 def main_window(self):88 def main_view(self):
98 return self.app.select_single(MainView)89 return self.app.wait_select_single(emulators.MainView)
9990
100class SheetMixin(object):91class SheetMixin(object):
101 """A mixin to to give access to common sheet elements"""92 """A mixin to to give access to common sheet elements"""
10293
103 def _click_sheet_confirm(self):94 def _click_sheet_confirm(self):
104 """Clicks the confirm button"""95 """Clicks the confirm button"""
105 button = self.main_window.select_single(96 button = self.main_view.select_single(
106 'Button', objectName='confirmButton')97 'Button', objectName='confirmButton')
107 self.pointing_device.click_object(button)98 self.pointing_device.click_object(button)
10899
109 def _click_sheet_cancel(self):100 def _click_sheet_cancel(self):
110 """Clicks the cancel button"""101 """Clicks the cancel button"""
111 button = self.main_window.select_single(102 button = self.main_view.select_single(
112 'Button', objectName='cancelButton')103 'Button', objectName='cancelButton')
113 self.pointing_device.click_object(button)104 self.pointing_device.click_object(button)
114105
@@ -118,12 +109,12 @@
118 def _open_add_location_page(self):109 def _open_add_location_page(self):
119 """Opens the AddLocationPage"""110 """Opens the AddLocationPage"""
120 # click on listitem to open AddLocationPage111 # click on listitem to open AddLocationPage
121 addCityItem = self.main_window.wait_select_single('Standard', objectName='AddCityListItem')112 addCityItem = self.main_view.wait_select_single('Standard', objectName='AddCityListItem')
122 self.assertThat(lambda: addCityItem.visible, Eventually(Equals(True)))113 self.assertThat(lambda: addCityItem.visible, Eventually(Equals(True)))
123 self.pointing_device.move_to_object(addCityItem)114 self.pointing_device.move_to_object(addCityItem)
124 self.pointing_device.click()115 self.pointing_device.click()
125116
126 addLocPage = self.main_window.select_single("DefaultSheet", objectName="AddLocationSheet")117 addLocPage = self.main_view.select_single("DefaultSheet", objectName="AddLocationSheet")
127 self.assertThat(addLocPage.visible, Eventually(Equals(True)))118 self.assertThat(addLocPage.visible, Eventually(Equals(True)))
128119
129class DatabaseMixin(object):120class DatabaseMixin(object):
@@ -187,7 +178,7 @@
187 with open(path) as fh:178 with open(path) as fh:
188 json_str = fh.read()179 json_str = fh.read()
189 result.append(json_str.strip())180 result.append(json_str.strip())
190 fh.close() 181 fh.close()
191 return result182 return result
192183
193 def add_locations_to_database(self, limit=None):184 def add_locations_to_database(self, limit=None):
194185
=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py'
--- tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py 2014-02-15 14:31:10 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py 2014-03-05 15:16:06 +0000
@@ -11,7 +11,7 @@
1111
12from testtools.matchers import Equals, Not12from testtools.matchers import Equals, Not
13from autopilot.matchers import Eventually13from autopilot.matchers import Eventually
14from autopilot.introspection.dbus import StateNotFoundError 14from autopilot.introspection.dbus import StateNotFoundError
15from unittest import skip15from unittest import skip
1616
17from ubuntu_weather_app.tests import WeatherTestCase, DatabaseMixin, SheetMixin, LocationManagerMixin17from ubuntu_weather_app.tests import WeatherTestCase, DatabaseMixin, SheetMixin, LocationManagerMixin
@@ -28,7 +28,7 @@
28 self.clean_db()28 self.clean_db()
29 super(TestLocationManager, self).setUp()29 super(TestLocationManager, self).setUp()
30 self.assertThat(30 self.assertThat(
31 self.get_qml_view().visible, Eventually(Equals(True)))31 self.main_view.visible, Eventually(Equals(True)))
3232
33 def _preload_database_and_launch(self):33 def _preload_database_and_launch(self):
34 #we want to start with existing data34 #we want to start with existing data
@@ -42,15 +42,15 @@
42 logger.debug("Re-Launching app to introspect")42 logger.debug("Re-Launching app to introspect")
43 super(TestLocationManager, self).setUp()43 super(TestLocationManager, self).setUp()
44 self.assertThat(44 self.assertThat(
45 self.get_qml_view().visible, Eventually(Equals(True)))45 self.main_view.visible, Eventually(Equals(True)))
4646
47 def _open_location_manager(self, kb=False):47 def _open_location_manager(self, kb=False):
48 """Opens the location manager"""48 """Opens the location manager"""
49 if kb: self.keyboard.press_and_release('Ctrl+n')49 if kb: self.keyboard.press_and_release('Ctrl+n')
50 else: self.main_window.open_toolbar().click_button("EditButton")50 else: self.main_view.open_toolbar().click_button("EditButton")
5151
52 # test location manager becomes visible52 # test location manager becomes visible
53 managerSheet = self.main_window.select_single('ComposerSheet', objectName='LocationManagerSheet')53 managerSheet = self.main_view.select_single('ComposerSheet', objectName='LocationManagerSheet')
54 self.assertThat(managerSheet.visible, Eventually(Equals(True)))54 self.assertThat(managerSheet.visible, Eventually(Equals(True)))
5555
56 def _swipe_first_location_to_remove(self):56 def _swipe_first_location_to_remove(self):
@@ -69,7 +69,7 @@
69 return qqlw.count69 return qqlw.count
7070
71 def _search_for_city(self, city):71 def _search_for_city(self, city):
72 searchField = self.main_window.wait_select_single("TextField", objectName="SearchField")72 searchField = self.main_view.wait_select_single("TextField", objectName="SearchField")
73 #poll clicking for focus for lack of better method, due to screen switching animation73 #poll clicking for focus for lack of better method, due to screen switching animation
74 #is there a property we can use instead?74 #is there a property we can use instead?
75 timeout = 075 timeout = 0
@@ -89,22 +89,22 @@
89 self._search_for_city(location)89 self._search_for_city(location)
9090
91 # wait for results and click on the first item91 # wait for results and click on the first item
92 load_indicator = self.main_window.select_single('ActivityIndicator', objectName='SearchingSpinner')92 load_indicator = self.main_view.select_single('ActivityIndicator', objectName='SearchingSpinner')
93 self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120))93 self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120))
94 resultsList = self.main_window.select_single('QQuickListView', objectName='SearchResultList')94 resultsList = self.main_view.select_single('QQuickListView', objectName='SearchResultList')
95 self.assertThat(resultsList.visible, Eventually(Equals(True)))95 self.assertThat(resultsList.visible, Eventually(Equals(True)))
96 firstResult = self.main_window.wait_select_single('Label', objectName='searchResult0')96 firstResult = self.main_view.wait_select_single('Label', objectName='searchResult0')
97 self.pointing_device.move_to_object(firstResult)97 self.pointing_device.move_to_object(firstResult)
98 self.pointing_device.click()98 self.pointing_device.click()
99 sleep(1)99 sleep(1)
100100
101 # LocationManagerPage should be visible and location added101 # LocationManagerPage should be visible and location added
102 addedItem = self.main_window.wait_select_single('Label', text=location)102 addedItem = self.main_view.wait_select_single('Label', text=location)
103 self.assertThat(addedItem.text, Eventually(Equals(location)))103 self.assertThat(addedItem.text, Eventually(Equals(location)))
104 self._click_sheet_confirm()104 self._click_sheet_confirm()
105105
106 # back to locations, wait till data is loaded106 # back to locations, wait till data is loaded
107 load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner')107 load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner')
108 self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120))108 self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120))
109109
110 def _remove_location(self):110 def _remove_location(self):
@@ -118,34 +118,34 @@
118 self._add_location("Paris")118 self._add_location("Paris")
119119
120 # only location is there120 # only location is there
121 loadingPage = self.main_window.select_single("Tabs", objectName="rootTabs")121 loadingPage = self.main_view.select_single("Tabs", objectName="rootTabs")
122 self.assertThat(loadingPage.visible, Eventually(Equals(True)))122 self.assertThat(loadingPage.visible, Eventually(Equals(True)))
123 tabObjects = self.main_window.select_many('LocationTab', objectName='LocationTab')123 tabObjects = self.main_view.select_many('LocationTab', objectName='LocationTab')
124 self.assertEqual(1, len(tabObjects))124 self.assertEqual(1, len(tabObjects))
125125
126 def test_add_predefined_location(self):126 def test_add_predefined_location(self):
127 """Adds a location"""127 """Adds a location"""
128 self._open_add_location_page()128 self._open_add_location_page()
129129
130 resultsList = self.main_window.select_single('QQuickListView', objectName='SearchResultList')130 resultsList = self.main_view.select_single('QQuickListView', objectName='SearchResultList')
131 self.assertThat(resultsList.visible, Eventually(Equals(True)))131 self.assertThat(resultsList.visible, Eventually(Equals(True)))
132 testResult = self.main_window.wait_select_single('Label', objectName='searchResult4')132 testResult = self.main_view.wait_select_single('Label', objectName='searchResult4')
133 self.pointing_device.move_to_object(testResult)133 self.pointing_device.move_to_object(testResult)
134 self.pointing_device.click()134 self.pointing_device.click()
135135
136 # LocationManagerPage should be visible and location added136 # LocationManagerPage should be visible and location added
137 addedItem = self.main_window.wait_select_single('Label', objectName="existingLocation0")137 addedItem = self.main_view.wait_select_single('Label', objectName="existingLocation0")
138 self.assertThat(addedItem.text, Eventually(Equals("Cairo")))138 self.assertThat(addedItem.text, Eventually(Equals("Cairo")))
139 self._click_sheet_confirm()139 self._click_sheet_confirm()
140140
141 # back to locations, wait till data is loaded141 # back to locations, wait till data is loaded
142 load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner')142 load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner')
143 self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120))143 self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120))
144144
145 # only location is there145 # only location is there
146 loadingPage = self.main_window.select_single("Tabs", objectName="rootTabs")146 loadingPage = self.main_view.select_single("Tabs", objectName="rootTabs")
147 self.assertThat(loadingPage.visible, Eventually(Equals(True)))147 self.assertThat(loadingPage.visible, Eventually(Equals(True)))
148 tabObjects = self.main_window.select_many('LocationTab', objectName='LocationTab')148 tabObjects = self.main_view.select_many('LocationTab', objectName='LocationTab')
149 self.assertEqual(1, len(tabObjects))149 self.assertEqual(1, len(tabObjects))
150150
151 def test_search_city(self):151 def test_search_city(self):
@@ -156,15 +156,15 @@
156 searchField = self._search_for_city("London")156 searchField = self._search_for_city("London")
157157
158 # wait for results and click on the first item158 # wait for results and click on the first item
159 load_indicator = self.main_window.select_single('ActivityIndicator', objectName='SearchingSpinner')159 load_indicator = self.main_view.select_single('ActivityIndicator', objectName='SearchingSpinner')
160 self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120))160 self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120))
161 resultsList = self.main_window.select_single('QQuickListView', objectName='SearchResultList')161 resultsList = self.main_view.select_single('QQuickListView', objectName='SearchResultList')
162 self.assertThat(resultsList.visible, Eventually(Equals(True)))162 self.assertThat(resultsList.visible, Eventually(Equals(True)))
163 firstResult = self.main_window.wait_select_single("Label", objectName="searchResult0")163 firstResult = self.main_view.wait_select_single("Label", objectName="searchResult0")
164 self.assertThat(firstResult.text, Eventually(Equals("London")))164 self.assertThat(firstResult.text, Eventually(Equals("London")))
165165
166 # regain focus, clear search field and do another search166 # regain focus, clear search field and do another search
167 searchField = self.main_window.wait_select_single("TextField", objectName="SearchField")167 searchField = self.main_view.wait_select_single("TextField", objectName="SearchField")
168 self.pointing_device.click_object(searchField)168 self.pointing_device.click_object(searchField)
169 clear_button = searchField.wait_select_single("AbstractButton")169 clear_button = searchField.wait_select_single("AbstractButton")
170 self.pointing_device.click_object(clear_button)170 self.pointing_device.click_object(clear_button)
@@ -173,17 +173,17 @@
173 self.pointing_device.click_object(searchField)173 self.pointing_device.click_object(searchField)
174 self.keyboard.type("Hamburg")174 self.keyboard.type("Hamburg")
175 self.keyboard.press_and_release('Enter')175 self.keyboard.press_and_release('Enter')
176 load_indicator = self.main_window.select_single('ActivityIndicator', objectName='SearchingSpinner')176 load_indicator = self.main_view.select_single('ActivityIndicator', objectName='SearchingSpinner')
177 self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120))177 self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120))
178 self.assertThat(resultsList.visible, Eventually(Equals(True)))178 self.assertThat(resultsList.visible, Eventually(Equals(True)))
179 firstResult = self.main_window.wait_select_single("Label", objectName="searchResult0")179 firstResult = self.main_view.wait_select_single("Label", objectName="searchResult0")
180 self.assertThat(firstResult.text, Eventually(Equals("Hamburg")))180 self.assertThat(firstResult.text, Eventually(Equals("Hamburg")))
181181
182 def test_cancel_adding_location(self):182 def test_cancel_adding_location(self):
183 """Cancel the cities search"""183 """Cancel the cities search"""
184 self._open_add_location_page()184 self._open_add_location_page()
185 self._click_sheet_cancel()185 self._click_sheet_cancel()
186 locationList = self.main_window.wait_select_single('QQuickListView', objectName='LocationList')186 locationList = self.main_view.wait_select_single('QQuickListView', objectName='LocationList')
187 self.assertThat(locationList.visible, Eventually(Equals(True)))187 self.assertThat(locationList.visible, Eventually(Equals(True)))
188188
189 def test_no_location_found(self):189 def test_no_location_found(self):
@@ -194,43 +194,43 @@
194 self._search_for_city("UbuntuCity")194 self._search_for_city("UbuntuCity")
195195
196 # wait for result and look if label is shown196 # wait for result and look if label is shown
197 load_indicator = self.main_window.select_single('ActivityIndicator', objectName='SearchingSpinner')197 load_indicator = self.main_view.select_single('ActivityIndicator', objectName='SearchingSpinner')
198 self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120))198 self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120))
199 errorLabel = self.main_window.select_single('Label', objectName='noCityError')199 errorLabel = self.main_view.select_single('Label', objectName='noCityError')
200 self.assertThat(errorLabel.visible, Eventually(Equals(True)))200 self.assertThat(errorLabel.visible, Eventually(Equals(True)))
201201
202 def test_location_lookup(self):202 def test_location_lookup(self):
203 """Tests the location lookup"""203 """Tests the location lookup"""
204 # start lookup204 # start lookup
205 lookupItem = self.main_window.wait_select_single('Standard', objectName='LocationLookupItem')205 lookupItem = self.main_view.wait_select_single('Standard', objectName='LocationLookupItem')
206 self.pointing_device.click_object(lookupItem)206 self.pointing_device.click_object(lookupItem)
207207
208 # wait for result208 # wait for result
209 load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LookupIndicator')209 load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LookupIndicator')
210 self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120))210 self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120))
211211
212 # check a location was found212 # check a location was found
213 location = self.main_window.wait_select_single('Label', objectName='CurrentLocationLabel')213 location = self.main_view.wait_select_single('Label', objectName='CurrentLocationLabel')
214 self.assertThat(location.text, Eventually(Not(Equals(""))))214 self.assertThat(location.text, Eventually(Not(Equals(""))))
215 location_name = location.text215 location_name = location.text
216216
217 # add location217 # add location
218 add_button = self.main_window.wait_select_single('Button', objectName='LookupItemAddButton')218 add_button = self.main_view.wait_select_single('Button', objectName='LookupItemAddButton')
219 self.pointing_device.click_object(add_button)219 self.pointing_device.click_object(add_button)
220220
221 # LocationManagerPage should be visible and location added221 # LocationManagerPage should be visible and location added
222 addedItem = self.main_window.wait_select_single('Label', objectName="existingLocation0")222 addedItem = self.main_view.wait_select_single('Label', objectName="existingLocation0")
223 self.assertThat(addedItem.text, Eventually(Equals(location_name)))223 self.assertThat(addedItem.text, Eventually(Equals(location_name)))
224 self._click_sheet_confirm()224 self._click_sheet_confirm()
225225
226 # back to locations, wait till data is loaded226 # back to locations, wait till data is loaded
227 load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner')227 load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner')
228 self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120))228 self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120))
229229
230 # only location is there230 # only location is there
231 loadingPage = self.main_window.select_single("Tabs", objectName="rootTabs")231 loadingPage = self.main_view.select_single("Tabs", objectName="rootTabs")
232 self.assertThat(loadingPage.visible, Eventually(Equals(True)))232 self.assertThat(loadingPage.visible, Eventually(Equals(True)))
233 tabObjects = self.main_window.select_many('LocationTab', objectName='LocationTab')233 tabObjects = self.main_view.select_many('LocationTab', objectName='LocationTab')
234 self.assertEqual(1, len(tabObjects))234 self.assertEqual(1, len(tabObjects))
235235
236 def test_remove_location(self):236 def test_remove_location(self):
@@ -238,20 +238,20 @@
238 self._preload_database_and_launch()238 self._preload_database_and_launch()
239239
240 # wait till data is loaded240 # wait till data is loaded
241 loadingPage = self.main_window.select_single("Tabs", objectName="rootTabs")241 loadingPage = self.main_view.select_single("Tabs", objectName="rootTabs")
242 self.assertThat(loadingPage.visible, Eventually(Equals(True)))242 self.assertThat(loadingPage.visible, Eventually(Equals(True)))
243243
244 # count locations at start244 # count locations at start
245 tabObjects = self.main_window.select_many('LocationTab', objectName='LocationTab')245 tabObjects = self.main_view.select_many('LocationTab', objectName='LocationTab')
246 tabsSumStart = len(tabObjects)246 tabsSumStart = len(tabObjects)
247247
248 # go to the location manager and remove 1st location248 # go to the location manager and remove 1st location
249 self._remove_location()249 self._remove_location()
250250
251 # back to locations, only one is left251 # back to locations, only one is left
252 load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner')252 load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner')
253 self.assertThat(load_indicator.running, Eventually(Equals(False)))253 self.assertThat(load_indicator.running, Eventually(Equals(False)))
254 tabObjects = self.main_window.select_many('LocationTab', objectName='LocationTab')254 tabObjects = self.main_view.select_many('LocationTab', objectName='LocationTab')
255 self.assertThat(lambda: tabsSumStart-1, Eventually(Equals(len(tabObjects))))255 self.assertThat(lambda: tabsSumStart-1, Eventually(Equals(len(tabObjects))))
256256
257 def test_cancel_remove_location(self):257 def test_cancel_remove_location(self):
@@ -259,11 +259,11 @@
259 self._preload_database_and_launch()259 self._preload_database_and_launch()
260260
261 # wait data is loaded261 # wait data is loaded
262 loadingPage = self.main_window.select_single("Tabs", objectName="rootTabs")262 loadingPage = self.main_view.select_single("Tabs", objectName="rootTabs")
263 self.assertThat(loadingPage.visible, Eventually(Equals(True)))263 self.assertThat(loadingPage.visible, Eventually(Equals(True)))
264264
265 # count locations at start265 # count locations at start
266 tabObjects = self.main_window.select_many('LocationTab', objectName='LocationTab')266 tabObjects = self.main_view.select_many('LocationTab', objectName='LocationTab')
267 tabsSumStart = len(tabObjects)267 tabsSumStart = len(tabObjects)
268268
269 # go to the location manager, remove location, but click cancel269 # go to the location manager, remove location, but click cancel
@@ -272,9 +272,9 @@
272 self._click_sheet_cancel()272 self._click_sheet_cancel()
273273
274 # back to locations, no loction is removed274 # back to locations, no loction is removed
275 loadingPage = self.main_window.select_single("Tabs", objectName="rootTabs")275 loadingPage = self.main_view.select_single("Tabs", objectName="rootTabs")
276 self.assertThat(loadingPage.visible, Eventually(Equals(True)))276 self.assertThat(loadingPage.visible, Eventually(Equals(True)))
277 tabObjects = self.main_window.select_many('LocationTab', objectName='LocationTab')277 tabObjects = self.main_view.select_many('LocationTab', objectName='LocationTab')
278 self.assertEqual(tabsSumStart, len(tabObjects))278 self.assertEqual(tabsSumStart, len(tabObjects))
279279
280 def test_del_add_bug(self):280 def test_del_add_bug(self):
@@ -291,30 +291,30 @@
291 self._add_location("Cairo")291 self._add_location("Cairo")
292292
293 # back to locations, wait till data is loaded293 # back to locations, wait till data is loaded
294 load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner')294 load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner')
295 self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120))295 self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120))
296296
297 # count the tabs297 # count the tabs
298 tabObjects = self.main_window.select_many('LocationTab', objectName='LocationTab')298 tabObjects = self.main_view.select_many('LocationTab', objectName='LocationTab')
299 self.assertThat(lambda: len(tabObjects), Eventually(Equals(2)))299 self.assertThat(lambda: len(tabObjects), Eventually(Equals(2)))
300 self.assertThat(300 self.assertThat(
301 self.main_window.select_single('LocationTab', index=1).title,301 self.main_view.select_single('LocationTab', index=1).title,
302 Eventually(Equals("Cairo")))302 Eventually(Equals("Cairo")))
303303
304 @skip("skipped because of Bug #1279073")304 @skip("skipped because of Bug #1279073")
305 def test_open_location_manager_keyboard(self):305 def test_open_location_manager_keyboard(self):
306 if self.platform_model != "Desktop": 306 if self.platform_model != "Desktop":
307 return307 return
308 self._preload_database_and_launch()308 self._preload_database_and_launch()
309 self._open_location_manager(kb=True)309 self._open_location_manager(kb=True)
310310
311 # close sheet by keyboard and test311 # close sheet by keyboard and test
312 self.keyboard.press_and_release('Escape')312 self.keyboard.press_and_release('Escape')
313 self.assertRaises(StateNotFoundError, lambda: self.main_window.select_single('ComposerSheet'))313 self.assertRaises(StateNotFoundError, lambda: self.main_view.select_single('ComposerSheet'))
314314
315 @skip("skipped because of Bug #1279073")315 @skip("skipped because of Bug #1279073")
316 def test_add_location_keyboard(self):316 def test_add_location_keyboard(self):
317 if self.platform_model != "Desktop": 317 if self.platform_model != "Desktop":
318 return318 return
319 self._preload_database_and_launch()319 self._preload_database_and_launch()
320 self._open_location_manager(kb=True)320 self._open_location_manager(kb=True)
@@ -322,5 +322,5 @@
322322
323 # close sheet by keyboard and test all sheets are closed323 # close sheet by keyboard and test all sheets are closed
324 self.keyboard.press_and_release('Escape')324 self.keyboard.press_and_release('Escape')
325 self.assertRaises(StateNotFoundError, lambda: self.main_window.select_single('DefaultSheet'))325 self.assertRaises(StateNotFoundError, lambda: self.main_view.select_single('DefaultSheet'))
326 self.assertRaises(StateNotFoundError, lambda: self.main_window.select_single('ComposerSheet'))326 self.assertRaises(StateNotFoundError, lambda: self.main_view.select_single('ComposerSheet'))
327327
=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_mainview.py'
--- tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 2014-02-26 17:08:11 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 2014-03-05 15:16:06 +0000
@@ -13,7 +13,7 @@
1313
14from testtools.matchers import Equals, Is, Not14from testtools.matchers import Equals, Is, Not
15from autopilot.matchers import Eventually15from autopilot.matchers import Eventually
16from unittest import skip 16from unittest import skip
1717
18import logging18import logging
1919
@@ -34,7 +34,7 @@
34 logger.debug("Re-Launching app to introspect")34 logger.debug("Re-Launching app to introspect")
35 super(TestMainView, self).setUp()35 super(TestMainView, self).setUp()
36 self.assertThat(36 self.assertThat(
37 self.get_qml_view().visible, Eventually(Equals(True)))37 self.main_view.visible, Eventually(Equals(True)))
3838
39 def tearDown(self):39 def tearDown(self):
40 super(TestMainView, self).tearDown()40 super(TestMainView, self).tearDown()
@@ -44,10 +44,10 @@
44 second tab"""44 second tab"""
4545
46 # first tab should be visible after start46 # first tab should be visible after start
47 tabs = self.main_window.get_tabs()47 tabs = self.main_view.get_tabs()
48 first_tab = self.main_window.select_single(48 first_tab = self.main_view.select_single(
49 'LocationTab', index=0)49 'LocationTab', index=0)
50 second_tab = self.main_window.select_single(50 second_tab = self.main_view.select_single(
51 'LocationTab', index=1)51 'LocationTab', index=1)
52 self.assertThat(tabs.selectedTabIndex, Eventually(Equals(0)))52 self.assertThat(tabs.selectedTabIndex, Eventually(Equals(0)))
53 self.assertThat(first_tab.visible, Eventually(Equals(True)))53 self.assertThat(first_tab.visible, Eventually(Equals(True)))
@@ -57,7 +57,7 @@
57 # switch to next tab57 # switch to next tab
58 if kb and not back: self.keyboard.press_and_release('Ctrl+Tab')58 if kb and not back: self.keyboard.press_and_release('Ctrl+Tab')
59 elif kb and back: self.keyboard.press_and_release('Ctrl+Shift+Tab')59 elif kb and back: self.keyboard.press_and_release('Ctrl+Shift+Tab')
60 else: self.main_window.switch_to_tab_by_index(1)60 else: self.main_view.switch_to_tab_by_index(1)
6161
62 self.assertThat(tabs.selectedTabIndex, Eventually(Equals(1)))62 self.assertThat(tabs.selectedTabIndex, Eventually(Equals(1)))
63 self.assertThat(first_tab.visible, Eventually(Equals(False)))63 self.assertThat(first_tab.visible, Eventually(Equals(False)))
@@ -71,35 +71,35 @@
71 @skip("skipped because of Bug #1279073")71 @skip("skipped because of Bug #1279073")
72 def test_switch_tabs_keyboard(self):72 def test_switch_tabs_keyboard(self):
73 """Test start of app with two locations and switch from first to second tab"""73 """Test start of app with two locations and switch from first to second tab"""
74 if self.platform_model != "Desktop": 74 if self.platform_model != "Desktop":
75 return75 return
76 self._switch_tabs(kb=True)76 self._switch_tabs(kb=True)
7777
78 @skip("skipped because of Bug #1279073")78 @skip("skipped because of Bug #1279073")
79 def test_switch_tabs_keyboard_back(self):79 def test_switch_tabs_keyboard_back(self):
80 """Test start of app with two locations and switch from first to second tab"""80 """Test start of app with two locations and switch from first to second tab"""
81 if self.platform_model != "Desktop": 81 if self.platform_model != "Desktop":
82 return82 return
83 self._switch_tabs(kb=True, back=True)83 self._switch_tabs(kb=True, back=True)
8484
85 def _refresh(self, kb=False):85 def _refresh(self, kb=False):
86 # get the dates from the test data86 # get the dates from the test data
87 if self.main_window.wideAspect:87 if self.main_view.wideAspect:
88 self._ensure_tablet_tabs_loaded()88 self._ensure_tablet_tabs_loaded()
89 self.assertThat(lambda: self.main_window.select_many('Label', objectName='DayDateLabel'), Eventually(Not(Is(None))))89 self.assertThat(lambda: self.main_view.select_many('Label', objectName='DayDateLabel'), Eventually(Not(Is(None))))
90 curr_dates = self.main_window.select_many('Label', objectName='DayDateLabel')90 curr_dates = self.main_view.select_many('Label', objectName='DayDateLabel')
91 tab1_curr_date = curr_dates[0].text91 tab1_curr_date = curr_dates[0].text
92 tab2_curr_date = curr_dates[2].text92 tab2_curr_date = curr_dates[2].text
9393
94 # refresh and wait till loading has finished94 # refresh and wait till loading has finished
95 if kb: self.keyboard.press_and_release('Ctrl+r')95 if kb: self.keyboard.press_and_release('Ctrl+r')
96 else: self.main_window.open_toolbar().click_button("RefreshButton")96 else: self.main_view.open_toolbar().click_button("RefreshButton")
97 load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner')97 load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner')
98 self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120))98 self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120))
9999
100 # get the data from the refreshed tabs, have to be new100 # get the data from the refreshed tabs, have to be new
101 self.assertThat(lambda: self.main_window.select_many('Label',objectName='DayDateLabel'), Eventually(Not(Is(None)), timeout=60))101 self.assertThat(lambda: self.main_view.select_many('Label',objectName='DayDateLabel'), Eventually(Not(Is(None)), timeout=60))
102 refreshed_dates = self.main_window.select_many('Label',objectName='DayDateLabel')102 refreshed_dates = self.main_view.select_many('Label',objectName='DayDateLabel')
103 self.assertNotEqual(tab1_curr_date, refreshed_dates[0].text)103 self.assertNotEqual(tab1_curr_date, refreshed_dates[0].text)
104 self.assertNotEqual(tab2_curr_date, refreshed_dates[2].text)104 self.assertNotEqual(tab2_curr_date, refreshed_dates[2].text)
105105
@@ -108,55 +108,55 @@
108108
109 @skip("skipped because of Bug #1279073")109 @skip("skipped because of Bug #1279073")
110 def test_refresh_tabs_keyboard(self):110 def test_refresh_tabs_keyboard(self):
111 if self.platform_model != "Desktop": 111 if self.platform_model != "Desktop":
112 return112 return
113 self._refresh(kb=True)113 self._refresh(kb=True)
114 114
115 @skip("skipped because of Bug #1279073")115 @skip("skipped because of Bug #1279073")
116 def test_day_navigation_keyboard(self):116 def test_day_navigation_keyboard(self):
117 # get the dates from the test data117 # get the dates from the test data
118 if self.platform_model != "Desktop": 118 if self.platform_model != "Desktop":
119 return119 return
120 self.assertThat(lambda: self.main_window.select_many('QQuickListView', objectName='DailyForecastList'), Eventually(Not(Is(None))))120 self.assertThat(lambda: self.main_view.select_many('QQuickListView', objectName='DailyForecastList'), Eventually(Not(Is(None))))
121 dayLists = self.main_window.select_many('QQuickListView', objectName='DailyForecastList')121 dayLists = self.main_view.select_many('QQuickListView', objectName='DailyForecastList')
122 self.assertThat(dayLists[1].visible, Eventually(Equals(True)))122 self.assertThat(dayLists[1].visible, Eventually(Equals(True)))
123 self.assertThat(dayLists[1].currentIndex, Eventually(Equals(0)))123 self.assertThat(dayLists[1].currentIndex, Eventually(Equals(0)))
124124
125 # navigate to to overmorrow125 # navigate to to overmorrow
126 self.keyboard.press_and_release('Down')126 self.keyboard.press_and_release('Down')
127 self.keyboard.press_and_release('Down')127 self.keyboard.press_and_release('Down')
128 dayLists = self.main_window.select_many('QQuickListView', objectName='DailyForecastList')128 dayLists = self.main_view.select_many('QQuickListView', objectName='DailyForecastList')
129 self.assertThat(dayLists[1].visible, Eventually(Equals(True)))129 self.assertThat(dayLists[1].visible, Eventually(Equals(True)))
130 self.assertThat(dayLists[1].currentIndex, Eventually(Equals(2)))130 self.assertThat(dayLists[1].currentIndex, Eventually(Equals(2)))
131131
132 # navigate to tomorrow132 # navigate to tomorrow
133 self.keyboard.press_and_release('Up')133 self.keyboard.press_and_release('Up')
134 dayLists = self.main_window.select_many('QQuickListView', objectName='DailyForecastList')134 dayLists = self.main_view.select_many('QQuickListView', objectName='DailyForecastList')
135 self.assertThat(dayLists[1].visible, Eventually(Equals(True)))135 self.assertThat(dayLists[1].visible, Eventually(Equals(True)))
136 self.assertThat(dayLists[1].currentIndex, Eventually(Equals(1)))136 self.assertThat(dayLists[1].currentIndex, Eventually(Equals(1)))
137137
138 @skip("skipped because of Bug #1279073")138 @skip("skipped because of Bug #1279073")
139 def test_show_details_keyboard(self):139 def test_show_details_keyboard(self):
140 if self.platform_model != "Desktop": 140 if self.platform_model != "Desktop":
141 return141 return
142 self.assertThat(lambda: self.main_window.select_many('QQuickFlickable', state="back"), Eventually(Not(Is(True))))142 self.assertThat(lambda: self.main_view.select_many('QQuickFlickable', state="back"), Eventually(Not(Is(True))))
143 back_flipped = self.main_window.select_many('QQuickFlipable', state="back")143 back_flipped = self.main_view.select_many('QQuickFlipable', state="back")
144 self.assertEqual(0, len(back_flipped))144 self.assertEqual(0, len(back_flipped))
145145
146 # press space146 # press space
147 self.keyboard.press_and_release('Space')147 self.keyboard.press_and_release('Space')
148148
149 # check the displayed info is flipped and only one is flipped149 # check the displayed info is flipped and only one is flipped
150 self.assertThat(lambda: self.main_window.select_many('QQuickFlickable', state="back"), Eventually(Not(Is(True))))150 self.assertThat(lambda: self.main_view.select_many('QQuickFlickable', state="back"), Eventually(Not(Is(True))))
151 flipables = self.main_window.select_many('QQuickFlipable')151 flipables = self.main_view.select_many('QQuickFlipable')
152 self.assertThat(flipables[1].state, Eventually(Equals("back")))152 self.assertThat(flipables[1].state, Eventually(Equals("back")))
153 back_flipped = self.main_window.select_many('QQuickFlipable', state="back")153 back_flipped = self.main_view.select_many('QQuickFlipable', state="back")
154 self.assertEqual(1, len(back_flipped))154 self.assertEqual(1, len(back_flipped))
155155
156 # press space again, hide details156 # press space again, hide details
157 self.keyboard.press_and_release('Space')157 self.keyboard.press_and_release('Space')
158158
159 # check nothing is flipped 159 # check nothing is flipped
160 self.assertThat(lambda: self.main_window.select_many('QQuickFlickable', state="back"), Eventually(Not(Is(True))))160 self.assertThat(lambda: self.main_view.select_many('QQuickFlickable', state="back"), Eventually(Not(Is(True))))
161 back_flipped = self.main_window.select_many('QQuickFlipable', state="back")161 back_flipped = self.main_view.select_many('QQuickFlipable', state="back")
162 self.assertEqual(0, len(back_flipped))162 self.assertEqual(0, len(back_flipped))
163163
=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_settings.py'
--- tests/autopilot/ubuntu_weather_app/tests/test_settings.py 2014-02-26 17:08:11 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/test_settings.py 2014-03-05 15:16:06 +0000
@@ -27,26 +27,26 @@
27 self.add_units_to_database()27 self.add_units_to_database()
28 super(TestSettings, self).setUp()28 super(TestSettings, self).setUp()
29 self.assertThat(29 self.assertThat(
30 self.get_qml_view().visible, Eventually(Equals(True)))30 self.main_view.visible, Eventually(Equals(True)))
3131
32 def _open_settings_sheet(self):32 def _open_settings_sheet(self):
33 """Opens the settings sheet"""33 """Opens the settings sheet"""
34 self.main_window.open_toolbar().click_button("SettingsButton")34 self.main_view.open_toolbar().click_button("SettingsButton")
3535
36 def _move_pointer_around(self):36 def _move_pointer_around(self):
37 """Helper method to move the pointer around, to assure selector is opened"""37 """Helper method to move the pointer around, to assure selector is opened"""
38 self.assertThat(lambda: self.main_window.select_single('ComposerSheet', objectName='SettingsSheet'), 38 self.assertThat(lambda: self.main_view.select_single('ComposerSheet', objectName='SettingsSheet'),
39 Eventually(Not(Is(None))))39 Eventually(Not(Is(None))))
40 sheet = self.main_window.select_single('ComposerSheet', objectName='SettingsSheet')40 sheet = self.main_view.select_single('ComposerSheet', objectName='SettingsSheet')
41 self.pointing_device.move_to_object(sheet)41 self.pointing_device.move_to_object(sheet)
4242
43 def _check_units(self, units):43 def _check_units(self, units):
44 """Checks selected units by values from the first location tab""" 44 """Checks selected units by values from the first location tab"""
45 if self.main_window.wideAspect:45 if self.main_view.wideAspect:
46 self._ensure_tablet_tabs_loaded()46 self._ensure_tablet_tabs_loaded()
47 self.assertThat(lambda: self.main_window.select_many('QQuickText', objectName='CurrentTempText'),47 self.assertThat(lambda: self.main_view.select_many('QQuickText', objectName='CurrentTempText'),
48 Eventually(Not(Is(None))))48 Eventually(Not(Is(None))))
49 current_location_tab = self.main_window.wait_select_single(49 current_location_tab = self.main_view.wait_select_single(
50 'LocationTab', visible=True)50 'LocationTab', visible=True)
51 today_item = current_location_tab.wait_select_single(51 today_item = current_location_tab.wait_select_single(
52 'QQuickItem', focus=True)52 'QQuickItem', focus=True)
@@ -69,20 +69,20 @@
6969
70 def _check_wind_units(self, wind_units):70 def _check_wind_units(self, wind_units):
71 """Checks selected units by values from the first location tab"""71 """Checks selected units by values from the first location tab"""
72 if self.main_window.wideAspect:72 if self.main_view.wideAspect:
73 self._ensure_tablet_tabs_loaded()73 self._ensure_tablet_tabs_loaded()
74 self.assertThat(lambda: self.main_window.select_many('WeatherDetailComponent', objectName='WindSpeedValue')[0],74 self.assertThat(lambda: self.main_view.select_many('WeatherDetailComponent', objectName='WindSpeedValue')[0],
75 Eventually(Not(Is(None))))75 Eventually(Not(Is(None))))
76 current_location_tab = self.main_window.select_single(76 current_location_tab = self.main_view.select_single(
77 'LocationTab', visible=True)77 'LocationTab', visible=True)
78 focused_item = current_location_tab.select_single(78 focused_item = current_location_tab.select_single(
79 'QQuickItem', focus=True)79 'QQuickItem', focus=True)
80 wind_component = focused_item.select_single(80 wind_component = focused_item.select_single(
81 'WeatherDetailComponent', objectName='WindSpeedValue')81 'WeatherDetailComponent', objectName='WindSpeedValue')
82 self.assertThat(lambda: wind_component.select_single('QQuickText', objectName='WeatherDetailUnit'), 82 self.assertThat(lambda: wind_component.select_single('QQuickText', objectName='WeatherDetailUnit'),
83 Eventually(Not(Is(None))))83 Eventually(Not(Is(None))))
84 wind_unit = wind_component.select_single('QQuickText', objectName='WeatherDetailUnit')84 wind_unit = wind_component.select_single('QQuickText', objectName='WeatherDetailUnit')
85 self.assertThat(lambda: wind_component.select_single('QQuickText', objectName='WeatherDetailValue'), 85 self.assertThat(lambda: wind_component.select_single('QQuickText', objectName='WeatherDetailValue'),
86 Eventually(Not(Is(None))))86 Eventually(Not(Is(None))))
87 wind_value = wind_component.select_single('QQuickText', objectName='WeatherDetailValue')87 wind_value = wind_component.select_single('QQuickText', objectName='WeatherDetailValue')
88 if wind_units == "mph":88 if wind_units == "mph":
@@ -94,20 +94,20 @@
9494
95 def _check_precipitation_units(self, pre_units):95 def _check_precipitation_units(self, pre_units):
96 """Checks selected units by values from the first location tab"""96 """Checks selected units by values from the first location tab"""
97 if self.main_window.wideAspect:97 if self.main_view.wideAspect:
98 self._ensure_tablet_tabs_loaded()98 self._ensure_tablet_tabs_loaded()
99 self.assertThat(lambda: self.main_window.select_many('WeatherDetailComponent', objectName='PrecipitationValue')[0],99 self.assertThat(lambda: self.main_view.select_many('WeatherDetailComponent', objectName='PrecipitationValue')[0],
100 Eventually(Not(Is(None))))100 Eventually(Not(Is(None))))
101 current_location_tab = self.main_window.select_single(101 current_location_tab = self.main_view.select_single(
102 'LocationTab', visible=True)102 'LocationTab', visible=True)
103 focused_item = current_location_tab.select_single(103 focused_item = current_location_tab.select_single(
104 'QQuickItem', focus=True)104 'QQuickItem', focus=True)
105 component = focused_item.select_single(105 component = focused_item.select_single(
106 'WeatherDetailComponent', objectName='PrecipitationValue')106 'WeatherDetailComponent', objectName='PrecipitationValue')
107 self.assertThat(lambda: component.select_many('QQuickText', objectName='WeatherDetailUnit'), 107 self.assertThat(lambda: component.select_many('QQuickText', objectName='WeatherDetailUnit'),
108 Eventually(Not(Is(None))))108 Eventually(Not(Is(None))))
109 unit = component.select_single('QQuickText', objectName='WeatherDetailUnit')109 unit = component.select_single('QQuickText', objectName='WeatherDetailUnit')
110 self.assertThat(lambda: component.select_single('QQuickText', objectName='WeatherDetailValue'), 110 self.assertThat(lambda: component.select_single('QQuickText', objectName='WeatherDetailValue'),
111 Eventually(Not(Is(None))))111 Eventually(Not(Is(None))))
112 value = component.select_single('QQuickText', objectName='WeatherDetailValue')112 value = component.select_single('QQuickText', objectName='WeatherDetailValue')
113 if pre_units == "in":113 if pre_units == "in":
@@ -119,16 +119,16 @@
119119
120 def _check_service(self, service):120 def _check_service(self, service):
121 """Checks selected units weather data service from the first location tab"""121 """Checks selected units weather data service from the first location tab"""
122 if self.main_window.wideAspect:122 if self.main_view.wideAspect:
123 self._ensure_tablet_tabs_loaded()123 self._ensure_tablet_tabs_loaded()
124 self.assertThat(lambda: self.main_window.select_many('TabFooter', objectName='TabFooter')[0],124 self.assertThat(lambda: self.main_view.select_many('TabFooter', objectName='TabFooter')[0],
125 Eventually(Not(Is(None))))125 Eventually(Not(Is(None))))
126 current_location_tab = self.main_window.select_single('LocationTab', visible=True)126 current_location_tab = self.main_view.select_single('LocationTab', visible=True)
127 self.assertThat(lambda: current_location_tab.select_single('TabFooter', objectName='TabFooter'), 127 self.assertThat(lambda: current_location_tab.select_single('TabFooter', objectName='TabFooter'),
128 Eventually(Not(Is(None))))128 Eventually(Not(Is(None))))
129 self.assertThat(lambda: current_location_tab.select_single('QQuickImage', objectName='DataProviderLogo'), 129 self.assertThat(lambda: current_location_tab.select_single('QQuickImage', objectName='DataProviderLogo'),
130 Eventually(Not(Is(None))))130 Eventually(Not(Is(None))))
131 131
132 focused_item = current_location_tab.select_single('QQuickItem', focus=True)132 focused_item = current_location_tab.select_single('QQuickItem', focus=True)
133 tab_footer = current_location_tab.select_single('TabFooter', objectName='TabFooter')133 tab_footer = current_location_tab.select_single('TabFooter', objectName='TabFooter')
134 provider_logo = current_location_tab.select_single('QQuickImage', objectName='DataProviderLogo')134 provider_logo = current_location_tab.select_single('QQuickImage', objectName='DataProviderLogo')
@@ -146,9 +146,9 @@
146 self._open_settings_sheet()146 self._open_settings_sheet()
147147
148 # open the value selector148 # open the value selector
149 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='TemperatureUnitsSelector'), 149 self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='TemperatureUnitsSelector'),
150 Eventually(Not(Is(None))))150 Eventually(Not(Is(None))))
151 units_selector = self.main_window.select_single('OptionSelector', objectName="TemperatureUnitsSelector")151 units_selector = self.main_view.select_single('OptionSelector', objectName="TemperatureUnitsSelector")
152 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))152 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
153 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))153 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))
154 current_option = units_selector.select_many('ShapeItem')[1]154 current_option = units_selector.select_many('ShapeItem')[1]
@@ -163,15 +163,15 @@
163 self._click_sheet_confirm()163 self._click_sheet_confirm()
164164
165 # wait for reload and check the imperial values165 # wait for reload and check the imperial values
166 load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner')166 load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner')
167 self.assertThat(load_indicator.running, Eventually(Equals(False)))167 self.assertThat(load_indicator.running, Eventually(Equals(False)))
168 self._check_units('imperial')168 self._check_units('imperial')
169169
170 # switch back to metric values again170 # switch back to metric values again
171 self._open_settings_sheet()171 self._open_settings_sheet()
172 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='TemperatureUnitsSelector'), 172 self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='TemperatureUnitsSelector'),
173 Eventually(Not(Is(None))))173 Eventually(Not(Is(None))))
174 units_selector = self.main_window.select_single('OptionSelector', objectName="TemperatureUnitsSelector")174 units_selector = self.main_view.select_single('OptionSelector', objectName="TemperatureUnitsSelector")
175 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))175 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
176 self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None))))176 self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None))))
177 current_option = units_selector.select_many('ShapeItem')[2]177 current_option = units_selector.select_many('ShapeItem')[2]
@@ -191,7 +191,7 @@
191 self._click_sheet_confirm()191 self._click_sheet_confirm()
192192
193 # wait for reload and check the metric values again193 # wait for reload and check the metric values again
194 load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner')194 load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner')
195 self.assertThat(load_indicator.running, Eventually(Equals(False)))195 self.assertThat(load_indicator.running, Eventually(Equals(False)))
196 self._check_units('metric')196 self._check_units('metric')
197197
@@ -203,9 +203,9 @@
203 self._open_settings_sheet()203 self._open_settings_sheet()
204204
205 # open the temp value selector205 # open the temp value selector
206 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='TemperatureUnitsSelector'), 206 self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='TemperatureUnitsSelector'),
207 Eventually(Not(Is(None))))207 Eventually(Not(Is(None))))
208 units_selector = self.main_window.select_single('OptionSelector', objectName="TemperatureUnitsSelector")208 units_selector = self.main_view.select_single('OptionSelector', objectName="TemperatureUnitsSelector")
209 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))209 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
210 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))210 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))
211 current_option = units_selector.select_many('ShapeItem')[1]211 current_option = units_selector.select_many('ShapeItem')[1]
@@ -219,9 +219,9 @@
219 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))219 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
220220
221 # open the wind value selector221 # open the wind value selector
222 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='WindUnitsSelector'), 222 self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='WindUnitsSelector'),
223 Eventually(Not(Is(None))))223 Eventually(Not(Is(None))))
224 units_selector = self.main_window.select_single('OptionSelector', objectName="WindUnitsSelector")224 units_selector = self.main_view.select_single('OptionSelector', objectName="WindUnitsSelector")
225 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))225 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
226 self.pointing_device.click_object(units_selector)226 self.pointing_device.click_object(units_selector)
227227
@@ -244,9 +244,9 @@
244 self._open_settings_sheet()244 self._open_settings_sheet()
245245
246 # open the wind value selector246 # open the wind value selector
247 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='WindUnitsSelector'), 247 self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='WindUnitsSelector'),
248 Eventually(Not(Is(None))))248 Eventually(Not(Is(None))))
249 units_selector = self.main_window.select_single('OptionSelector', objectName="WindUnitsSelector")249 units_selector = self.main_view.select_single('OptionSelector', objectName="WindUnitsSelector")
250 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))250 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
251 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))251 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))
252 current_option = units_selector.select_many('ShapeItem')[1]252 current_option = units_selector.select_many('ShapeItem')[1]
@@ -261,15 +261,15 @@
261 self._click_sheet_confirm()261 self._click_sheet_confirm()
262262
263 # wait for reload and check the mph values263 # wait for reload and check the mph values
264 load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner')264 load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner')
265 self.assertThat(load_indicator.running, Eventually(Equals(False)))265 self.assertThat(load_indicator.running, Eventually(Equals(False)))
266 self._check_wind_units('mph')266 self._check_wind_units('mph')
267267
268 # switch back to kmh values again268 # switch back to kmh values again
269 self._open_settings_sheet()269 self._open_settings_sheet()
270 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='WindUnitsSelector'), 270 self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='WindUnitsSelector'),
271 Eventually(Not(Is(None))))271 Eventually(Not(Is(None))))
272 units_selector = self.main_window.select_single('OptionSelector', objectName="WindUnitsSelector")272 units_selector = self.main_view.select_single('OptionSelector', objectName="WindUnitsSelector")
273 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))273 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
274 self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None))))274 self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None))))
275 current_option = units_selector.select_many('ShapeItem')[2]275 current_option = units_selector.select_many('ShapeItem')[2]
@@ -289,7 +289,7 @@
289 self._click_sheet_confirm()289 self._click_sheet_confirm()
290290
291 # wait for reload and check the metric values again291 # wait for reload and check the metric values again
292 load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner')292 load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner')
293 self.assertThat(load_indicator.running, Eventually(Equals(False)))293 self.assertThat(load_indicator.running, Eventually(Equals(False)))
294 self._check_wind_units('kmh')294 self._check_wind_units('kmh')
295295
@@ -301,9 +301,9 @@
301 self._open_settings_sheet()301 self._open_settings_sheet()
302302
303 # open the precipitation value selector303 # open the precipitation value selector
304 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='PrecipitationUnitsSelector'), 304 self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='PrecipitationUnitsSelector'),
305 Eventually(Not(Is(None))))305 Eventually(Not(Is(None))))
306 units_selector = self.main_window.select_single('OptionSelector', objectName="PrecipitationUnitsSelector")306 units_selector = self.main_view.select_single('OptionSelector', objectName="PrecipitationUnitsSelector")
307 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))307 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
308 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))308 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))
309 current_option = units_selector.select_many('ShapeItem')[1]309 current_option = units_selector.select_many('ShapeItem')[1]
@@ -318,15 +318,15 @@
318 self._click_sheet_confirm()318 self._click_sheet_confirm()
319319
320 # wait for reload and check the inch values320 # wait for reload and check the inch values
321 load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner')321 load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner')
322 self.assertThat(load_indicator.running, Eventually(Equals(False)))322 self.assertThat(load_indicator.running, Eventually(Equals(False)))
323 self._check_wind_units('in')323 self._check_wind_units('in')
324324
325 # switch back to mm values again325 # switch back to mm values again
326 self._open_settings_sheet()326 self._open_settings_sheet()
327 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='PrecipitationUnitsSelector'), 327 self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='PrecipitationUnitsSelector'),
328 Eventually(Not(Is(None))))328 Eventually(Not(Is(None))))
329 units_selector = self.main_window.select_single('OptionSelector', objectName="PrecipitationUnitsSelector")329 units_selector = self.main_view.select_single('OptionSelector', objectName="PrecipitationUnitsSelector")
330 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))330 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
331 self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None))))331 self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None))))
332 current_option = units_selector.select_many('ShapeItem')[2]332 current_option = units_selector.select_many('ShapeItem')[2]
@@ -348,7 +348,7 @@
348 self._click_sheet_confirm()348 self._click_sheet_confirm()
349349
350 # wait for reload and check the metric values again350 # wait for reload and check the metric values again
351 load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner')351 load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner')
352 self.assertThat(load_indicator.running, Eventually(Equals(False)))352 self.assertThat(load_indicator.running, Eventually(Equals(False)))
353 self._check_precipitation_units('mm')353 self._check_precipitation_units('mm')
354354
@@ -359,8 +359,8 @@
359 self._open_settings_sheet()359 self._open_settings_sheet()
360360
361 # open the value selector361 # open the value selector
362 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='ServiceSelector'), Eventually(Not(Is(None))))362 self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='ServiceSelector'), Eventually(Not(Is(None))))
363 units_selector = self.main_window.select_single('OptionSelector', objectName="ServiceSelector")363 units_selector = self.main_view.select_single('OptionSelector', objectName="ServiceSelector")
364 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))364 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
365 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))365 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))
366 current_option = units_selector.select_many('ShapeItem')[1]366 current_option = units_selector.select_many('ShapeItem')[1]
@@ -374,22 +374,22 @@
374 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))374 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
375375
376 # check if precipitation units selector appears376 # check if precipitation units selector appears
377 self.assertThat(lambda: self.main_window.select_single('OptionSelector', 377 self.assertThat(lambda: self.main_view.select_single('OptionSelector',
378 objectName='PrecipitationUnitsSelector'), Eventually(Not(Is(None))))378 objectName='PrecipitationUnitsSelector'), Eventually(Not(Is(None))))
379 units_selector = self.main_window.select_single('OptionSelector', 379 units_selector = self.main_view.select_single('OptionSelector',
380 objectName="PrecipitationUnitsSelector")380 objectName="PrecipitationUnitsSelector")
381 self.assertThat(units_selector.visible, Eventually(Equals(1)))381 self.assertThat(units_selector.visible, Eventually(Equals(1)))
382 self._click_sheet_confirm()382 self._click_sheet_confirm()
383383
384 # wait for reload and check the used service 384 # wait for reload and check the used service
385 load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner')385 load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner')
386 self.assertThat(load_indicator.running, Eventually(Equals(False)))386 self.assertThat(load_indicator.running, Eventually(Equals(False)))
387 self._check_service('openweathermap')387 self._check_service('openweathermap')
388388
389 # switch back to metric values again389 # switch back to metric values again
390 self._open_settings_sheet()390 self._open_settings_sheet()
391 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='ServiceSelector'), Eventually(Not(Is(None))))391 self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='ServiceSelector'), Eventually(Not(Is(None))))
392 units_selector = self.main_window.select_single('OptionSelector', objectName="ServiceSelector")392 units_selector = self.main_view.select_single('OptionSelector', objectName="ServiceSelector")
393 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))393 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
394 self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None))))394 self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None))))
395 current_option = units_selector.select_many('ShapeItem')[2]395 current_option = units_selector.select_many('ShapeItem')[2]
@@ -406,14 +406,14 @@
406 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))406 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
407407
408 # check if precipitation units selector disappears and confirm408 # check if precipitation units selector disappears and confirm
409 self.assertThat(lambda: self.main_window.select_single('OptionSelector', 409 self.assertThat(lambda: self.main_view.select_single('OptionSelector',
410 objectName='PrecipitationUnitsSelector'), Eventually(Not(Is(None))))410 objectName='PrecipitationUnitsSelector'), Eventually(Not(Is(None))))
411 units_selector = self.main_window.select_single('OptionSelector', 411 units_selector = self.main_view.select_single('OptionSelector',
412 objectName="PrecipitationUnitsSelector")412 objectName="PrecipitationUnitsSelector")
413 self.assertThat(units_selector.visible, Eventually(Equals(0)))413 self.assertThat(units_selector.visible, Eventually(Equals(0)))
414 self._click_sheet_confirm()414 self._click_sheet_confirm()
415415
416 # wait for reload and check the metric values again416 # wait for reload and check the metric values again
417 load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner')417 load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner')
418 self.assertThat(load_indicator.running, Eventually(Equals(False)))418 self.assertThat(load_indicator.running, Eventually(Equals(False)))
419 self._check_service('weatherchannel')419 self._check_service('weatherchannel')

Subscribers

People subscribed via source and target branches