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