Skip to content

Commit 4043d02

Browse files
add selenium test for workflow rerun
1 parent 505ec12 commit 4043d02

2 files changed

Lines changed: 97 additions & 0 deletions

File tree

client/src/utils/navigation/navigation.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,13 @@ workflow_run:
709709
create: '${_} .create-collection'
710710
<<: *upload_mixin
711711

712+
form_element:
713+
selectors:
714+
_: 'div.workflow-run-element[id="form-element-${index}"]'
715+
select: '${_} .multiselect'
716+
select_value: '${_} .multiselect__single'
717+
changed_value_badge: '${_} .form-input-changed-input-badge'
718+
712719
selectors:
713720
warning: '[data-description="workflow run warning"]'
714721
run_error: '[data-description="workflow run error"]'
@@ -905,6 +912,7 @@ invocations:
905912
state_details: '[data-description="workflow invocation state"]'
906913
progress_steps_note: '[data-description="workflow invocation state"] .steps-progress .progress-note'
907914
progress_jobs_note: '[data-description="workflow invocation state"] .jobs-progress .progress-note'
915+
workflow_rerun_button: '[data-button-rerun][data-title="Rerun Workflow with same inputs"]'
908916
invocation_tab:
909917
type: xpath
910918
selector: '//a[text()="${label}"]'
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
from galaxy_test.base.workflow_fixtures import WORKFLOW_SIMPLE_CAT_TWICE
2+
from .framework import (
3+
managed_history,
4+
retry_assertion_during_transitions,
5+
RunsWorkflows,
6+
selenium_test,
7+
SeleniumTestCase,
8+
UsesHistoryItemAssertions,
9+
)
10+
11+
12+
class TestWorkflowRun(SeleniumTestCase, UsesHistoryItemAssertions, RunsWorkflows):
13+
ensure_registered = True
14+
15+
@selenium_test
16+
@managed_history
17+
def test_workflow_rerun(self):
18+
# Run a workflow first
19+
self.perform_upload(self.get_filename("1.fasta"))
20+
self.wait_for_history()
21+
self.workflow_run_open_workflow(WORKFLOW_SIMPLE_CAT_TWICE)
22+
self.screenshot("workflow_run_before_rerun_ready")
23+
self.workflow_run_submit()
24+
self.sleep_for(self.wait_types.UX_TRANSITION)
25+
self.workflow_run_wait_for_ok(hid=2, expand=True)
26+
self.assert_item_summary_includes(2, "2 sequences")
27+
28+
# Keep track of the original history name
29+
original_history_name = self.history_panel_name()
30+
31+
# Create a new history, different from the original
32+
self.history_panel_create_new()
33+
self.home()
34+
self._assert_history_name_is("Unnamed history")
35+
assert self.history_panel_name() != original_history_name
36+
37+
self.screenshot("workflow_run_before_rerun_complete")
38+
39+
# Route to rerun
40+
self._invocations_panel_open_latest_invocation()
41+
self.components.invocations.workflow_rerun_button.wait_for_and_click()
42+
self.sleep_for(self.wait_types.UX_TRANSITION)
43+
44+
# Arriving on the rerun page, the history should have switched back to the original history
45+
self._assert_history_name_is(original_history_name)
46+
47+
self.screenshot("workflow_rerun_ready")
48+
49+
# Check input has the original dataset name
50+
form_element = self.components.workflow_run.form_element._(index=0)
51+
input_element_value = form_element.select_value.wait_for_visible()
52+
assert (
53+
"1: 1.fasta" in input_element_value.text
54+
), f"Expected input to be 1.fasta but got {input_element_value.text}"
55+
56+
# Change input value to latest dataset (as it would be if it wasn't a rerun)
57+
self.select_set_value(form_element.select, "2:")
58+
59+
# Find that the changed input badge exists
60+
form_element.changed_value_badge.wait_for_visible()
61+
self.screenshot("workflow_rerun_changed_input")
62+
63+
@retry_assertion_during_transitions
64+
def _assert_history_name_is(self, expected_name=None):
65+
name = self.history_panel_name()
66+
assert name == expected_name, f"History name should be {expected_name} but is {name}"
67+
68+
def _invocations_panel_open_latest_invocation(self):
69+
"""Open the latest invocation from the invocations panel."""
70+
invocations = self.components.invocations
71+
invocations.activity.wait_for_and_click()
72+
self.components.invocations.invocations_panel_list.wait_for_visible()
73+
74+
@retry_assertion_during_transitions
75+
def assert_has_row():
76+
invocations.invocations_panel_list_items.wait_for_visible()
77+
invocation_rows = invocations.invocations_panel_list_items.all()
78+
assert len(invocation_rows) > 0
79+
return invocation_rows[0]
80+
81+
assert_has_row()
82+
83+
invocations.state_details.assert_absent()
84+
details = invocations.invocations_panel_list_items.all()[0]
85+
details.click()
86+
invocations.state_details.wait_for_visible()
87+
88+
# close invocations panel
89+
invocations.activity.wait_for_and_click()

0 commit comments

Comments
 (0)