Skip to content

Commit

Permalink
Merge pull request #5882 from jmchilton/editor_tests_2
Browse files Browse the repository at this point in the history
More, better workflow editor Selenium tests - part 2.
  • Loading branch information
dannon authored Apr 13, 2018
2 parents 1bc1720 + 2cc6500 commit 6e16b77
Show file tree
Hide file tree
Showing 10 changed files with 298 additions and 138 deletions.
8 changes: 6 additions & 2 deletions client/galaxy/scripts/mvc/workflow/workflow-connector.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ $.extend(Connector.prototype, {
redraw: function() {
const handle1 = this.handle1;
const handle2 = this.handle2;
const startRibbon = handle1 && handle1.isMappedOver();
const endRibbon = handle2 && handle2.isMappedOver();
const canvasClass = `${startRibbon ? "start-ribbon" : ""} ${endRibbon ? "end-ribbon" : ""}`;
var canvas_container = $("#canvas-container");
if (!this.canvas) {
this.canvas = document.createElement("canvas");
Expand Down Expand Up @@ -71,6 +74,7 @@ $.extend(Connector.prototype, {
this.canvas.style.top = `${canvas_top}px`;
this.canvas.setAttribute("width", canvas_width);
this.canvas.setAttribute("height", canvas_height);
this.canvas.setAttribute("class", canvasClass);
// Adjust points to be relative to the canvas
start_x -= canvas_left;
start_y -= canvas_top;
Expand All @@ -84,13 +88,13 @@ $.extend(Connector.prototype, {
var start_offsets = null;
var end_offsets = null;
var num_offsets = 1;
if (handle1 && handle1.isMappedOver()) {
if (startRibbon) {
var start_offsets = [-6, -3, 0, 3, 6];
num_offsets = 5;
} else {
var start_offsets = [0];
}
if (handle2 && handle2.isMappedOver()) {
if (endRibbon) {
var end_offsets = [-6, -3, 0, 3, 6];
num_offsets = 5;
} else {
Expand Down
4 changes: 2 additions & 2 deletions client/galaxy/scripts/mvc/workflow/workflow-view-terminals.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ var BaseInputTerminalView = TerminalView.extend({
const node = options.node;
const input = options.input;
const name = input.name;
const id = `node-${node.id}-input-${name}`;
const id = `node-${node.cid}-input-${name}`;
const terminal = this.terminalForInput(input);
if (!terminal.multiple) {
this.setupMappingView(terminal);
Expand Down Expand Up @@ -179,7 +179,7 @@ var BaseOutputTerminalView = TerminalView.extend({
const node = options.node;
const output = options.output;
const name = output.name;
const id = `node-${node.id}-output-${name}`;
const id = `node-${node.cid}-output-${name}`;
const terminal = this.terminalForOutput(output);
this.setupMappingView(terminal);
this.el.terminal = terminal;
Expand Down
8 changes: 4 additions & 4 deletions templates/base/base_panels.mako
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@
<div id="left">
${self.left_panel()}
<div class="unified-panel-footer">
<div class="panel-collapse"></div>
<div class="drag"></div>
<div id="left-panel-collapse" class="panel-collapse"></div>
<div id="left-panel-drag" class="drag"></div>
</div>
</div><!--end left-->
%endif
Expand All @@ -235,8 +235,8 @@
<div id="right">
${self.right_panel()}
<div class="unified-panel-footer">
<div class="panel-collapse right"></div>
<div class="drag"></div>
<div id="right-panel-collapse" class="panel-collapse right"></div>
<div id="right-panel-drag" class="drag"></div>
</div>
</div><!--end right-->
%endif
Expand Down
8 changes: 4 additions & 4 deletions templates/webapps/galaxy/galaxy.panels.mako
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@
</div>
<div class="unified-panel-body" style="overflow: auto;"></div>
<div class="unified-panel-footer">
<div class="panel-collapse right"></span></div>
<div class="drag"></div>
<div id="left-panel-collapse" class="panel-collapse right"></span></div>
<div id="left-panel-drag" class="drag"></div>
</div>
</div>
%endif
Expand All @@ -237,8 +237,8 @@
</div>
<div class="unified-panel-body" style="overflow: auto;"></div>
<div class="unified-panel-footer">
<div class="panel-collapse right"></span></div>
<div class="drag"></div>
<div id="right-panel-collapse" class="panel-collapse right"></span></div>
<div id="right-panel-drag" class="drag"></div>
</div>
</div>
%endif
Expand Down
91 changes: 11 additions & 80 deletions test/api/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,54 +18,15 @@
wait_on,
WorkflowPopulator
)
from base.workflow_fixtures import ( # noqa: I100
WORKFLOW_NESTED_SIMPLE,
WORKFLOW_WITH_OUTPUT_COLLECTION,
WORKFLOW_WITH_OUTPUT_COLLECTION_MAPPING,
)
from galaxy.exceptions import error_codes # noqa: I201
from galaxy.tools.verify.test_data import TestDataResolver


SIMPLE_NESTED_WORKFLOW_YAML = """
class: GalaxyWorkflow
inputs:
- id: outer_input
outputs:
- id: outer_output
source: second_cat#out_file1
steps:
- tool_id: cat1
label: first_cat
state:
input1:
$link: outer_input
- run:
class: GalaxyWorkflow
inputs:
- id: inner_input
outputs:
- id: workflow_output
source: random_lines#out_file1
steps:
- tool_id: random_lines1
label: random_lines
state:
num_lines: 1
input:
$link: inner_input
seed_source:
seed_source_selector: set_seed
seed: asdf
label: nested_workflow
connect:
inner_input: first_cat#out_file1
- tool_id: cat1
label: second_cat
state:
input1:
$link: nested_workflow#workflow_output
queries:
- input2:
$link: nested_workflow#workflow_output
"""


class BaseWorkflowsApiTestCase(api.ApiTestCase):
# TODO: Find a new file for this class.

Expand Down Expand Up @@ -474,7 +435,7 @@ def get_subworkflow_content_id(workflow_id):
subworkflow_step = next(s for s in steps.values() if s["type"] == "subworkflow")
return subworkflow_step['content_id']

workflow_id = self._upload_yaml_workflow(SIMPLE_NESTED_WORKFLOW_YAML, publish=True)
workflow_id = self._upload_yaml_workflow(WORKFLOW_NESTED_SIMPLE, publish=True)
subworkflow_content_id = get_subworkflow_content_id(workflow_id)
with self._different_user():
other_import_response = self.__import_workflow(workflow_id)
Expand Down Expand Up @@ -633,21 +594,7 @@ def __run_cat_workflow(self, inputs_by):

@skip_without_tool("collection_creates_pair")
def test_workflow_run_output_collections(self):
workflow_id = self._upload_yaml_workflow("""
class: GalaxyWorkflow
steps:
- label: text_input
type: input
- label: split_up
tool_id: collection_creates_pair
state:
input1:
$link: text_input
- tool_id: collection_paired_test
state:
f1:
$link: split_up#paired_output
""")
workflow_id = self._upload_yaml_workflow(WORKFLOW_WITH_OUTPUT_COLLECTION)
with self.dataset_populator.test_history() as history_id:
hda1 = self.dataset_populator.new_dataset(history_id, content="a\nb\nc\nd\n")
inputs = {
Expand Down Expand Up @@ -779,23 +726,7 @@ def test_workflow_resume_with_mapped_over_input(self):

@skip_without_tool("collection_creates_pair")
def test_workflow_run_output_collection_mapping(self):
workflow_id = self._upload_yaml_workflow("""
class: GalaxyWorkflow
steps:
- type: input_collection
- tool_id: collection_creates_pair
state:
input1:
$link: 0
- tool_id: collection_paired_test
state:
f1:
$link: 1#paired_output
- tool_id: cat_list
state:
input1:
$link: 2#out1
""")
workflow_id = self._upload_yaml_workflow(WORKFLOW_WITH_OUTPUT_COLLECTION_MAPPING)
with self.dataset_populator.test_history() as history_id:
hdca1 = self.dataset_collection_populator.create_list_in_history(history_id, contents=["a\nb\nc\nd\n", "e\nf\ng\nh\n"]).json()
self.dataset_populator.wait_for_history(history_id, assert_ok=True)
Expand Down Expand Up @@ -990,7 +921,7 @@ def test_run_subworkflow_simple(self):
outer_input:
value: 1.bed
type: File
""" % SIMPLE_NESTED_WORKFLOW_YAML
""" % WORKFLOW_NESTED_SIMPLE
self._run_jobs(workflow_run_description, history_id=history_id)

content = self.dataset_populator.get_history_dataset_content(history_id)
Expand Down Expand Up @@ -1266,7 +1197,7 @@ def test_workflow_run_input_mapping_with_subworkflows(self):
- identifier: el2
value: 1.fastq
type: File
""" % SIMPLE_NESTED_WORKFLOW_YAML, history_id=history_id)
""" % WORKFLOW_NESTED_SIMPLE, history_id=history_id)
workflow_id = summary.workflow_id
invocation_id = summary.invocation_id
invocation_response = self._get("workflows/%s/invocations/%s" % (workflow_id, invocation_id))
Expand Down Expand Up @@ -1856,7 +1787,7 @@ def test_nested_workflow_rerun_with_use_cached_job(self):
outer_input:
value: 1.bed
type: File
""" % SIMPLE_NESTED_WORKFLOW_YAML
""" % WORKFLOW_NESTED_SIMPLE
run_jobs_summary = self._run_jobs(workflow_run_description, history_id=history_id_one)
self.dataset_populator.wait_for_history(history_id_one, assert_ok=True)
workflow_request = run_jobs_summary.workflow_request
Expand Down
134 changes: 134 additions & 0 deletions test/base/workflow_fixtures.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@

WORKFLOW_SIMPLE_CAT_TWICE = """
class: GalaxyWorkflow
inputs:
- id: input1
steps:
- tool_id: cat
label: first_cat
state:
input1:
$link: input1
queries:
- input2:
$link: input1
"""


WORKFLOW_WITH_OLD_TOOL_VERSION = """
class: GalaxyWorkflow
inputs:
- id: input1
steps:
- tool_id: multiple_versions
tool_version: "0.0.1"
state:
inttest: 8
"""


WORKFLOW_WITH_INVALID_STATE = """
class: GalaxyWorkflow
inputs:
- id: input1
steps:
- tool_id: multiple_versions
tool_version: "0.0.1"
state:
inttest: "moocow"
"""


WORKFLOW_WITH_OUTPUT_COLLECTION = """
class: GalaxyWorkflow
steps:
- label: text_input
type: input
- label: split_up
tool_id: collection_creates_pair
state:
input1:
$link: text_input
- tool_id: collection_paired_test
state:
f1:
$link: split_up#paired_output
"""


WORKFLOW_SIMPLE_MAPPING = """
class: GalaxyWorkflow
inputs:
- id: input1
type: data_collection_input
collection_type: list
steps:
- tool_id: cat
label: cat
state:
input1:
$link: input1
"""


WORKFLOW_WITH_OUTPUT_COLLECTION_MAPPING = """
class: GalaxyWorkflow
steps:
- type: input_collection
- tool_id: collection_creates_pair
state:
input1:
$link: 0
- tool_id: collection_paired_test
state:
f1:
$link: 1#paired_output
- tool_id: cat_list
state:
input1:
$link: 2#out1
"""


WORKFLOW_NESTED_SIMPLE = """
class: GalaxyWorkflow
inputs:
- id: outer_input
outputs:
- id: outer_output
source: second_cat#out_file1
steps:
- tool_id: cat1
label: first_cat
state:
input1:
$link: outer_input
- run:
class: GalaxyWorkflow
inputs:
- id: inner_input
outputs:
- id: workflow_output
source: random_lines#out_file1
steps:
- tool_id: random_lines1
label: random_lines
state:
num_lines: 1
input:
$link: inner_input
seed_source:
seed_source_selector: set_seed
seed: asdf
label: nested_workflow
connect:
inner_input: first_cat#out_file1
- tool_id: cat1
label: second_cat
state:
input1:
$link: nested_workflow#workflow_output
queries:
- input2:
$link: nested_workflow#workflow_output
"""
Loading

0 comments on commit 6e16b77

Please sign in to comment.