Merge lp:~nskaggs/ubuntu-weather-app/ap-tweaks into lp:ubuntu-weather-app/obsolete.trunk
- ap-tweaks
- Merge into trunk
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 |
Related bugs: |
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
Nicholas Skaggs (nskaggs) wrote : | # |
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:214
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 215. By Nicholas Skaggs
-
remove get_qml_view
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:215
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Leo Arias (elopio) wrote : | # |
A nice step forward. Thanks Nic.
Preview Diff
1 | === modified file 'tests/autopilot/ubuntu_weather_app/tests/__init__.py' |
2 | --- tests/autopilot/ubuntu_weather_app/tests/__init__.py 2014-02-26 17:08:11 +0000 |
3 | +++ tests/autopilot/ubuntu_weather_app/tests/__init__.py 2014-03-05 15:16:06 +0000 |
4 | @@ -10,7 +10,6 @@ |
5 | """weather-app autopilot tests.""" |
6 | |
7 | import os.path |
8 | -import glob |
9 | import sqlite3 |
10 | import time |
11 | import logging |
12 | @@ -19,19 +18,20 @@ |
13 | |
14 | from autopilot.input import Mouse, Touch, Pointer |
15 | from autopilot.platform import model |
16 | -from autopilot.testcase import AutopilotTestCase |
17 | from testtools.matchers import Equals, Is, Not |
18 | from autopilot.matchers import Eventually |
19 | |
20 | +from ubuntuuitoolkit import ( |
21 | + base, |
22 | + emulators as toolkit_emulators |
23 | +) |
24 | +from ubuntu_weather_app import emulators |
25 | import ubuntu_weather_app |
26 | |
27 | -from ubuntuuitoolkit import emulators as toolkit_emulators |
28 | -from ubuntu_weather_app.emulators import MainView |
29 | - |
30 | logger = logging.getLogger(__name__) |
31 | |
32 | |
33 | -class WeatherTestCase(AutopilotTestCase): |
34 | +class WeatherTestCase(base.UbuntuUIToolkitAppTestCase): |
35 | |
36 | """A common test case class that provides several useful methods for |
37 | weather app tests.""" |
38 | @@ -45,16 +45,10 @@ |
39 | installed_location = "/usr/share/ubuntu-weather-app/ubuntu-weather-app.qml" |
40 | |
41 | def setUp(self): |
42 | + super(WeatherTestCase, self).setUp() |
43 | self.pointing_device = Pointer(self.input_device_class.create()) |
44 | - super(WeatherTestCase, self).setUp() |
45 | self.launch_app() |
46 | |
47 | - """Workaround to find the qmlscene binary via shell globbing. |
48 | - This is needed since we can't rely on qt5-default being installed on |
49 | - devices to make qmlscene available in the path""" |
50 | - def qmlscene(self): |
51 | - return glob.glob("/usr/lib/*/qt5/bin/qmlscene")[0] |
52 | - |
53 | def launch_app(self): |
54 | if os.path.exists(self.local_location): |
55 | logger.debug("Running via local installation") |
56 | @@ -68,14 +62,14 @@ |
57 | |
58 | def launch_test_local(self): |
59 | self.app = self.launch_test_application( |
60 | - self.qmlscene(), |
61 | + base.get_qmlscene_launch_command(), |
62 | self.local_location, |
63 | app_type='qt', |
64 | emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase) |
65 | |
66 | def launch_test_installed(self): |
67 | self.app = self.launch_test_application( |
68 | - self.qmlscene(), |
69 | + base.get_qmlscene_launch_command(), |
70 | self.installed_location, |
71 | app_type='qt', |
72 | emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase) |
73 | @@ -85,30 +79,27 @@ |
74 | "com.ubuntu.weather", |
75 | emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase) |
76 | |
77 | - def get_qml_view(self): |
78 | - return self.app.select_single("QQuickView") |
79 | - |
80 | """Test if tabs with data are present in tablet mode""" |
81 | def _ensure_tablet_tabs_loaded(self): |
82 | - self.assertThat(lambda: self.main_window.wait_select_single('QQuickRectangle', visible=True, objectName='SideLabel'), |
83 | + self.assertThat(lambda: self.main_view.wait_select_single('QQuickRectangle', visible=True, objectName='SideLabel'), |
84 | Eventually(Not(Is(None)), timeout=60)) |
85 | |
86 | @property |
87 | - def main_window(self): |
88 | - return self.app.select_single(MainView) |
89 | + def main_view(self): |
90 | + return self.app.wait_select_single(emulators.MainView) |
91 | |
92 | class SheetMixin(object): |
93 | """A mixin to to give access to common sheet elements""" |
94 | |
95 | def _click_sheet_confirm(self): |
96 | """Clicks the confirm button""" |
97 | - button = self.main_window.select_single( |
98 | + button = self.main_view.select_single( |
99 | 'Button', objectName='confirmButton') |
100 | self.pointing_device.click_object(button) |
101 | |
102 | def _click_sheet_cancel(self): |
103 | """Clicks the cancel button""" |
104 | - button = self.main_window.select_single( |
105 | + button = self.main_view.select_single( |
106 | 'Button', objectName='cancelButton') |
107 | self.pointing_device.click_object(button) |
108 | |
109 | @@ -118,12 +109,12 @@ |
110 | def _open_add_location_page(self): |
111 | """Opens the AddLocationPage""" |
112 | # click on listitem to open AddLocationPage |
113 | - addCityItem = self.main_window.wait_select_single('Standard', objectName='AddCityListItem') |
114 | + addCityItem = self.main_view.wait_select_single('Standard', objectName='AddCityListItem') |
115 | self.assertThat(lambda: addCityItem.visible, Eventually(Equals(True))) |
116 | self.pointing_device.move_to_object(addCityItem) |
117 | self.pointing_device.click() |
118 | |
119 | - addLocPage = self.main_window.select_single("DefaultSheet", objectName="AddLocationSheet") |
120 | + addLocPage = self.main_view.select_single("DefaultSheet", objectName="AddLocationSheet") |
121 | self.assertThat(addLocPage.visible, Eventually(Equals(True))) |
122 | |
123 | class DatabaseMixin(object): |
124 | @@ -187,7 +178,7 @@ |
125 | with open(path) as fh: |
126 | json_str = fh.read() |
127 | result.append(json_str.strip()) |
128 | - fh.close() |
129 | + fh.close() |
130 | return result |
131 | |
132 | def add_locations_to_database(self, limit=None): |
133 | |
134 | === modified file 'tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py' |
135 | --- tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py 2014-02-15 14:31:10 +0000 |
136 | +++ tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py 2014-03-05 15:16:06 +0000 |
137 | @@ -11,7 +11,7 @@ |
138 | |
139 | from testtools.matchers import Equals, Not |
140 | from autopilot.matchers import Eventually |
141 | -from autopilot.introspection.dbus import StateNotFoundError |
142 | +from autopilot.introspection.dbus import StateNotFoundError |
143 | from unittest import skip |
144 | |
145 | from ubuntu_weather_app.tests import WeatherTestCase, DatabaseMixin, SheetMixin, LocationManagerMixin |
146 | @@ -28,7 +28,7 @@ |
147 | self.clean_db() |
148 | super(TestLocationManager, self).setUp() |
149 | self.assertThat( |
150 | - self.get_qml_view().visible, Eventually(Equals(True))) |
151 | + self.main_view.visible, Eventually(Equals(True))) |
152 | |
153 | def _preload_database_and_launch(self): |
154 | #we want to start with existing data |
155 | @@ -42,15 +42,15 @@ |
156 | logger.debug("Re-Launching app to introspect") |
157 | super(TestLocationManager, self).setUp() |
158 | self.assertThat( |
159 | - self.get_qml_view().visible, Eventually(Equals(True))) |
160 | + self.main_view.visible, Eventually(Equals(True))) |
161 | |
162 | def _open_location_manager(self, kb=False): |
163 | """Opens the location manager""" |
164 | if kb: self.keyboard.press_and_release('Ctrl+n') |
165 | - else: self.main_window.open_toolbar().click_button("EditButton") |
166 | + else: self.main_view.open_toolbar().click_button("EditButton") |
167 | |
168 | # test location manager becomes visible |
169 | - managerSheet = self.main_window.select_single('ComposerSheet', objectName='LocationManagerSheet') |
170 | + managerSheet = self.main_view.select_single('ComposerSheet', objectName='LocationManagerSheet') |
171 | self.assertThat(managerSheet.visible, Eventually(Equals(True))) |
172 | |
173 | def _swipe_first_location_to_remove(self): |
174 | @@ -69,7 +69,7 @@ |
175 | return qqlw.count |
176 | |
177 | def _search_for_city(self, city): |
178 | - searchField = self.main_window.wait_select_single("TextField", objectName="SearchField") |
179 | + searchField = self.main_view.wait_select_single("TextField", objectName="SearchField") |
180 | #poll clicking for focus for lack of better method, due to screen switching animation |
181 | #is there a property we can use instead? |
182 | timeout = 0 |
183 | @@ -89,22 +89,22 @@ |
184 | self._search_for_city(location) |
185 | |
186 | # wait for results and click on the first item |
187 | - load_indicator = self.main_window.select_single('ActivityIndicator', objectName='SearchingSpinner') |
188 | + load_indicator = self.main_view.select_single('ActivityIndicator', objectName='SearchingSpinner') |
189 | self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120)) |
190 | - resultsList = self.main_window.select_single('QQuickListView', objectName='SearchResultList') |
191 | + resultsList = self.main_view.select_single('QQuickListView', objectName='SearchResultList') |
192 | self.assertThat(resultsList.visible, Eventually(Equals(True))) |
193 | - firstResult = self.main_window.wait_select_single('Label', objectName='searchResult0') |
194 | + firstResult = self.main_view.wait_select_single('Label', objectName='searchResult0') |
195 | self.pointing_device.move_to_object(firstResult) |
196 | self.pointing_device.click() |
197 | sleep(1) |
198 | |
199 | # LocationManagerPage should be visible and location added |
200 | - addedItem = self.main_window.wait_select_single('Label', text=location) |
201 | + addedItem = self.main_view.wait_select_single('Label', text=location) |
202 | self.assertThat(addedItem.text, Eventually(Equals(location))) |
203 | self._click_sheet_confirm() |
204 | |
205 | # back to locations, wait till data is loaded |
206 | - load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner') |
207 | + load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner') |
208 | self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120)) |
209 | |
210 | def _remove_location(self): |
211 | @@ -118,34 +118,34 @@ |
212 | self._add_location("Paris") |
213 | |
214 | # only location is there |
215 | - loadingPage = self.main_window.select_single("Tabs", objectName="rootTabs") |
216 | + loadingPage = self.main_view.select_single("Tabs", objectName="rootTabs") |
217 | self.assertThat(loadingPage.visible, Eventually(Equals(True))) |
218 | - tabObjects = self.main_window.select_many('LocationTab', objectName='LocationTab') |
219 | + tabObjects = self.main_view.select_many('LocationTab', objectName='LocationTab') |
220 | self.assertEqual(1, len(tabObjects)) |
221 | |
222 | def test_add_predefined_location(self): |
223 | """Adds a location""" |
224 | self._open_add_location_page() |
225 | |
226 | - resultsList = self.main_window.select_single('QQuickListView', objectName='SearchResultList') |
227 | + resultsList = self.main_view.select_single('QQuickListView', objectName='SearchResultList') |
228 | self.assertThat(resultsList.visible, Eventually(Equals(True))) |
229 | - testResult = self.main_window.wait_select_single('Label', objectName='searchResult4') |
230 | + testResult = self.main_view.wait_select_single('Label', objectName='searchResult4') |
231 | self.pointing_device.move_to_object(testResult) |
232 | self.pointing_device.click() |
233 | |
234 | # LocationManagerPage should be visible and location added |
235 | - addedItem = self.main_window.wait_select_single('Label', objectName="existingLocation0") |
236 | + addedItem = self.main_view.wait_select_single('Label', objectName="existingLocation0") |
237 | self.assertThat(addedItem.text, Eventually(Equals("Cairo"))) |
238 | self._click_sheet_confirm() |
239 | |
240 | # back to locations, wait till data is loaded |
241 | - load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner') |
242 | + load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner') |
243 | self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120)) |
244 | |
245 | # only location is there |
246 | - loadingPage = self.main_window.select_single("Tabs", objectName="rootTabs") |
247 | + loadingPage = self.main_view.select_single("Tabs", objectName="rootTabs") |
248 | self.assertThat(loadingPage.visible, Eventually(Equals(True))) |
249 | - tabObjects = self.main_window.select_many('LocationTab', objectName='LocationTab') |
250 | + tabObjects = self.main_view.select_many('LocationTab', objectName='LocationTab') |
251 | self.assertEqual(1, len(tabObjects)) |
252 | |
253 | def test_search_city(self): |
254 | @@ -156,15 +156,15 @@ |
255 | searchField = self._search_for_city("London") |
256 | |
257 | # wait for results and click on the first item |
258 | - load_indicator = self.main_window.select_single('ActivityIndicator', objectName='SearchingSpinner') |
259 | + load_indicator = self.main_view.select_single('ActivityIndicator', objectName='SearchingSpinner') |
260 | self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120)) |
261 | - resultsList = self.main_window.select_single('QQuickListView', objectName='SearchResultList') |
262 | + resultsList = self.main_view.select_single('QQuickListView', objectName='SearchResultList') |
263 | self.assertThat(resultsList.visible, Eventually(Equals(True))) |
264 | - firstResult = self.main_window.wait_select_single("Label", objectName="searchResult0") |
265 | + firstResult = self.main_view.wait_select_single("Label", objectName="searchResult0") |
266 | self.assertThat(firstResult.text, Eventually(Equals("London"))) |
267 | |
268 | # regain focus, clear search field and do another search |
269 | - searchField = self.main_window.wait_select_single("TextField", objectName="SearchField") |
270 | + searchField = self.main_view.wait_select_single("TextField", objectName="SearchField") |
271 | self.pointing_device.click_object(searchField) |
272 | clear_button = searchField.wait_select_single("AbstractButton") |
273 | self.pointing_device.click_object(clear_button) |
274 | @@ -173,17 +173,17 @@ |
275 | self.pointing_device.click_object(searchField) |
276 | self.keyboard.type("Hamburg") |
277 | self.keyboard.press_and_release('Enter') |
278 | - load_indicator = self.main_window.select_single('ActivityIndicator', objectName='SearchingSpinner') |
279 | + load_indicator = self.main_view.select_single('ActivityIndicator', objectName='SearchingSpinner') |
280 | self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120)) |
281 | self.assertThat(resultsList.visible, Eventually(Equals(True))) |
282 | - firstResult = self.main_window.wait_select_single("Label", objectName="searchResult0") |
283 | + firstResult = self.main_view.wait_select_single("Label", objectName="searchResult0") |
284 | self.assertThat(firstResult.text, Eventually(Equals("Hamburg"))) |
285 | |
286 | def test_cancel_adding_location(self): |
287 | """Cancel the cities search""" |
288 | self._open_add_location_page() |
289 | self._click_sheet_cancel() |
290 | - locationList = self.main_window.wait_select_single('QQuickListView', objectName='LocationList') |
291 | + locationList = self.main_view.wait_select_single('QQuickListView', objectName='LocationList') |
292 | self.assertThat(locationList.visible, Eventually(Equals(True))) |
293 | |
294 | def test_no_location_found(self): |
295 | @@ -194,43 +194,43 @@ |
296 | self._search_for_city("UbuntuCity") |
297 | |
298 | # wait for result and look if label is shown |
299 | - load_indicator = self.main_window.select_single('ActivityIndicator', objectName='SearchingSpinner') |
300 | + load_indicator = self.main_view.select_single('ActivityIndicator', objectName='SearchingSpinner') |
301 | self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120)) |
302 | - errorLabel = self.main_window.select_single('Label', objectName='noCityError') |
303 | + errorLabel = self.main_view.select_single('Label', objectName='noCityError') |
304 | self.assertThat(errorLabel.visible, Eventually(Equals(True))) |
305 | |
306 | def test_location_lookup(self): |
307 | """Tests the location lookup""" |
308 | # start lookup |
309 | - lookupItem = self.main_window.wait_select_single('Standard', objectName='LocationLookupItem') |
310 | + lookupItem = self.main_view.wait_select_single('Standard', objectName='LocationLookupItem') |
311 | self.pointing_device.click_object(lookupItem) |
312 | |
313 | # wait for result |
314 | - load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LookupIndicator') |
315 | + load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LookupIndicator') |
316 | self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120)) |
317 | |
318 | # check a location was found |
319 | - location = self.main_window.wait_select_single('Label', objectName='CurrentLocationLabel') |
320 | + location = self.main_view.wait_select_single('Label', objectName='CurrentLocationLabel') |
321 | self.assertThat(location.text, Eventually(Not(Equals("")))) |
322 | location_name = location.text |
323 | |
324 | # add location |
325 | - add_button = self.main_window.wait_select_single('Button', objectName='LookupItemAddButton') |
326 | + add_button = self.main_view.wait_select_single('Button', objectName='LookupItemAddButton') |
327 | self.pointing_device.click_object(add_button) |
328 | |
329 | # LocationManagerPage should be visible and location added |
330 | - addedItem = self.main_window.wait_select_single('Label', objectName="existingLocation0") |
331 | + addedItem = self.main_view.wait_select_single('Label', objectName="existingLocation0") |
332 | self.assertThat(addedItem.text, Eventually(Equals(location_name))) |
333 | self._click_sheet_confirm() |
334 | |
335 | # back to locations, wait till data is loaded |
336 | - load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner') |
337 | + load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner') |
338 | self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120)) |
339 | |
340 | # only location is there |
341 | - loadingPage = self.main_window.select_single("Tabs", objectName="rootTabs") |
342 | + loadingPage = self.main_view.select_single("Tabs", objectName="rootTabs") |
343 | self.assertThat(loadingPage.visible, Eventually(Equals(True))) |
344 | - tabObjects = self.main_window.select_many('LocationTab', objectName='LocationTab') |
345 | + tabObjects = self.main_view.select_many('LocationTab', objectName='LocationTab') |
346 | self.assertEqual(1, len(tabObjects)) |
347 | |
348 | def test_remove_location(self): |
349 | @@ -238,20 +238,20 @@ |
350 | self._preload_database_and_launch() |
351 | |
352 | # wait till data is loaded |
353 | - loadingPage = self.main_window.select_single("Tabs", objectName="rootTabs") |
354 | + loadingPage = self.main_view.select_single("Tabs", objectName="rootTabs") |
355 | self.assertThat(loadingPage.visible, Eventually(Equals(True))) |
356 | |
357 | # count locations at start |
358 | - tabObjects = self.main_window.select_many('LocationTab', objectName='LocationTab') |
359 | + tabObjects = self.main_view.select_many('LocationTab', objectName='LocationTab') |
360 | tabsSumStart = len(tabObjects) |
361 | |
362 | # go to the location manager and remove 1st location |
363 | self._remove_location() |
364 | |
365 | # back to locations, only one is left |
366 | - load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner') |
367 | + load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner') |
368 | self.assertThat(load_indicator.running, Eventually(Equals(False))) |
369 | - tabObjects = self.main_window.select_many('LocationTab', objectName='LocationTab') |
370 | + tabObjects = self.main_view.select_many('LocationTab', objectName='LocationTab') |
371 | self.assertThat(lambda: tabsSumStart-1, Eventually(Equals(len(tabObjects)))) |
372 | |
373 | def test_cancel_remove_location(self): |
374 | @@ -259,11 +259,11 @@ |
375 | self._preload_database_and_launch() |
376 | |
377 | # wait data is loaded |
378 | - loadingPage = self.main_window.select_single("Tabs", objectName="rootTabs") |
379 | + loadingPage = self.main_view.select_single("Tabs", objectName="rootTabs") |
380 | self.assertThat(loadingPage.visible, Eventually(Equals(True))) |
381 | |
382 | # count locations at start |
383 | - tabObjects = self.main_window.select_many('LocationTab', objectName='LocationTab') |
384 | + tabObjects = self.main_view.select_many('LocationTab', objectName='LocationTab') |
385 | tabsSumStart = len(tabObjects) |
386 | |
387 | # go to the location manager, remove location, but click cancel |
388 | @@ -272,9 +272,9 @@ |
389 | self._click_sheet_cancel() |
390 | |
391 | # back to locations, no loction is removed |
392 | - loadingPage = self.main_window.select_single("Tabs", objectName="rootTabs") |
393 | + loadingPage = self.main_view.select_single("Tabs", objectName="rootTabs") |
394 | self.assertThat(loadingPage.visible, Eventually(Equals(True))) |
395 | - tabObjects = self.main_window.select_many('LocationTab', objectName='LocationTab') |
396 | + tabObjects = self.main_view.select_many('LocationTab', objectName='LocationTab') |
397 | self.assertEqual(tabsSumStart, len(tabObjects)) |
398 | |
399 | def test_del_add_bug(self): |
400 | @@ -291,30 +291,30 @@ |
401 | self._add_location("Cairo") |
402 | |
403 | # back to locations, wait till data is loaded |
404 | - load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner') |
405 | + load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner') |
406 | self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120)) |
407 | |
408 | # count the tabs |
409 | - tabObjects = self.main_window.select_many('LocationTab', objectName='LocationTab') |
410 | + tabObjects = self.main_view.select_many('LocationTab', objectName='LocationTab') |
411 | self.assertThat(lambda: len(tabObjects), Eventually(Equals(2))) |
412 | self.assertThat( |
413 | - self.main_window.select_single('LocationTab', index=1).title, |
414 | + self.main_view.select_single('LocationTab', index=1).title, |
415 | Eventually(Equals("Cairo"))) |
416 | |
417 | @skip("skipped because of Bug #1279073") |
418 | def test_open_location_manager_keyboard(self): |
419 | - if self.platform_model != "Desktop": |
420 | + if self.platform_model != "Desktop": |
421 | return |
422 | self._preload_database_and_launch() |
423 | self._open_location_manager(kb=True) |
424 | |
425 | # close sheet by keyboard and test |
426 | self.keyboard.press_and_release('Escape') |
427 | - self.assertRaises(StateNotFoundError, lambda: self.main_window.select_single('ComposerSheet')) |
428 | + self.assertRaises(StateNotFoundError, lambda: self.main_view.select_single('ComposerSheet')) |
429 | |
430 | @skip("skipped because of Bug #1279073") |
431 | def test_add_location_keyboard(self): |
432 | - if self.platform_model != "Desktop": |
433 | + if self.platform_model != "Desktop": |
434 | return |
435 | self._preload_database_and_launch() |
436 | self._open_location_manager(kb=True) |
437 | @@ -322,5 +322,5 @@ |
438 | |
439 | # close sheet by keyboard and test all sheets are closed |
440 | self.keyboard.press_and_release('Escape') |
441 | - self.assertRaises(StateNotFoundError, lambda: self.main_window.select_single('DefaultSheet')) |
442 | - self.assertRaises(StateNotFoundError, lambda: self.main_window.select_single('ComposerSheet')) |
443 | + self.assertRaises(StateNotFoundError, lambda: self.main_view.select_single('DefaultSheet')) |
444 | + self.assertRaises(StateNotFoundError, lambda: self.main_view.select_single('ComposerSheet')) |
445 | |
446 | === modified file 'tests/autopilot/ubuntu_weather_app/tests/test_mainview.py' |
447 | --- tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 2014-02-26 17:08:11 +0000 |
448 | +++ tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 2014-03-05 15:16:06 +0000 |
449 | @@ -13,7 +13,7 @@ |
450 | |
451 | from testtools.matchers import Equals, Is, Not |
452 | from autopilot.matchers import Eventually |
453 | -from unittest import skip |
454 | +from unittest import skip |
455 | |
456 | import logging |
457 | |
458 | @@ -34,7 +34,7 @@ |
459 | logger.debug("Re-Launching app to introspect") |
460 | super(TestMainView, self).setUp() |
461 | self.assertThat( |
462 | - self.get_qml_view().visible, Eventually(Equals(True))) |
463 | + self.main_view.visible, Eventually(Equals(True))) |
464 | |
465 | def tearDown(self): |
466 | super(TestMainView, self).tearDown() |
467 | @@ -44,10 +44,10 @@ |
468 | second tab""" |
469 | |
470 | # first tab should be visible after start |
471 | - tabs = self.main_window.get_tabs() |
472 | - first_tab = self.main_window.select_single( |
473 | + tabs = self.main_view.get_tabs() |
474 | + first_tab = self.main_view.select_single( |
475 | 'LocationTab', index=0) |
476 | - second_tab = self.main_window.select_single( |
477 | + second_tab = self.main_view.select_single( |
478 | 'LocationTab', index=1) |
479 | self.assertThat(tabs.selectedTabIndex, Eventually(Equals(0))) |
480 | self.assertThat(first_tab.visible, Eventually(Equals(True))) |
481 | @@ -57,7 +57,7 @@ |
482 | # switch to next tab |
483 | if kb and not back: self.keyboard.press_and_release('Ctrl+Tab') |
484 | elif kb and back: self.keyboard.press_and_release('Ctrl+Shift+Tab') |
485 | - else: self.main_window.switch_to_tab_by_index(1) |
486 | + else: self.main_view.switch_to_tab_by_index(1) |
487 | |
488 | self.assertThat(tabs.selectedTabIndex, Eventually(Equals(1))) |
489 | self.assertThat(first_tab.visible, Eventually(Equals(False))) |
490 | @@ -71,35 +71,35 @@ |
491 | @skip("skipped because of Bug #1279073") |
492 | def test_switch_tabs_keyboard(self): |
493 | """Test start of app with two locations and switch from first to second tab""" |
494 | - if self.platform_model != "Desktop": |
495 | + if self.platform_model != "Desktop": |
496 | return |
497 | self._switch_tabs(kb=True) |
498 | |
499 | @skip("skipped because of Bug #1279073") |
500 | def test_switch_tabs_keyboard_back(self): |
501 | """Test start of app with two locations and switch from first to second tab""" |
502 | - if self.platform_model != "Desktop": |
503 | + if self.platform_model != "Desktop": |
504 | return |
505 | self._switch_tabs(kb=True, back=True) |
506 | |
507 | def _refresh(self, kb=False): |
508 | # get the dates from the test data |
509 | - if self.main_window.wideAspect: |
510 | + if self.main_view.wideAspect: |
511 | self._ensure_tablet_tabs_loaded() |
512 | - self.assertThat(lambda: self.main_window.select_many('Label', objectName='DayDateLabel'), Eventually(Not(Is(None)))) |
513 | - curr_dates = self.main_window.select_many('Label', objectName='DayDateLabel') |
514 | + self.assertThat(lambda: self.main_view.select_many('Label', objectName='DayDateLabel'), Eventually(Not(Is(None)))) |
515 | + curr_dates = self.main_view.select_many('Label', objectName='DayDateLabel') |
516 | tab1_curr_date = curr_dates[0].text |
517 | tab2_curr_date = curr_dates[2].text |
518 | |
519 | # refresh and wait till loading has finished |
520 | if kb: self.keyboard.press_and_release('Ctrl+r') |
521 | - else: self.main_window.open_toolbar().click_button("RefreshButton") |
522 | - load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner') |
523 | + else: self.main_view.open_toolbar().click_button("RefreshButton") |
524 | + load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner') |
525 | self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120)) |
526 | |
527 | # get the data from the refreshed tabs, have to be new |
528 | - self.assertThat(lambda: self.main_window.select_many('Label',objectName='DayDateLabel'), Eventually(Not(Is(None)), timeout=60)) |
529 | - refreshed_dates = self.main_window.select_many('Label',objectName='DayDateLabel') |
530 | + self.assertThat(lambda: self.main_view.select_many('Label',objectName='DayDateLabel'), Eventually(Not(Is(None)), timeout=60)) |
531 | + refreshed_dates = self.main_view.select_many('Label',objectName='DayDateLabel') |
532 | self.assertNotEqual(tab1_curr_date, refreshed_dates[0].text) |
533 | self.assertNotEqual(tab2_curr_date, refreshed_dates[2].text) |
534 | |
535 | @@ -108,55 +108,55 @@ |
536 | |
537 | @skip("skipped because of Bug #1279073") |
538 | def test_refresh_tabs_keyboard(self): |
539 | - if self.platform_model != "Desktop": |
540 | + if self.platform_model != "Desktop": |
541 | return |
542 | self._refresh(kb=True) |
543 | - |
544 | + |
545 | @skip("skipped because of Bug #1279073") |
546 | def test_day_navigation_keyboard(self): |
547 | # get the dates from the test data |
548 | - if self.platform_model != "Desktop": |
549 | + if self.platform_model != "Desktop": |
550 | return |
551 | - self.assertThat(lambda: self.main_window.select_many('QQuickListView', objectName='DailyForecastList'), Eventually(Not(Is(None)))) |
552 | - dayLists = self.main_window.select_many('QQuickListView', objectName='DailyForecastList') |
553 | + self.assertThat(lambda: self.main_view.select_many('QQuickListView', objectName='DailyForecastList'), Eventually(Not(Is(None)))) |
554 | + dayLists = self.main_view.select_many('QQuickListView', objectName='DailyForecastList') |
555 | self.assertThat(dayLists[1].visible, Eventually(Equals(True))) |
556 | self.assertThat(dayLists[1].currentIndex, Eventually(Equals(0))) |
557 | |
558 | # navigate to to overmorrow |
559 | self.keyboard.press_and_release('Down') |
560 | self.keyboard.press_and_release('Down') |
561 | - dayLists = self.main_window.select_many('QQuickListView', objectName='DailyForecastList') |
562 | + dayLists = self.main_view.select_many('QQuickListView', objectName='DailyForecastList') |
563 | self.assertThat(dayLists[1].visible, Eventually(Equals(True))) |
564 | self.assertThat(dayLists[1].currentIndex, Eventually(Equals(2))) |
565 | |
566 | # navigate to tomorrow |
567 | self.keyboard.press_and_release('Up') |
568 | - dayLists = self.main_window.select_many('QQuickListView', objectName='DailyForecastList') |
569 | + dayLists = self.main_view.select_many('QQuickListView', objectName='DailyForecastList') |
570 | self.assertThat(dayLists[1].visible, Eventually(Equals(True))) |
571 | self.assertThat(dayLists[1].currentIndex, Eventually(Equals(1))) |
572 | |
573 | @skip("skipped because of Bug #1279073") |
574 | def test_show_details_keyboard(self): |
575 | - if self.platform_model != "Desktop": |
576 | + if self.platform_model != "Desktop": |
577 | return |
578 | - self.assertThat(lambda: self.main_window.select_many('QQuickFlickable', state="back"), Eventually(Not(Is(True)))) |
579 | - back_flipped = self.main_window.select_many('QQuickFlipable', state="back") |
580 | + self.assertThat(lambda: self.main_view.select_many('QQuickFlickable', state="back"), Eventually(Not(Is(True)))) |
581 | + back_flipped = self.main_view.select_many('QQuickFlipable', state="back") |
582 | self.assertEqual(0, len(back_flipped)) |
583 | |
584 | # press space |
585 | self.keyboard.press_and_release('Space') |
586 | |
587 | # check the displayed info is flipped and only one is flipped |
588 | - self.assertThat(lambda: self.main_window.select_many('QQuickFlickable', state="back"), Eventually(Not(Is(True)))) |
589 | - flipables = self.main_window.select_many('QQuickFlipable') |
590 | + self.assertThat(lambda: self.main_view.select_many('QQuickFlickable', state="back"), Eventually(Not(Is(True)))) |
591 | + flipables = self.main_view.select_many('QQuickFlipable') |
592 | self.assertThat(flipables[1].state, Eventually(Equals("back"))) |
593 | - back_flipped = self.main_window.select_many('QQuickFlipable', state="back") |
594 | + back_flipped = self.main_view.select_many('QQuickFlipable', state="back") |
595 | self.assertEqual(1, len(back_flipped)) |
596 | |
597 | # press space again, hide details |
598 | self.keyboard.press_and_release('Space') |
599 | |
600 | - # check nothing is flipped |
601 | - self.assertThat(lambda: self.main_window.select_many('QQuickFlickable', state="back"), Eventually(Not(Is(True)))) |
602 | - back_flipped = self.main_window.select_many('QQuickFlipable', state="back") |
603 | + # check nothing is flipped |
604 | + self.assertThat(lambda: self.main_view.select_many('QQuickFlickable', state="back"), Eventually(Not(Is(True)))) |
605 | + back_flipped = self.main_view.select_many('QQuickFlipable', state="back") |
606 | self.assertEqual(0, len(back_flipped)) |
607 | |
608 | === modified file 'tests/autopilot/ubuntu_weather_app/tests/test_settings.py' |
609 | --- tests/autopilot/ubuntu_weather_app/tests/test_settings.py 2014-02-26 17:08:11 +0000 |
610 | +++ tests/autopilot/ubuntu_weather_app/tests/test_settings.py 2014-03-05 15:16:06 +0000 |
611 | @@ -27,26 +27,26 @@ |
612 | self.add_units_to_database() |
613 | super(TestSettings, self).setUp() |
614 | self.assertThat( |
615 | - self.get_qml_view().visible, Eventually(Equals(True))) |
616 | + self.main_view.visible, Eventually(Equals(True))) |
617 | |
618 | def _open_settings_sheet(self): |
619 | """Opens the settings sheet""" |
620 | - self.main_window.open_toolbar().click_button("SettingsButton") |
621 | + self.main_view.open_toolbar().click_button("SettingsButton") |
622 | |
623 | def _move_pointer_around(self): |
624 | """Helper method to move the pointer around, to assure selector is opened""" |
625 | - self.assertThat(lambda: self.main_window.select_single('ComposerSheet', objectName='SettingsSheet'), |
626 | + self.assertThat(lambda: self.main_view.select_single('ComposerSheet', objectName='SettingsSheet'), |
627 | Eventually(Not(Is(None)))) |
628 | - sheet = self.main_window.select_single('ComposerSheet', objectName='SettingsSheet') |
629 | + sheet = self.main_view.select_single('ComposerSheet', objectName='SettingsSheet') |
630 | self.pointing_device.move_to_object(sheet) |
631 | |
632 | def _check_units(self, units): |
633 | - """Checks selected units by values from the first location tab""" |
634 | - if self.main_window.wideAspect: |
635 | + """Checks selected units by values from the first location tab""" |
636 | + if self.main_view.wideAspect: |
637 | self._ensure_tablet_tabs_loaded() |
638 | - self.assertThat(lambda: self.main_window.select_many('QQuickText', objectName='CurrentTempText'), |
639 | + self.assertThat(lambda: self.main_view.select_many('QQuickText', objectName='CurrentTempText'), |
640 | Eventually(Not(Is(None)))) |
641 | - current_location_tab = self.main_window.wait_select_single( |
642 | + current_location_tab = self.main_view.wait_select_single( |
643 | 'LocationTab', visible=True) |
644 | today_item = current_location_tab.wait_select_single( |
645 | 'QQuickItem', focus=True) |
646 | @@ -69,20 +69,20 @@ |
647 | |
648 | def _check_wind_units(self, wind_units): |
649 | """Checks selected units by values from the first location tab""" |
650 | - if self.main_window.wideAspect: |
651 | + if self.main_view.wideAspect: |
652 | self._ensure_tablet_tabs_loaded() |
653 | - self.assertThat(lambda: self.main_window.select_many('WeatherDetailComponent', objectName='WindSpeedValue')[0], |
654 | + self.assertThat(lambda: self.main_view.select_many('WeatherDetailComponent', objectName='WindSpeedValue')[0], |
655 | Eventually(Not(Is(None)))) |
656 | - current_location_tab = self.main_window.select_single( |
657 | + current_location_tab = self.main_view.select_single( |
658 | 'LocationTab', visible=True) |
659 | focused_item = current_location_tab.select_single( |
660 | 'QQuickItem', focus=True) |
661 | wind_component = focused_item.select_single( |
662 | 'WeatherDetailComponent', objectName='WindSpeedValue') |
663 | - self.assertThat(lambda: wind_component.select_single('QQuickText', objectName='WeatherDetailUnit'), |
664 | + self.assertThat(lambda: wind_component.select_single('QQuickText', objectName='WeatherDetailUnit'), |
665 | Eventually(Not(Is(None)))) |
666 | wind_unit = wind_component.select_single('QQuickText', objectName='WeatherDetailUnit') |
667 | - self.assertThat(lambda: wind_component.select_single('QQuickText', objectName='WeatherDetailValue'), |
668 | + self.assertThat(lambda: wind_component.select_single('QQuickText', objectName='WeatherDetailValue'), |
669 | Eventually(Not(Is(None)))) |
670 | wind_value = wind_component.select_single('QQuickText', objectName='WeatherDetailValue') |
671 | if wind_units == "mph": |
672 | @@ -94,20 +94,20 @@ |
673 | |
674 | def _check_precipitation_units(self, pre_units): |
675 | """Checks selected units by values from the first location tab""" |
676 | - if self.main_window.wideAspect: |
677 | + if self.main_view.wideAspect: |
678 | self._ensure_tablet_tabs_loaded() |
679 | - self.assertThat(lambda: self.main_window.select_many('WeatherDetailComponent', objectName='PrecipitationValue')[0], |
680 | + self.assertThat(lambda: self.main_view.select_many('WeatherDetailComponent', objectName='PrecipitationValue')[0], |
681 | Eventually(Not(Is(None)))) |
682 | - current_location_tab = self.main_window.select_single( |
683 | + current_location_tab = self.main_view.select_single( |
684 | 'LocationTab', visible=True) |
685 | focused_item = current_location_tab.select_single( |
686 | 'QQuickItem', focus=True) |
687 | component = focused_item.select_single( |
688 | 'WeatherDetailComponent', objectName='PrecipitationValue') |
689 | - self.assertThat(lambda: component.select_many('QQuickText', objectName='WeatherDetailUnit'), |
690 | + self.assertThat(lambda: component.select_many('QQuickText', objectName='WeatherDetailUnit'), |
691 | Eventually(Not(Is(None)))) |
692 | unit = component.select_single('QQuickText', objectName='WeatherDetailUnit') |
693 | - self.assertThat(lambda: component.select_single('QQuickText', objectName='WeatherDetailValue'), |
694 | + self.assertThat(lambda: component.select_single('QQuickText', objectName='WeatherDetailValue'), |
695 | Eventually(Not(Is(None)))) |
696 | value = component.select_single('QQuickText', objectName='WeatherDetailValue') |
697 | if pre_units == "in": |
698 | @@ -119,16 +119,16 @@ |
699 | |
700 | def _check_service(self, service): |
701 | """Checks selected units weather data service from the first location tab""" |
702 | - if self.main_window.wideAspect: |
703 | + if self.main_view.wideAspect: |
704 | self._ensure_tablet_tabs_loaded() |
705 | - self.assertThat(lambda: self.main_window.select_many('TabFooter', objectName='TabFooter')[0], |
706 | - Eventually(Not(Is(None)))) |
707 | - current_location_tab = self.main_window.select_single('LocationTab', visible=True) |
708 | - self.assertThat(lambda: current_location_tab.select_single('TabFooter', objectName='TabFooter'), |
709 | - Eventually(Not(Is(None)))) |
710 | - self.assertThat(lambda: current_location_tab.select_single('QQuickImage', objectName='DataProviderLogo'), |
711 | - Eventually(Not(Is(None)))) |
712 | - |
713 | + self.assertThat(lambda: self.main_view.select_many('TabFooter', objectName='TabFooter')[0], |
714 | + Eventually(Not(Is(None)))) |
715 | + current_location_tab = self.main_view.select_single('LocationTab', visible=True) |
716 | + self.assertThat(lambda: current_location_tab.select_single('TabFooter', objectName='TabFooter'), |
717 | + Eventually(Not(Is(None)))) |
718 | + self.assertThat(lambda: current_location_tab.select_single('QQuickImage', objectName='DataProviderLogo'), |
719 | + Eventually(Not(Is(None)))) |
720 | + |
721 | focused_item = current_location_tab.select_single('QQuickItem', focus=True) |
722 | tab_footer = current_location_tab.select_single('TabFooter', objectName='TabFooter') |
723 | provider_logo = current_location_tab.select_single('QQuickImage', objectName='DataProviderLogo') |
724 | @@ -146,9 +146,9 @@ |
725 | self._open_settings_sheet() |
726 | |
727 | # open the value selector |
728 | - self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='TemperatureUnitsSelector'), |
729 | + self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='TemperatureUnitsSelector'), |
730 | Eventually(Not(Is(None)))) |
731 | - units_selector = self.main_window.select_single('OptionSelector', objectName="TemperatureUnitsSelector") |
732 | + units_selector = self.main_view.select_single('OptionSelector', objectName="TemperatureUnitsSelector") |
733 | self.assertThat(units_selector.selectedIndex, Eventually(Equals(0))) |
734 | self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None)))) |
735 | current_option = units_selector.select_many('ShapeItem')[1] |
736 | @@ -163,15 +163,15 @@ |
737 | self._click_sheet_confirm() |
738 | |
739 | # wait for reload and check the imperial values |
740 | - load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner') |
741 | + load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner') |
742 | self.assertThat(load_indicator.running, Eventually(Equals(False))) |
743 | self._check_units('imperial') |
744 | |
745 | # switch back to metric values again |
746 | self._open_settings_sheet() |
747 | - self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='TemperatureUnitsSelector'), |
748 | + self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='TemperatureUnitsSelector'), |
749 | Eventually(Not(Is(None)))) |
750 | - units_selector = self.main_window.select_single('OptionSelector', objectName="TemperatureUnitsSelector") |
751 | + units_selector = self.main_view.select_single('OptionSelector', objectName="TemperatureUnitsSelector") |
752 | self.assertThat(units_selector.selectedIndex, Eventually(Equals(1))) |
753 | self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None)))) |
754 | current_option = units_selector.select_many('ShapeItem')[2] |
755 | @@ -191,7 +191,7 @@ |
756 | self._click_sheet_confirm() |
757 | |
758 | # wait for reload and check the metric values again |
759 | - load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner') |
760 | + load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner') |
761 | self.assertThat(load_indicator.running, Eventually(Equals(False))) |
762 | self._check_units('metric') |
763 | |
764 | @@ -203,9 +203,9 @@ |
765 | self._open_settings_sheet() |
766 | |
767 | # open the temp value selector |
768 | - self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='TemperatureUnitsSelector'), |
769 | + self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='TemperatureUnitsSelector'), |
770 | Eventually(Not(Is(None)))) |
771 | - units_selector = self.main_window.select_single('OptionSelector', objectName="TemperatureUnitsSelector") |
772 | + units_selector = self.main_view.select_single('OptionSelector', objectName="TemperatureUnitsSelector") |
773 | self.assertThat(units_selector.selectedIndex, Eventually(Equals(0))) |
774 | self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None)))) |
775 | current_option = units_selector.select_many('ShapeItem')[1] |
776 | @@ -219,9 +219,9 @@ |
777 | self.assertThat(units_selector.selectedIndex, Eventually(Equals(1))) |
778 | |
779 | # open the wind value selector |
780 | - self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='WindUnitsSelector'), |
781 | + self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='WindUnitsSelector'), |
782 | Eventually(Not(Is(None)))) |
783 | - units_selector = self.main_window.select_single('OptionSelector', objectName="WindUnitsSelector") |
784 | + units_selector = self.main_view.select_single('OptionSelector', objectName="WindUnitsSelector") |
785 | self.assertThat(units_selector.selectedIndex, Eventually(Equals(0))) |
786 | self.pointing_device.click_object(units_selector) |
787 | |
788 | @@ -244,9 +244,9 @@ |
789 | self._open_settings_sheet() |
790 | |
791 | # open the wind value selector |
792 | - self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='WindUnitsSelector'), |
793 | + self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='WindUnitsSelector'), |
794 | Eventually(Not(Is(None)))) |
795 | - units_selector = self.main_window.select_single('OptionSelector', objectName="WindUnitsSelector") |
796 | + units_selector = self.main_view.select_single('OptionSelector', objectName="WindUnitsSelector") |
797 | self.assertThat(units_selector.selectedIndex, Eventually(Equals(0))) |
798 | self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None)))) |
799 | current_option = units_selector.select_many('ShapeItem')[1] |
800 | @@ -261,15 +261,15 @@ |
801 | self._click_sheet_confirm() |
802 | |
803 | # wait for reload and check the mph values |
804 | - load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner') |
805 | + load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner') |
806 | self.assertThat(load_indicator.running, Eventually(Equals(False))) |
807 | self._check_wind_units('mph') |
808 | |
809 | # switch back to kmh values again |
810 | self._open_settings_sheet() |
811 | - self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='WindUnitsSelector'), |
812 | + self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='WindUnitsSelector'), |
813 | Eventually(Not(Is(None)))) |
814 | - units_selector = self.main_window.select_single('OptionSelector', objectName="WindUnitsSelector") |
815 | + units_selector = self.main_view.select_single('OptionSelector', objectName="WindUnitsSelector") |
816 | self.assertThat(units_selector.selectedIndex, Eventually(Equals(1))) |
817 | self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None)))) |
818 | current_option = units_selector.select_many('ShapeItem')[2] |
819 | @@ -289,7 +289,7 @@ |
820 | self._click_sheet_confirm() |
821 | |
822 | # wait for reload and check the metric values again |
823 | - load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner') |
824 | + load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner') |
825 | self.assertThat(load_indicator.running, Eventually(Equals(False))) |
826 | self._check_wind_units('kmh') |
827 | |
828 | @@ -301,9 +301,9 @@ |
829 | self._open_settings_sheet() |
830 | |
831 | # open the precipitation value selector |
832 | - self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='PrecipitationUnitsSelector'), |
833 | + self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='PrecipitationUnitsSelector'), |
834 | Eventually(Not(Is(None)))) |
835 | - units_selector = self.main_window.select_single('OptionSelector', objectName="PrecipitationUnitsSelector") |
836 | + units_selector = self.main_view.select_single('OptionSelector', objectName="PrecipitationUnitsSelector") |
837 | self.assertThat(units_selector.selectedIndex, Eventually(Equals(0))) |
838 | self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None)))) |
839 | current_option = units_selector.select_many('ShapeItem')[1] |
840 | @@ -318,15 +318,15 @@ |
841 | self._click_sheet_confirm() |
842 | |
843 | # wait for reload and check the inch values |
844 | - load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner') |
845 | + load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner') |
846 | self.assertThat(load_indicator.running, Eventually(Equals(False))) |
847 | self._check_wind_units('in') |
848 | |
849 | # switch back to mm values again |
850 | self._open_settings_sheet() |
851 | - self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='PrecipitationUnitsSelector'), |
852 | + self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='PrecipitationUnitsSelector'), |
853 | Eventually(Not(Is(None)))) |
854 | - units_selector = self.main_window.select_single('OptionSelector', objectName="PrecipitationUnitsSelector") |
855 | + units_selector = self.main_view.select_single('OptionSelector', objectName="PrecipitationUnitsSelector") |
856 | self.assertThat(units_selector.selectedIndex, Eventually(Equals(1))) |
857 | self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None)))) |
858 | current_option = units_selector.select_many('ShapeItem')[2] |
859 | @@ -348,7 +348,7 @@ |
860 | self._click_sheet_confirm() |
861 | |
862 | # wait for reload and check the metric values again |
863 | - load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner') |
864 | + load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner') |
865 | self.assertThat(load_indicator.running, Eventually(Equals(False))) |
866 | self._check_precipitation_units('mm') |
867 | |
868 | @@ -359,8 +359,8 @@ |
869 | self._open_settings_sheet() |
870 | |
871 | # open the value selector |
872 | - self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='ServiceSelector'), Eventually(Not(Is(None)))) |
873 | - units_selector = self.main_window.select_single('OptionSelector', objectName="ServiceSelector") |
874 | + self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='ServiceSelector'), Eventually(Not(Is(None)))) |
875 | + units_selector = self.main_view.select_single('OptionSelector', objectName="ServiceSelector") |
876 | self.assertThat(units_selector.selectedIndex, Eventually(Equals(0))) |
877 | self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None)))) |
878 | current_option = units_selector.select_many('ShapeItem')[1] |
879 | @@ -374,22 +374,22 @@ |
880 | self.assertThat(units_selector.selectedIndex, Eventually(Equals(1))) |
881 | |
882 | # check if precipitation units selector appears |
883 | - self.assertThat(lambda: self.main_window.select_single('OptionSelector', |
884 | + self.assertThat(lambda: self.main_view.select_single('OptionSelector', |
885 | objectName='PrecipitationUnitsSelector'), Eventually(Not(Is(None)))) |
886 | - units_selector = self.main_window.select_single('OptionSelector', |
887 | + units_selector = self.main_view.select_single('OptionSelector', |
888 | objectName="PrecipitationUnitsSelector") |
889 | self.assertThat(units_selector.visible, Eventually(Equals(1))) |
890 | self._click_sheet_confirm() |
891 | |
892 | - # wait for reload and check the used service |
893 | - load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner') |
894 | + # wait for reload and check the used service |
895 | + load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner') |
896 | self.assertThat(load_indicator.running, Eventually(Equals(False))) |
897 | self._check_service('openweathermap') |
898 | |
899 | # switch back to metric values again |
900 | self._open_settings_sheet() |
901 | - self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='ServiceSelector'), Eventually(Not(Is(None)))) |
902 | - units_selector = self.main_window.select_single('OptionSelector', objectName="ServiceSelector") |
903 | + self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='ServiceSelector'), Eventually(Not(Is(None)))) |
904 | + units_selector = self.main_view.select_single('OptionSelector', objectName="ServiceSelector") |
905 | self.assertThat(units_selector.selectedIndex, Eventually(Equals(1))) |
906 | self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None)))) |
907 | current_option = units_selector.select_many('ShapeItem')[2] |
908 | @@ -406,14 +406,14 @@ |
909 | self.assertThat(units_selector.selectedIndex, Eventually(Equals(0))) |
910 | |
911 | # check if precipitation units selector disappears and confirm |
912 | - self.assertThat(lambda: self.main_window.select_single('OptionSelector', |
913 | + self.assertThat(lambda: self.main_view.select_single('OptionSelector', |
914 | objectName='PrecipitationUnitsSelector'), Eventually(Not(Is(None)))) |
915 | - units_selector = self.main_window.select_single('OptionSelector', |
916 | + units_selector = self.main_view.select_single('OptionSelector', |
917 | objectName="PrecipitationUnitsSelector") |
918 | self.assertThat(units_selector.visible, Eventually(Equals(0))) |
919 | self._click_sheet_confirm() |
920 | |
921 | # wait for reload and check the metric values again |
922 | - load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner') |
923 | + load_indicator = self.main_view.select_single('ActivityIndicator', objectName='LoadingSpinner') |
924 | self.assertThat(load_indicator.running, Eventually(Equals(False))) |
925 | self._check_service('weatherchannel') |
I dislike the whitespaces changes being flagged...