Merge lp:~elopio/ubuntu-system-settings/refactor_about_tests into lp:ubuntu-system-settings
- refactor_about_tests
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Sebastien Bacher |
Approved revision: | 772 |
Merged at revision: | 800 |
Proposed branch: | lp:~elopio/ubuntu-system-settings/refactor_about_tests |
Merge into: | lp:ubuntu-system-settings |
Prerequisite: | lp:~jonas-drange/ubuntu-system-settings/1211804-allow-technology-preference |
Diff against target: |
603 lines (+248/-121) 7 files modified
tests/autopilot/ubuntu_system_settings/__init__.py (+155/-20) tests/autopilot/ubuntu_system_settings/tests/__init__.py (+28/-49) tests/autopilot/ubuntu_system_settings/tests/test_about.py (+51/-42) tests/autopilot/ubuntu_system_settings/tests/test_cellular.py (+7/-4) tests/autopilot/ubuntu_system_settings/tests/test_datetime.py (+4/-3) tests/autopilot/ubuntu_system_settings/tests/test_search.py (+0/-1) tests/autopilot/ubuntu_system_settings/tests/test_sound.py (+3/-2) |
To merge this branch: | bzr merge lp:~elopio/ubuntu-system-settings/refactor_about_tests |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Sebastien Bacher (community) | Approve | ||
Jonas G. Drange (community) | Approve | ||
Brendan Donegan | Pending | ||
Review via email:
|
This proposal supersedes a proposal from 2014-07-03.
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
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
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://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
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://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
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://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
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://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
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://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
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://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
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://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Sebastien Bacher (seb128) wrote : Posted in a previous version of this proposal | # |
thanks, looks fine to me
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brendan Donegan (brendan-donegan) wrote : Posted in a previous version of this proposal | # |
Great - thanks!
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:767
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://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:771
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Jonas G. Drange (jonas-drange) wrote : | # |
LGTM, thanks!
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:772
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://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:772
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://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:772
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://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:772
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://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:772
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://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:772
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://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Leo Arias (elopio) wrote : | # |
What's happening on these failed executions is that the dbus service is crashing.
https:/
These seems more often now, but I'm not changing that part on my tests and it has just happened on the released image.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:772
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://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:772
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://
Preview Diff
1 | === modified file 'tests/autopilot/ubuntu_system_settings/__init__.py' |
2 | --- tests/autopilot/ubuntu_system_settings/__init__.py 2014-07-11 16:12:02 +0000 |
3 | +++ tests/autopilot/ubuntu_system_settings/__init__.py 2014-07-11 23:29:42 +0000 |
4 | @@ -23,8 +23,12 @@ |
5 | |
6 | from time import sleep |
7 | |
8 | -from autopilot import platform |
9 | -from ubuntuuitoolkit import emulators as toolkit_emulators |
10 | +import autopilot.logging |
11 | +import ubuntuuitoolkit |
12 | +from autopilot import introspection, platform |
13 | + |
14 | + |
15 | +logger = logging.getLogger(__name__) |
16 | |
17 | |
18 | class SystemSettings(): |
19 | @@ -72,7 +76,7 @@ |
20 | app = testobj.launch_test_application( |
21 | *params, |
22 | app_type='qt', |
23 | - emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase, |
24 | + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase, |
25 | capture_output=True) |
26 | |
27 | return app |
28 | @@ -83,13 +87,34 @@ |
29 | return self.app.select_single(MainWindow) |
30 | |
31 | |
32 | -class MainWindow(toolkit_emulators.MainView): |
33 | +class MainWindow(ubuntuuitoolkit.MainView): |
34 | """An emulator class that makes it easy to interact with the UI.""" |
35 | |
36 | - @property |
37 | - def pointer(self): |
38 | - """ Return pointer """ |
39 | - return toolkit_emulators.get_pointing_device() |
40 | + @autopilot.logging.log_action(logger.debug) |
41 | + def click_item(self, object_name): |
42 | + """Click a system settings item. |
43 | + |
44 | + :param object_name: The objectName property of the item to click. |
45 | + |
46 | + """ |
47 | + item = self.select_single(objectName=object_name) |
48 | + item.swipe_into_view() |
49 | + self.pointing_device.click_object(item) |
50 | + |
51 | + @autopilot.logging.log_action(logger.info) |
52 | + def go_to_about_page(self): |
53 | + """Open the About page. |
54 | + |
55 | + :return: The About page. |
56 | + |
57 | + """ |
58 | + return self._go_to_page('entryComponent-about', 'aboutPage') |
59 | + |
60 | + def _go_to_page(self, item_object_name, page_object_name): |
61 | + self.click_item(item_object_name) |
62 | + page = self.wait_select_single(objectName=page_object_name) |
63 | + page.active.wait_for(True) |
64 | + return page |
65 | |
66 | def scroll_to(self, obj): |
67 | page = self.select_single(objectName='systemSettingsPage') |
68 | @@ -98,7 +123,7 @@ |
69 | page_center_x = int(page_right / 2) |
70 | page_center_y = int(page_bottom / 2) |
71 | while obj.globalRect[1] + obj.height > page_bottom: |
72 | - self.pointer.drag( |
73 | + self.pointing_device.drag( |
74 | page_center_x, |
75 | page_center_y, |
76 | page_center_x, |
77 | @@ -109,12 +134,7 @@ |
78 | |
79 | def scroll_to_and_click(self, obj): |
80 | self.scroll_to(obj) |
81 | - self.pointer.click_object(obj) |
82 | - |
83 | - @property |
84 | - def about_page(self): |
85 | - """ Return 'About' page """ |
86 | - return self.select_single(objectName='aboutPage') |
87 | + self.pointing_device.click_object(obj) |
88 | |
89 | @property |
90 | def cellular_page(self): |
91 | @@ -127,11 +147,6 @@ |
92 | return self.select_single(objectName="chooseCarrierPage") |
93 | |
94 | @property |
95 | - def licenses_page(self): |
96 | - """ Return 'License' page """ |
97 | - return self.select_single(objectName='licensesPage') |
98 | - |
99 | - @property |
100 | def storage_page(self): |
101 | """ Return 'Storage' page """ |
102 | return self.select_single(objectName='storagePage') |
103 | @@ -145,3 +160,123 @@ |
104 | def sound_page(self): |
105 | """ Return 'Sound' page """ |
106 | return self.select_single(objectName='soundPage') |
107 | + |
108 | + |
109 | +class CelullarPage(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
110 | + |
111 | + """Autopilot helper for the Sound page.""" |
112 | + |
113 | + @classmethod |
114 | + def validate_dbus_object(cls, path, state): |
115 | + name = introspection.get_classname_from_path(path) |
116 | + if name == b'ItemPage': |
117 | + if state['objectName'][1] == 'cellularPage': |
118 | + return True |
119 | + return False |
120 | + |
121 | + |
122 | +class SoundPage(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
123 | + |
124 | + """Autopilot helper for the Sound page.""" |
125 | + |
126 | + @classmethod |
127 | + def validate_dbus_object(cls, path, state): |
128 | + name = introspection.get_classname_from_path(path) |
129 | + if name == b'ItemPage': |
130 | + if state['objectName'][1] == 'soundPage': |
131 | + return True |
132 | + return False |
133 | + |
134 | + |
135 | +class AboutPage(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
136 | + |
137 | + """Autopilot helper for the About page.""" |
138 | + |
139 | + @classmethod |
140 | + def validate_dbus_object(cls, path, state): |
141 | + name = introspection.get_classname_from_path(path) |
142 | + if name == b'ItemPage': |
143 | + if state['objectName'][1] == 'aboutPage': |
144 | + return True |
145 | + return False |
146 | + |
147 | + def get_device_name(self): |
148 | + device_label = self.select_single(objectName='deviceLabel') |
149 | + return device_label.text |
150 | + |
151 | + def is_serial_visible(self): |
152 | + serial_item = self._get_serial_item() |
153 | + return serial_item.visible |
154 | + |
155 | + def _get_serial_item(self): |
156 | + return self.select_single(objectName='serialItem') |
157 | + |
158 | + def get_serial(self): |
159 | + serial_item = self._get_serial_item() |
160 | + return serial_item.value |
161 | + |
162 | + def is_imei_visible(self): |
163 | + imei_item = self._get_imei_item() |
164 | + return imei_item.visible |
165 | + |
166 | + def _get_imei_item(self): |
167 | + return self.wait_select_single(objectName='imeiItem') |
168 | + |
169 | + def get_imei(self): |
170 | + imei_item = self._get_imei_item() |
171 | + return imei_item.value |
172 | + |
173 | + def get_os_information(self): |
174 | + os_item = self.select_single(objectName='osItem') |
175 | + return os_item.value |
176 | + |
177 | + def get_last_updated_date(self): |
178 | + last_updated_item = self.select_single(objectName='lastUpdatedItem') |
179 | + return last_updated_item.value |
180 | + |
181 | + @autopilot.logging.log_action(logger.info) |
182 | + def go_to_check_for_updates(self): |
183 | + check_for_updates_button = self.select_single( |
184 | + objectName='updateButton') |
185 | + self.pointing_device.click_object(check_for_updates_button) |
186 | + system_updates_page = self.get_root_instance().wait_select_single( |
187 | + objectName='systemUpdatesPage') |
188 | + system_updates_page.active.wait_for(True) |
189 | + return system_updates_page |
190 | + |
191 | + @autopilot.logging.log_action(logger.info) |
192 | + def go_to_software_licenses(self): |
193 | + license_item = self.select_single( |
194 | + ubuntuuitoolkit.listitems.Standard, objectName='licenseItem') |
195 | + license_item.swipe_into_view() |
196 | + self.pointing_device.click_object(license_item) |
197 | + licenses_page = self.get_root_instance().wait_select_single( |
198 | + objectName='licensesPage') |
199 | + licenses_page.active.wait_for(True) |
200 | + return licenses_page |
201 | + |
202 | + |
203 | +class LicensesPage(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
204 | + |
205 | + """Autopilot helper for the Licenses page.""" |
206 | + |
207 | + @classmethod |
208 | + def validate_dbus_object(cls, path, state): |
209 | + name = introspection.get_classname_from_path(path) |
210 | + if name == b'ItemPage': |
211 | + if state['objectName'][1] == 'licensesPage': |
212 | + return True |
213 | + return False |
214 | + |
215 | + |
216 | +class SystemUpdatesPage(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
217 | + |
218 | + """Autopilot helper for the System Updates page.""" |
219 | + |
220 | + @classmethod |
221 | + def validate_dbus_object(cls, path, state): |
222 | + name = introspection.get_classname_from_path(path) |
223 | + if name == b'ItemPage': |
224 | + if state['objectName'][1] == 'systemUpdatesPage': |
225 | + return True |
226 | + return False |
227 | |
228 | === modified file 'tests/autopilot/ubuntu_system_settings/tests/__init__.py' |
229 | --- tests/autopilot/ubuntu_system_settings/tests/__init__.py 2014-07-09 10:02:47 +0000 |
230 | +++ tests/autopilot/ubuntu_system_settings/tests/__init__.py 2014-07-11 23:29:42 +0000 |
231 | @@ -9,30 +9,26 @@ |
232 | |
233 | from __future__ import absolute_import |
234 | |
235 | -from ubuntu_system_settings import SystemSettings |
236 | - |
237 | -from autopilot.input import Mouse, Touch |
238 | -from autopilot.platform import model |
239 | -from autopilot.matchers import Eventually |
240 | -from testtools.matchers import Equals, NotEquals, GreaterThan |
241 | - |
242 | -from ubuntuuitoolkit.base import UbuntuUIToolkitAppTestCase |
243 | |
244 | import dbus |
245 | import dbusmock |
246 | import subprocess |
247 | |
248 | +import ubuntuuitoolkit |
249 | +from autopilot.matchers import Eventually |
250 | +from testtools.matchers import Equals, NotEquals, GreaterThan |
251 | + |
252 | +from ubuntu_system_settings import SystemSettings |
253 | + |
254 | + |
255 | CONNMAN_IFACE = 'org.ofono.ConnectionManager' |
256 | RDO_IFACE = 'org.ofono.RadioSettings' |
257 | |
258 | |
259 | -class UbuntuSystemSettingsTestCase(UbuntuUIToolkitAppTestCase): |
260 | - """ Base class for Ubuntu System Settings """ |
261 | +class UbuntuSystemSettingsTestCase( |
262 | + ubuntuuitoolkit.base.UbuntuUIToolkitAppTestCase): |
263 | |
264 | - if model() == 'Desktop': |
265 | - scenarios = [('with mouse', dict(input_device_class=Mouse))] |
266 | - else: |
267 | - scenarios = [('with touch', dict(input_device_class=Touch))] |
268 | + """Base class for Ubuntu System Settings.""" |
269 | |
270 | def setUp(self, panel=None): |
271 | super(UbuntuSystemSettingsTestCase, self).setUp() |
272 | @@ -185,28 +181,23 @@ |
273 | |
274 | |
275 | class AboutBaseTestCase(UbuntuSystemSettingsTestCase): |
276 | - """ Base class for About this phone tests """ |
277 | + |
278 | + """Base class for About this phone tests.""" |
279 | |
280 | def setUp(self): |
281 | - """ Go to About page """ |
282 | - super(AboutBaseTestCase, self).setUp('about') |
283 | - self.assertThat(self.system_settings.main_view.about_page.active, |
284 | - Eventually(Equals(True))) |
285 | + """Go to About page.""" |
286 | + super(AboutBaseTestCase, self).setUp() |
287 | + self.about_page = self.system_settings.main_view.go_to_about_page() |
288 | |
289 | |
290 | class StorageBaseTestCase(AboutBaseTestCase): |
291 | - """ Base class for Storage page tests """ |
292 | + |
293 | + """Base class for Storage page tests.""" |
294 | |
295 | def setUp(self): |
296 | - """ Go to Storage Page """ |
297 | + """Go to Storage Page.""" |
298 | super(StorageBaseTestCase, self).setUp() |
299 | - # Click on 'Storage' option |
300 | - button = self.system_settings.main_view.about_page.select_single( |
301 | - 'Standard', |
302 | - objectName='storageItem' |
303 | - ) |
304 | - self.assertThat(button, NotEquals(None)) |
305 | - self.system_settings.main_view.scroll_to_and_click(button) |
306 | + self.system_settings.main_view.click_item('storageItem') |
307 | self.assertThat(self.storage_page.active, Eventually(Equals(True))) |
308 | |
309 | def assert_space_item(self, object_name, text): |
310 | @@ -236,36 +227,24 @@ |
311 | |
312 | |
313 | class LicenseBaseTestCase(AboutBaseTestCase): |
314 | - """ Base class for Licenses page tests """ |
315 | + |
316 | + """Base class for Licenses page tests.""" |
317 | |
318 | def setUp(self): |
319 | - """ Go to License Page """ |
320 | + """Go to License Page.""" |
321 | super(LicenseBaseTestCase, self).setUp() |
322 | - # Click on 'Software licenses' option |
323 | - button = self.system_settings.main_view.select_single( |
324 | - 'Standard', |
325 | - objectName='licenseItem') |
326 | - self.system_settings.main_view.scroll_to_and_click(button) |
327 | - |
328 | - @property |
329 | - def licenses_page(self): |
330 | - """ Return 'License' page """ |
331 | - return self.main_view.wait_select_single( |
332 | - 'ItemPage', objectName='licensesPage' |
333 | - ) |
334 | + self.licenses_page = self.about_page.go_to_software_licenses() |
335 | |
336 | |
337 | class SystemUpdatesBaseTestCase(UbuntuSystemSettingsTestCase): |
338 | - """ Base class for SystemUpdates page tests """ |
339 | + |
340 | + """Base class for SystemUpdates page tests.""" |
341 | |
342 | def setUp(self): |
343 | - """ Go to SystemUpdates Page """ |
344 | + """Go to SystemUpdates Page.""" |
345 | super(SystemUpdatesBaseTestCase, self).setUp() |
346 | - # Click on 'System Updates' option |
347 | - button = self.system_settings.main_view.select_single( |
348 | - objectName='entryComponent-system-update') |
349 | - self.assertThat(button, NotEquals(None)) |
350 | - self.system_settings.main_view.scroll_to_and_click(button) |
351 | + self.system_settings.main_view.click_item( |
352 | + 'entryComponent-system-update') |
353 | |
354 | |
355 | class SoundBaseTestCase(UbuntuSystemSettingsTestCase): |
356 | |
357 | === modified file 'tests/autopilot/ubuntu_system_settings/tests/test_about.py' |
358 | --- tests/autopilot/ubuntu_system_settings/tests/test_about.py 2014-07-02 18:27:59 +0000 |
359 | +++ tests/autopilot/ubuntu_system_settings/tests/test_about.py 2014-07-11 23:29:42 +0000 |
360 | @@ -27,7 +27,8 @@ |
361 | |
362 | |
363 | class AboutTestCase(AboutBaseTestCase): |
364 | - """ Tests for About this phone Page """ |
365 | + |
366 | + """Tests for About this phone Page.""" |
367 | |
368 | def _get_imei_from_dbus(self): |
369 | bus = dbus.SystemBus() |
370 | @@ -93,37 +94,48 @@ |
371 | else: |
372 | return str(info.split()[0]) |
373 | |
374 | - def test_serial(self): |
375 | + def test_device_with_serial_number_must_display_it(self): |
376 | """Checks whether the UI is showing the correct serial number.""" |
377 | - item = self.system_settings.main_view.about_page.select_single( |
378 | - objectName='serialItem' |
379 | - ) |
380 | - serial = self._get_device_serial_number() |
381 | - |
382 | - if not serial: |
383 | - self.assertThat(item.visible, Equals(False)) |
384 | + device_serial = self._get_device_serial_number() |
385 | + if not device_serial: |
386 | + self.skipTest('The device has no serial number.') |
387 | else: |
388 | + self.assertTrue(self.about_page.is_serial_visible()) |
389 | + displayed_serial = self.about_page.get_serial() |
390 | self.assertThat( |
391 | - item.value, Equals(self._get_device_serial_number()) |
392 | - ) |
393 | - |
394 | - def test_imei_information_is_correct(self): |
395 | + displayed_serial, Equals(device_serial)) |
396 | + |
397 | + def test_device_without_serial_must_not_display_it(self): |
398 | + device_serial = self._get_device_serial_number() |
399 | + if device_serial: |
400 | + self.skipTest('The device has serial number.') |
401 | + else: |
402 | + self.assertFalse(self.about_page.is_serial_visible()) |
403 | + |
404 | + def test_device_with_imei_must_display_it(self): |
405 | """Checks whether the UI is exposing the right IMEI.""" |
406 | - imei_item = self.system_settings.main_view.about_page.wait_select_single( |
407 | - objectName='imeiItem') |
408 | - imei_ofono = self._get_imei_from_dbus() |
409 | + device_imei = self._get_imei_from_dbus() |
410 | + if not device_imei: |
411 | + self.skipTest('The device has no imei.') |
412 | + else: |
413 | + self.assertTrue(self.about_page.is_imei_visible()) |
414 | + displayed_imei = self.about_page.get_imei() |
415 | + self.assertThat(displayed_imei, Equals(device_imei)) |
416 | |
417 | - if not imei_ofono: |
418 | - self.assertThat(imei_item.visible, Equals(False)) |
419 | + def test_device_without_imei_must_not_display_it(self): |
420 | + device_imei = self._get_imei_from_dbus() |
421 | + if device_imei: |
422 | + self.skipTest('The device has imei.') |
423 | else: |
424 | - self.assertEquals(imei_item.value, imei_ofono) |
425 | + self.assertFalse(self.about_page.is_imei_visible()) |
426 | |
427 | def test_settings_show_correct_version_of_the_os(self): |
428 | """Ensure the UI is showing the correct version of the OS.""" |
429 | - item = self.system_settings.main_view.about_page.select_single(objectName='osItem') |
430 | + device_os_version = self._get_os_name() |
431 | + displayed_os_info = self.about_page.get_os_information() |
432 | # TODO: find a way to check the image build number as well |
433 | # -- om26er 10-03-2014 |
434 | - self.assertTrue(self._get_os_name() in item.value) |
435 | + self.assertTrue(device_os_version in displayed_os_info) |
436 | |
437 | @skipIf(subprocess.call( |
438 | ['which', 'getprop'], stdout=subprocess.PIPE) != 0, |
439 | @@ -131,31 +143,26 @@ |
440 | ) |
441 | def test_hardware_name(self): |
442 | """Ensure the UI is showing the correct device name.""" |
443 | - device_label = self.system_settings.main_view.about_page.select_single( |
444 | - objectName='deviceLabel' |
445 | - ).text |
446 | + displayed_device_name = self.about_page.get_device_name() |
447 | device_name_from_getprop = self._get_device_manufacturer_and_model() |
448 | |
449 | - self.assertEquals(device_label, device_name_from_getprop) |
450 | + self.assertEquals(displayed_device_name, device_name_from_getprop) |
451 | |
452 | def test_last_updated(self): |
453 | """Checks whether Last Updated info is correct.""" |
454 | - last_updated = self.system_settings.main_view.about_page.select_single( |
455 | - objectName='lastUpdatedItem' |
456 | - ).value |
457 | - |
458 | - self.assertEquals(last_updated, self._get_last_updated_date()) |
459 | + last_updated_date_displayed = self.about_page.get_last_updated_date() |
460 | + self.assertEquals( |
461 | + last_updated_date_displayed, self._get_last_updated_date()) |
462 | |
463 | def test_check_for_updates(self): |
464 | """ |
465 | Checks whether clicking on Check for Updates brings us |
466 | to the Updates page. |
467 | """ |
468 | - update_button = self.system_settings.main_view.about_page.select_single( |
469 | - objectName='updateButton') |
470 | - self.system_settings.main_view.pointer.click_object(update_button) |
471 | - self.assertThat(self.system_settings.main_view.updates_page.visible, |
472 | - Eventually(Equals(True))) |
473 | + system_updates_page = self.about_page.go_to_check_for_updates() |
474 | + self.assertThat( |
475 | + system_updates_page.visible, Eventually(Equals(True))) |
476 | + |
477 | |
478 | class StorageTestCase(StorageBaseTestCase): |
479 | """ Tests for Storage """ |
480 | @@ -261,10 +268,12 @@ |
481 | |
482 | |
483 | class LicenseTestCase(LicenseBaseTestCase): |
484 | - """ Tests for Licenses """ |
485 | - |
486 | - def test_licenses_page(self): |
487 | - """ Check whether Storage page is available """ |
488 | - self.assertThat( |
489 | - self.system_settings.main_view.licenses_page.active, |
490 | - Eventually(Equals(True))) |
491 | + |
492 | + """Tests for Licenses.""" |
493 | + |
494 | + def test_open_licenses_page(self): |
495 | + """Check whether Storage page is available.""" |
496 | + # FIXME this is not a good Autopilot tests. It would be better if it |
497 | + # opens one of the licenses and checks that it is visible. |
498 | + # --elopio - 2014-07-02 |
499 | + self.assertThat(self.licenses_page.active, Equals(True)) |
500 | |
501 | === modified file 'tests/autopilot/ubuntu_system_settings/tests/test_cellular.py' |
502 | --- tests/autopilot/ubuntu_system_settings/tests/test_cellular.py 2014-07-11 16:12:02 +0000 |
503 | +++ tests/autopilot/ubuntu_system_settings/tests/test_cellular.py 2014-07-11 23:29:42 +0000 |
504 | @@ -4,8 +4,10 @@ |
505 | # This program is free software: you can redistribute it and/or modify it |
506 | # under the terms of the GNU General Public License version 3, as published |
507 | # by the Free Software Foundation. |
508 | + |
509 | import dbus |
510 | from time import sleep |
511 | + |
512 | from autopilot.introspection.dbus import StateNotFoundError |
513 | from gi.repository import Gio |
514 | from testtools.matchers import Equals, NotEquals, raises |
515 | @@ -43,7 +45,7 @@ |
516 | def select_preference(self, label): |
517 | """Helper method that clicks a preference that matches provided label""" |
518 | pref = self.data_preference_selector.select_single('Label', text=label) |
519 | - self.system_settings.main_view.pointer.click_object(pref) |
520 | + self.system_settings.main_view.pointing_device.click_object(pref) |
521 | |
522 | def assert_selected_preference(self, index): |
523 | """Helper method asserting that the selected data technology preference |
524 | @@ -56,10 +58,11 @@ |
525 | objectName="autoChooseCarrierSelector" |
526 | ) |
527 | manual = selector.select_single('Label', text=_("Manually")) |
528 | - self.system_settings.main_view.pointer.click_object(manual) |
529 | + self.system_settings.main_view.pointing_device.click_object(manual) |
530 | choosecarrier = self.system_settings.main_view.cellular_page.\ |
531 | select_single(objectName="chooseCarrier") |
532 | - self.system_settings.main_view.pointer.click_object(choosecarrier) |
533 | + self.system_settings.main_view.pointing_device.click_object( |
534 | + choosecarrier) |
535 | self.assertThat( |
536 | self.system_settings.main_view.choose_page.title, |
537 | Equals(_("Carrier")) |
538 | @@ -211,7 +214,7 @@ |
539 | |
540 | self.system_settings.main_view.go_back() |
541 | |
542 | - self.system_settings.main_view.pointer.click_object( |
543 | + self.system_settings.main_view.pointing_device.click_object( |
544 | self.system_settings.main_view.select_single( |
545 | objectName='entryComponent-cellular')) |
546 | |
547 | |
548 | === modified file 'tests/autopilot/ubuntu_system_settings/tests/test_datetime.py' |
549 | --- tests/autopilot/ubuntu_system_settings/tests/test_datetime.py 2014-06-12 10:33:31 +0000 |
550 | +++ tests/autopilot/ubuntu_system_settings/tests/test_datetime.py 2014-07-11 23:29:42 +0000 |
551 | @@ -65,7 +65,8 @@ |
552 | text_field = self.system_settings.main_view.select_single( |
553 | objectName='selectTimeZoneField' |
554 | ) |
555 | - self.system_settings.main_view.pointer.move_to_object(text_field) |
556 | + self.system_settings.main_view.pointing_device.move_to_object( |
557 | + text_field) |
558 | |
559 | def test_time_date_page(self): |
560 | """ Checks whether Time & Date page is available """ |
561 | @@ -108,7 +109,7 @@ |
562 | objectName='locationsListView' |
563 | ) |
564 | london = TimeDateTestCase.wait_select_listview_first(listview) |
565 | - self.system_settings.main_view.pointer.click_object(london) |
566 | + self.system_settings.main_view.pointing_device.click_object(london) |
567 | header = self.system_settings.main_view.select_single( |
568 | objectName='MainView_Header' |
569 | ) |
570 | @@ -128,7 +129,7 @@ |
571 | ) |
572 | |
573 | preston = TimeDateTestCase.wait_select_listview_first(listview) |
574 | - self.system_settings.main_view.pointer.click_object(preston) |
575 | + self.system_settings.main_view.pointing_device.click_object(preston) |
576 | |
577 | # The timer is 1 second, wait and see that we haven't moved pages |
578 | sleep(2) |
579 | |
580 | === modified file 'tests/autopilot/ubuntu_system_settings/tests/test_search.py' |
581 | --- tests/autopilot/ubuntu_system_settings/tests/test_search.py 2014-05-27 15:56:15 +0000 |
582 | +++ tests/autopilot/ubuntu_system_settings/tests/test_search.py 2014-07-11 23:29:42 +0000 |
583 | @@ -5,7 +5,6 @@ |
584 | # under the terms of the GNU General Public License version 3, as published |
585 | # by the Free Software Foundation. |
586 | |
587 | -from autopilot.introspection.dbus import StateNotFoundError |
588 | from testtools.matchers import Equals |
589 | from autopilot.matchers import Eventually |
590 | |
591 | |
592 | === modified file 'tests/autopilot/ubuntu_system_settings/tests/test_sound.py' |
593 | --- tests/autopilot/ubuntu_system_settings/tests/test_sound.py 2014-06-11 09:38:03 +0000 |
594 | +++ tests/autopilot/ubuntu_system_settings/tests/test_sound.py 2014-07-11 23:29:42 +0000 |
595 | @@ -30,5 +30,6 @@ |
596 | kbd_snd = self.system_settings.main_view.sound_page.select_single( |
597 | objectName="keyboardSoundSwitch") |
598 | current_value = kbd_snd.get_properties()["checked"] |
599 | - self.system_settings.main_view.pointer.click_object(kbd_snd) |
600 | - self.assertThat(kbd_snd.get_properties()["checked"], NotEquals(current_value)) |
601 | + self.system_settings.main_view.pointing_device.click_object(kbd_snd) |
602 | + self.assertThat( |
603 | + 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://