From 420e89313058d43cf12f15c2e8f8c9b2d645404e Mon Sep 17 00:00:00 2001 From: John Chilton Date: Wed, 27 Nov 2024 15:47:17 -0500 Subject: [PATCH] selenium test for the upgrade all activity --- client/src/components/Tool/ToolCard.vue | 4 ++- client/src/utils/navigation/navigation.yml | 2 ++ lib/galaxy/selenium/navigates_galaxy.py | 26 +++++++++++++++++++ .../selenium/test_workflow_editor.py | 26 ++++++++++++++----- 4 files changed, 50 insertions(+), 8 deletions(-) diff --git a/client/src/components/Tool/ToolCard.vue b/client/src/components/Tool/ToolCard.vue index f09527328008..21e12c9cfce3 100644 --- a/client/src/components/Tool/ToolCard.vue +++ b/client/src/components/Tool/ToolCard.vue @@ -127,7 +127,9 @@ const showHelpForum = computed(() => isConfigLoaded.value && config.value.enable {{ props.title }} {{ props.description }} - (Galaxy Version {{ props.version }}) + (Galaxy Version {{ props.version }})
diff --git a/client/src/utils/navigation/navigation.yml b/client/src/utils/navigation/navigation.yml index 7352b9296bd6..2ae8f1a5dc69 100644 --- a/client/src/utils/navigation/navigation.yml +++ b/client/src/utils/navigation/navigation.yml @@ -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}"]' @@ -745,6 +746,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" diff --git a/lib/galaxy/selenium/navigates_galaxy.py b/lib/galaxy/selenium/navigates_galaxy.py index 597132597d7f..03e63b332b5a 100644 --- a/lib/galaxy/selenium/navigates_galaxy.py +++ b/lib/galaxy/selenium/navigates_galaxy.py @@ -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): @@ -1227,6 +1228,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() diff --git a/lib/galaxy_test/selenium/test_workflow_editor.py b/lib/galaxy_test/selenium/test_workflow_editor.py index e13a7f547c20..0c1918fda94b 100644 --- a/lib/galaxy_test/selenium/test_workflow_editor.py +++ b/lib/galaxy_test/selenium/test_workflow_editor.py @@ -606,9 +606,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("0.2", node="multiple_versions") self.screenshot("workflow_editor_version_update") self.sleep_for(self.wait_types.UX_RENDER) self.assert_workflow_has_changes_and_save() @@ -623,6 +621,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" + 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 @@ -795,9 +809,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() @@ -1346,7 +1358,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()