on xenial help sign in
open the indicator directly if it is displayed in the menu.
bfb27cfLeo Arias
tests/autopilot/unity8/indicators/__init__.py+8−4
@@ -49,16 +49,20 @@ class DisplayIndicator(object):
49 :return: The custom proxy object for the display indicator page.
49 :return: The custom proxy object for the display indicator page.
50
50
51 """
51 """
52− # TODO open the indicator directly if it is displayed in the menu.
52+ if self.is_indicator_icon_visible():
53+ return self._main_window.open_indicator_page(
54+ 'indicator-rotation-lock')
55+ else:
56+ return self._open_indicator_with_icon_not_visible()
57+
58+ def _open_indicator_with_icon_not_visible(self):
53 # open any displayed indicator.
59 # open any displayed indicator.
54 self._main_window.open_indicator_page('indicator-datetime')
60 self._main_window.open_indicator_page('indicator-datetime')
55 self._make_indicator_icon_visible()
61 self._make_indicator_icon_visible()
56 indicator_rotation_icon = self._main_window.select_single(
62 indicator_rotation_icon = self._main_window.select_single(
57 objectName='indicator-rotation-lock-panelItem')
63 objectName='indicator-rotation-lock-panelItem')
58 self._main_window.pointing_device.click_object(indicator_rotation_icon)
64 self._main_window.pointing_device.click_object(indicator_rotation_icon)
59− indicators_menu = self._main_window.select_single('IndicatorsMenu')
60− indicators_menu.fullyOpened.wait_for(True)
61− return self._main_window.select_single(
65+ return self._main_window.wait_select_single(
62 objectName='indicator-rotation-lock-page')
66 objectName='indicator-rotation-lock-page')
63
67
64 def _make_indicator_icon_visible(self):
68 def _make_indicator_icon_visible(self):
tests/autopilot/unity8/shell/emulators/main_window.py+1−1
@@ -88,7 +88,7 @@ class QQuickView(emulators.UnityEmulatorBase):
88 self.wait_select_single('IndicatorsMenu', fullyOpened=True)
88 self.wait_select_single('IndicatorsMenu', fullyOpened=True)
89 return self._get_indicator_page(indicator_name)
89 return self._get_indicator_page(indicator_name)
90
90
91− @autopilot_logging.log_action(logger.info)
91+ @autopilot_logging.log_action(logger.info)
92 def close_indicator_page(self):
92 def close_indicator_page(self):
93 """Swipe to close the opened indicator, wait until it's closed."""
93 """Swipe to close the opened indicator, wait until it's closed."""
94 indicators_menu = self.wait_select_single('IndicatorsMenu')
94 indicators_menu = self.wait_select_single('IndicatorsMenu')