Skip to content

Commit 7967817

Browse files
committed
initial test
1 parent 3251606 commit 7967817

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed

tests/e2e-playwright/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ def _(
749749
expected_states,
750750
True,
751751
None,
752-
service_version, # noqa: FBT003
752+
service_version,
753753
)
754754

755755
return _
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import logging
2+
import re
3+
from collections.abc import Callable
4+
from typing import Any, Final
5+
6+
from playwright.sync_api import Page
7+
from pydantic import AnyUrl
8+
from pytest_simcore.helpers.logging_tools import log_context
9+
from pytest_simcore.helpers.playwright import (
10+
MINUTE,
11+
RobustWebSocket,
12+
ServiceType,
13+
wait_for_service_running,
14+
)
15+
16+
_WAITING_FOR_SERVICE_TO_START: Final[int] = 5 * MINUTE
17+
_DEFAULT_RESPONSE_TO_WAIT_FOR: Final[re.Pattern] = re.compile(
18+
r"/flask/list_function_job_collections_for_functionid"
19+
)
20+
21+
22+
def test_response_surface_modeling(
23+
page: Page,
24+
create_project_from_service_dashboard: Callable[
25+
[ServiceType, str, str | None, str | None], dict[str, Any]
26+
],
27+
log_in_and_out: RobustWebSocket,
28+
service_key: str,
29+
service_version: str | None,
30+
product_url: AnyUrl,
31+
is_service_legacy: bool,
32+
):
33+
with (
34+
log_context(
35+
logging.INFO,
36+
f"Waiting for {service_key} to be responsive (waiting for {_DEFAULT_RESPONSE_TO_WAIT_FOR})",
37+
),
38+
page.expect_response(
39+
_DEFAULT_RESPONSE_TO_WAIT_FOR, timeout=_WAITING_FOR_SERVICE_TO_START
40+
),
41+
):
42+
project_data = create_project_from_service_dashboard(
43+
ServiceType.DYNAMIC, service_key, None, service_version
44+
)
45+
assert "workbench" in project_data, "Expected workbench to be in project data!"
46+
assert isinstance(
47+
project_data["workbench"], dict
48+
), "Expected workbench to be a dict!"
49+
node_ids: list[str] = list(project_data["workbench"])
50+
assert len(node_ids) == 1, "Expected 1 node in the workbench!"
51+
52+
wait_for_service_running(
53+
page=page,
54+
node_id=node_ids[0],
55+
websocket=log_in_and_out,
56+
timeout=_WAITING_FOR_SERVICE_TO_START,
57+
press_start_button=False,
58+
product_url=product_url,
59+
is_service_legacy=is_service_legacy,
60+
)

0 commit comments

Comments
 (0)