Skip to content

Commit

Permalink
Add selenium tests for workflow landing
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed Oct 20, 2024
1 parent f96792b commit 7500f4f
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 1 deletion.
2 changes: 1 addition & 1 deletion client/src/entry/analysis/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}),
},
Expand Down
7 changes: 7 additions & 0 deletions lib/galaxy/selenium/navigates_galaxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
63 changes: 63 additions & 0 deletions lib/galaxy_test/selenium/test_workflow_landing.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 7500f4f

Please sign in to comment.