Merge lp:~indicator-applet-developers/unity8/indicator-power-autopilot-test into lp:unity8
- indicator-power-autopilot-test
- Merge into trunk
Status: | Work in progress |
---|---|
Proposed branch: | lp:~indicator-applet-developers/unity8/indicator-power-autopilot-test |
Merge into: | lp:unity8 |
Diff against target: |
302 lines (+196/-9) 5 files modified
debian/control (+2/-0) tests/autopilot/unity8/indicators/__init__.py (+20/-0) tests/autopilot/unity8/indicators/tests/__init__.py (+20/-5) tests/autopilot/unity8/indicators/tests/test_indicator_power.py (+145/-0) tests/autopilot/unity8/indicators/tests/test_indicators.py (+9/-4) |
To merge this branch: | bzr merge lp:~indicator-applet-developers/unity8/indicator-power-autopilot-test |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Albert Astals Cid (community) | Needs Fixing | ||
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Leo Arias (community) | Approve | ||
Thomi Richards (community) | Approve | ||
Christopher Lee (community) | Needs Fixing | ||
Review via email: mp+247079@code.launchpad.net |
Commit message
Add discharging battery autopilot test.
Description of the change
This test simulates a discharging battery using a fake upower via python-dbusmock.
Offering for commentary with the UEQA team, charles wanting to absorb best practices for writing these autopilot tests.
Note that this requires a couple of related branches:
For a upower template tweak to enable signalling,
https:/
For an indicator-power which will listen on a special private bus for the fake upower:
https:/
NOTE that we're chasing an intermittent failure, may need some pitti advice about, hence WIP.
Charles Kerr (charlesk) : | # |
Thomi Richards (thomir-deactivatedaccount) : | # |
Leo Arias (elopio) wrote : | # |
I added some more comments.
Charles Kerr (charlesk) wrote : | # |
I've nibbled around the edges of these NFs and have fixed most of the little pieces, but it's past my bedtime so Allan or I will need to finish the revisions tomorrow.
Remaining TODO:
* device_
* FakeUPower as a Fixture
* moving the Indicator helper class to tests/autopilot
* GRID_UNIT_PX: is it needed? if so, why?
Allan LeSage (allanlesage) wrote : | # |
Filed lp:1413390 for the GRID_UNIT_PX issue, will tag in source, also here's a relevant IRC snippet with elopio: http://
Allan LeSage (allanlesage) wrote : | # |
Corrected _get_device_
I see elopio's and veebers' questions about using a CPO for Indicator object--this isn't strictly CPO-able as it represents not the appearance of the Indicator but its D-Bus state. Please bring questions on this, resolved?
Leo Arias (elopio) wrote : | # |
Some comments inline.
And one item for discussion:
<elopio> veebers: thomi: alesage: why are we putting the custom proxy object in a module named helpers, intead of putting them in the module named indicators?
<veebers> alesage, elopio: sounds good to me. I would imagine the apps have a similar layout for precedent?
<elopio> veebers: it's a mess with apps. But that's what I am aiming for. We will have the browser CPO in webbrowser.
<elopio> instead of webbrowser.
<veebers> ack, for the CPO no need to have it in helpers
<alesage> sounds decided, I'll make that change veebers, elopio
Thank you! I specially like the idea of starting the service with a different dbus address.
Leo Arias (elopio) : | # |
Allan LeSage (allanlesage) wrote : | # |
Question in comments. . . .
Thomi Richards (thomir-deactivatedaccount) wrote : | # |
Much better, but a few issues still.
Leo Arias (elopio) wrote : | # |
I replied to some replies. Will look again at the new version.
Leo Arias (elopio) : | # |
Thomi Richards (thomir-deactivatedaccount) wrote : | # |
LGTM
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1568
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Albert Astals Cid (aacid) wrote : | # |
Charles, Allan, you good with this?
- 1569. By Allan LeSage
-
Add python3-dbusmock dependency.
Leo Arias (elopio) wrote : | # |
Please remove the unused
56 + def icon_matches(self, icon_name):
These must be reverted to work with python2. We are currently installing unity8-autopilot also on the py2 path:
78 + super().setUp()
149 + super().setUp()
199 + super().setUp()
- 1570. By Allan LeSage
-
Move PowerIndicator, flake8 correction, restore py2 supers, broken test fix.
- 1571. By Allan LeSage
-
Remove icon_matches.
Leo Arias (elopio) wrote : | # |
Looks good. Thanks for the changes.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1570
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1571
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1572. By Allan LeSage
-
Correct python-dbusmock build-deps.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1572
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1573. By Allan LeSage
-
Relocate python*-dbusmock dependencies.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1573
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1573
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Albert Astals Cid (aacid) wrote : | # |
Text conflict in tests/autopilot
Text conflict in tests/autopilot
Text conflict in tests/autopilot
3 conflicts encountered.
- 1574. By Allan LeSage
-
Merge trunk, resolving conflicts.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1574
http://
Executed test runs:
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1574
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1574
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Albert Astals Cid (aacid) wrote : | # |
Hi guys, can you please add the "MP Submission Checklist Template" from https:/
Allan LeSage (allanlesage) wrote : | # |
This might sit for a bit, need to investigate a persistent Jenkins failure, will ping you Albert.
Albert Astals Cid (aacid) wrote : | # |
I'll put it as Work In Progress to remove it from my dashboard of things to review.
Unmerged revisions
- 1574. By Allan LeSage
-
Merge trunk, resolving conflicts.
- 1573. By Allan LeSage
-
Relocate python*-dbusmock dependencies.
- 1572. By Allan LeSage
-
Correct python-dbusmock build-deps.
- 1571. By Allan LeSage
-
Remove icon_matches.
- 1570. By Allan LeSage
-
Move PowerIndicator, flake8 correction, restore py2 supers, broken test fix.
- 1569. By Allan LeSage
-
Add python3-dbusmock dependency.
- 1568. By Charles Kerr
-
in __init__, make multiline import follow pep 328
- 1567. By Charles Kerr
-
in IndicatorPowerT
estCase. setUp() , remove the self.main_ window. wait_select_ single( ), since it's also encapsulated in the Indicator helper class - 1566. By Charles Kerr
-
in IndicatorPowerT
estCase. setUp() , don't create a temporary list for service_test_args. - 1565. By Charles Kerr
-
in MockUPower.setUp(), clean up the OSError exception's message
Preview Diff
1 | === modified file 'debian/control' | |||
2 | --- debian/control 2015-01-22 10:09:11 +0000 | |||
3 | +++ debian/control 2015-01-27 16:20:28 +0000 | |||
4 | @@ -144,10 +144,12 @@ | |||
5 | 144 | libqt5widgets5, | 144 | libqt5widgets5, |
6 | 145 | python-autopilot, | 145 | python-autopilot, |
7 | 146 | python-evdev, | 146 | python-evdev, |
8 | 147 | python-dbusmock, | ||
9 | 147 | python-fixtures, | 148 | python-fixtures, |
10 | 148 | python-gi, | 149 | python-gi, |
11 | 149 | python-mock, | 150 | python-mock, |
12 | 150 | python3-autopilot, | 151 | python3-autopilot, |
13 | 152 | python3-dbusmock, | ||
14 | 151 | python3-evdev, | 153 | python3-evdev, |
15 | 152 | python3-fixtures, | 154 | python3-fixtures, |
16 | 153 | python3-gi, | 155 | python3-gi, |
17 | 154 | 156 | ||
18 | === modified file 'tests/autopilot/unity8/indicators/__init__.py' | |||
19 | --- tests/autopilot/unity8/indicators/__init__.py 2015-01-21 04:15:31 +0000 | |||
20 | +++ tests/autopilot/unity8/indicators/__init__.py 2015-01-27 16:20:28 +0000 | |||
21 | @@ -12,6 +12,7 @@ | |||
22 | 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
23 | 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
24 | 14 | # GNU General Public License for more details. | 14 | # GNU General Public License for more details. |
25 | 15 | # | ||
26 | 15 | # You should have received a copy of the GNU General Public License | 16 | # You should have received a copy of the GNU General Public License |
27 | 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
28 | 17 | 18 | ||
29 | @@ -21,6 +22,25 @@ | |||
30 | 21 | from unity8.shell import emulators | 22 | from unity8.shell import emulators |
31 | 22 | 23 | ||
32 | 23 | 24 | ||
33 | 25 | class PowerIndicator(object): | ||
34 | 26 | |||
35 | 27 | def __init__(self, main_window): | ||
36 | 28 | self.main_window = main_window | ||
37 | 29 | |||
38 | 30 | def get_icon_name(self): | ||
39 | 31 | """Returns the icon name. | ||
40 | 32 | |||
41 | 33 | Can be a list of options, eg | ||
42 | 34 | 'image://theme/battery-040,battery-good-symbolic,battery-good' | ||
43 | 35 | |||
44 | 36 | """ | ||
45 | 37 | widget = self.main_window.wait_select_single( | ||
46 | 38 | objectName='indicator-power-widget' | ||
47 | 39 | ) | ||
48 | 40 | # convert it from a dbus.string to a normal string | ||
49 | 41 | return str(widget.icons[0]) | ||
50 | 42 | |||
51 | 43 | |||
52 | 24 | class IndicatorPage(emulators.UnityEmulatorBase): | 44 | class IndicatorPage(emulators.UnityEmulatorBase): |
53 | 25 | 45 | ||
54 | 26 | """Autopilot helper for the IndicatorPage component.""" | 46 | """Autopilot helper for the IndicatorPage component.""" |
55 | 27 | 47 | ||
56 | === modified file 'tests/autopilot/unity8/indicators/tests/__init__.py' | |||
57 | --- tests/autopilot/unity8/indicators/tests/__init__.py 2015-01-20 17:56:49 +0000 | |||
58 | +++ tests/autopilot/unity8/indicators/tests/__init__.py 2015-01-27 16:20:28 +0000 | |||
59 | @@ -16,19 +16,34 @@ | |||
60 | 16 | # You should have received a copy of the GNU General Public License | 16 | # You should have received a copy of the GNU General Public License |
61 | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
62 | 18 | 18 | ||
63 | 19 | from autopilot import platform | ||
64 | 20 | |||
65 | 21 | from unity8 import process_helpers | 19 | from unity8 import process_helpers |
66 | 22 | from unity8.shell import tests | 20 | from unity8.shell import tests |
67 | 23 | 21 | ||
68 | 24 | 22 | ||
69 | 25 | class IndicatorTestCase(tests.UnityTestCase): | 23 | class IndicatorTestCase(tests.UnityTestCase): |
70 | 26 | 24 | ||
72 | 27 | device_emulation_scenarios = tests._get_device_emulation_scenarios() | 25 | scenarios = tests._get_device_emulation_scenarios() |
73 | 28 | 26 | ||
74 | 29 | def setUp(self): | 27 | def setUp(self): |
75 | 30 | if platform.model() == 'Desktop': | ||
76 | 31 | self.skipTest('Test cannot be run on the desktop.') | ||
77 | 32 | super(IndicatorTestCase, self).setUp() | 28 | super(IndicatorTestCase, self).setUp() |
78 | 29 | self._dirty_services = set() | ||
79 | 33 | self.unity_proxy = self.launch_unity() | 30 | self.unity_proxy = self.launch_unity() |
80 | 34 | process_helpers.unlock_unity(self.unity_proxy) | 31 | process_helpers.unlock_unity(self.unity_proxy) |
81 | 32 | |||
82 | 33 | def start_test_service(self, service_name, *args): | ||
83 | 34 | """Restart a service (e.g. 'indicator-power-service') with test args. | ||
84 | 35 | |||
85 | 36 | Adds a no-arguments restart to addCleanup() so that the system | ||
86 | 37 | can reset to a nontest version of the service when the tests finish. | ||
87 | 38 | """ | ||
88 | 39 | self._start_service(service_name, *args) | ||
89 | 40 | if service_name not in self._dirty_services: | ||
90 | 41 | self._dirty_services.add(service_name) | ||
91 | 42 | self.addCleanup(self._start_service, service_name) | ||
92 | 43 | |||
93 | 44 | @staticmethod | ||
94 | 45 | def _start_service(service_name, *args): | ||
95 | 46 | """Restart an upstart service; e.g. indicator-power-service""" | ||
96 | 47 | if process_helpers.is_job_running(service_name): | ||
97 | 48 | process_helpers.stop_job(service_name) | ||
98 | 49 | process_helpers.start_job(service_name, *args) | ||
99 | 35 | 50 | ||
100 | === added file 'tests/autopilot/unity8/indicators/tests/test_indicator_power.py' | |||
101 | --- tests/autopilot/unity8/indicators/tests/test_indicator_power.py 1970-01-01 00:00:00 +0000 | |||
102 | +++ tests/autopilot/unity8/indicators/tests/test_indicator_power.py 2015-01-27 16:20:28 +0000 | |||
103 | @@ -0,0 +1,145 @@ | |||
104 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | ||
105 | 2 | # | ||
106 | 3 | # Unity - Indicators Autopilot Test Suite | ||
107 | 4 | # Copyright (C) 2015 Canonical | ||
108 | 5 | # | ||
109 | 6 | # This program is free software: you can redistribute it and/or modify | ||
110 | 7 | # it under the terms of the GNU General Public License as published by | ||
111 | 8 | # the Free Software Foundation, either version 3 of the License, or | ||
112 | 9 | # (at your option) any later version. | ||
113 | 10 | # | ||
114 | 11 | # This program is distributed in the hope that it will be useful, | ||
115 | 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
116 | 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
117 | 14 | # GNU General Public License for more details. | ||
118 | 15 | # | ||
119 | 16 | # You should have received a copy of the GNU General Public License | ||
120 | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
121 | 18 | |||
122 | 19 | import os | ||
123 | 20 | import subprocess | ||
124 | 21 | |||
125 | 22 | from autopilot.matchers import Eventually | ||
126 | 23 | import dbusmock | ||
127 | 24 | from fixtures import Fixture | ||
128 | 25 | from testtools.matchers import Contains | ||
129 | 26 | |||
130 | 27 | from unity8.indicators import PowerIndicator | ||
131 | 28 | from unity8.indicators.tests import IndicatorTestCase | ||
132 | 29 | |||
133 | 30 | |||
134 | 31 | class MockBattery(object): | ||
135 | 32 | |||
136 | 33 | def __init__(self, proxy, object_path): | ||
137 | 34 | self.proxy = proxy | ||
138 | 35 | self.object_path = object_path | ||
139 | 36 | |||
140 | 37 | def set_properties(self, properties): | ||
141 | 38 | self.proxy.SetDeviceProperties(self.object_path, properties) | ||
142 | 39 | |||
143 | 40 | |||
144 | 41 | class MockUPower(Fixture): | ||
145 | 42 | |||
146 | 43 | def setUp(self): | ||
147 | 44 | |||
148 | 45 | super(MockUPower, self).setUp() | ||
149 | 46 | |||
150 | 47 | self._battery_count = 0 | ||
151 | 48 | |||
152 | 49 | key = 'DBUS_SYSTEM_BUS_ADDRESS' | ||
153 | 50 | if key in os.environ: | ||
154 | 51 | raise OSError("environment variable {} already set".format(key)) | ||
155 | 52 | |||
156 | 53 | # start a dbusmock system bus and get its address, which looks like | ||
157 | 54 | # "unix:abstract=/tmp/dbus-LQo4Do4ldY,guid=3f7f39089f00884fa96533f354935995" | ||
158 | 55 | dbusmock.DBusTestCase.start_system_bus() | ||
159 | 56 | self.bus_address = os.environ[key].split(',')[0] | ||
160 | 57 | |||
161 | 58 | # start a mock upower service | ||
162 | 59 | self.proxy = dbusmock.DBusTestCase.spawn_server_template( | ||
163 | 60 | 'upower', | ||
164 | 61 | {'OnBattery': True, 'HibernateAllowed': False}, | ||
165 | 62 | stdout=subprocess.PIPE | ||
166 | 63 | )[1] | ||
167 | 64 | |||
168 | 65 | self.addCleanup(self._cleanUp) | ||
169 | 66 | |||
170 | 67 | def _cleanUp(self): | ||
171 | 68 | self.proxy = None | ||
172 | 69 | self.bus_address = None | ||
173 | 70 | dbusmock.DBusTestCase.tearDownClass() | ||
174 | 71 | |||
175 | 72 | def add_discharging_battery( | ||
176 | 73 | self, | ||
177 | 74 | model_name='Mock Battery', | ||
178 | 75 | percentage=30.0, | ||
179 | 76 | seconds_until_empty=1200): | ||
180 | 77 | |||
181 | 78 | # uniqueness required; this becomes part of the device's object_path | ||
182 | 79 | device_name = 'mock_BAT{}'.format(self._battery_count) | ||
183 | 80 | self._battery_count += 1 | ||
184 | 81 | |||
185 | 82 | object_path = self.proxy.AddDischargingBattery( | ||
186 | 83 | device_name, | ||
187 | 84 | model_name, | ||
188 | 85 | percentage, | ||
189 | 86 | seconds_until_empty | ||
190 | 87 | ) | ||
191 | 88 | |||
192 | 89 | return MockBattery(self.proxy, object_path) | ||
193 | 90 | |||
194 | 91 | |||
195 | 92 | class IndicatorPowerTestCase(IndicatorTestCase): | ||
196 | 93 | |||
197 | 94 | def setUp(self): | ||
198 | 95 | super(IndicatorPowerTestCase, self).setUp() | ||
199 | 96 | |||
200 | 97 | # start a mock UPower service | ||
201 | 98 | self.upower = self.useFixture(MockUPower()) | ||
202 | 99 | |||
203 | 100 | # restart indicator-power with the mock env variables | ||
204 | 101 | self.start_test_service( | ||
205 | 102 | 'indicator-power', | ||
206 | 103 | 'INDICATOR_POWER_BUS_ADDRESS_UPOWER={}'.format( | ||
207 | 104 | self.upower.bus_address | ||
208 | 105 | ) | ||
209 | 106 | ) | ||
210 | 107 | |||
211 | 108 | def test_discharging_battery(self): | ||
212 | 109 | """Test the icon as the battery drains.""" | ||
213 | 110 | |||
214 | 111 | # tuples of battery states + expected outcomes for those states | ||
215 | 112 | steps = [ | ||
216 | 113 | ({'Percentage': 100.0}, {'icon_name': 'battery-100'}), | ||
217 | 114 | ({'Percentage': 95.0}, {'icon_name': 'battery-100'}), | ||
218 | 115 | ({'Percentage': 90.0}, {'icon_name': 'battery-100'}), | ||
219 | 116 | ({'Percentage': 85.0}, {'icon_name': 'battery-080'}), | ||
220 | 117 | ({'Percentage': 80.0}, {'icon_name': 'battery-080'}), | ||
221 | 118 | ({'Percentage': 75.0}, {'icon_name': 'battery-080'}), | ||
222 | 119 | ({'Percentage': 70.0}, {'icon_name': 'battery-080'}), | ||
223 | 120 | ({'Percentage': 65.0}, {'icon_name': 'battery-060'}), | ||
224 | 121 | ({'Percentage': 60.0}, {'icon_name': 'battery-060'}), | ||
225 | 122 | ({'Percentage': 55.0}, {'icon_name': 'battery-060'}), | ||
226 | 123 | ({'Percentage': 50.0}, {'icon_name': 'battery-060'}), | ||
227 | 124 | ({'Percentage': 45.0}, {'icon_name': 'battery-040'}), | ||
228 | 125 | ({'Percentage': 40.0}, {'icon_name': 'battery-040'}), | ||
229 | 126 | ({'Percentage': 35.0}, {'icon_name': 'battery-040'}), | ||
230 | 127 | ({'Percentage': 30.0}, {'icon_name': 'battery-040'}), | ||
231 | 128 | ({'Percentage': 25.0}, {'icon_name': 'battery-020'}), | ||
232 | 129 | ({'Percentage': 20.0}, {'icon_name': 'battery-020'}), | ||
233 | 130 | ({'Percentage': 15.0}, {'icon_name': 'battery-020'}), | ||
234 | 131 | ({'Percentage': 10.0}, {'icon_name': 'battery-020'}), | ||
235 | 132 | ({'Percentage': 5.0}, {'icon_name': 'battery-000'}), | ||
236 | 133 | ({'Percentage': 0.0}, {'icon_name': 'battery-000'}) | ||
237 | 134 | ] | ||
238 | 135 | |||
239 | 136 | battery = self.upower.add_discharging_battery() | ||
240 | 137 | |||
241 | 138 | indicator = PowerIndicator(self.main_window) | ||
242 | 139 | |||
243 | 140 | for properties, expected in steps: | ||
244 | 141 | battery.set_properties(properties) | ||
245 | 142 | self.assertTrue( | ||
246 | 143 | indicator.get_icon_name, | ||
247 | 144 | Eventually(Contains(expected['icon_name'])) | ||
248 | 145 | ) | ||
249 | 0 | 146 | ||
250 | === modified file 'tests/autopilot/unity8/indicators/tests/test_indicators.py' | |||
251 | --- tests/autopilot/unity8/indicators/tests/test_indicators.py 2015-01-20 17:56:49 +0000 | |||
252 | +++ tests/autopilot/unity8/indicators/tests/test_indicators.py 2015-01-27 16:20:28 +0000 | |||
253 | @@ -18,10 +18,9 @@ | |||
254 | 18 | 18 | ||
255 | 19 | from __future__ import absolute_import | 19 | from __future__ import absolute_import |
256 | 20 | 20 | ||
257 | 21 | from autopilot import platform | ||
258 | 21 | from testscenarios import multiply_scenarios | 22 | from testscenarios import multiply_scenarios |
259 | 22 | 23 | ||
260 | 23 | from autopilot import platform | ||
261 | 24 | |||
262 | 25 | from unity8.indicators import tests | 24 | from unity8.indicators import tests |
263 | 26 | 25 | ||
264 | 27 | 26 | ||
265 | @@ -38,7 +37,7 @@ | |||
266 | 38 | ] | 37 | ] |
267 | 39 | scenarios = multiply_scenarios( | 38 | scenarios = multiply_scenarios( |
268 | 40 | indicator_scenarios, | 39 | indicator_scenarios, |
270 | 41 | tests.IndicatorTestCase.device_emulation_scenarios | 40 | tests.IndicatorTestCase.scenarios |
271 | 42 | ) | 41 | ) |
272 | 43 | 42 | ||
273 | 44 | def setUp(self): | 43 | def setUp(self): |
274 | @@ -46,6 +45,9 @@ | |||
275 | 46 | if (platform.model() == 'Nexus 10' and | 45 | if (platform.model() == 'Nexus 10' and |
276 | 47 | self.indicator_name == 'indicator-bluetooth'): | 46 | self.indicator_name == 'indicator-bluetooth'): |
277 | 48 | self.skipTest('Nexus 10 does not have bluetooth at the moment.') | 47 | self.skipTest('Nexus 10 does not have bluetooth at the moment.') |
278 | 48 | if platform.model() == 'Desktop': | ||
279 | 49 | # names exported differently in unity7 | ||
280 | 50 | self.skipTest('Test cannot be run on the desktop.') | ||
281 | 49 | 51 | ||
282 | 50 | def test_indicator_exists(self): | 52 | def test_indicator_exists(self): |
283 | 51 | self.main_window._get_indicator_panel_item( | 53 | self.main_window._get_indicator_panel_item( |
284 | @@ -73,7 +75,7 @@ | |||
285 | 73 | ] | 75 | ] |
286 | 74 | scenarios = multiply_scenarios( | 76 | scenarios = multiply_scenarios( |
287 | 75 | indicator_scenarios, | 77 | indicator_scenarios, |
289 | 76 | tests.IndicatorTestCase.device_emulation_scenarios | 78 | tests.IndicatorTestCase.scenarios |
290 | 77 | ) | 79 | ) |
291 | 78 | 80 | ||
292 | 79 | def setUp(self): | 81 | def setUp(self): |
293 | @@ -81,6 +83,9 @@ | |||
294 | 81 | if (platform.model() == 'Nexus 10' and | 83 | if (platform.model() == 'Nexus 10' and |
295 | 82 | self.indicator_name == 'indicator-bluetooth'): | 84 | self.indicator_name == 'indicator-bluetooth'): |
296 | 83 | self.skipTest('Nexus 10 does not have bluetooth at the moment.') | 85 | self.skipTest('Nexus 10 does not have bluetooth at the moment.') |
297 | 86 | if platform.model() == 'Desktop': | ||
298 | 87 | # names exported differently in unity7 | ||
299 | 88 | self.skipTest('Test cannot be run on the desktop.') | ||
300 | 84 | 89 | ||
301 | 85 | def test_indicator_page_title_matches_widget(self): | 90 | def test_indicator_page_title_matches_widget(self): |
302 | 86 | """Swiping open an indicator must show its correct title. | 91 | """Swiping open an indicator must show its correct title. |
Looking good so far. Some questions and things that need fixing up.