@@ -9,7 +9,9 @@
99
1010from autopilot.platform import model
1111from autopilot.testcase import AutopilotTestCase
12+from autopilot.matchers import Eventually
1213import subprocess
14+from testtools.matchers import Equals, NotEquals
1315import logging
1416import os.path
1517import sysconfig
@@ -29,6 +31,10 @@ class Unity8TestCase(AutopilotTestCase):
2931
3032 """A sane test case base class for the Unity8 shell tests."""
3133
34+ def setUp(self):
35+ super(Unity8TestCase, self).setUp()
36+ self._proxy = None
37+
3238 def launch_unity(self):
3339 """Launch the unity8 shell, return a proxy object for it."""
3440 shell_binary_path = self._get_shell_binary_path()
@@ -38,8 +44,24 @@ class Unity8TestCase(AutopilotTestCase):
3844 app_type='qt'
3945 )
4046 logger.debug("Started unity8 shell, backend is: %r", app_proxy._Backend)
47+ self._set_proxy(app_proxy)
48+
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!")
4153 return app_proxy
4254
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.
58+
59+ """
60+ self._proxy = proxy
61+ self.addCleanup(self._clear_proxy)
62+
63+ def _clear_proxy(self):
64+ self._proxy = None
4365
4466 def _get_shell_binary_path(self):
4567 """Return a path to the unity8 binary, either the locally built binary
@@ -62,6 +84,11 @@ class Unity8TestCase(AutopilotTestCase):
6284 except subprocess.CalledProcessError as e:
6385 self.fail("Unable to locate unity8 binary: %r" % e)
6486
87+ def get_dash(self):
88+ dash = self._proxy.select_single("Dash")
89+ self.assertThat(dash, NotEquals(None))
90+ return dash
91+
6592
6693class ShellTestCase(AutopilotTestCase):
6794