Merge lp:~om26er/ubuntu-system-settings/fix_tests into lp:ubuntu-system-settings

Proposed by Omer Akram
Status: Superseded
Proposed branch: lp:~om26er/ubuntu-system-settings/fix_tests
Merge into: lp:ubuntu-system-settings
Prerequisite: lp:~om26er/ubuntu-system-settings/pep8_pyflakes_fix
Diff against target: 527 lines (+235/-135)
6 files modified
plugins/about/License.qml (+0/-1)
plugins/about/Software.qml (+1/-0)
tests/autopilot/ubuntu_system_settings/helpers.py (+54/-0)
tests/autopilot/ubuntu_system_settings/tests/__init__.py (+23/-25)
tests/autopilot/ubuntu_system_settings/tests/test_about.py (+134/-90)
tests/autopilot/ubuntu_system_settings/tests/test_search.py (+23/-19)
To merge this branch: bzr merge lp:~om26er/ubuntu-system-settings/fix_tests
Reviewer Review Type Date Requested Status
Sebastien Bacher (community) Needs Fixing
PS Jenkins bot continuous-integration Approve
Review via email: mp+210102@code.launchpad.net

This proposal has been superseded by a proposal from 2014-04-01.

Commit message

autopilot tests improvements:
 * Improved existing tests to compare values with backends instead of just testing the 'item' is there.
 * Fixed a skipped failing test
 * Delete label tests and those which are trying to make sure certain elements exist.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
648. By Omer Akram

fix pep8

649. By Omer Akram

fix

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Omer Akram (om26er) wrote :

\o/

On Tue, Mar 11, 2014 at 4:17 AM, PS Jenkins bot <
<email address hidden>> wrote:

> Review: Approve continuous-integration
>
> PASSED: Continuous integration, rev:649
> http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/693/
> Executed test runs:
> SUCCESS:
> http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/3801
> SUCCESS:
> http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3386
> SUCCESS:
> http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-trusty-amd64-ci/209
> SUCCESS:
> http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-trusty-armhf-ci/197
> SUCCESS:
> http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-trusty-i386-ci/196
> SUCCESS:
> http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3338
> SUCCESS:
> http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3819
> deb:
> http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3819/artifact/work/output/*zip*/output.zip
> SUCCESS:
> http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3388
> deb:
> http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3388/artifact/work/output/*zip*/output.zip
> SUCCESS:
> http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5754
> SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/4639
>
> Click here to trigger a rebuild:
> http://s-jenkins.ubuntu-ci:8080/job/ubuntu-system-settings-ci/693/rebuild
>
> --
>
> https://code.launchpad.net/~om26er/ubuntu-system-settings/fix_tests/+merge/210102
> You are the owner of lp:~om26er/ubuntu-system-settings/fix_tests.
>

650. By Omer Akram

merge trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
651. By Omer Akram

bring back system updates changes so we don't conflict

652. By Omer Akram

merge trunk, fix conflicts

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for your work, that looks mostly fine, 3 of the StorageTestCase tests fail if the xdg directories are missing though

e.g

"Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/ubuntu_system_settings/tests/test_about.py", line 161, in test_space_used_by_music
    music_space = self._get_space_by_directory('Music')
  File "/usr/lib/python2.7/dist-packages/ubuntu_system_settings/tests/test_about.py", line 131, in _get_space_by_directory
    output = subprocess.check_output(['du', '--block-size=1', location])
  File "/usr/lib/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['du', '--block-size=1', '/home/user/Videos']' returned non-zero exit status 1

same for Pictures and Music

Those directories are translated if you use a different locale (e.g they are "Vidéos" "Images" "Musique" on a french system). You either need to restore the translations or handle the directories not being there

review: Needs Fixing
653. By Omer Akram

translate directory names so that tests don't fail on non-english desktops

Revision history for this message
Omer Akram (om26er) wrote :

Thanks for the review, I have fixed that problem, now we are translating those names.

Revision history for this message
Iain Lane (laney) wrote :

Drive-by commenting...

On Tue, Apr 01, 2014 at 04:22:31PM -0000, Omer Akram wrote:
> Thanks for the review, I have fixed that problem, now we are translating those names.

You can do this more flexibly (since users are allowed to change these
directories to anything they want) by retrieving the actual user dir in
use.

For example using GLib with gi like so:

>>> from gi.repository import GLib
>>> GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_MUSIC)
'/home/laney/Music'

