From d5879db0c0e1974a00c1287e9c919ab4bac7aecf Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Sat, 19 Oct 2024 17:02:57 +0200 Subject: [PATCH] Add selenium tests for workflow landing --- client/src/entry/analysis/router.js | 2 +- lib/galaxy/selenium/navigates_galaxy.py | 7 +++ .../selenium/test_workflow_landing.py | 63 +++++++++++++++++++ 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 lib/galaxy_test/selenium/test_workflow_landing.py diff --git a/client/src/entry/analysis/router.js b/client/src/entry/analysis/router.js index 5c8cb8177e18..6b1b3ff50b51 100644 --- a/client/src/entry/analysis/router.js +++ b/client/src/entry/analysis/router.js @@ -506,7 +506,7 @@ export function getRouter(Galaxy) { component: WorkflowLanding, props: (route) => ({ uuid: route.params.uuid, - public: !!route.query.public, + public: route.query.public.toLowerCase() === "true", secret: route.query.client_secret, }), }, diff --git a/lib/galaxy/selenium/navigates_galaxy.py b/lib/galaxy/selenium/navigates_galaxy.py index 49fcea2e1260..118248fe0d66 100644 --- a/lib/galaxy/selenium/navigates_galaxy.py +++ b/lib/galaxy/selenium/navigates_galaxy.py @@ -299,6 +299,13 @@ def home(self) -> None: except SeleniumTimeoutException as e: raise ClientBuildException(e) + def go_to_workflow_landing(self, uuid: str, public: Literal["false", "true"], client_secret: Optional[str]): + path = f"workflow_landings/{uuid}?public={public}" + if client_secret: + path = f"{path}&client_secret={client_secret}" + self.driver.get(self.build_url(path)) + self.components.workflow_run.run_workflow.wait_for_visible() + def go_to_trs_search(self) -> None: self.driver.get(self.build_url("workflows/trs_search")) self.components.masthead._.wait_for_visible() diff --git a/lib/galaxy_test/selenium/test_workflow_landing.py b/lib/galaxy_test/selenium/test_workflow_landing.py new file mode 100644 index 000000000000..9927c383bb5e --- /dev/null +++ b/lib/galaxy_test/selenium/test_workflow_landing.py @@ -0,0 +1,63 @@ +from typing import Literal + +from galaxy.schema.schema import CreateWorkflowLandingRequestPayload +from .framework import ( + managed_history, + RunsWorkflows, + selenium_test, + SeleniumTestCase, +) + + +class TestWorkflowLanding(SeleniumTestCase, RunsWorkflows): + ensure_registered = True + + @selenium_test + @managed_history + def test_private_request(self): + self._create_landing_and_run(public="false") + + @selenium_test + @managed_history + def test_pubblic_request(self): + self._create_landing_and_run(public="true") + + def _create_landing_and_run(self, public: Literal["false", "true"]): + self.perform_upload(self.get_filename("1.txt")) + self.wait_for_history() + workflow_id = self.workflow_populator.upload_yaml_workflow( + """ +class: GalaxyWorkflow +inputs: + input_int: integer + input_data: data +steps: + simple_constructs: + tool_id: simple_constructs + label: tool_exec + in: + inttest: input_int + files_0|file: input_data +""", + name=self._get_random_name("landing_wf"), + ) + if public == "true": + client_secret = None + else: + client_secret = "abcdefg" + landing_request_payload = CreateWorkflowLandingRequestPayload( + workflow_id=workflow_id, + workflow_target_type="stored_workflow", + request_state={"input_int": 321123}, + public=public, + client_secret=client_secret, + ) + landing_request = self.dataset_populator.create_workflow_landing(landing_request_payload) + self.go_to_workflow_landing(str(landing_request.uuid), public="false", client_secret=client_secret) + self.screenshot("workflow_run_private_landing") + self.workflow_run_submit() + output_hid = 2 + self.workflow_run_wait_for_ok(hid=output_hid) + history_id = self.current_history_id() + content = self.dataset_populator.get_history_dataset_content(history_id, hid=output_hid) + assert "321123" in content, content