on xenial help sign in
On the autopilot helpers, swipe if the item to open from the dash is not visible.
e552fdcLeonardo Arias Fonseca
debian/control+1−1
@@ -151,7 +151,7 @@ Depends: autopilot-qt5 (>= 1.4),
151 python3-fixtures,
151 python3-fixtures,
152 python3-gi,
152 python3-gi,
153 qttestability-autopilot (>= 1.4),
153 qttestability-autopilot (>= 1.4),
154− ubuntu-ui-toolkit-autopilot,
154+ ubuntu-ui-toolkit-autopilot (>= 1.2.1485+15.04.20150417.1-0ubuntu1),
155 unity-scope-click,
155 unity-scope-click,
156 unity8 (= ${source:Version}),
156 unity8 (= ${source:Version}),
157 unity8-fake-env (= ${source:Version}),
157 unity8-fake-env (= ${source:Version}),
tests/autopilot/unity8/shell/emulators/dash.py+15−8
@@ -185,14 +185,15 @@ class Dash(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
185
185
186
186
187class ListViewWithPageHeader(ubuntuuitoolkit.QQuickFlickable):
187class ListViewWithPageHeader(ubuntuuitoolkit.QQuickFlickable):
188− pass
188+
189+ margin_to_swipe_from_bottom = ubuntuuitoolkit.units.gu(4)
189
190
190
191
191class GenericScopeView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
192class GenericScopeView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
192 """Autopilot emulator for generic scopes."""
193 """Autopilot emulator for generic scopes."""
193
194
194 @autopilot_logging.log_action(logger.info)
195 @autopilot_logging.log_action(logger.info)
195− def open_preview(self, category, app_name):
196+ def open_preview(self, category, app_name, press_duration=0.10):
196 """Open the preview of an application.
197 """Open the preview of an application.
197
198
198 :parameter category: The name of the category where the application is.
199 :parameter category: The name of the category where the application is.
@@ -203,16 +204,19 @@ class GenericScopeView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
203 # FIXME some categories need a long press in order to see the preview.
204 # FIXME some categories need a long press in order to see the preview.
204 # Some categories do not show previews, like recent apps.
205 # Some categories do not show previews, like recent apps.
205 # --elopio - 2014-1-14
206 # --elopio - 2014-1-14
206− self.click_scope_item(category, app_name)
207+ self.click_scope_item(category, app_name, press_duration)
207 preview_list = self.wait_select_single(
208 preview_list = self.wait_select_single(
208 'QQuickLoader', objectName='subPageLoader')
209 'QQuickLoader', objectName='subPageLoader')
209 preview_list.subPageShown.wait_for(True)
210 preview_list.subPageShown.wait_for(True)
210 preview_list.x.wait_for(0)
211 preview_list.x.wait_for(0)
212+ self.get_root_instance().select_single(
213+ objectName='processingIndicator').visible.wait_for(False)
211 return preview_list.select_single(
214 return preview_list.select_single(
212− Preview, objectName='preview{}'.format(preview_list.currentIndex))
215+ Preview, objectName='preview{}'.format(
216+ preview_list.initialIndex))
213
217
214 @autopilot_logging.log_action(logger.debug)
218 @autopilot_logging.log_action(logger.debug)
215− def click_scope_item(self, category, title):
219+ def click_scope_item(self, category, title, press_duration=0.10):
216 """Click an item from the scope.
220 """Click an item from the scope.
217
221
218 :parameter category: The name of the category where the item is.
222 :parameter category: The name of the category where the item is.
@@ -220,9 +224,12 @@ class GenericScopeView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
220
224
221 """
225 """
222 category_element = self._get_category_element(category)
226 category_element = self._get_category_element(category)
223− icon = category_element.wait_select_single('AbstractButton',
227+ icon = category_element.wait_select_single(
224− title=title)
228+ 'AbstractButton', title=title)
229+ list_view = self.select_single(
230+ ListViewWithPageHeader, objectName='categoryListView')
231+ list_view.swipe_child_into_view(icon)
225− self.pointing_device.click_object(icon)
232+ self.pointing_device.click_object(icon, press_duration=press_duration)
226
233
227 def _get_category_element(self, category):
234 def _get_category_element(self, category):
228 try:
235 try:
tests/autopilot/unity8/shell/tests/test_emulators.py+6
@@ -120,6 +120,12 @@ class GenericScopeViewEmulatorTestCase(tests.DashBaseTestCase):
120 self.assertIsInstance(preview, dash_emulators.Preview)
120 self.assertIsInstance(preview, dash_emulators.Preview)
121 self.assertTrue(preview.isCurrent)
121 self.assertTrue(preview.isCurrent)
122
122
123+ def test_open_preview_of_non_visible_item(self):
124+ """Open an item that requires swiping to make it visible."""
125+ preview = self.generic_scope.open_preview('2', 'Title.2.0')
126+ self.assertIsInstance(preview, dash_emulators.Preview)
127+ self.assertTrue(preview.isCurrent)
128+
123
129
124class DashAppsEmulatorTestCase(tests.DashBaseTestCase):
130class DashAppsEmulatorTestCase(tests.DashBaseTestCase):
125
131