Warning

This document is for an in-development version of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.

galaxy.selenium package

Top-level of library designed to ease use of Selenium targetting Galaxy.

galaxy_selenium is purposes being designed to depend on Python selenium, six, pyyaml, and optional pyvirtualdisplay but not galaxy-lib (or any of Galaxy or Galaxy’s test stuff) currently.

Submodules

galaxy.selenium.cli module

galaxy.selenium.cli.add_selenium_arguments(parser)[source]

Add common selenium arguments for argparse driver utility.

class galaxy.selenium.cli.DriverWrapper(args)[source]

Bases: galaxy.selenium.navigates_galaxy.NavigatesGalaxy

Adapt argparse command-line options to a concrete Selenium driver.

__init__(args)[source]
build_url(url='')[source]
default_timeout
finish()[source]

galaxy.selenium.components module

class galaxy.selenium.components.Target[source]

Bases: object

description

Return a plain-text description of the browser target for logging/messages.

element_locator

Return a (by, selector) Selenium elment locator tuple for this selector.

class galaxy.selenium.components.SelectorTemplate(selector, selector_type, children=None, kwds=None, with_classes=None)[source]

Bases: galaxy.selenium.components.Target

__init__(selector, selector_type, children=None, kwds=None, with_classes=None)[source]
static from_dict(raw_value, children=None)[source]
with_class(class_)[source]
descendant(has_selector)[source]
description
selector
element_locator
as_css_class
class galaxy.selenium.components.Label(text)[source]

Bases: galaxy.selenium.components.Target

__init__(text)[source]
description
element_locator
class galaxy.selenium.components.Text(text)[source]

Bases: galaxy.selenium.components.Target

__init__(text)[source]
description
element_locator
class galaxy.selenium.components.Component(name, sub_components, selectors, labels, text)[source]

Bases: object

__init__(name, sub_components, selectors, labels, text)[source]
selector
static from_dict(name, raw_value)[source]

galaxy.selenium.data module

galaxy.selenium.driver_factory module

galaxy.selenium.driver_factory.get_local_driver(browser='auto', headless=False)[source]
galaxy.selenium.driver_factory.get_remote_driver(host, port, browser='auto')[source]
galaxy.selenium.driver_factory.is_virtual_display_available()[source]
galaxy.selenium.driver_factory.virtual_display_if_enabled(enabled)[source]

galaxy.selenium.has_driver module

A mixin to extend a class that has self.driver with higher-level constructs.

This should be mixed into classes with a self.driver and self.default_timeout attribute.

class galaxy.selenium.has_driver.HasDriver[source]

Bases: object

exception TimeoutException(msg=None, screen=None, stacktrace=None)

Bases: selenium.common.exceptions.WebDriverException

Thrown when a command does not complete in enough time.

assert_xpath(xpath)[source]
assert_selector(selector)[source]
assert_selector_absent_or_hidden(selector)[source]
assert_absent_or_hidden(selector_template)[source]
selector_is_displayed(selector)[source]
is_displayed(selector_template)[source]
assert_selector_absent(selector)[source]
find_elements(selector_template)[source]
assert_absent(selector_template)[source]
wait_for_xpath(xpath, **kwds)[source]
wait_for_xpath_visible(xpath, **kwds)[source]
wait_for_selector(selector, **kwds)[source]
wait_for_present(selector_template, **kwds)[source]
wait_for_visible(selector_template, **kwds)[source]
wait_for_selector_visible(selector, **kwds)[source]
wait_for_selector_clickable(selector, **kwds)[source]
wait_for_clickable(selector_template, **kwds)[source]
wait_for_selector_absent_or_hidden(selector, **kwds)[source]
wait_for_selector_absent(selector, **kwds)[source]
wait_for_absent(selector_template, **kwds)[source]
wait_for_absent_or_hidden(selector_template, **kwds)[source]
wait_for_id(id, **kwds)[source]
click(selector_template)[source]
action_chains()[source]
send_enter(element)[source]
send_escape(element)[source]
send_backspace(element)[source]
wait(timeout=<object object>, **kwds)[source]
click_xpath(xpath)[source]
click_label(text)[source]
click_selector(selector)[source]
fill(form, info)[source]
click_submit(form)[source]
prepend_timeout_message(timeout_exception, message)[source]
galaxy.selenium.has_driver.exception_indicates_not_clickable(exception)[source]
galaxy.selenium.has_driver.exception_indicates_stale_element(exception)[source]
exception galaxy.selenium.has_driver.TimeoutException(msg=None, screen=None, stacktrace=None)[source]

