@@ -185,14 +185,15 @@ class Dash(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
187class ListViewWithPageHeader(ubuntuuitoolkit.QQuickFlickable):
187class ListViewWithPageHeader(ubuntuuitoolkit.QQuickFlickable):
189+ margin_to_swipe_from_bottom = ubuntuuitoolkit.units.gu(4)
191class GenericScopeView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
192class GenericScopeView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
192 """Autopilot emulator for generic scopes."""
193 """Autopilot emulator for generic scopes."""
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.
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))
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.
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):
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)
227 def _get_category_element(self, category):
234 def _get_category_element(self, category):