It's not essential, but it'd be nice to do that this time round if you
can. This is the kind of enhancement that falls through the cracks.

--
Iain Lane [ <email address hidden> ]
Debian Developer [ <email address hidden> ]
Ubuntu Developer [ <email address hidden> ]

654. By Omer Akram

merge with victor's branch, fix conflicts

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, the tests still can fail though (if you run under a C local on a non english desktop, or if the directories are missing), the proper solution is the one hinted by Laney. We should also handle without failing the case when one of the directory is missing on disk (which can happen)

review: Needs Fixing
655. By Omer Akram

use glib to get directory locations inside HOME

656. By Omer Akram

make tests more solid by using Eventually

657. By Omer Akram

skip test if the directory does not exist

658. By Omer Akram

don't skip tests based on platform, rather handle cases in code

659. By Omer Akram

skip test if getprop is not found instead of making it platform dependent

660. By Omer Akram

fix pep8/pyflakes complaints

661. By Omer Akram

merge with trunk, fix conflicts

662. By Omer Akram

fix

663. By Omer Akram

don't skip tests based on platform, rather check if the required backend is availabe or not and test accordingly

664. By Omer Akram

skip disk storage tests on desktop as they can fail because the calculation can take a long time, bug 1304328

665. By Omer Akram

skip disk space tests, in some cases they can be slow

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/about/License.qml'
2--- plugins/about/License.qml 2014-03-04 12:45:06 +0000
3+++ plugins/about/License.qml 2014-04-01 16:56:38 +0000
4@@ -8,7 +8,6 @@
5 property string binary;
6
7 id: licensesPage
8- objectName: "licensesPage"
9 title: binary
10 flickable: scrollWidget
11
12
13=== modified file 'plugins/about/Software.qml'
14--- plugins/about/Software.qml 2013-07-29 14:08:10 +0000
15+++ plugins/about/Software.qml 2014-04-01 16:56:38 +0000
16@@ -7,6 +7,7 @@
17
18 ItemPage {
19 id: licensesPage
20+ objectName: "licensesPage"
21 title: i18n.tr("Software licenses")
22 flickable: softwareList
23
24
25=== added file 'tests/autopilot/ubuntu_system_settings/helpers.py'
26--- tests/autopilot/ubuntu_system_settings/helpers.py 1970-01-01 00:00:00 +0000
27+++ tests/autopilot/ubuntu_system_settings/helpers.py 2014-04-01 16:56:38 +0000
28@@ -0,0 +1,54 @@
29+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
30+#
31+# Copyright (C) 2014 Canonical Ltd.
32+#
33+# This program is free software; you can redistribute it and/or modify
34+# it under the terms of the GNU Lesser General Public License as published by
35+# the Free Software Foundation; version 3.
36+#
37+# This program is distributed in the hope that it will be useful,
38+# but WITHOUT ANY WARRANTY; without even the implied warranty of
39+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40+# GNU Lesser General Public License for more details.
41+#
42+# You should have received a copy of the GNU Lesser General Public License
43+# along with this program. If not, see <http://www.gnu.org/licenses/>.
44+
45+APP_PATH = '/usr/bin/system-settings'
46+DESKTOP_FILE = '/usr/share/applications/ubuntu-system-settings.desktop'
47+
48+from autopilot import platform
49+
50+from ubuntuuitoolkit import emulators as toolkit_emulators
51+
52+
53+def launch_system_settings(testobj, panel=None):
54+ """Launch system settings application
55+
56+ :param testobj: An AutopilotTestCase object, needed to call
57+ testobj.launch_test_application()
58+
59+ :param panel: Launch to a specific panel. Default None.
60+
61+ :param emulator_base: emulator_base for launch_test_application.
62+
63+ :returns: A proxy object that represents the application. Introspection
64+ data is retrievable via this object.
65+ """
66+ params = [APP_PATH]
67+ if platform.model() != 'Desktop':
68+ params.append('--desktop_file_hint={}'.format(DESKTOP_FILE))
69+
70+ # Launch to a specific panel
71+ if panel is not None:
72+ params.append(panel)
73+
74+ # Default emulator base
75+ emulator = toolkit_emulators.UbuntuUIToolkitEmulatorBase
76+
77+ app = testobj.launch_test_application(
78+ *params,
79+ app_type='qt',
80+ emulator_base=emulator)
81+
82+ return app
83
84=== modified file 'tests/autopilot/ubuntu_system_settings/tests/__init__.py'
85--- tests/autopilot/ubuntu_system_settings/tests/__init__.py 2014-03-27 13:16:09 +0000
86+++ tests/autopilot/ubuntu_system_settings/tests/__init__.py 2014-04-01 16:56:38 +0000
87@@ -9,7 +9,7 @@
88
89 from __future__ import absolute_import
90
91-from ubuntu_system_settings.utils.i18n import ugettext as _
92+from ubuntu_system_settings import helpers
93
94 from autopilot.input import Mouse, Touch, Pointer
95 from autopilot.platform import model
96@@ -34,24 +34,9 @@
97
98 def setUp(self, panel=None):
99 super(UbuntuSystemSettingsTestCase, self).setUp()
100- self.launch_system_settings(panel=panel)
101+ self.app = helpers.launch_system_settings(self, panel=panel)
102 self.assertThat(self.main_view.visible, Eventually(Equals(True)))
103
104- def launch_system_settings(self, panel=None):
105- params = ['/usr/bin/system-settings']
106- if (model() != 'Desktop'):
107- params.append('--desktop_file_hint=/usr/share/applications/'
108- 'ubuntu-system-settings.desktop')
109-
110- # Launch to a specific panel
111- if panel is not None:
112- params.append(panel)
113-
114- self.app = self.launch_test_application(
115- *params,
116- app_type='qt',
117- emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
118-
119 @property
120 def main_view(self):
121 """ Return main view """
122@@ -107,7 +92,7 @@
123 def setUp(self):
124 super(UbuntuSystemSettingsBatteryTestCase, self).setUp()
125 self.add_mock_battery()
126- self.launch_system_settings()
127+ self.app = helpers.launch_system_settings(self)
128 self.assertThat(self.main_view.visible, Eventually(Equals(True)))
129
130
131@@ -177,6 +162,7 @@
132 def setUp(self):
133 """ Go to About page """
134 super(AboutBaseTestCase, self).setUp('about')
135+ self.assertThat(self.about_page.active, Eventually(Equals(True)))
136
137 @property
138 def about_page(self):
139@@ -191,10 +177,13 @@
140 """ Go to Storage Page """
141 super(StorageBaseTestCase, self).setUp()
142 # Click on 'Storage' option
143- button = self.about_page.select_single(objectName='storageItem')
144- self.assertThat(button, NotEquals(None))
145+ button = self.about_page.select_single(
146+ 'Standard', objectName='storageItem'
147+ )
148 self.scroll_to_and_click(button)
149
150+ self.assertThat(self.storage_page.active, Eventually(Equals(True)))
151+
152 def assert_space_item(self, object_name, text):
153 """ Checks whether an space item exists and returns a value """
154 item = self.storage_page.select_single(objectName=object_name)
155@@ -207,10 +196,17 @@
156 values = size_label.text.split(' ') # Format: "00.0 (bytes|MB|GB)"
157 self.assertThat(len(values), GreaterThan(1))
158
159+ def get_storage_space_used_by_category(self, objectName):
160+ return self.main_view.wait_select_single(
161+ 'StorageItem', objectName=objectName
162+ ).value
163+
164 @property
165 def storage_page(self):
166 """ Return 'Storage' page """
167- return self.main_view.select_single(objectName='storagePage')
168+ return self.main_view.select_single(
169+ 'Storage', objectName='storagePage'
170+ )
171
172
173 class LicenseBaseTestCase(AboutBaseTestCase):
174@@ -220,15 +216,17 @@
175 """ Go to License Page """
176 super(LicenseBaseTestCase, self).setUp()
177 # Click on 'Software licenses' option
178- button = self.main_view.select_single(objectName='licenseItem')
179- self.assertThat(button, NotEquals(None))
180- self.assertThat(button.text, Equals(_('Software licenses')))
181+ button = self.main_view.select_single(
182+ 'Standard', objectName='licenseItem'
183+ )
184 self.scroll_to_and_click(button)
185
186 @property
187 def licenses_page(self):
188 """ Return 'License' page """
189- return self.main_view.select_single(objectName='licensesPage')
190+ return self.main_view.wait_select_single(
191+ 'ItemPage', objectName='licensesPage'
192+ )
193
194
195 class SystemUpdatesBaseTestCase(UbuntuSystemSettingsTestCase):
196
197=== modified file 'tests/autopilot/ubuntu_system_settings/tests/test_about.py'
198--- tests/autopilot/ubuntu_system_settings/tests/test_about.py 2014-03-10 11:24:08 +0000
199+++ tests/autopilot/ubuntu_system_settings/tests/test_about.py 2014-04-01 16:56:38 +0000
200@@ -5,11 +5,13 @@
201 # under the terms of the GNU General Public License version 3, as published
202 # by the Free Software Foundation.
203
204-from time import sleep
205+import os
206+import subprocess
207
208+from autopilot.matchers import Eventually
209 from autopilot.platform import model
210-from testtools.matchers import Equals, NotEquals, GreaterThan
211-from unittest import expectedFailure
212+from testtools import skipUnless, skipIf
213+from testtools.matchers import Equals, NotEquals
214
215 from ubuntu_system_settings.tests import (
216 AboutBaseTestCase,
217@@ -18,97 +20,122 @@
218 )
219 from ubuntu_system_settings.utils.i18n import ugettext as _
220
221+import dbus
222+
223
224 class AboutTestCase(AboutBaseTestCase):
225 """ Tests for About this phone Page """
226
227- def test_about_page(self):
228- """ Checks whether About page is available """
229- self.assertThat(self.about_page, NotEquals(None))
230- self.assertThat(self.about_page.title, Equals(_('About this phone')))
231-
232- def test_device(self):
233- """ Checks whether Device info is shown """
234- device_label = self.about_page.select_single(objectName='deviceLabel')
235- self.assertThat(device_label, NotEquals(None))
236- self.assertThat(device_label.text, NotEquals(''))
237+ def _get_imei_from_dbus(self):
238+ bus = dbus.SystemBus()
239+ manager = dbus.Interface(
240+ bus.get_object('org.ofono', '/'), 'org.ofono.Manager'
241+ )
242+ modems = manager.GetModems()
243+
244+ for path, properties in modems:
245+ return properties['Serial']
246+
247+ def _get_os_name(self):
248+ os_id = subprocess.check_output(['lsb_release', '-is'])
249+ os_release = subprocess.check_output(['lsb_release', '-rs'])
250+
251+ return '{} {}'.format(os_id.strip(), os_release.strip())
252+
253+ def _get_device_serial_number(self):
254+ return subprocess.check_output(['getprop', 'ro.serialno']).strip()
255+
256+ def _get_device_manufacturer_and_model(self):
257+ manufacturer = subprocess.check_output(
258+ ['getprop', 'ro.product.manufacturer']
259+ ).strip()
260+ model = subprocess.check_output(
261+ ['getprop', 'ro.product.model']
262+ ).strip()
263+
264+ return '{} {}'.format(manufacturer, model)
265+
266+ def _get_system_image_iface(self):
267+ bus = dbus.SystemBus()
268+ service = bus.get_object('com.canonical.SystemImage', '/Service')
269+ iface = dbus.Interface(service, 'com.canonical.SystemImage')
270+ return iface.Info()
271+
272+ def _get_last_updated_date(self):
273+ info = self._get_system_image_iface()[3]
274+
275+ if info == 'Unknown':
276+ return _('Never')
277+ else:
278+ return str(info.split()[0])
279
280 def test_serial(self):
281- """ Checks whether Serial info is available """
282+ """Checks whether the UI is showing the correct serial number."""
283 item = self.about_page.select_single(objectName='serialItem')
284- self.assertThat(item, NotEquals(None))
285- self.assertThat(item.text, Equals(_('Serial')))
286- if (model() == 'Desktop'):
287- self.assertThat(item.value, Equals(_('N/A')))
288- else:
289- self.assertThat(item.value, NotEquals(_('N/A')))
290-
291- def test_imei(self):
292- """ Checks whether IMEI info is available """
293- item = self.about_page.select_single(objectName='imeiItem')
294- self.assertThat(item, NotEquals(None))
295- self.assertThat(item.text, Equals(_('IMEI')))
296- if (model() == 'Desktop'):
297- self.assertThat(item.value, Equals(_('N/A')))
298- else:
299- self.assertThat(item.value, NotEquals(_('N/A')))
300-
301- def test_software(self):
302- """ Checks whether Software info is available """
303- item = self.about_page.select_single(objectName='softwareItem')
304- self.assertThat(item, NotEquals(None))
305- self.assertThat(item.text, Equals(_('Software:')))
306-
307- def test_os(self):
308- """ Checks whether OS info is available """
309+
310+ if model() == 'Desktop':
311+ self.assertThat(item.value, Equals(_('N/A')))
312+ else:
313+ self.assertThat(
314+ item.value, Equals(self._get_device_serial_number())
315+ )
316+
317+ @skipUnless(
318+ model() == 'Nexus 4',
319+ 'Nexus 4 is currently the only telephony device that we support'
320+ )
321+ def test_imei_information_is_correct(self):
322+ """Checks whether the UI is exposing the right IMEI."""
323+ imei = self.about_page.wait_select_single(
324+ objectName='imeiItem').value
325+
326+ self.assertEquals(imei, self._get_imei_from_dbus())
327+
328+ def test_settings_show_correct_version_of_the_os(self):
329+ """Ensure the UI is showing the correct version of the OS."""
330 item = self.about_page.select_single(objectName='osItem')
331- self.assertThat(item, NotEquals(None))
332- self.assertThat(item.text, Equals(_('OS')))
333- info = item.value.split()
334- self.assertThat(len(info), GreaterThan(1))
335- self.assertThat(info[0], Equals(_('Ubuntu')))
336- self.assertThat(info[1], NotEquals(''))
337- if (len(info) > 2):
338- self.assertThat(info[2], NotEquals(''))
339-
340+ # TODO: find a way to check the image build number as well
341+ # -- om26er 10-03-2014
342+ self.assertTrue(self._get_os_name() in item.value)
343+
344+ @skipIf(
345+ model() == 'Desktop',
346+ 'Only run on android devices where getprop is available')
347+ def test_hardware_name(self):
348+ """Ensure the UI is showing the correct device name."""
349+ device_label = self.about_page.select_single(
350+ objectName='deviceLabel'
351+ ).text
352+ device_name_from_getprop = self._get_device_manufacturer_and_model()
353+
354+ self.assertEquals(device_label, device_name_from_getprop)
355+
356+ @skipIf(
357+ model() == 'Desktop',
358+ 'Image based upgrades are only available on touch devices, for now.'
359+ )
360 def test_last_updated(self):
361- """ Checks whether Last Updated info is available """
362- item = self.about_page.select_single(objectName='lastUpdatedItem')
363- self.assertThat(item, NotEquals(None))
364- self.assertThat(item.text, Equals(_('Last updated')))
365- date = item.value.split('-')
366- if (len(date) == 1):
367- self.assertThat(item.value, Equals(_('Never')))
368- else:
369- # 2013-10-19
370- self.assertThat(len(item.value), Equals(10))
371-
372- def test_legal(self):
373- """ Checks whether Legal info is available """
374- item = self.about_page.select_single(objectName='legalItem')
375- self.assertThat(item, NotEquals(None))
376- self.assertThat(item.text, Equals(_('Legal:')))
377-
378- def test_update(self):
379- """ Checks whether Update button is available """
380- button = self.about_page.select_single(objectName='updateButton')
381- self.assertThat(button, NotEquals(None))
382- self.assertThat(button.text, Equals(_('Check for updates')))
383+ """Checks whether Last Updated info is correct."""
384+ last_updated = self.about_page.select_single(
385+ objectName='lastUpdatedItem'
386+ ).value
387+
388+ self.assertEquals(last_updated, self._get_last_updated_date())
389
390
391 class StorageTestCase(StorageBaseTestCase):
392 """ Tests for Storage """
393
394- def test_storage_page(self):
395- """ Check whether Storage page is available """
396- self.assertThat(self.storage_page, NotEquals(None))
397+ def _get_space_by_directory(self, dir_name):
398+ location = os.path.expanduser('~/' + dir_name)
399+ output = subprocess.check_output(['du', '--block-size=1', location])
400+ disk_space = output.split()[len(output.split()) - 2]
401+ return disk_space
402
403 def test_disk(self):
404 """ Checks whether disk item is available """
405- sleep(5)
406- disk_item = self.storage_page.select_single(objectName='diskItem')
407- self.assertThat(disk_item, NotEquals(None))
408- self.assertThat(disk_item.text, Equals(_('Total storage')))
409+ disk_item = self.storage_page.wait_select_single(objectName='diskItem')
410+ self.assertThat(disk_item.text, Equals('Total storage'))
411
412 def test_space(self):
413 """ Checks whether storage item is available """
414@@ -118,17 +145,35 @@
415 """ Checks storage item """
416 self.assert_space_item('usedByUbuntuItem', _('Used by Ubuntu'))
417
418- def test_space_movies(self):
419- """ Checks whether space item is available """
420- self.assert_space_item('moviesItem', _('Videos'))
421-
422- def test_space_audio(self):
423- """ Checks whether space item is available """
424- self.assert_space_item('audioItem', _('Audio'))
425-
426- def test_space_pictures(self):
427- """ Checks whether space item is available """
428- self.assert_space_item('picturesItem', _('Pictures'))
429+ def test_space_used_by_movies(self):
430+ """ Checks whether space shown to be used by movies is
431+ correct. """
432+ movie_space = self._get_space_by_directory(_('Videos'))
433+ movie_space_in_ui = self.get_storage_space_used_by_category(
434+ 'moviesItem'
435+ )
436+
437+ self.assertEquals(movie_space_in_ui, movie_space)
438+
439+ def test_space_used_by_music(self):
440+ """ Checks whether space shown to be used by music is
441+ correct. """
442+ music_space = self._get_space_by_directory(_('Music'))
443+ music_space_in_ui = self.get_storage_space_used_by_category(
444+ 'audioItem'
445+ )
446+
447+ self.assertEquals(music_space_in_ui, music_space)
448+
449+ def test_space_used_by_pictures(self):
450+ """ Checks whether space shown to be used by pictures is
451+ correct. """
452+ pictures_space = self._get_space_by_directory(_('Pictures'))
453+ pictures_space_in_ui = self.get_storage_space_used_by_category(
454+ 'picturesItem'
455+ )
456+
457+ self.assertEquals(pictures_space_in_ui, pictures_space)
458
459 def test_space_other_files(self):
460 """ Checks whether space item is available """
461@@ -149,7 +194,6 @@
462 class LicenseTestCase(LicenseBaseTestCase):
463 """ Tests for Licenses """
464
465- @expectedFailure
466 def test_licenses_page(self):
467 """ Check whether Storage page is available """
468- self.assertThat(self.licenses_page, NotEquals(None))
469+ self.assertThat(self.licenses_page.active, Eventually(Equals(True)))
470
471=== modified file 'tests/autopilot/ubuntu_system_settings/tests/test_search.py'
472--- tests/autopilot/ubuntu_system_settings/tests/test_search.py 2014-03-10 11:24:08 +0000
473+++ tests/autopilot/ubuntu_system_settings/tests/test_search.py 2014-04-01 16:56:38 +0000
474@@ -6,7 +6,8 @@
475 # by the Free Software Foundation.
476
477 from autopilot.introspection.dbus import StateNotFoundError
478-from testtools.matchers import Equals, NotEquals
479+from testtools.matchers import Equals
480+from autopilot.matchers import Eventually
481
482 from ubuntu_system_settings.tests import UbuntuSystemSettingsTestCase
483 from ubuntu_system_settings.utils.i18n import ugettext as _
484@@ -21,22 +22,25 @@
485 def setUp(self):
486 super(SearchTestCases, self).setUp()
487
488- def test_search(self):
489+ def _get_entry_component(self, name):
490+ return self.main_view.wait_select_single(
491+ objectName='entryComponent-' + name
492+ )
493+
494+ def _type_into_search_box(self, text):
495+ search_box = self.main_view.select_single(
496+ objectName='searchTextField'
497+ )
498+ self.scroll_to_and_click(search_box)
499+ self.keyboard.type(_(text))
500+ self.assertThat(search_box.text, Eventually(Equals(text)))
501+
502+ def test_search_filter_results(self):
503 """ Checks whether Search box actually filters the results """
504- # Select search text field
505- search = self.main_view.select_single(objectName='searchTextField')
506- self.assertThat(search, NotEquals(None))
507- # Move to text field
508- self.scroll_to_and_click(search)
509- # Filter by string
510- self.keyboard.type(_('Sound'))
511- # Search component
512- sound = self.main_view.select_single(objectName='entryComponent-sound')
513- self.assertThat(sound, NotEquals(None))
514- try:
515- background = self.main_view.select_single(
516- objectName='entryComponent-background'
517- )
518- except StateNotFoundError:
519- background = None
520- self.assertThat(background, Equals(None))
521+ self._type_into_search_box('Sound')
522+ sound_icon = self._get_entry_component('sound')
523+
524+ self.assertThat(sound_icon.visible, Eventually(Equals(True)))
525+ self.assertRaises(
526+ StateNotFoundError, self._get_entry_component, 'background'
527+ )

Subscribers

People subscribed via source and target branches