on xenial help sign in
Reverted the open_preview autopilot helper to return a Preview object.
commit7790ae3d30240934d2f3796118f210f413f00593 authorLeo Arias <leo.arias@canonical.com> dateWed 2 Apr 2014, 01:23 (13 years ago) parenta07680a
2 files changed+12−6
tests/autopilot/unity8/shell/emulators/dash.py+9−1 tests/autopilot/unity8/shell/tests/test_emulators.py+3−5
tests/autopilot/unity8/shell/emulators/dash.py+9−1
@@ -145,6 +145,7 @@ class GenericScopeView(emulators.UnityEmulatorBase):
145145
146146 :parameter category: The name of the category where the application is.
147147 :app_name: The name of the application.
148+ :return: The opened preview.
148149
149150 """
150151 category_element = self._get_category_element(category)
@@ -153,8 +154,11 @@ class GenericScopeView(emulators.UnityEmulatorBase):
153154 # Some categories do not show previews, like recent apps.
154155 # --elopio - 2014-1-14
155156 self.pointing_device.click_object(icon)
156− return self.get_root_instance().wait_select_single(
157+ preview_list = self.get_root_instance().wait_select_single(
157158 'PreviewListView', objectName='dashContentPreviewList')
159+ preview_list.x.wait_for(0)
160+ return preview_list.select_single(
161+ Preview, objectName='preview{}'.format(preview_list.currentIndex))
158162
159163 def _get_category_element(self, category):
160164 try:
@@ -183,3 +187,7 @@ class DashApps(GenericScopeView):
183187 if card.objectName != 'cardToolCard':
184188 result.append(card)
185189 return result
190+
191+
192+class Preview(emulators.UnityEmulatorBase):
193+ """Autopilot custom proxy object for generic previews."""
tests/autopilot/unity8/shell/tests/test_emulators.py+3−5
@@ -141,7 +141,9 @@ class GenericScopeViewEmulatorTestCase(DashBaseTestCase):
141141
142142 def test_open_preview(self):
143143 preview = self.generic_scope.open_preview('0', 'Title.0.0')
144− preview.x.wait_for(0)
144+ self.assertIsInstance(preview, dash_emulators.Preview)
145+ self.assertTrue(preview.isCurrent)
146+
145147
146148class DashAppsEmulatorTestCase(DashBaseTestCase):
147149
@@ -186,7 +188,3 @@ class DashAppsEmulatorTestCase(DashBaseTestCase):
186188 category)
187189 grid = category_element.select_single('CardFilterGrid')
188190 return grid.columns * grid.rows
189−
190− def test_open_preview(self):
191− preview = self.applications_scope.open_preview('2', 'Title.2.1')
192− preview.x.wait_for(0)