ubuntuuitoolkit
Ubuntu UI Toolkit Autopilot tests and helpers.
- class ubuntuuitoolkit.AppHeader(*args)¶
Bases: ubuntuuitoolkit._custom_proxy_objects._common.UbuntuUIToolkitCustomProxyObjectBase
AppHeader Autopilot custom proxy object.
Click an action button of the header.
Parameters: object_name – The QML objectName property of the action Raises ToolkitException: If there is no action button with that object name.
- ensure_visible()¶
- get_selected_section_index()¶
- switch_to_next_tab(instance, *args, **kwargs)¶
Open the next tab.
Raises ToolkitException: If the main view has no tabs.
- switch_to_section_by_index(instance, *args, **kwargs)¶
Select a section in the header divider
Parameters: index – The index of the section to select Raises ToolkitEmulatorException: If the selection index is out of range or useDeprecatedToolbar is set.
- switch_to_tab_by_index(instance, *args, **kwargs)¶
Open a tab. This only supports the new tabs in the header
Parameters: index – The index of the tab to open. Raises ToolkitException: If the tab index is out of range or useDeprecatedToolbar is set.
- wait_for_animation()¶
- ubuntuuitoolkit.check_autopilot_version()¶
Check that the Autopilot installed version matches the one required.
Raises ToolkitException: If the installed Autopilot version does’t match the required by the custom proxy objects.
- class ubuntuuitoolkit.CheckBox(*args)¶
Bases: ubuntuuitoolkit._custom_proxy_objects._common.UbuntuUIToolkitCustomProxyObjectBase
CheckBox Autopilot custom proxy object.
- change_state(instance, *args, **kwargs)¶
Change the state of a CheckBox.
If it is checked, it will be unchecked. If it is unchecked, it will be checked.
Parameters: time_out – number of seconds to wait for the CheckBox state to change. Default is 10.
- check(instance, *args, **kwargs)¶
Check a CheckBox, if its not already checked.
Parameters: timeout – number of seconds to wait for the CheckBox to be checked. Default is 10.
- uncheck(instance, *args, **kwargs)¶
Uncheck a CheckBox, if its not already unchecked.
Parameters: timeout – number of seconds to wait for the CheckBox to be unchecked. Default is 10.
- ubuntuuitoolkit.get_keyboard()¶
Return the keyboard device.
- ubuntuuitoolkit.get_pointing_device()¶
Return the pointing device depending on the platform.
If the platform is Desktop, the pointing device will be a Mouse. If not, the pointing device will be Touch.
- class ubuntuuitoolkit.Header(*args)¶
Bases: ubuntuuitoolkit._custom_proxy_objects._header.AppHeader
Autopilot helper for the deprecated Header.
- class ubuntuuitoolkit.Dialog(*args)¶
Bases: ubuntuuitoolkit._custom_proxy_objects._common.UbuntuUIToolkitCustomProxyObjectBase
Autopilot helper for the Dialog component.
- class ubuntuuitoolkit.UCListItem(*args)¶
Bases: ubuntuuitoolkit._custom_proxy_objects._common.UbuntuUIToolkitCustomProxyObjectBase
Base class to emulate swipe for leading and trailing actions.
- toggle_selected(instance, *args, **kwargs)¶
Toggles selected state of the ListItem.
- trigger_leading_action(instance, *args, **kwargs)¶
Swipe the item in from left to right to open leading actions and click on the button representing the requested action.
- parameters: action_objectName - object name of the action to be
- triggered. wait_function - a custom wait function to wait till the action is triggered
- trigger_trailing_action(instance, *args, **kwargs)¶
Swipe the item in from right to left to open trailing actions and click on the button representing the requested action.
- parameters: action_objectName - object name of the action to be
- triggered. wait_function - a custom wait function to wait till the action is triggered
- class ubuntuuitoolkit.MainView(*args)¶
Bases: ubuntuuitoolkit._custom_proxy_objects._common.UbuntuUIToolkitCustomProxyObjectBase
MainView Autopilot custom proxy object.
Click the specified button.
Parameters: action_object_name – the objectName of the action to trigger. Raises ToolkitException: The requested button is not available.
- close_toolbar(instance, *args, **kwargs)¶
Close the toolbar if it is opened.
Raises ToolkitException: If the main view has no toolbar.
- get_action_selection_popover(object_name)¶
Return an ActionSelectionPopover custom proxy object.
Parameters: object_name – The QML objectName property of the popover.
- get_header()¶
Return the AppHeader custom proxy object of the MainView.
- get_tabs()¶
Return the Tabs custom proxy object of the MainView.
Raises ToolkitException: If the main view has no tabs.
Return a TextInputContextMenu emulator.
Parameters: object_name – The QML objectName property of the popover.
- get_toolbar()¶
Return the Toolbar custom proxy object of the MainView.
Raises ToolkitException: If the main view has no toolbar.
- go_back(instance, *args, **kwargs)¶
Go to the previous page.
- open_toolbar(instance, *args, **kwargs)¶
Open the toolbar if it is not already opened.
Returns: The toolbar. Raises ToolkitException: If the main view has no toolbar.
- switch_to_next_tab(instance, *args, **kwargs)¶
Open the next tab.
Returns: The newly opened tab.
- switch_to_previous_tab(instance, *args, **kwargs)¶
Open the previous tab.
Returns: The newly opened tab.
- switch_to_tab(instance, *args, **kwargs)¶
Open a tab.
Parameters: object_name – The QML objectName property of the tab. Returns: The newly opened tab. Raises ToolkitException: If there is no tab with that object name.
- switch_to_tab_by_index(instance, *args, **kwargs)¶
Open a tab.
Parameters: index – The index of the tab to open. Returns: The newly opened tab. Raises ToolkitException: If the tab index is out of range.
- classmethod validate_dbus_object(path, state)¶
- class ubuntuuitoolkit.OptionSelector(*args)¶
Bases: ubuntuuitoolkit._custom_proxy_objects._common.UbuntuUIToolkitCustomProxyObjectBase
OptionSelector Autopilot custom proxy object
- get_current_label()¶
gets the text of the currently selected item
- get_option_count()¶
Gets the number of items in the option selector
- get_selected_index()¶
Gets the current selected index of the QQuickListView
- get_selected_text()¶
gets the text of the currently selected item
- select_option(*args, **kwargs)¶
Select delegate in option selector
- Example usage::
- select_option(objectName=”myOptionSelectorDelegate”) select_option(‘Label’, text=”some_text_here”)
Parameters: kwargs – keywords used to find property(s) of delegate in option selector
- class ubuntuuitoolkit.QQuickFlickable(*args)¶
Bases: ubuntuuitoolkit._custom_proxy_objects._flickable.Scrollable
- pull_to_refresh(instance, *args, **kwargs)¶
Pulls the flickable down and triggers a refresh on it.
Raises ubuntuuitoolkit.ToolkitException: If the flickable has no pull to release functionality.
- swipe_child_into_view(instance, *args, **kwargs)¶
Make the child visible.
Currently it works only when the object needs to be swiped vertically. TODO implement horizontal swiping. –elopio - 2014-03-21
- swipe_to_bottom(instance, *args, **kwargs)¶
- swipe_to_show_more_above(instance, *args, **kwargs)¶
- swipe_to_show_more_below(instance, *args, **kwargs)¶
- swipe_to_top(instance, *args, **kwargs)¶
- class ubuntuuitoolkit.QQuickGridView(*args)¶
Bases: ubuntuuitoolkit._custom_proxy_objects._flickable.QQuickFlickable
Autopilot helper for the QQuickGridView component.
- class ubuntuuitoolkit.QQuickListView(*args)¶
Bases: ubuntuuitoolkit._custom_proxy_objects._flickable.QQuickFlickable
- click_element(instance, *args, **kwargs)¶
Click an element from the list.
It swipes the element into view if it’s center is not visible.
Parameters: - objectName – The objectName property of the element to click.
- direction – The direction where the element is, it can be either ‘above’ or ‘below’. Default value is None, which means we don’t know where the object is and we will need to search the full list.
- drag_item(instance, *args, **kwargs)¶
- enable_select_mode(instance, *args, **kwargs)¶
Default implementation to enable select mode. Performs a long tap over the first list item in the ListView. The delegates must be the new ListItem components.
- class ubuntuuitoolkit.TabBar(*args)¶
Bases: ubuntuuitoolkit._custom_proxy_objects._common.UbuntuUIToolkitCustomProxyObjectBase
TabBar Autopilot custom proxy object.
- switch_to_next_tab(instance, *args, **kwargs)¶
Open the next tab.
- class ubuntuuitoolkit.Tabs(*args)¶
Bases: ubuntuuitoolkit._custom_proxy_objects._common.UbuntuUIToolkitCustomProxyObjectBase
Tabs Autopilot custom proxy object.
- get_current_tab()¶
Return the currently selected tab.
- get_number_of_tabs()¶
Return the number of tabs.
- class ubuntuuitoolkit.TextArea(*args)¶
Bases: ubuntuuitoolkit._custom_proxy_objects._textfield.TextField
TextArea autopilot emulator.
- clear()¶
Clear the text area.
- class ubuntuuitoolkit.TextField(*args)¶
Bases: ubuntuuitoolkit._custom_proxy_objects._common.UbuntuUIToolkitCustomProxyObjectBase
TextField Autopilot custom proxy object.
- clear(instance, *args, **kwargs)¶
Clear the text field.
- is_empty()¶
Return True if the text field is empty. False otherwise.
- write(instance, *args, **kwargs)¶
Write into the text field.
Parameters: - text – The text to write.
- clear – If True, the text field will be cleared before writing the text. If False, the text will be appended at the end of the text field. Default is True.
- class ubuntuuitoolkit.Toolbar(*args)¶
Bases: ubuntuuitoolkit._custom_proxy_objects._common.UbuntuUIToolkitCustomProxyObjectBase
Toolbar Autopilot custom proxy object.
Click the back button of the toolbar.
Click a button of the toolbar.
The toolbar should be opened before clicking the button, or an exception will be raised. If the toolbar is closed for some reason (e.g., timer finishes) after moving the mouse cursor and before clicking the button, it is re-opened automatically by this function.
Parameters: object_name – The QML objectName property of the button. Raises ToolkitException: If there is no button with that object name.
- close(instance, *args, **kwargs)¶
Close the toolbar if it’s opened.
- open(instance, *args, **kwargs)¶
Open the toolbar if it’s not already opened.
Returns: The toolbar.
- exception ubuntuuitoolkit.ToolkitException¶
Bases: exceptions.Exception
Exception raised when there is an error with the custom proxy object.
- class ubuntuuitoolkit.UbuntuListView11(*args)¶
Bases: ubuntuuitoolkit._custom_proxy_objects._qquicklistview.QQuickListView
Autopilot helper for the UbuntuListView 1.1.
- manual_refresh_nowait()¶
- manual_refresh_wait()¶
- pull_to_refresh_enabled()¶
- wait_refresh_completed()¶
- class ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase(*args)¶
Bases: autopilot.introspection.dbus.CustomEmulatorBase
A base class for all the Ubuntu UI Toolkit custom proxy objects.
- is_flickable()¶
Check if the object is flickable.
If the object has a flicking attribute, we consider it as a flickable.
Returns: True if the object is flickable. False otherwise.
- swipe_into_view(instance, *args, **kwargs)¶
Make the object visible.
Currently it works only when the object needs to be swiped vertically. TODO implement horizontal swiping. –elopio - 2014-03-21