Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions tests/e2e-playwright/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,10 @@ SLEEPERS_INPUT_FILE := .e2e-playwright-sleepers-env.txt
S4L_INPUT_FILE := .e2e-playwright-sim4life-env.txt
JUPYTER_LAB_INPUT_FILE := .e2e-playwright-jupyterlab-env.txt
CLASSIC_TIP_INPUT_FILE := .e2e-playwright-classictip-env.txt
RSM_INPUT_FILE := .e2e-playwright-rsm-env.txt

# Prompt the user for input and store it into variables
$(SLEEPERS_INPUT_FILE) $(JUPYTER_LAB_INPUT_FILE) $(CLASSIC_TIP_INPUT_FILE) $(S4L_INPUT_FILE):
$(SLEEPERS_INPUT_FILE) $(JUPYTER_LAB_INPUT_FILE) $(CLASSIC_TIP_INPUT_FILE) $(S4L_INPUT_FILE) $(RSM_INPUT_FILE):
@read -p "Enter your product URL: " PRODUCT_URL; \
read -p "Is the product billable [y/n]: " BILLABLE; \
read -p "Is the product lite [y/n]: " IS_LITE; \
Expand Down Expand Up @@ -189,6 +190,20 @@ $(SLEEPERS_INPUT_FILE) $(JUPYTER_LAB_INPUT_FILE) $(CLASSIC_TIP_INPUT_FILE) $(S4L
elif [ "$@" = "$(SLEEPERS_INPUT_FILE)" ]; then \
read -p "Enter the number of sleepers: " NUM_SLEEPERS; \
echo "--num-sleepers=$$NUM_SLEEPERS" >> $@; \
elif [ "$@" = "$(RSM_INPUT_FILE)" ]; then \
read -p "Enter the service key (default to mmux-vite-app-sumo-write): " SERVICE_KEY; \
if [ -z "$$SERVICE_KEY" ]; then \
echo "No service key specified, using default."; \
echo "--service-key=mmux-vite-app-sumo-write" >> $@; \
else \
echo "--service-key=$$SERVICE_KEY" >> $@; \
fi; \
read -p "Enter the service version (default to latest): " SERVICE_VERSION; \
if [ -z "$$SERVICE_VERSION" ]; then \
echo "No service version specified, using default."; \
else \
echo "--service-version=$$SERVICE_VERSION" >> $@; \
fi; \
fi

# Run the tests
Expand All @@ -202,7 +217,10 @@ test-jupyterlab-anywhere: _check_venv_active $(JUPYTER_LAB_INPUT_FILE) ## run ju
@$(call run_test, $(JUPYTER_LAB_INPUT_FILE), tests/jupyterlabs/test_jupyterlab.py)

test-tip-anywhere: _check_venv_active $(CLASSIC_TIP_INPUT_FILE) ## run classic tip test and cache settings
$(call run_test, $(CLASSIC_TIP_INPUT_FILE), tests/tip/test_ti_plan.py)
@$(call run_test, $(CLASSIC_TIP_INPUT_FILE), tests/tip/test_ti_plan.py)

test-response-surface-modeling-anywhere: _check_venv_active $(RSM_INPUT_FILE) ## run response surface modeling test and cache settings
@$(call run_test, $(RSM_INPUT_FILE), tests/metamodeling/test_response_surface_modeling.py)

# Define the common test running function
define run_test
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e-playwright/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ def _(
expected_states,
True,
None,
service_version, # noqa: FBT003
service_version,
)

return _
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import logging
import re
from collections.abc import Callable
from typing import Any, Final

from playwright.sync_api import Page
from pydantic import AnyUrl
from pytest_simcore.helpers.logging_tools import log_context
from pytest_simcore.helpers.playwright import (
MINUTE,
RobustWebSocket,
ServiceType,
wait_for_service_running,
)

_WAITING_FOR_SERVICE_TO_START: Final[int] = 5 * MINUTE
_DEFAULT_RESPONSE_TO_WAIT_FOR: Final[re.Pattern] = re.compile(
r"/flask/list_function_job_collections_for_functionid"
)


def test_response_surface_modeling(
page: Page,
create_project_from_service_dashboard: Callable[
[ServiceType, str, str | None, str | None], dict[str, Any]
],
log_in_and_out: RobustWebSocket,
service_key: str,
service_version: str | None,
product_url: AnyUrl,
is_service_legacy: bool,
):
with (
log_context(
logging.INFO,
f"Waiting for {service_key} to be responsive (waiting for {_DEFAULT_RESPONSE_TO_WAIT_FOR})",
),
page.expect_response(
_DEFAULT_RESPONSE_TO_WAIT_FOR, timeout=_WAITING_FOR_SERVICE_TO_START
),
):
project_data = create_project_from_service_dashboard(
ServiceType.DYNAMIC, service_key, None, service_version
)
assert "workbench" in project_data, "Expected workbench to be in project data!"
assert isinstance(
project_data["workbench"], dict
), "Expected workbench to be a dict!"
node_ids: list[str] = list(project_data["workbench"])
assert len(node_ids) == 1, "Expected 1 node in the workbench!"

wait_for_service_running(
page=page,
node_id=node_ids[0],
websocket=log_in_and_out,
timeout=_WAITING_FOR_SERVICE_TO_START,
press_start_button=False,
product_url=product_url,
is_service_legacy=is_service_legacy,
)
Loading