@@ -24,7 +24,6 @@ from unity8.shell import emulators
2424
2525from autopilot import logging as autopilot_logging
2626from autopilot.introspection import dbus
27−from testtools.matchers import MatchesAny, Equals
2827from ubuntuuitoolkit import emulators as toolkit_emulators
2928
3029
@@ -146,7 +145,8 @@ class Dash(emulators.UnityEmulatorBase):
146145 current_header.globalRect.y +
147146 current_header.height / 4)
148147 self.pointing_device.click()
149− headerContainer = current_header.select_single(objectName="headerContainer")
148+ headerContainer = current_header.select_single(
149+ objectName="headerContainer")
150150 headerContainer.contentY.wait_for(0)
151151 search_text_field = self._get_search_text_field()
152152 search_text_field.write(query)
@@ -177,22 +177,32 @@ class GenericScopeView(emulators.UnityEmulatorBase):
177177 """Open the preview of an application.
178178
179179 :parameter category: The name of the category where the application is.
180− :app_name: The name of the application.
180+ :parameter app_name: The name of the application.
181181 :return: The opened preview.
182182
183183 """
184− category_element = self._get_category_element(category)
185− icon = category_element.select_single('AbstractButton', title=app_name)
186184 # FIXME some categories need a long press in order to see the preview.
187185 # Some categories do not show previews, like recent apps.
188186 # --elopio - 2014-1-14
189− self.pointing_device.click_object(icon)
187+ self.click_scope_item(category, app_name)
190188 preview_list = self.wait_select_single(
191189 'PreviewListView', objectName='previewListView')
192190 preview_list.x.wait_for(0)
193191 return preview_list.select_single(
194192 Preview, objectName='preview{}'.format(preview_list.currentIndex))
195193
194+ @autopilot_logging.log_action(logger.debug)
195+ def click_scope_item(self, category, title):
196+ """Click an item from the scope.
197+
198+ :parameter category: The name of the category where the item is.
199+ :parameter title: The title of the item.
200+
201+ """
202+ category_element = self._get_category_element(category)
203+ icon = category_element.select_single('AbstractButton', title=title)
204+ self.pointing_device.click_object(icon)
205+
196206 def _get_category_element(self, category):
197207 try:
198208 return self.wait_select_single(