From 4f56ba2d1d7cf7a5b2038c6b4d862d09b2db7e2b Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Sat, 30 Jan 2021 12:22:11 +0100 Subject: [PATCH] Selenium test for tool version update --- client/src/mvc/tool/tool-form-base.js | 1 + lib/galaxy/selenium/navigates_galaxy.py | 11 ++++----- lib/galaxy/selenium/navigation.yml | 1 + .../selenium/test_workflow_editor.py | 24 +++++++++++++++++++ 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/client/src/mvc/tool/tool-form-base.js b/client/src/mvc/tool/tool-form-base.js index a71f05e8210..a93b457496e 100644 --- a/client/src/mvc/tool/tool-form-base.js +++ b/client/src/mvc/tool/tool-form-base.js @@ -149,6 +149,7 @@ export default FormBase.extend({ // button for version selection var versions_button = new Ui.ButtonMenu({ icon: "fa-cubes", + cls: "btn btn-secondary float-right tool-versions", title: options.narrow ? null : "Versions", tooltip: "Select another tool version", }); diff --git a/lib/galaxy/selenium/navigates_galaxy.py b/lib/galaxy/selenium/navigates_galaxy.py index f461a851542..af5fb4edd94 100644 --- a/lib/galaxy/selenium/navigates_galaxy.py +++ b/lib/galaxy/selenium/navigates_galaxy.py @@ -1028,18 +1028,17 @@ class NavigatesGalaxy(HasDriver): workflow_button = workflow_row.find_element_by_css_selector(workflow_selector) workflow_button.click() - def workflow_index_click_option(self, option_title, workflow_index=0): - self.workflow_click_option(".workflow-dropdown", workflow_index) + def select_dropdown_item(self, option_title): menu_element = self.wait_for_selector_visible(".dropdown-menu.show") menu_options = menu_element.find_elements_by_css_selector("a.dropdown-item") - found_option = False for menu_option in menu_options: if option_title in menu_option.text: menu_option.click() - found_option = True - break + return True - if not found_option: + def workflow_index_click_option(self, option_title, workflow_index=0): + self.workflow_click_option(".workflow-dropdown", workflow_index) + if not self.select_dropdown_item(option_title): raise AssertionError("Failed to find workflow action option with title [%s]" % option_title) def workflow_index_click_tag_display(self, workflow_index=0): diff --git a/lib/galaxy/selenium/navigation.yml b/lib/galaxy/selenium/navigation.yml index 388cfcd7b12..200edcc6adb 100644 --- a/lib/galaxy/selenium/navigation.yml +++ b/lib/galaxy/selenium/navigation.yml @@ -378,6 +378,7 @@ workflow_editor: label_input: "[tour_id='__label'] input" annotation_input: "[tour_id='__annotation'] textarea" + tool_version_button: ".tool-versions" connector_for: "div[output-handle-id='${source_id}'][input-handle-id='${sink_id}']" diff --git a/lib/galaxy_test/selenium/test_workflow_editor.py b/lib/galaxy_test/selenium/test_workflow_editor.py index ffc08b0187a..69806ed72ce 100644 --- a/lib/galaxy_test/selenium/test_workflow_editor.py +++ b/lib/galaxy_test/selenium/test_workflow_editor.py @@ -298,6 +298,30 @@ steps: self.screenshot("workflow_editor_edit_menu") self.workflow_editor_click_option("Save As") + @selenium_test + def test_editor_tool_upgrade(self): + workflow_populator = self.workflow_populator + workflow_id = workflow_populator.upload_yaml_workflow("""class: GalaxyWorkflow +inputs: [] +steps: + - tool_id: multiple_versions + tool_version: 0.1 + label: multiple_versions + state: + foo: bar + """, exact_tools=True) + self.workflow_index_open() + self.workflow_index_click_option("Edit") + 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.screenshot("workflow_editor_version_update") + self.assert_has_changes_and_save() + self.sleep_for(self.wait_types.UX_RENDER) + workflow = self.workflow_populator.download_workflow(workflow_id) + assert workflow['steps']['0']['tool_version'] == '0.2' + @selenium_test def test_editor_tool_upgrade_message(self): workflow_populator = self.workflow_populator