on xenial help sign in
Finish the test_click_dash_icon_must_unfocus_application.
commit2f76b9844eadee6026fe6eb456ed968988f09f3d authorLeo Arias <leo.arias@canonical.com> dateThu 26 Jun 2014, 01:04 (12 years ago) parent4c4ef38
4 files changed+32−4
tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py+3−2 tests/autopilot/unity8/shell/emulators/launcher.py+11−2 tests/autopilot/unity8/shell/emulators/main_window.py+7 tests/autopilot/unity8/shell/tests/test_emulators.py+11
tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py+3−2
@@ -120,5 +120,6 @@ class ApplicationLifecycleTests(tests.ApplicationLifeCycleTestCase):
120120 application_name = self.launch_fake_app()
121121 self.assert_current_focused_application(application_name)
122122
123− launcher = self.main_window.open_launcher()
124− import pdb; pdb.set_trace()
123+ self.main_window.show_dash_from_launcher()
124+
125+ self.assert_current_focused_application('')
tests/autopilot/unity8/shell/emulators/launcher.py+11−2
@@ -21,13 +21,13 @@ import logging
2121
2222import autopilot.logging
2323
24−from unity8.shell.emulators import UnityEmulatorBase
24+from unity8.shell import emulators
2525
2626
2727logger = logging.getLogger(__name__)
2828
2929
30−class Launcher(UnityEmulatorBase):
30+class Launcher(emulators.UnityEmulatorBase):
3131
3232 """An emulator that understands the Launcher."""
3333
@@ -64,3 +64,12 @@ class Launcher(UnityEmulatorBase):
6464 self.shown.wait_for(False)
6565 else:
6666 logger.debug('The launcher is already closed.')
67+
68+ @autopilot.logging.log_action(logger.debug)
69+ def click_dash_icon(self):
70+ if self.shown:
71+ dash_icon = self.select_single(
72+ 'QQuickImage', objectName='dashItem')
73+ self.pointing_device.click_object(dash_icon)
74+ else:
75+ raise emulators.UnityEmulatorException('The launcher is closed.')
tests/autopilot/unity8/shell/emulators/main_window.py+7
@@ -137,6 +137,13 @@ class QQuickView(emulators.UnityEmulatorBase):
137137 def _get_search_indicator(self):
138138 return self.select_single('SearchIndicator', objectName='search')
139139
140+ @autopilot_logging.log_action(logger.info)
141+ def show_dash_from_launcher(self):
142+ """Open the dash clicking the dash icon on the launcher."""
143+ launcher = self.open_launcher()
144+ launcher.click_dash_icon()
145+ return self.get_dash()
146+
140147 @autopilot_logging.log_action(logger.info)
141148 def open_launcher(self):
142149 launcher = self._get_launcher()
tests/autopilot/unity8/shell/tests/test_emulators.py+11
@@ -244,3 +244,14 @@ class LauncherTestCase(tests.UnityTestCase):
244244 launcher.hide()
245245
246246 self.assertFalse(mock_drag.called)
247+
248+ def test_click_dash_icon_with_launcher_closed_must_raise_exception(self):
249+ launcher = self.main_window.open_launcher()
250+ launcher.hide()
251+
252+ exception = self.assertRaises(
253+ emulators.UnityEmulatorException,
254+ launcher.click_dash_icon)
255+
256+ self.assertEqual(
257+ 'The launcher is closed.', str(exception))