22 from autopilot
import logging
as autopilot_logging
23 from autopilot
import input
29 logger = logging.getLogger(__name__)
33 """An emulator class that makes it easy to interact with the shell"""
35 def get_greeter(self):
36 return self.select_single(Greeter)
38 def get_login_loader(self):
39 return self.select_single(
"QQuickLoader", objectName=
"loginLoader")
41 def get_login_list(self):
42 return self.select_single(
"LoginList")
44 def get_bottombar(self):
45 return self.select_single(
"Bottombar")
47 def get_pinPadLoader(self):
48 return self.select_single(
50 objectName=
"pinPadLoader"
53 def get_lockscreen(self):
54 return self.select_single(
"Lockscreen")
56 def get_pinentryField(self):
57 return self.select_single(objectName=
"pinentryField")
59 def _get_indicator_panel_item(self, indicator_name):
60 return self.select_single(
62 objectName=indicator_name+
'-panelItem'
65 def _get_indicator_page(self, indicator_name):
66 return self.select_single(
68 objectName=indicator_name+
'-page'
71 @autopilot_logging.log_action(logger.info)
73 """Swipe to open the indicator, wait until it's open.
75 :returns: The indicator page.
78 start_x, start_y = input.get_center_point(widget)
81 self.pointing_device.drag(start_x, start_y, end_x, end_y)
82 self.wait_select_single(
'IndicatorsMenu', fullyOpened=
True)
85 @autopilot_logging.log_action(logger.info)
87 """Swipe to close the opened indicator, wait until it's closed."""
88 indicators_menu = self.wait_select_single(
'IndicatorsMenu')
89 end_x, end_y = input.get_center_point(indicators_menu)
92 self.pointing_device.drag(start_x, start_y, end_x, end_y)
93 indicators_menu.fullyClosed.wait_for(
True)
95 @autopilot_logging.log_action(logger.info)
97 """Show the dash swiping from the left."""
98 x, y, width, height = self.
_get_shell().globalRect
101 start_y = end_y = y + height // 2
103 self.pointing_device.drag(start_x, start_y, end_x, end_y)
106 def _get_shell(self):
107 return self.select_single(
'Shell')
110 """Return the id of the focused application."""
113 @autopilot_logging.log_action(logger.info)
115 """Open the dash clicking the dash icon on the launcher."""
117 launcher.click_dash_icon()
119 launcher.shown.wait_for(
False)
121 @autopilot_logging.log_action(logger.info)
122 def open_launcher(self):
127 def _get_launcher(self):
128 return self.select_single(Launcher)
130 def is_launcher_open(self):
133 @autopilot_logging.log_action(logger.info)
135 """Launch an application.
137 :parameter application_name: The name of the application to launch.
141 launcher.click_application_launcher_icon(application_name)
143 launcher.shown.wait_for(
False)
146 """Enter code 'code' into the single-pin lightdm pincode entry screen.
148 :param code: must be a string of numeric characters.
149 :raises: TypeError if code is not a string.
150 :raises: ValueError if code contains non-numeric characters.
153 if not isinstance(code, str):
155 "'code' parameter must be a string, not %r."
159 if not num.isdigit():
161 "'code' parameter contains non-numeric characters."
163 self.pointing_device.click_object(
166 def _get_pinpad_button(self, button_id):
167 return self.select_single(
169 objectName=
'pinPadButton{}'.format(button_id)
172 @autopilot_logging.log_action(logger.info)
174 """Wait for a notification dialog to appear.
176 :return: An object for the notification dialog data.
177 :raise StateNotFoundError: if the timeout expires when the
178 notification has not appeared.
181 notify_list = self.select_single(
'Notifications',
182 objectName=
'notificationList')
183 visible_notification = notify_list.wait_select_single(
'Notification',
185 return {
'summary': visible_notification.summary,
186 'body': visible_notification.body,
187 'iconSource': visible_notification.iconSource}
def enter_pin_code(self, code)
def close_indicator_page(self)
def _get_pinpad_button(self, button_id)
def get_current_focused_app_id(self)
def open_indicator_page(self, indicator_name)
def _get_indicator_page(self, indicator_name)
def wait_for_notification(self)
def show_dash_from_launcher(self)
def show_dash_swiping(self)
def launch_application(self, application_name)
def _get_indicator_panel_item(self, indicator_name)