Bases: selenium.common.exceptions.WebDriverException

Thrown when a command does not complete in enough time.

galaxy.selenium.navigates_galaxy module

A mixing that extends a HasDriver class with Galaxy-specific utilities.

Implementer must provide a self.build_url method to target Galaxy.

class galaxy.selenium.navigates_galaxy.WaitType(name, default_length)

Bases: tuple

default_length

Alias for field number 1

name

Alias for field number 0

class galaxy.selenium.navigates_galaxy.NullTourCallback[source]

Bases: object

handle_step(step, step_index)[source]
galaxy.selenium.navigates_galaxy.exception_seems_to_indicate_transition(e)[source]

True if exception seems to indicate the page state is transitioning.

Galaxy features many different transition effects that change the page state over time. These transitions make it slightly more difficult to test Galaxy because atomic input actions take an indeterminate amount of time to be reflected on the screen. This method takes a Selenium assertion and tries to infer if such a transition could be the root cause of the exception. The methods that follow use it to allow retrying actions during transitions.

Currently the two kinds of exceptions that we say may indicate a transition are StaleElement exceptions (a DOM element grabbed at one step is no longer available) and “not clickable” exceptions (so perhaps a popup modal is blocking a click).

galaxy.selenium.navigates_galaxy.retry_call_during_transitions(f, attempts=10, sleep=0.1, exception_check=<function exception_seems_to_indicate_transition>)[source]
galaxy.selenium.navigates_galaxy.retry_during_transitions(f, attempts=10, sleep=0.1, exception_check=<function exception_seems_to_indicate_transition>)[source]
class galaxy.selenium.navigates_galaxy.NavigatesGalaxy[source]

Bases: galaxy.selenium.has_driver.HasDriver

Class with helpers methods for driving components of the Galaxy interface.

In most cases, methods for interacting with Galaxy components that appear in multiple tests or applications should be refactored into this class for now. Keep in mind that this class is used outside the context of ``TestCase``s as well - so some methods more explicitly related to test data or assertion checking may make more sense in SeleniumTestCase for instance.

Some day this class will likely be split up into smaller mixins for particular components of Galaxy, but until that day the best practice is to prefix methods for driving or querying the interface with the name of the component or page the method operates on. These serve as psedu-namespaces until we decompose this class. For instance, the method for clicking an option in the workflow editor is workflow_editor_click_option instead of click_workflow_editor_option.

default_password = '123456'
wait_types = <galaxy.util.bunch.Bunch object>
get(url='')[source]
navigation
components
wait_length(wait_type)[source]
sleep_for(wait_type)[source]
sleep_for_seconds(duration)[source]
timeout_for(**kwds)[source]
home()[source]
switch_to_main_panel()[source]
local_storage(*args, **kwds)[source]
main_panel(*args, **kwds)[source]
api_get(endpoint, data=None, raw=False)[source]
api_delete(endpoint, raw=False)[source]
get_galaxy_session()[source]
selenium_to_requests_cookies()[source]
history_panel_name_element()[source]
history_panel_name(*args, **kwds)[source]
current_history()[source]
current_history_id()[source]
current_history_contents()[source]
latest_history_item()[source]
wait_for_history(assert_ok=True)[source]
history_panel_create_new_with_name(name)[source]
history_panel_create_new()[source]

Click create new and pause a bit for the history to begin to refresh.

