on xenial help sign in
On the autopilot helpers, swipe if the item to open from the dash is not visible.

unity8-autopilot dependencies now require ubuntu-ui-toolkit-autopilot (>= 1.2.1485+15.04.20150417.1-0ubuntu1) Approved by: Michał Sawicz, PS Jenkins bot

commite552fdc537890e139f350eb321ed4cbf840986a3 authorLeonardo Arias Fonseca <leo.arias@canonical.com> dateTue 16 Jun 2015, 15:12 (11 years ago) parentb0503a569a87ec
3 files changed+22−9
debian/control+1−1 tests/autopilot/unity8/shell/emulators/dash.py+15−8 tests/autopilot/unity8/shell/tests/test_emulators.py+6
debian/control+1−1
@@ -151,7 +151,7 @@ Depends: autopilot-qt5 (>= 1.4),
151151 python3-fixtures,
152152 python3-gi,
153153 qttestability-autopilot (>= 1.4),
154− ubuntu-ui-toolkit-autopilot,
154+ ubuntu-ui-toolkit-autopilot (>= 1.2.1485+15.04.20150417.1-0ubuntu1),
155155 unity-scope-click,
156156 unity8 (= ${source:Version}),
157157 unity8-fake-env (= ${source:Version}),
tests/autopilot/unity8/shell/emulators/dash.py+15−8
@@ -185,14 +185,15 @@ class Dash(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
185185
186186
187187class ListViewWithPageHeader(ubuntuuitoolkit.QQuickFlickable):
188− pass
188+
189+ margin_to_swipe_from_bottom = ubuntuuitoolkit.units.gu(4)
189190
190191
191192class GenericScopeView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
192193 """Autopilot emulator for generic scopes."""
193194
194195 @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):
196197 """Open the preview of an application.
197198
198199 :parameter category: The name of the category where the application is.
@@ -203,16 +204,19 @@ class GenericScopeView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
203204 # FIXME some categories need a long press in order to see the preview.
204205 # Some categories do not show previews, like recent apps.
205206 # --elopio - 2014-1-14
206− self.click_scope_item(category, app_name)
207+ self.click_scope_item(category, app_name, press_duration)
207208 preview_list = self.wait_select_single(
208209 'QQuickLoader', objectName='subPageLoader')
209210 preview_list.subPageShown.wait_for(True)
210211 preview_list.x.wait_for(0)
212+ self.get_root_instance().select_single(
213+ objectName='processingIndicator').visible.wait_for(False)
211214 return preview_list.select_single(
212− Preview, objectName='preview{}'.format(preview_list.currentIndex))
215+ Preview, objectName='preview{}'.format(
216+ preview_list.initialIndex))
213217
214218 @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):
216220 """Click an item from the scope.
217221
218222 :parameter category: The name of the category where the item is.
@@ -220,9 +224,12 @@ class GenericScopeView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
220224
221225 """
222226 category_element = self._get_category_element(category)
223− icon = category_element.wait_select_single('AbstractButton',
224− title=title)
225− self.pointing_device.click_object(icon)
227+ icon = category_element.wait_select_single(
228+ 'AbstractButton', title=title)
229+ list_view = self.select_single(
230+ ListViewWithPageHeader, objectName='categoryListView')
231+ list_view.swipe_child_into_view(icon)
232+ self.pointing_device.click_object(icon, press_duration=press_duration)
226233
227234 def _get_category_element(self, category):
228235 try:
tests/autopilot/unity8/shell/tests/test_emulators.py+6
@@ -120,6 +120,12 @@ class GenericScopeViewEmulatorTestCase(tests.DashBaseTestCase):
120120 self.assertIsInstance(preview, dash_emulators.Preview)
121121 self.assertTrue(preview.isCurrent)
122122
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+
123129
124130class DashAppsEmulatorTestCase(tests.DashBaseTestCase):
125131