@@ -9,7 +9,9 @@
10from autopilot.platform import model
10from autopilot.platform import model
11from autopilot.testcase import AutopilotTestCase
11from autopilot.testcase import AutopilotTestCase
12+from autopilot.matchers import Eventually
12import subprocess
13import subprocess
14+from testtools.matchers import Equals, NotEquals
13import logging
15import logging
14import os.path
16import os.path
15import sysconfig
17import sysconfig
@@ -29,6 +31,10 @@ class Unity8TestCase(AutopilotTestCase):
30 """A sane test case base class for the Unity8 shell tests."""
32 """A sane test case base class for the Unity8 shell tests."""
35+ super(Unity8TestCase, self).setUp()
32 def launch_unity(self):
38 def launch_unity(self):
33 """Launch the unity8 shell, return a proxy object for it."""
39 """Launch the unity8 shell, return a proxy object for it."""
34 shell_binary_path = self._get_shell_binary_path()
40 shell_binary_path = self._get_shell_binary_path()
@@ -38,8 +44,24 @@ class Unity8TestCase(AutopilotTestCase):
38 app_type='qt'
44 app_type='qt'
40 logger.debug("Started unity8 shell, backend is: %r", app_proxy._Backend)
46 logger.debug("Started unity8 shell, backend is: %r", app_proxy._Backend)
47+ self._set_proxy(app_proxy)
49+ # this line ensures that the dash is visible before we return.
50+ logger.info("Waiting for the dash to load...")
51+ self.assertThat(self.get_dash().showScopeOnLoaded, Eventually(Equals("")))
52+ logger.info("dash loaded!")
41 return app_proxy
53 return app_proxy
55+ def _set_proxy(self, proxy):
56+ """Keep a copy of the proxy object, so we can use it to get common parts
57+ of the shell later on.
61+ self.addCleanup(self._clear_proxy)
63+ def _clear_proxy(self):
44 def _get_shell_binary_path(self):
66 def _get_shell_binary_path(self):
45 """Return a path to the unity8 binary, either the locally built binary
67 """Return a path to the unity8 binary, either the locally built binary
@@ -62,6 +84,11 @@ class Unity8TestCase(AutopilotTestCase):
62 except subprocess.CalledProcessError as e:
84 except subprocess.CalledProcessError as e:
63 self.fail("Unable to locate unity8 binary: %r" % e)
85 self.fail("Unable to locate unity8 binary: %r" % e)
88+ dash = self._proxy.select_single("Dash")
89+ self.assertThat(dash, NotEquals(None))
66class ShellTestCase(AutopilotTestCase):
93class ShellTestCase(AutopilotTestCase):