Merge pull request #13196 from mvdbeek/fix_tool_id_update

[21.09] Fix tool id update when updating tool shed tools in editor
This commit is contained in:
Aysam Guerler
2022-01-19 16:26:14 -05:00
committed by GitHub
14 changed files with 80 additions and 31 deletions
@@ -171,9 +171,16 @@ export default {
},
postChanges(newVersion) {
const options = this.node.config_form;
let toolId = options.id;
let toolVersion = options.version;
if (newVersion) {
toolId = toolId.replace(toolVersion, newVersion);
toolVersion = newVersion;
console.debug("FormTool - Tool version changed.", toolId, toolVersion);
}
this.$emit("onSetData", this.node.id, {
tool_id: options.id,
tool_version: newVersion || options.version,
tool_id: toolId,
tool_version: toolVersion,
type: "tool",
inputs: Object.assign({}, this.mainValues, this.sectionValues),
});
@@ -314,6 +314,7 @@ export default {
},
setData(data) {
this.config_form = data.config_form;
this.content_id = data.content_id;
this.tool_state = data.tool_state;
this.errors = data.errors;
this.tooltip = data.tooltip || "";
@@ -326,7 +327,6 @@ export default {
},
initData(data) {
this.uuid = data.uuid;
this.content_id = data.config_form?.id || data.content_id;
this.annotation = data.annotation;
this.label = data.label;
this.setData(data);
@@ -699,6 +699,7 @@ class WorkflowsAPIController(BaseGalaxyAPIController, UsesStoredWorkflowMixin, U
'annotation': inputs.get('__annotation', ''),
'name': module.get_name(),
'tool_state': module.get_state(),
'content_id': module.get_content_id(),
'inputs': module.get_all_inputs(connectable_only=True),
'outputs': module.get_all_outputs(),
'config_form': module.get_config_form(),
+8
View File
@@ -384,6 +384,14 @@ class TestWithSeleniumMixin(GalaxyTestSeleniumContext, UsesApiTestCaseMixin):
self.assert_no_error_message()
return GALAXY_TEST_SELENIUM_ADMIN_USER_EMAIL
@retry_assertion_during_transitions
def assert_workflow_has_changes_and_save(self):
save_button = self.components.workflow_editor.save_button
save_button.wait_for_visible()
assert not save_button.has_class("disabled")
save_button.wait_for_and_click()
self.sleep_for(self.wait_types.UX_RENDER)
def workflow_upload_yaml_with_random_name(self, content, **kwds):
workflow_populator = self.workflow_populator
name = self._get_random_name()
@@ -71,7 +71,7 @@ class WorkflowEditorTestCase(SeleniumTestCase):
new_annotation = 'look new annotation'
edit_annotation.wait_for_and_send_keys(new_annotation)
self.assert_has_changes_and_save()
self.assert_workflow_has_changes_and_save()
self.workflow_index_open_with_name(name)
self.assert_wf_annotation_is(new_annotation)
@@ -84,7 +84,7 @@ class WorkflowEditorTestCase(SeleniumTestCase):
edit_name = self.components.workflow_editor.edit_name
edit_name.wait_for_and_send_keys(new_name)
self.assert_has_changes_and_save()
self.assert_workflow_has_changes_and_save()
self.workflow_index_open_with_name(new_name)
self.assert_wf_name_is(name)
@@ -104,19 +104,19 @@ class WorkflowEditorTestCase(SeleniumTestCase):
self.sleep_for(self.wait_types.UX_RENDER)
self.components.tool_form.parameter_input(parameter='select_single').wait_for_and_send_keys('e')
self.sleep_for(self.wait_types.UX_RENDER)
self.assert_has_changes_and_save()
self.assert_workflow_has_changes_and_save()
workflow = self.workflow_populator.download_workflow(workflow_id)
tool_state = json.loads(workflow['steps']['0']['tool_state'])
assert tool_state['select_single'] == 'parameter value'
# Disable optional button, resets value to null
self.components.tool_form.parameter_checkbox(parameter='select_single').wait_for_and_click()
self.assert_has_changes_and_save()
self.assert_workflow_has_changes_and_save()
workflow = self.workflow_populator.download_workflow(workflow_id)
tool_state = json.loads(workflow['steps']['0']['tool_state'])
assert tool_state['select_single'] is None
# Enable button but don't provide a value
self.components.tool_form.parameter_checkbox(parameter='select_single').wait_for_and_click()
self.assert_has_changes_and_save()
self.assert_workflow_has_changes_and_save()
workflow = self.workflow_populator.download_workflow(workflow_id)
tool_state = json.loads(workflow['steps']['0']['tool_state'])
assert tool_state['select_single'] == ""
@@ -192,7 +192,7 @@ steps:
assert textarea_column_names.get_attribute('value') == 'a\nb\nc\n'
self.set_text_element(columns, '4\n5\n6\n')
self.sleep_for(self.wait_types.UX_RENDER)
self.assert_has_changes_and_save()
self.assert_workflow_has_changes_and_save()
self.driver.refresh()
node.title.wait_for_and_click()
textarea_columns = columns.wait_for_visible()
@@ -300,7 +300,7 @@ steps:
self.workflow_editor_connect("input1#output", "first_cat#input1")
self.assert_connected("input1#output", "first_cat#input1")
self.sleep_for(self.wait_types.UX_RENDER)
self.assert_has_changes_and_save()
self.assert_workflow_has_changes_and_save()
self.workflow_index_open_with_name(name)
self.assert_connected("input1#output", "first_cat#input1")
@@ -422,7 +422,7 @@ steps:
assert self.select_dropdown_item('Switch to 0.2'), 'Switch to tool version dropdown item not found'
self.screenshot("workflow_editor_version_update")
self.sleep_for(self.wait_types.UX_RENDER)
self.assert_has_changes_and_save()
self.assert_workflow_has_changes_and_save()
workflow = self.workflow_populator.download_workflow(workflow_id)
assert workflow['steps']['0']['tool_version'] == '0.2'
@@ -435,7 +435,7 @@ steps:
self.assert_modal_has_text("Using version '0.2' instead of version '0.0.1'")
self.screenshot("workflow_editor_tool_upgrade")
self.components.workflow_editor.modal_button_continue.wait_for_and_click()
self.assert_has_changes_and_save()
self.assert_workflow_has_changes_and_save()
@selenium_test
def test_editor_subworkflow_tool_upgrade_message(self):
@@ -462,7 +462,7 @@ steps:
self.assert_modal_has_text("parameter 'inttest': an integer or workflow parameter is required")
self.screenshot("workflow_editor_subworkflow_tool_upgrade")
self.components.workflow_editor.modal_button_continue.wait_for_and_click()
self.assert_has_changes_and_save()
self.assert_workflow_has_changes_and_save()
@staticmethod
def set_text_element(element, value):
@@ -483,9 +483,9 @@ steps:
self.set_text_element(editor.label_input, 'source label')
# Select node using new label, ensures labels are synced between side panel and node
cat_node = editor.node._(label="source label")
self.assert_has_changes_and_save()
self.assert_workflow_has_changes_and_save()
editor.annotation_input.wait_for_and_send_keys("source annotation")
self.assert_has_changes_and_save()
self.assert_workflow_has_changes_and_save()
editor.configure_output(output='out_file1').wait_for_and_click()
output_label = editor.label_output(output='out_file1')
self.set_text_element(output_label, 'workflow output label')
@@ -499,7 +499,7 @@ steps:
editor.label_input.wait_for_and_send_keys('cloned label')
output_label = editor.label_output(output='out_file1')
self.set_text_element(output_label, 'cloned output label')
self.assert_has_changes_and_save()
self.assert_workflow_has_changes_and_save()
edited_workflow = self.workflow_populator.download_workflow(workflow_id)
source_step = next(iter(step for step in edited_workflow['steps'].values() if step['label'] == 'source label'))
cloned_step = next(iter(step for step in edited_workflow['steps'].values() if step['label'] == 'cloned label'))
@@ -531,7 +531,7 @@ steps:
editor.tool_menu_section_link(section_name="workflows").wait_for_and_click()
editor.workflow_link(workflow_title=child_workflow_name).wait_for_and_click()
self.sleep_for(self.wait_types.UX_RENDER)
self.assert_has_changes_and_save()
self.assert_workflow_has_changes_and_save()
workflow = self.workflow_populator.download_workflow(parent_workflow_id)
subworkflow_step = workflow['steps']['1']
assert subworkflow_step['name'] == child_workflow_name
@@ -702,14 +702,6 @@ steps:
workflow_populator.upload_yaml_workflow(content, name=name)
return name
@retry_assertion_during_transitions
def assert_has_changes_and_save(self):
save_button = self.components.workflow_editor.save_button
save_button.wait_for_visible()
assert not save_button.has_class("disabled")
save_button.wait_for_and_click()
self.sleep_for(self.wait_types.UX_RENDER)
@retry_assertion_during_transitions
def assert_wf_name_is(self, expected_name):
edit_name_element = self.components.workflow_editor.edit_name.wait_for_visible()
+1 -1
View File
@@ -1 +1 @@
include *.rst *.txt LICENSE
include *.rst *.txt LICENSE galaxy_test/base/tool_sheds_conf.xml
+3 -1
View File
@@ -38,7 +38,9 @@ ENTRY_POINTS = '''
'''
PACKAGE_DATA = {
# Be sure to update MANIFEST.in for source dist.
'galaxy': [
'galaxy': [],
'galaxy_test': [
'galaxy_test/base/tool_sheds_conf.xml',
],
}
PACKAGE_DIR = {
+1 -1
View File
@@ -5,8 +5,8 @@ import pytest
from nose.plugins.skip import SkipTest
from galaxy_test.base.populators import DatasetPopulator, skip_if_toolshed_down
from galaxy_test.base.uses_shed import CONDA_AUTO_INSTALL_JOB_TIMEOUT, UsesShed
from galaxy_test.driver import integration_util
from .uses_shed import CONDA_AUTO_INSTALL_JOB_TIMEOUT, UsesShed
FETCH_TOOL_ID = 'toolshed.g2.bx.psu.edu/repos/devteam/data_manager_fetch_genome_dbkeys_all_fasta/data_manager_fetch_genome_all_fasta_dbkey/0.0.3'
FETCH_GENOME_DBKEYS_ALL_FASTA_INPUT = {
@@ -5,8 +5,8 @@ import string
from nose.plugins.skip import SkipTest
from galaxy_test.base.populators import DatasetPopulator
from galaxy_test.base.uses_shed import CONDA_AUTO_INSTALL_JOB_TIMEOUT, UsesShed
from galaxy_test.driver import integration_util
from .uses_shed import CONDA_AUTO_INSTALL_JOB_TIMEOUT, UsesShed
FETCH_TOOL_ID = 'toolshed.g2.bx.psu.edu/repos/devteam/data_manager_fetch_genome_dbkeys_all_fasta/data_manager_fetch_genome_all_fasta_dbkey/0.0.3'
FETCH_GENOME_DBKEYS_ALL_FASTA_INPUT = {
@@ -2,9 +2,9 @@ import os
from collections import namedtuple
from galaxy_test.base.populators import DatasetPopulator
from galaxy_test.base.uses_shed import UsesShed
from galaxy_test.driver import integration_util
from tool_shed.util import hg_util
from .uses_shed import UsesShed
REPO_TYPE = namedtuple('REPO_TYPE', 'name owner changeset')
REPO = REPO_TYPE(
+1 -1
View File
@@ -1,8 +1,8 @@
import os
from galaxy_test.base.populators import skip_if_toolshed_down
from galaxy_test.base.uses_shed import UsesShed
from galaxy_test.driver import integration_util
from .uses_shed import UsesShed
class ToolShedToolTestIntegrationTestCase(integration_util.IntegrationTestCase, UsesShed):
@@ -0,0 +1,39 @@
from galaxy_test.base.uses_shed import UsesShed
from .framework import (
selenium_test,
SeleniumIntegrationTestCase
)
class WorkflowEditorToolUpgradeWithToolShedToolTestCase(SeleniumIntegrationTestCase, UsesShed):
requires_admin = True
@classmethod
def handle_galaxy_config_kwds(cls, config):
cls.configure_shed(config)
@selenium_test
def test_tool_shed_tool_update_in_workflow_editor(self):
self.install_repository("iuc", "compose_text_param", "feb3acba1e0a") # 0.1.0
self.install_repository("iuc", "compose_text_param", "e188c9826e0f") # 0.1.1
self.login()
workflow_populator = self.workflow_populator
workflow_id = workflow_populator.upload_yaml_workflow("""class: GalaxyWorkflow
inputs: []
steps:
- tool_id: compose_text_param
tool_version: 0.1.0
label: compose_text_param
""", exact_tools=True)
self.workflow_index_open()
self.workflow_index_click_option("Edit")
editor = self.components.workflow_editor
editor.node._(label="compose_text_param").wait_for_and_click()
editor.tool_version_button.wait_for_and_click()
assert self.select_dropdown_item('Switch to 0.1.1'), 'Switch to tool version dropdown item not found'
self.screenshot("workflow_editor_version_update_tool_shed")
self.sleep_for(self.wait_types.UX_RENDER)
self.assert_workflow_has_changes_and_save()
workflow = self.workflow_populator.download_workflow(workflow_id)
assert workflow['steps']['0']['tool_version'] == '0.1.1'
assert workflow['steps']['0']['tool_id'] == 'toolshed.g2.bx.psu.edu/repos/iuc/compose_text_param/compose_text_param/0.1.1'