Skip to content

Commit

Permalink
selenium test for the upgrade all activity
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Nov 27, 2024
1 parent 5a5b7ce commit 066ff43
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 8 deletions.
4 changes: 3 additions & 1 deletion client/src/components/Tool/ToolCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ const showHelpForum = computed(() => isConfigLoaded.value && config.value.enable
<Heading h1 inline bold size="text" itemprop="name">{{ props.title }}</Heading>
</span>
<span itemprop="description">{{ props.description }}</span>
<span>(Galaxy Version {{ props.version }})</span>
<span data-description="galaxy tool version" :data-version="props.version"
>(Galaxy Version {{ props.version }})</span
>
</div>
<div class="d-flex flex-nowrap align-items-start flex-gapx-1">
<b-button-group class="tool-card-buttons">
Expand Down
2 changes: 2 additions & 0 deletions client/src/utils/navigation/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ registration:

tool_form:
selectors:
tool_version: '[data-description="galaxy tool version"]'
options: '.tool-dropdown'
execute: 'button#execute'
parameter_div: 'div.ui-form-element[id="form-element-${parameter}"]'
Expand Down Expand Up @@ -743,6 +744,7 @@ workflow_editor:
delete_selection: "[title='delete selected']"
auto_layout: "#auto-layout-button"
changes: "#activity-workflow-undo-redo"
upgrade_all: "#activity-workflow-upgrade"
comment:
selectors:
_: ".workflow-editor-comment"
Expand Down
26 changes: 26 additions & 0 deletions lib/galaxy/selenium/navigates_galaxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
GALAXY_VISUALIZATION_FRAME_ID = "galaxy_visualization"

WaitType = collections.namedtuple("WaitType", ["name", "default_length"])
EditorNodeReference = Union[int, str] # can reference nodes by order_index (starting at 0 as int or label)


class HistoryEntry(NamedTuple):
Expand Down Expand Up @@ -1211,6 +1212,31 @@ def workflow_editor_set_license(self, license: str) -> None:
license_selector_option = self.components.workflow_editor.license_selector_option
license_selector_option.wait_for_and_click()

def workflow_editor_add_tool_step(self, tool_id: str):
self.tool_open(tool_id)

def workflow_editor_set_label(self, label: str, node: Optional[EditorNodeReference] = None):
editor = self.components.workflow_editor
self.workflow_editor_ensure_tool_form_open(node)
self.set_text_element(editor.label_input, label)

def workflow_editor_set_tool_vesrion(self, version: str, node: Optional[EditorNodeReference] = None) -> None:
editor = self.components.workflow_editor
self.workflow_editor_ensure_tool_form_open(node)
editor.tool_version_button.wait_for_and_click()
assert self.select_dropdown_item(f"Switch to {version}"), "Switch to tool version dropdown item not found"

def workflow_editor_ensure_tool_form_open(self, node: Optional[EditorNodeReference] = None):
# if node is_empty just assume current tool step is open
editor = self.components.workflow_editor
if node is not None:
if isinstance(node, int):
node = editor.node.by_id(id=node)
else:
node = editor.node._(label=node)
node.wait_for_and_click()
editor.node_inspector.wait_for_visible()

def workflow_editor_click_option(self, option_label):
self.workflow_editor_click_options()
menu_element = self.workflow_editor_options_menu_element()
Expand Down
26 changes: 19 additions & 7 deletions lib/galaxy_test/selenium/test_workflow_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,9 +530,7 @@ def test_editor_tool_upgrade(self):
self.workflow_index_open()
self.components.workflows.edit_button.wait_for_and_click()
editor = self.components.workflow_editor
editor.node._(label="multiple_versions").wait_for_and_click()
editor.tool_version_button.wait_for_and_click()
assert self.select_dropdown_item("Switch to 0.2"), "Switch to tool version dropdown item not found"
self.workflow_editor_set_tool_vesrion("multiple_versions", "0.2")
self.screenshot("workflow_editor_version_update")
self.sleep_for(self.wait_types.UX_RENDER)
self.assert_workflow_has_changes_and_save()
Expand All @@ -547,6 +545,22 @@ def test_editor_tool_upgrade(self):
workflow = self.workflow_populator.download_workflow(workflow_id)
assert workflow["steps"]["0"]["tool_version"] == "0.1+galaxy6"

@selenium_test
def test_editor_tool_upgrade_all_tools(self):
editor = self.components.workflow_editor
annotation = "upgarde_all_test"
name = self.workflow_create_new(annotation=annotation)
self.workflow_editor_add_tool_step("multiple_versions")
self.workflow_editor_set_label(label="target label")
self.workflow_editor_set_tool_vesrion("0.1")
self.assert_workflow_has_changes_and_save()

editor.tool_bar.upgrade_all.wait_for_and_click()
self.workflow_editor_ensure_tool_form_open(node=0)
node = self.components.tool_form.tool_version.wait_for_present()
version = node.get_attribute("data-version")
assert version == "0.2"

@selenium_test
def test_editor_tool_upgrade_message(self):
workflow_populator = self.workflow_populator
Expand Down Expand Up @@ -719,9 +733,7 @@ def test_editor_duplicate_node(self):
self.workflow_index_open()
self.components.workflows.edit_button.wait_for_and_click()
editor = self.components.workflow_editor
cat_node = editor.node._(label="first_cat")
cat_node.wait_for_and_click()
self.set_text_element(editor.label_input, "source label")
self.workflow_editor_set_label(label="source label", node="first_cat")
# Select node using new label, ensures labels are synced between side panel and node
cat_node = editor.node._(label="source label")
self.assert_workflow_has_changes_and_save()
Expand Down Expand Up @@ -1270,7 +1282,7 @@ def test_editor_selection(self):
canvas = editor.canvas_body.wait_for_visible()

# place tool in center of canvas
self.tool_open("cat")
self.workflow_editor_add_tool_step("cat")
self.sleep_for(self.wait_types.UX_RENDER)
editor.label_input.wait_for_and_send_keys("tool_node")
tool_node = editor.node._(label="tool_node").wait_for_present()
Expand Down

0 comments on commit 066ff43

Please sign in to comment.