history_panel_wait_for_hid_ok(hid, allowed_force_refreshes=0)[source]
history_panel_item_component(history_item=None, hid=None)[source]
history_panel_wait_for_hid_visible(hid, allowed_force_refreshes=0)[source]
hid_to_history_item(hid, current_history_id=None)[source]
history_item_wait_for(history_item_selector, allowed_force_refreshes)[source]
history_panel_wait_for_history_loaded()[source]
history_panel_wait_for_hid_hidden(hid)[source]
history_panel_wait_for_hid_state(hid, state, allowed_force_refreshes=0)[source]
click_grid_popup_option(item_name, option_label)[source]
published_grid_search_for(search_term=None)[source]
get_logged_in_user()[source]
is_logged_in()[source]
submit_login(email, password=None, assert_valid=True, retries=0)[source]
register(email=None, password=None, username=None, confirm=None, assert_valid=True)[source]
wait_for_logged_in()[source]
click_center()[source]
perform_upload(test_path, ext=None, genome=None, ext_all=None, genome_all=None)[source]
upload_list(test_paths, name='test', ext=None, genome=None, hide_source_items=True)[source]
upload_pair(test_paths, name='test', ext=None, genome=None, hide_source_items=True)[source]
upload_paired_list(test_paths, name='test', ext=None, genome=None, hide_source_items=True)[source]
upload_tab_click(tab)[source]
upload_start_click()[source]
upload_set_collection_type(*args, **kwds)[source]
upload_start(tab_id='regular')[source]
upload_build(*args, **kwds)[source]
upload_queue_local_file(test_path, tab_id='regular')[source]
upload_rule_start()[source]
upload_rule_build()[source]
upload_rule_set_data_type(type_description)[source]
upload_rule_set_input_type(input_description)[source]
upload_rule_set_dataset(dataset_description='1:')[source]
rule_builder_set_collection_name(name)[source]
rule_builder_set_extension(extension)[source]
rule_builder_filter_count(count=1)[source]
rule_builder_sort(column_label, screenshot_name=None)[source]
rule_builder_add_regex_groups(column_label, group_count, regex, screenshot_name)[source]
rule_builder_add_regex_replacement(column_label, regex, replacement, screenshot_name=None)[source]
rule_builder_add_value(value, screenshot_name=None)[source]
rule_builder_remove_columns(column_labels, screenshot_name=None)[source]
rule_builder_concatenate_columns(column_label_1, column_label_2, screenshot_name=None)[source]
rule_builder_split_columns(column_labels_1, column_labels_2, screenshot_name=None)[source]
rule_builder_swap_columns(column_label_1, column_label_2, screenshot_name)[source]
rule_builder_rule_editor(*args, **kwds)[source]
rule_builder_set_mapping(mapping_type, column_label, screenshot_name=None)[source]
rule_builder_set_source(json)[source]
rule_builder_enter_source_text(json)[source]
workflow_editor_click_option(option_label)[source]
workflow_editor_click_options()[source]
workflow_editor_options_menu_element()[source]
workflow_editor_click_run()[source]
workflow_editor_click_save()[source]
admin_open()[source]
libraries_open()[source]
libraries_open_with_name(name)[source]
libraries_index_table_elements(*args, **kwds)[source]
libraries_index_click_create_new()[source]
libraries_index_create(name)[source]
libraries_index_sort_selector()[source]
libraries_index_sort_click()[source]
libraries_index_search_for(text)[source]
libraries_folder_create(name)[source]
libraries_click_dataset_import()[source]
libraries_dataset_import_from_history()[source]
libraries_dataset_import_from_path()[source]
libraries_dataset_import_from_history_select(to_select_items)[source]
libraries_dataset_import_from_history_click_ok(wait=True)[source]
libraries_table_elements()[source]
wait_for_overlays_cleared()[source]

Wait for modals and Toast notifications to disappear.

workflow_index_open()[source]
workflow_index_table_elements()[source]
workflow_index_table_row(workflow_index=0)[source]
workflow_index_column_text(*args, **kwds)[source]
workflow_index_search_for(search_term=None)[source]
workflow_index_click_import()[source]
workflow_index_rename(new_name, workflow_index=0)[source]
workflow_index_name(*args, **kwds)[source]

Get workflow name for workflow_index’th row.

