on xenial help sign in
First changes to check for dash/home scope loaded.
a465ea8Christopher Lee
Dash/DashContent.qml+3
@@ -114,6 +114,9 @@ Item {
114 height: ListView.view.height
114 height: ListView.view.height
115 asynchronous: true
115 asynchronous: true
116 source: scopeMapper.map(scope.id)
116 source: scopeMapper.map(scope.id)
117+ readonly property string scopeId: scope.id
118+ readonly property bool isCurrent: ListView.isCurrentItem
119+ readonly property bool isLoaded: status == Loader.Ready
117
120
118 onLoaded: {
121 onLoaded: {
119 item.scope = Qt.binding(function() { return scope })
122 item.scope = Qt.binding(function() { return scope })
tests/autopilot/unity8/shell/tests/__init__.py+25−8
@@ -144,14 +144,10 @@ class Unity8TestCase(AutopilotTestCase):
144 self._set_proxy(app_proxy)
144 self._set_proxy(app_proxy)
145
145
146 # Ensure that the dash is visible before we return:
146 # Ensure that the dash is visible before we return:
147− logger.debug("Unity8 started, waiting for Dash.")
147+ logger.debug("Unity8 started, waiting for it to be ready.")
148− # FIXME! There is a huge timeout here for when we're doing CI on
148+ self.assertUnityReady()
149− # VMs. See lp:1203715
150− self.assertThat(
151− self.get_dash().showScopeOnLoaded,
152− Eventually(Equals(""), timeout=40)
153− )
154− logger.debug("Unity8 Dash loaded and ready.")
149+ logger.debug("Unity8 loaded and ready.")
150+
155 return app_proxy
151 return app_proxy
156
152
157 def _setup_extra_mock_environment_patch(self):
153 def _setup_extra_mock_environment_patch(self):
@@ -169,11 +165,32 @@ class Unity8TestCase(AutopilotTestCase):
169 def _clear_proxy(self):
165 def _clear_proxy(self):
170 self._proxy = None
166 self._proxy = None
171
167
168+ def assertUnityReady(self):
169+ # FIXME! There is a huge timeout here for when we're doing CI on
170+ # VMs. See lp:1203715
171+ home_scope = self.get_dash_home_scope()
172+ # home_scope_is_loaded = lambda: home_scope.isCurrent
173+ # home_scope_is_current = lambda: get_home_scope().isLoaded
174+ self.assertThat(
175+ home_scope.isLoaded,
176+ Eventually(Equals(True), timeout=40)
177+ )
178+ self.assertThat(home_scope.isCurrent, Eventually(Equals(True)))
179+
172 def get_dash(self):
180 def get_dash(self):
173 dash = self._proxy.select_single(Dash)
181 dash = self._proxy.select_single(Dash)
174 self.assertThat(dash, NotEquals(None))
182 self.assertThat(dash, NotEquals(None))
175 return dash
183 return dash
176
184
185+ # change this to get_scope(name='home') and add the .scope to it
186+ def get_dash_home_scope(self):
187+ dash = self.get_dash()
188+ dash_content = dash.select_single(
189+ 'QQuickListView',
190+ objectName='dashContentList'
191+ )
192+ return dash_content.select_single('QQuickLoader', scopeId='home.scope')
193+
177 @property
194 @property
178 def main_window(self):
195 def main_window(self):
179 return MainWindow(self._proxy)
196 return MainWindow(self._proxy)