|
1 | | -from galaxy_test.base.workflow_fixtures import WORKFLOW_SIMPLE_CAT_TWICE |
| 1 | +from galaxy_test.base.workflow_fixtures import ( |
| 2 | + WORKFLOW_OPTIONAL_TRUE_INPUT_DATA, |
| 3 | + WORKFLOW_SIMPLE_CAT_TWICE, |
| 4 | +) |
2 | 5 | from .framework import ( |
3 | 6 | managed_history, |
4 | 7 | retry_assertion_during_transitions, |
@@ -136,6 +139,47 @@ def test_workflow_rerun_preserves_false_boolean_parameter(self): |
136 | 139 | self._assert_input_table_has_parameter("bool_param", "true") |
137 | 140 | self.screenshot("workflow_rerun_boolean_inputs_tab") |
138 | 141 |
|
| 142 | + @selenium_test |
| 143 | + @managed_history |
| 144 | + def test_workflow_rerun_with_unset_optional_data_input(self): |
| 145 | + """Regression test for workflow rerun crashing when an optional data_input was left empty. |
| 146 | +
|
| 147 | + When a workflow has an optional ``data_input`` step that the user did |
| 148 | + not provide on the original run, ``WorkflowInvocationRequestModel.inputs`` |
| 149 | + returns ``null`` for that step. WorkflowRunFormSimple.vue used to wrap |
| 150 | + the value as ``{values: [null]}`` regardless, which crashed the |
| 151 | + ``FormData`` mounted hook on ``"src" in null``. Because the mounted |
| 152 | + hook never completed, the bad wrapper survived in formData and was |
| 153 | + sent to the server, which rejected it with a ``DataOrCollectionRequest`` |
| 154 | + union ValidationError ("Extra inputs are not permitted in 'values'"). |
| 155 | + Reported on a "1 or 2 haplotypes" workflow where the second haplotype |
| 156 | + was left empty. |
| 157 | + """ |
| 158 | + invocations = self.components.invocations |
| 159 | + |
| 160 | + # Upload one HDA so the history isn't empty (the workflow form needs a |
| 161 | + # current history); the optional input is intentionally left unselected. |
| 162 | + self.perform_upload(self.get_filename("1.fasta")) |
| 163 | + self.wait_for_history() |
| 164 | + self.workflow_run_open_workflow(WORKFLOW_OPTIONAL_TRUE_INPUT_DATA) |
| 165 | + # Submit without touching the optional input so it goes to the server as null. |
| 166 | + self.workflow_run_submit() |
| 167 | + self.sleep_for(self.wait_types.UX_TRANSITION) |
| 168 | + self.workflow_run_wait_for_ok(hid=2, expand=True) |
| 169 | + |
| 170 | + # Submitting lands us on the new invocation page; click rerun directly. |
| 171 | + invocations.state_details.wait_for_visible() |
| 172 | + invocations.workflow_rerun_button.wait_for_and_click() |
| 173 | + self.sleep_for(self.wait_types.UX_TRANSITION) |
| 174 | + |
| 175 | + # Submit the rerun without touching anything. Pre-fix this raises a |
| 176 | + # "Workflow submission failed: ... 'values' not permitted ..." toast |
| 177 | + # because formData carries the poisoned `{values: [null]}` wrapper. |
| 178 | + self.workflow_run_submit() |
| 179 | + self.sleep_for(self.wait_types.UX_TRANSITION) |
| 180 | + self.workflow_run_wait_for_ok(hid=3, expand=True) |
| 181 | + self.screenshot("workflow_rerun_unset_optional_data_input_submitted") |
| 182 | + |
139 | 183 | @retry_assertion_during_transitions |
140 | 184 | def _assert_input_table_has_parameter(self, label: str, value: str): |
141 | 185 | table = self.wait_for_selector('[data-description="input table"]') |
|
0 commit comments