workflow_index_click_option(option_title, workflow_index=0)[source]
workflow_index_click_tag_display(workflow_index=0)[source]
workflow_index_tags(*args, **kwds)[source]
workflow_import_submit_url(url)[source]
workflow_sharing_click_publish()[source]
tagging_add(tags, auto_closes=True, parent_selector='')[source]
workflow_run_submit()[source]
tool_open(tool_id, outer=False)[source]
tool_parameter_div(expanded_parameter_id)[source]
tool_parameter_edit_rules(expanded_parameter_id='rules')[source]
tool_set_value(expanded_parameter_id, value, expected_type=None, test_data_resolver=None)[source]
tool_form_generate_tour()[source]
tool_form_execute()[source]
click_masthead_user()[source]
click_masthead_shared_data()[source]
click_masthead_workflow()[source]
click_button_new_workflow()[source]
wait_for_sizzle_selector_clickable(selector)[source]
click_history_options(*args, **kwds)[source]
click_history_option(option_label)[source]
history_click_create_new()[source]
history_panel_click_copy_elements()[source]
history_panel_add_tags(tags)[source]
history_panel_rename(new_name)[source]
history_panel_click_to_rename()[source]
history_panel_refresh_click()[source]
history_panel_multi_operations_show()[source]
history_panel_muli_operation_select_hid(hid)[source]
history_panel_multi_operation_action_click(action)[source]
history_multi_view_display_collection_contents(collection_hid, collection_type='list')[source]
history_panel_item_click_visualization_menu(hid)[source]
history_panel_item_available_visualizations_elements(hid)[source]
history_panel_item_get_nametags(hid)[source]
history_panel_item_available_visualizations(hid)[source]
history_panel_item_click_visualization(hid, visualization_name)[source]
history_panel_item_selector(hid, wait=False)[source]
modal_body_selector()[source]
history_panel_item_body_component(hid, wait=False)[source]
hda_click_primary_action_button(hid, button_key)[source]
history_panel_click_item_title(hid, **kwds)[source]
history_panel_ensure_showing_item_details(hid)[source]
history_panel_item_showing_details(hid)[source]
collection_builder_set_name(name)[source]
collection_builder_hide_originals()[source]
collection_builder_create()[source]
collection_builder_clear_filters()[source]
collection_builder_click_paired_item(forward_or_reverse, item)[source]
logout_if_needed()[source]
run_tour(path, skip_steps=None, sleep_on_steps=None, tour_callback=None)[source]
tour_wait_for_clickable_element(selector)[source]
tour_wait_for_element_present(selector)[source]
get_tooltip_text(element, sleep=0, click_away=True)[source]
assert_selector_absent_or_hidden_after_transitions(*args, **kwds)[source]

Variant of assert_selector_absent_or_hidden that retries during transitions.

In the parent method - the element is found and then it is checked to see if it is visible. It may disappear from the page in the middle there and cause a StaleElement error. For checks where we care about the final resting state after transitions - this method can be used to retry during those transitions.

assert_absent_or_hidden_after_transitions(*args, **kwds)[source]

Variant of assert_absent_or_hidden that retries during transitions.

See details above for more information about this.

assert_tooltip_text(element, expected, sleep=0, click_away=True)[source]
assert_error_message(contains=None)[source]
assert_warning_message(contains=None)[source]
assert_no_error_message()[source]
run_tour_step(step, step_index, tour_callback)[source]
wait_for_and_click_selector(*args, **kwds)[source]
wait_for_and_click(*args, **kwds)[source]
select2_set_value(container_selector_or_elem, value, with_click=True, clear_value=False)[source]
snapshot(description)[source]

Test case subclass overrides this to provide detailed logging.

exception galaxy.selenium.navigates_galaxy.NotLoggedInException(timeout_exception, user_info)[source]

Bases: selenium.common.exceptions.TimeoutException

__init__(timeout_exception, user_info)[source]

galaxy.selenium.sizzle module

Utilities for using sizzle (jQuery-style) selectors with Selenium.

galaxy.selenium.sizzle.sizzle_selector_clickable(selector)[source]
galaxy.selenium.sizzle.sizzle_presence_of_selector(selector)[source]
galaxy.selenium.sizzle.find_element_by_sizzle(driver, sizzle_selector)[source]

Finds an element by sizzle selector. :Args:

  • sizzle_selector: The sizzle selector to use when finding element.
Usage:driver.find_element_by_sizzle(‘#foo’)
galaxy.selenium.sizzle.find_elements_by_sizzle(driver, sizzle_selector)[source]

Finds elements by sizzle selector. :Args:

  • sizzle_selector: The sizzle selector to use when finding elements.
Usage:driver.find_elements_by_sizzle(‘.foo’)

galaxy.selenium.smart_components module

class galaxy.selenium.smart_components.SmartComponent(component, has_driver)[source]

Bases: object

Wrap a Component with driver aware methods.

Allows smarter selectors that know how to wait for themselves, test themselves, click themselves, etc…. More “magic”, but much cleaner usage.

__init__(component, has_driver)[source]
class galaxy.selenium.smart_components.SmartTarget(target, has_driver)[source]

Bases: object

Wrap a Target with driver aware methods.

__init__(target, has_driver)[source]
all()[source]
wait_for_and_click(**kwds)[source]
wait_for_visible(**kwds)[source]
wait_for_clickable(**kwds)[source]
wait_for_text(**kwds)[source]
wait_for_value(**kwds)[source]
is_displayed
wait_for_absent_or_hidden(**kwds)[source]
wait_for_absent(**kwds)[source]
wait_for_present(**kwds)[source]
assert_absent(**kwds)[source]
assert_absent_or_hidden(**kwds)[source]
assert_absent_or_hidden_after_transitions(**kwds)[source]
has_class(class_name)[source]
wait_for_and_send_keys(text)[source]