on xenial help sign in
Reverted the open_preview autopilot helper to return a Preview object.
commit011c277a3d73804134a4e338328863d972361d99 authorLeo Arias <leo.arias@canonical.com> dateThu 3 Apr 2014, 10:38 (13 years ago) parent9a27cd3311146f
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
@@ -142,6 +142,7 @@ class GenericScopeView(emulators.UnityEmulatorBase):
142142
143143 :parameter category: The name of the category where the application is.
144144 :app_name: The name of the application.
145+ :return: The opened preview.
145146
146147 """
147148 category_element = self._get_category_element(category)
@@ -150,8 +151,11 @@ class GenericScopeView(emulators.UnityEmulatorBase):
150151 # Some categories do not show previews, like recent apps.
151152 # --elopio - 2014-1-14
152153 self.pointing_device.click_object(icon)
153− return self.get_root_instance().wait_select_single(
154+ preview_list = self.get_root_instance().wait_select_single(
154155 'PreviewListView', objectName='dashContentPreviewList')
156+ preview_list.x.wait_for(0)
157+ return preview_list.select_single(
158+ Preview, objectName='preview{}'.format(preview_list.currentIndex))
155159
156160 def _get_category_element(self, category):
157161 try:
@@ -180,3 +184,7 @@ class DashApps(GenericScopeView):
180184 if card.objectName != 'cardToolCard':
181185 result.append(card)
182186 return result
187+
188+
189+class Preview(emulators.UnityEmulatorBase):
190+ """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)