Merge lp:~elopio/ubuntu-system-settings/refactor_about_tests into lp:ubuntu-system-settings
- refactor_about_tests
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~elopio/ubuntu-system-settings/refactor_about_tests |
Merge into: | lp:ubuntu-system-settings |
Prerequisite: | lp:~elopio/ubuntu-system-settings/python3 |
Diff against target: |
707 lines (+320/-149) 7 files modified
tests/autopilot/ubuntu_system_settings/__init__.py (+152/-27) tests/autopilot/ubuntu_system_settings/tests/__init__.py (+46/-56) tests/autopilot/ubuntu_system_settings/tests/test_about.py (+67/-47) tests/autopilot/ubuntu_system_settings/tests/test_cellular.py (+17/-5) tests/autopilot/ubuntu_system_settings/tests/test_datetime.py (+4/-3) tests/autopilot/ubuntu_system_settings/tests/test_search.py (+16/-6) tests/autopilot/ubuntu_system_settings/tests/test_sound.py (+18/-5) |
To merge this branch: | bzr merge lp:~elopio/ubuntu-system-settings/refactor_about_tests |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Brendan Donegan (community) | Approve | ||
Sebastien Bacher (community) | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Review via email: mp+225425@code.launchpad.net |
This proposal has been superseded by a proposal from 2014-07-11.
Commit message
Refactored the About autopilot tests to use the page object pattern. Added the click_item public helper to be used by UX tests.
Description of the change
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:761
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:765
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:767
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:767
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:767
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:767
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:767
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Sebastien Bacher (seb128) wrote : | # |
thanks, looks fine to me
Brendan Donegan (brendan-donegan) wrote : | # |
Great - thanks!
- 767. By Leo Arias
-
Merged with jonas branch.
- 768. By Leo Arias
-
Reverted the license changes for now.
- 769. By Leo Arias
-
Merged with trunk.
- 770. By Leo Arias
-
Updated the pointing device attribute.
- 771. By Leo Arias
-
Added the CellularPage to make the tests work with jonas' additions
- 772. By Leo Arias
-
Merged with trunk.
Unmerged revisions
Preview Diff
1 | === modified file 'tests/autopilot/ubuntu_system_settings/__init__.py' |
2 | --- tests/autopilot/ubuntu_system_settings/__init__.py 2014-07-09 00:25:18 +0000 |
3 | +++ tests/autopilot/ubuntu_system_settings/__init__.py 2014-07-09 00:25:18 +0000 |
4 | @@ -2,17 +2,20 @@ |
5 | # |
6 | # Copyright (C) 2014 Canonical Ltd. |
7 | # |
8 | -# This program is free software; you can redistribute it and/or modify |
9 | -# it under the terms of the GNU Lesser General Public License as published by |
10 | +# |
11 | +# This file is part of ubuntu-system-settings |
12 | +# |
13 | +# ubuntu-system-settings is free software: you can redistribute it and/or |
14 | +# modify it under the terms of the GNU General Public License as published by |
15 | # the Free Software Foundation; version 3. |
16 | # |
17 | -# This program is distributed in the hope that it will be useful, |
18 | +# ubuntu-system-settings is distributed in the hope that it will be useful, |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 | -# GNU Lesser General Public License for more details. |
22 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
23 | +# GNU General Public License for more details. |
24 | # |
25 | -# You should have received a copy of the GNU Lesser General Public License |
26 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
27 | +# You should have received a copy of the GNU General Public License |
28 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
29 | |
30 | import logging |
31 | |
32 | @@ -23,8 +26,12 @@ |
33 | |
34 | from time import sleep |
35 | |
36 | -from autopilot import platform |
37 | -from ubuntuuitoolkit import emulators as toolkit_emulators |
38 | +import autopilot.logging |
39 | +import ubuntuuitoolkit |
40 | +from autopilot import introspection, platform |
41 | + |
42 | + |
43 | +logger = logging.getLogger(__name__) |
44 | |
45 | |
46 | class SystemSettings(): |
47 | @@ -72,7 +79,7 @@ |
48 | app = testobj.launch_test_application( |
49 | *params, |
50 | app_type='qt', |
51 | - emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase) |
52 | + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) |
53 | |
54 | return app |
55 | |
56 | @@ -82,13 +89,34 @@ |
57 | return self.app.select_single(MainWindow) |
58 | |
59 | |
60 | -class MainWindow(toolkit_emulators.MainView): |
61 | +class MainWindow(ubuntuuitoolkit.MainView): |
62 | """An emulator class that makes it easy to interact with the UI.""" |
63 | |
64 | - @property |
65 | - def pointer(self): |
66 | - """ Return pointer """ |
67 | - return toolkit_emulators.get_pointing_device() |
68 | + @autopilot.logging.log_action(logger.debug) |
69 | + def click_item(self, object_name): |
70 | + """Click a system settings item. |
71 | + |
72 | + :param object_name: The objectName property of the item to click. |
73 | + |
74 | + """ |
75 | + item = self.select_single(objectName=object_name) |
76 | + item.swipe_into_view() |
77 | + self.pointing_device.click_object(item) |
78 | + |
79 | + @autopilot.logging.log_action(logger.info) |
80 | + def go_to_about_page(self): |
81 | + """Open the About page. |
82 | + |
83 | + :return: The About page. |
84 | + |
85 | + """ |
86 | + return self._go_to_page('entryComponent-about', 'aboutPage') |
87 | + |
88 | + def _go_to_page(self, item_object_name, page_object_name): |
89 | + self.click_item(item_object_name) |
90 | + page = self.wait_select_single(objectName=page_object_name) |
91 | + page.active.wait_for(True) |
92 | + return page |
93 | |
94 | def scroll_to(self, obj): |
95 | page = self.select_single(objectName='systemSettingsPage') |
96 | @@ -97,7 +125,7 @@ |
97 | page_center_x = int(page_right / 2) |
98 | page_center_y = int(page_bottom / 2) |
99 | while obj.globalRect[1] + obj.height > page_bottom: |
100 | - self.pointer.drag( |
101 | + self.pointing_device.drag( |
102 | page_center_x, |
103 | page_center_y, |
104 | page_center_x, |
105 | @@ -108,12 +136,7 @@ |
106 | |
107 | def scroll_to_and_click(self, obj): |
108 | self.scroll_to(obj) |
109 | - self.pointer.click_object(obj) |
110 | - |
111 | - @property |
112 | - def about_page(self): |
113 | - """ Return 'About' page """ |
114 | - return self.select_single(objectName='aboutPage') |
115 | + self.pointing_device.click_object(obj) |
116 | |
117 | @property |
118 | def cellular_page(self): |
119 | @@ -126,11 +149,6 @@ |
120 | return self.select_single(objectName="chooseCarrierPage") |
121 | |
122 | @property |
123 | - def licenses_page(self): |
124 | - """ Return 'License' page """ |
125 | - return self.select_single(objectName='licensesPage') |
126 | - |
127 | - @property |
128 | def storage_page(self): |
129 | """ Return 'Storage' page """ |
130 | return self.select_single(objectName='storagePage') |
131 | @@ -144,3 +162,110 @@ |
132 | def sound_page(self): |
133 | """ Return 'Sound' page """ |
134 | return self.select_single(objectName='soundPage') |
135 | + |
136 | + |
137 | +class SoundPage(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
138 | + |
139 | + """Autopilot helper for the Sound page.""" |
140 | + |
141 | + @classmethod |
142 | + def validate_dbus_object(cls, path, state): |
143 | + name = introspection.get_classname_from_path(path) |
144 | + if name == b'ItemPage': |
145 | + if state['objectName'][1] == 'soundPage': |
146 | + return True |
147 | + return False |
148 | + |
149 | + |
150 | +class AboutPage(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
151 | + |
152 | + """Autopilot helper for the About page.""" |
153 | + |
154 | + @classmethod |
155 | + def validate_dbus_object(cls, path, state): |
156 | + name = introspection.get_classname_from_path(path) |
157 | + if name == b'ItemPage': |
158 | + if state['objectName'][1] == 'aboutPage': |
159 | + return True |
160 | + return False |
161 | + |
162 | + def get_device_name(self): |
163 | + device_label = self.select_single(objectName='deviceLabel') |
164 | + return device_label.text |
165 | + |
166 | + def is_serial_visible(self): |
167 | + serial_item = self._get_serial_item() |
168 | + return serial_item.visible |
169 | + |
170 | + def _get_serial_item(self): |
171 | + return self.select_single(objectName='serialItem') |
172 | + |
173 | + def get_serial(self): |
174 | + serial_item = self._get_serial_item() |
175 | + return serial_item.value |
176 | + |
177 | + def is_imei_visible(self): |
178 | + imei_item = self._get_imei_item() |
179 | + return imei_item.visible |
180 | + |
181 | + def _get_imei_item(self): |
182 | + return self.wait_select_single(objectName='imeiItem') |
183 | + |
184 | + def get_imei(self): |
185 | + imei_item = self._get_imei_item() |
186 | + return imei_item.value |
187 | + |
188 | + def get_os_information(self): |
189 | + os_item = self.select_single(objectName='osItem') |
190 | + return os_item.value |
191 | + |
192 | + def get_last_updated_date(self): |
193 | + last_updated_item = self.select_single(objectName='lastUpdatedItem') |
194 | + return last_updated_item.value |
195 | + |
196 | + @autopilot.logging.log_action(logger.info) |
197 | + def go_to_check_for_updates(self): |
198 | + check_for_updates_button = self.select_single( |
199 | + objectName='updateButton') |
200 | + self.pointing_device.click_object(check_for_updates_button) |
201 | + system_updates_page = self.get_root_instance().wait_select_single( |
202 | + objectName='systemUpdatesPage') |
203 | + system_updates_page.active.wait_for(True) |
204 | + return system_updates_page |
205 | + |
206 | + @autopilot.logging.log_action(logger.info) |
207 | + def go_to_software_licenses(self): |
208 | + license_item = self.select_single( |
209 | + ubuntuuitoolkit.listitems.Standard, objectName='licenseItem') |
210 | + license_item.swipe_into_view() |
211 | + self.pointing_device.click_object(license_item) |
212 | + licenses_page = self.get_root_instance().wait_select_single( |
213 | + objectName='licensesPage') |
214 | + licenses_page.active.wait_for(True) |
215 | + return licenses_page |
216 | + |
217 | + |
218 | +class LicensesPage(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
219 | + |
220 | + """Autopilot helper for the Licenses page.""" |
221 | + |
222 | + @classmethod |
223 | + def validate_dbus_object(cls, path, state): |
224 | + name = introspection.get_classname_from_path(path) |
225 | + if name == b'ItemPage': |
226 | + if state['objectName'][1] == 'licensesPage': |
227 | + return True |
228 | + return False |
229 | + |
230 | + |
231 | +class SystemUpdatesPage(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
232 | + |
233 | + """Autopilot helper for the System Updates page.""" |
234 | + |
235 | + @classmethod |
236 | + def validate_dbus_object(cls, path, state): |
237 | + name = introspection.get_classname_from_path(path) |
238 | + if name == b'ItemPage': |
239 | + if state['objectName'][1] == 'systemUpdatesPage': |
240 | + return True |
241 | + return False |
242 | |
243 | === modified file 'tests/autopilot/ubuntu_system_settings/tests/__init__.py' |
244 | --- tests/autopilot/ubuntu_system_settings/tests/__init__.py 2014-06-11 09:36:44 +0000 |
245 | +++ tests/autopilot/ubuntu_system_settings/tests/__init__.py 2014-07-09 00:25:18 +0000 |
246 | @@ -1,35 +1,42 @@ |
247 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
248 | -# Copyright 2013 Canonical |
249 | -# |
250 | -# This program is free software: you can redistribute it and/or modify it |
251 | -# under the terms of the GNU General Public License version 3, as published |
252 | -# by the Free Software Foundation. |
253 | +# |
254 | +# Copyright 2013, 2014 Canonical |
255 | +# |
256 | +# This file is part of ubuntu-system-settings |
257 | +# |
258 | +# ubuntu-system-settings is free software: you can redistribute it and/or |
259 | +# modify it under the terms of the GNU General Public License as published by |
260 | +# the Free Software Foundation; version 3. |
261 | +# |
262 | +# ubuntu-system-settings is distributed in the hope that it will be useful, |
263 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
264 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
265 | +# GNU General Public License for more details. |
266 | +# |
267 | +# You should have received a copy of the GNU General Public License |
268 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
269 | + |
270 | |
271 | """ Tests for Ubuntu System Settings """ |
272 | |
273 | from __future__ import absolute_import |
274 | |
275 | -from ubuntu_system_settings import SystemSettings |
276 | - |
277 | -from autopilot.input import Mouse, Touch |
278 | -from autopilot.platform import model |
279 | -from autopilot.matchers import Eventually |
280 | -from testtools.matchers import Equals, NotEquals, GreaterThan |
281 | - |
282 | -from ubuntuuitoolkit.base import UbuntuUIToolkitAppTestCase |
283 | |
284 | import dbus |
285 | import dbusmock |
286 | import subprocess |
287 | |
288 | - |
289 | -class UbuntuSystemSettingsTestCase(UbuntuUIToolkitAppTestCase): |
290 | - """ Base class for Ubuntu System Settings """ |
291 | - |
292 | - if model() == 'Desktop': |
293 | - scenarios = [('with mouse', dict(input_device_class=Mouse))] |
294 | - else: |
295 | - scenarios = [('with touch', dict(input_device_class=Touch))] |
296 | +import ubuntuuitoolkit |
297 | +from autopilot.matchers import Eventually |
298 | +from testtools.matchers import Equals, NotEquals, GreaterThan |
299 | + |
300 | +from ubuntu_system_settings import SystemSettings |
301 | + |
302 | + |
303 | +class UbuntuSystemSettingsTestCase( |
304 | + ubuntuuitoolkit.base.UbuntuUIToolkitAppTestCase): |
305 | + |
306 | + """Base class for Ubuntu System Settings.""" |
307 | |
308 | def setUp(self, panel=None): |
309 | super(UbuntuSystemSettingsTestCase, self).setUp() |
310 | @@ -128,28 +135,23 @@ |
311 | |
312 | |
313 | class AboutBaseTestCase(UbuntuSystemSettingsTestCase): |
314 | - """ Base class for About this phone tests """ |
315 | + |
316 | + """Base class for About this phone tests.""" |
317 | |
318 | def setUp(self): |
319 | - """ Go to About page """ |
320 | - super(AboutBaseTestCase, self).setUp('about') |
321 | - self.assertThat(self.system_settings.main_view.about_page.active, |
322 | - Eventually(Equals(True))) |
323 | + """Go to About page.""" |
324 | + super(AboutBaseTestCase, self).setUp() |
325 | + self.about_page = self.system_settings.main_view.go_to_about_page() |
326 | |
327 | |
328 | class StorageBaseTestCase(AboutBaseTestCase): |
329 | - """ Base class for Storage page tests """ |
330 | + |
331 | + """Base class for Storage page tests.""" |
332 | |
333 | def setUp(self): |
334 | - """ Go to Storage Page """ |
335 | + """Go to Storage Page.""" |
336 | super(StorageBaseTestCase, self).setUp() |
337 | - # Click on 'Storage' option |
338 | - button = self.system_settings.main_view.about_page.select_single( |
339 | - 'Standard', |
340 | - objectName='storageItem' |
341 | - ) |
342 | - self.assertThat(button, NotEquals(None)) |
343 | - self.system_settings.main_view.scroll_to_and_click(button) |
344 | + self.system_settings.main_view.click_item('storageItem') |
345 | self.assertThat(self.storage_page.active, Eventually(Equals(True))) |
346 | |
347 | def assert_space_item(self, object_name, text): |
348 | @@ -180,36 +182,24 @@ |
349 | |
350 | |
351 | class LicenseBaseTestCase(AboutBaseTestCase): |
352 | - """ Base class for Licenses page tests """ |
353 | + |
354 | + """Base class for Licenses page tests.""" |
355 | |
356 | def setUp(self): |
357 | - """ Go to License Page """ |
358 | + """Go to License Page.""" |
359 | super(LicenseBaseTestCase, self).setUp() |
360 | - # Click on 'Software licenses' option |
361 | - button = self.system_settings.main_view.select_single( |
362 | - 'Standard', |
363 | - objectName='licenseItem') |
364 | - self.system_settings.main_view.scroll_to_and_click(button) |
365 | - |
366 | - @property |
367 | - def licenses_page(self): |
368 | - """ Return 'License' page """ |
369 | - return self.main_view.wait_select_single( |
370 | - 'ItemPage', objectName='licensesPage' |
371 | - ) |
372 | + self.licenses_page = self.about_page.go_to_software_licenses() |
373 | |
374 | |
375 | class SystemUpdatesBaseTestCase(UbuntuSystemSettingsTestCase): |
376 | - """ Base class for SystemUpdates page tests """ |
377 | + |
378 | + """Base class for SystemUpdates page tests.""" |
379 | |
380 | def setUp(self): |
381 | - """ Go to SystemUpdates Page """ |
382 | + """Go to SystemUpdates Page.""" |
383 | super(SystemUpdatesBaseTestCase, self).setUp() |
384 | - # Click on 'System Updates' option |
385 | - button = self.system_settings.main_view.select_single( |
386 | - objectName='entryComponent-system-update') |
387 | - self.assertThat(button, NotEquals(None)) |
388 | - self.system_settings.main_view.scroll_to_and_click(button) |
389 | + self.system_settings.main_view.click_item( |
390 | + 'entryComponent-system-update') |
391 | |
392 | |
393 | class SoundBaseTestCase(UbuntuSystemSettingsTestCase): |
394 | |
395 | === modified file 'tests/autopilot/ubuntu_system_settings/tests/test_about.py' |
396 | --- tests/autopilot/ubuntu_system_settings/tests/test_about.py 2014-07-09 00:25:18 +0000 |
397 | +++ tests/autopilot/ubuntu_system_settings/tests/test_about.py 2014-07-09 00:25:18 +0000 |
398 | @@ -1,9 +1,20 @@ |
399 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
400 | -# Copyright 2013 Canonical |
401 | -# |
402 | -# This program is free software: you can redistribute it and/or modify it |
403 | -# under the terms of the GNU General Public License version 3, as published |
404 | -# by the Free Software Foundation. |
405 | +# |
406 | +# Copyright 2013, 2014 Canonical |
407 | +# |
408 | +# This file is part of ubuntu-system-settings |
409 | +# |
410 | +# ubuntu-system-settings is free software: you can redistribute it and/or |
411 | +# modify it under the terms of the GNU General Public License as published by |
412 | +# the Free Software Foundation; version 3. |
413 | +# |
414 | +# ubuntu-system-settings is distributed in the hope that it will be useful, |
415 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
416 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
417 | +# GNU General Public License for more details. |
418 | +# |
419 | +# You should have received a copy of the GNU General Public License |
420 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
421 | |
422 | import os |
423 | import subprocess |
424 | @@ -27,7 +38,8 @@ |
425 | |
426 | |
427 | class AboutTestCase(AboutBaseTestCase): |
428 | - """ Tests for About this phone Page """ |
429 | + |
430 | + """Tests for About this phone Page.""" |
431 | |
432 | def _get_imei_from_dbus(self): |
433 | bus = dbus.SystemBus() |
434 | @@ -93,37 +105,48 @@ |
435 | else: |
436 | return str(info.split()[0]) |
437 | |
438 | - def test_serial(self): |
439 | + def test_device_with_serial_number_must_display_it(self): |
440 | """Checks whether the UI is showing the correct serial number.""" |
441 | - item = self.system_settings.main_view.about_page.select_single( |
442 | - objectName='serialItem' |
443 | - ) |
444 | - serial = self._get_device_serial_number() |
445 | - |
446 | - if not serial: |
447 | - self.assertThat(item.visible, Equals(False)) |
448 | + device_serial = self._get_device_serial_number() |
449 | + if not device_serial: |
450 | + self.skipTest('The device has no serial number.') |
451 | else: |
452 | + self.assertTrue(self.about_page.is_serial_visible()) |
453 | + displayed_serial = self.about_page.get_serial() |
454 | self.assertThat( |
455 | - item.value, Equals(self._get_device_serial_number()) |
456 | - ) |
457 | - |
458 | - def test_imei_information_is_correct(self): |
459 | + displayed_serial, Equals(device_serial)) |
460 | + |
461 | + def test_device_without_serial_must_not_display_it(self): |
462 | + device_serial = self._get_device_serial_number() |
463 | + if device_serial: |
464 | + self.skipTest('The device has serial number.') |
465 | + else: |
466 | + self.assertFalse(self.about_page.is_serial_visible()) |
467 | + |
468 | + def test_device_with_imei_must_display_it(self): |
469 | """Checks whether the UI is exposing the right IMEI.""" |
470 | - imei_item = self.system_settings.main_view.about_page.wait_select_single( |
471 | - objectName='imeiItem') |
472 | - imei_ofono = self._get_imei_from_dbus() |
473 | + device_imei = self._get_imei_from_dbus() |
474 | + if not device_imei: |
475 | + self.skipTest('The device has no imei.') |
476 | + else: |
477 | + self.assertTrue(self.about_page.is_imei_visible()) |
478 | + displayed_imei = self.about_page.get_imei() |
479 | + self.assertThat(displayed_imei, Equals(device_imei)) |
480 | |
481 | - if not imei_ofono: |
482 | - self.assertThat(imei_item.visible, Equals(False)) |
483 | + def test_device_without_imei_must_not_display_it(self): |
484 | + device_imei = self._get_imei_from_dbus() |
485 | + if device_imei: |
486 | + self.skipTest('The device has imei.') |
487 | else: |
488 | - self.assertEquals(imei_item.value, imei_ofono) |
489 | + self.assertFalse(self.about_page.is_imei_visible()) |
490 | |
491 | def test_settings_show_correct_version_of_the_os(self): |
492 | """Ensure the UI is showing the correct version of the OS.""" |
493 | - item = self.system_settings.main_view.about_page.select_single(objectName='osItem') |
494 | + device_os_version = self._get_os_name() |
495 | + displayed_os_info = self.about_page.get_os_information() |
496 | # TODO: find a way to check the image build number as well |
497 | # -- om26er 10-03-2014 |
498 | - self.assertTrue(self._get_os_name() in item.value) |
499 | + self.assertTrue(device_os_version in displayed_os_info) |
500 | |
501 | @skipIf(subprocess.call( |
502 | ['which', 'getprop'], stdout=subprocess.PIPE) != 0, |
503 | @@ -131,31 +154,26 @@ |
504 | ) |
505 | def test_hardware_name(self): |
506 | """Ensure the UI is showing the correct device name.""" |
507 | - device_label = self.system_settings.main_view.about_page.select_single( |
508 | - objectName='deviceLabel' |
509 | - ).text |
510 | + displayed_device_name = self.about_page.get_device_name() |
511 | device_name_from_getprop = self._get_device_manufacturer_and_model() |
512 | |
513 | - self.assertEquals(device_label, device_name_from_getprop) |
514 | + self.assertEquals(displayed_device_name, device_name_from_getprop) |
515 | |
516 | def test_last_updated(self): |
517 | """Checks whether Last Updated info is correct.""" |
518 | - last_updated = self.system_settings.main_view.about_page.select_single( |
519 | - objectName='lastUpdatedItem' |
520 | - ).value |
521 | - |
522 | - self.assertEquals(last_updated, self._get_last_updated_date()) |
523 | + last_updated_date_displayed = self.about_page.get_last_updated_date() |
524 | + self.assertEquals( |
525 | + last_updated_date_displayed, self._get_last_updated_date()) |
526 | |
527 | def test_check_for_updates(self): |
528 | """ |
529 | Checks whether clicking on Check for Updates brings us |
530 | to the Updates page. |
531 | """ |
532 | - update_button = self.system_settings.main_view.about_page.select_single( |
533 | - objectName='updateButton') |
534 | - self.system_settings.main_view.pointer.click_object(update_button) |
535 | - self.assertThat(self.system_settings.main_view.updates_page.visible, |
536 | - Eventually(Equals(True))) |
537 | + system_updates_page = self.about_page.go_to_check_for_updates() |
538 | + self.assertThat( |
539 | + system_updates_page.visible, Eventually(Equals(True))) |
540 | + |
541 | |
542 | class StorageTestCase(StorageBaseTestCase): |
543 | """ Tests for Storage """ |
544 | @@ -261,10 +279,12 @@ |
545 | |
546 | |
547 | class LicenseTestCase(LicenseBaseTestCase): |
548 | - """ Tests for Licenses """ |
549 | - |
550 | - def test_licenses_page(self): |
551 | - """ Check whether Storage page is available """ |
552 | - self.assertThat( |
553 | - self.system_settings.main_view.licenses_page.active, |
554 | - Eventually(Equals(True))) |
555 | + |
556 | + """Tests for Licenses.""" |
557 | + |
558 | + def test_open_licenses_page(self): |
559 | + """Check whether Storage page is available.""" |
560 | + # FIXME this is not a good Autopilot tests. It would be better if it |
561 | + # opens one of the licenses and checks that it is visible. |
562 | + # --elopio - 2014-07-02 |
563 | + self.assertThat(self.licenses_page.active, Equals(True)) |
564 | |
565 | === modified file 'tests/autopilot/ubuntu_system_settings/tests/test_cellular.py' |
566 | --- tests/autopilot/ubuntu_system_settings/tests/test_cellular.py 2014-07-09 00:25:18 +0000 |
567 | +++ tests/autopilot/ubuntu_system_settings/tests/test_cellular.py 2014-07-09 00:25:18 +0000 |
568 | @@ -1,9 +1,20 @@ |
569 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
570 | +# |
571 | # Copyright 2014 Canonical |
572 | # |
573 | -# This program is free software: you can redistribute it and/or modify it |
574 | -# under the terms of the GNU General Public License version 3, as published |
575 | -# by the Free Software Foundation. |
576 | +# This file is part of ubuntu-system-settings |
577 | +# |
578 | +# ubuntu-system-settings is free software: you can redistribute it and/or |
579 | +# modify it under the terms of the GNU General Public License as published by |
580 | +# the Free Software Foundation; version 3. |
581 | +# |
582 | +# ubuntu-system-settings is distributed in the hope that it will be useful, |
583 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
584 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
585 | +# GNU General Public License for more details. |
586 | +# |
587 | +# You should have received a copy of the GNU General Public License |
588 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
589 | |
590 | from autopilot.introspection.dbus import StateNotFoundError |
591 | from testtools.matchers import Equals, NotEquals, raises |
592 | @@ -23,10 +34,11 @@ |
593 | objectName="autoChooseCarrierSelector" |
594 | ) |
595 | manual = selector.select_single('Label', text=_("Manually")) |
596 | - self.system_settings.main_view.pointer.click_object(manual) |
597 | + self.system_settings.main_view.pointing_device.click_object(manual) |
598 | choosecarrier = self.system_settings.main_view.cellular_page.\ |
599 | select_single(objectName="chooseCarrier") |
600 | - self.system_settings.main_view.pointer.click_object(choosecarrier) |
601 | + self.system_settings.main_view.pointing_device.click_object( |
602 | + choosecarrier) |
603 | self.assertThat( |
604 | self.system_settings.main_view.choose_page.title, |
605 | Equals(_("Carrier")) |
606 | |
607 | === modified file 'tests/autopilot/ubuntu_system_settings/tests/test_datetime.py' |
608 | --- tests/autopilot/ubuntu_system_settings/tests/test_datetime.py 2014-06-12 10:33:31 +0000 |
609 | +++ tests/autopilot/ubuntu_system_settings/tests/test_datetime.py 2014-07-09 00:25:18 +0000 |
610 | @@ -65,7 +65,8 @@ |
611 | text_field = self.system_settings.main_view.select_single( |
612 | objectName='selectTimeZoneField' |
613 | ) |
614 | - self.system_settings.main_view.pointer.move_to_object(text_field) |
615 | + self.system_settings.main_view.pointing_device.move_to_object( |
616 | + text_field) |
617 | |
618 | def test_time_date_page(self): |
619 | """ Checks whether Time & Date page is available """ |
620 | @@ -108,7 +109,7 @@ |
621 | objectName='locationsListView' |
622 | ) |
623 | london = TimeDateTestCase.wait_select_listview_first(listview) |
624 | - self.system_settings.main_view.pointer.click_object(london) |
625 | + self.system_settings.main_view.pointing_device.click_object(london) |
626 | header = self.system_settings.main_view.select_single( |
627 | objectName='MainView_Header' |
628 | ) |
629 | @@ -128,7 +129,7 @@ |
630 | ) |
631 | |
632 | preston = TimeDateTestCase.wait_select_listview_first(listview) |
633 | - self.system_settings.main_view.pointer.click_object(preston) |
634 | + self.system_settings.main_view.pointing_device.click_object(preston) |
635 | |
636 | # The timer is 1 second, wait and see that we haven't moved pages |
637 | sleep(2) |
638 | |
639 | === modified file 'tests/autopilot/ubuntu_system_settings/tests/test_search.py' |
640 | --- tests/autopilot/ubuntu_system_settings/tests/test_search.py 2014-05-27 15:56:15 +0000 |
641 | +++ tests/autopilot/ubuntu_system_settings/tests/test_search.py 2014-07-09 00:25:18 +0000 |
642 | @@ -1,11 +1,21 @@ |
643 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
644 | -# Copyright 2013 Canonical |
645 | -# |
646 | -# This program is free software: you can redistribute it and/or modify it |
647 | -# under the terms of the GNU General Public License version 3, as published |
648 | -# by the Free Software Foundation. |
649 | +# |
650 | +# Copyright 2013, 2014 Canonical |
651 | +# |
652 | +# This file is part of ubuntu-system-settings |
653 | +# |
654 | +# ubuntu-system-settings is free software: you can redistribute it and/or |
655 | +# modify it under the terms of the GNU General Public License as published by |
656 | +# the Free Software Foundation; version 3. |
657 | +# |
658 | +# ubuntu-system-settings is distributed in the hope that it will be useful, |
659 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
660 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
661 | +# GNU General Public License for more details. |
662 | +# |
663 | +# You should have received a copy of the GNU General Public License |
664 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
665 | |
666 | -from autopilot.introspection.dbus import StateNotFoundError |
667 | from testtools.matchers import Equals |
668 | from autopilot.matchers import Eventually |
669 | |
670 | |
671 | === modified file 'tests/autopilot/ubuntu_system_settings/tests/test_sound.py' |
672 | --- tests/autopilot/ubuntu_system_settings/tests/test_sound.py 2014-06-11 09:38:03 +0000 |
673 | +++ tests/autopilot/ubuntu_system_settings/tests/test_sound.py 2014-07-09 00:25:18 +0000 |
674 | @@ -1,9 +1,21 @@ |
675 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
676 | +# |
677 | # Copyright 2014 Canonical |
678 | # |
679 | -# This program is free software: you can redistribute it and/or modify it |
680 | -# under the terms of the GNU General Public License version 3, as published |
681 | -# by the Free Software Foundation. |
682 | +# This file is part of ubuntu-system-settings |
683 | +# |
684 | +# ubuntu-system-settings is free software: you can redistribute it and/or |
685 | +# modify it under the terms of the GNU General Public License as published by |
686 | +# the Free Software Foundation; version 3. |
687 | +# |
688 | +# ubuntu-system-settings is distributed in the hope that it will be useful, |
689 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
690 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
691 | +# GNU General Public License for more details. |
692 | +# |
693 | +# You should have received a copy of the GNU General Public License |
694 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
695 | + |
696 | |
697 | from testtools.matchers import Equals, NotEquals |
698 | |
699 | @@ -30,5 +42,6 @@ |
700 | kbd_snd = self.system_settings.main_view.sound_page.select_single( |
701 | objectName="keyboardSoundSwitch") |
702 | current_value = kbd_snd.get_properties()["checked"] |
703 | - self.system_settings.main_view.pointer.click_object(kbd_snd) |
704 | - self.assertThat(kbd_snd.get_properties()["checked"], NotEquals(current_value)) |
705 | + self.system_settings.main_view.pointing_device.click_object(kbd_snd) |
706 | + self.assertThat( |
707 | + kbd_snd.get_properties()["checked"], NotEquals(current_value)) |
FAILED: Continuous integration, rev:760 jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- ci/923/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- utopic- touch/1513 jenkins. qa.ubuntu. com/job/ generic- mediumtests- utopic/ 1309 jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- utopic- amd64-ci/ 115 jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- utopic- armhf-ci/ 115 jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- utopic- armhf-ci/ 115/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- utopic- i386-ci/ 115 jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- runner- mako/1795 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/2490 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/2490/ artifact/ work/output/ *zip*/output. zip s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 9224 jenkins. qa.ubuntu. com/job/ autopilot- testrunner- otto-utopic/ 1080 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- amd64/1469 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- amd64/1469/ artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/ubuntu- system- settings- ci/923/ rebuild
http://