From f7a37a7203e780c0047cf3f6dc22e32aab5b3a3c Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Fri, 24 Jan 2025 08:45:36 +0100 Subject: [PATCH 1/6] added service_version fixture --- tests/e2e-playwright/tests/conftest.py | 50 +++++++++++++++---- .../tests/sim4life/test_sim4life.py | 1 + 2 files changed, 42 insertions(+), 9 deletions(-) diff --git a/tests/e2e-playwright/tests/conftest.py b/tests/e2e-playwright/tests/conftest.py index a3402b7746da..4162bfbfe95c 100644 --- a/tests/e2e-playwright/tests/conftest.py +++ b/tests/e2e-playwright/tests/conftest.py @@ -112,6 +112,13 @@ def pytest_addoption(parser: pytest.Parser) -> None: default=False, help="Whether service is a legacy service (no sidecar)", ) + group.addoption( + "--service-version", + action="store", + type=str, + default=None, + help="The service version option defines a service specific version", + ) group.addoption( "--template-id", action="store", @@ -272,6 +279,14 @@ def is_service_legacy(request: pytest.FixtureRequest) -> bool: return TypeAdapter(bool).validate_python(autoscaled) +@pytest.fixture(scope="session") +def service_version(request: pytest.FixtureRequest) -> str | None: + if key := request.config.getoption("--service-version"): + assert isinstance(key, str) + return key + return None + + @pytest.fixture(scope="session") def template_id(request: pytest.FixtureRequest) -> str | None: if key := request.config.getoption("--template-id"): @@ -438,6 +453,17 @@ def _open_with_resources(page: Page, *, click_it: bool): return open_with_resources_button +def _select_service_version(page: Page, *, version: str) -> None: + try: + # since https://github.com/ITISFoundation/osparc-simcore/pull/7060 + page.get_by_test_id("serviceSelectBox", timeout=5 * SECOND).select_option( + version + ) + except TimeoutError: + # we try the non robust way + page.get_by_label("Version").select_option(version) + + @pytest.fixture def create_new_project_and_delete( page: Page, @@ -445,6 +471,7 @@ def create_new_project_and_delete( is_product_billable: bool, api_request_context: APIRequestContext, product_url: AnyUrl, + service_version: str | None, ) -> Iterator[Callable[[tuple[RunningState], bool], dict[str, Any]]]: """The first available service currently displayed in the dashboard will be opened NOTE: cannot be used multiple times or going back to dashboard will fail!! @@ -453,12 +480,13 @@ def create_new_project_and_delete( def _( expected_states: tuple[RunningState] = (RunningState.NOT_STARTED,), + *, press_open: bool = True, template_id: str | None = None, ) -> dict[str, Any]: - assert ( - len(created_project_uuids) == 0 - ), "misuse of this fixture! only 1 study can be opened at a time. Otherwise please modify the fixture" + assert len(created_project_uuids) == 0, ( + "misuse of this fixture! only 1 study can be opened at a time. Otherwise please modify the fixture" + ) with log_context( logging.INFO, f"Open project in {product_url=} as {is_product_billable=}", @@ -479,6 +507,8 @@ def _( ): open_with_resources_clicked = False # Project detail view pop-ups shows + if service_version is not None: + _select_service_version(page, version=service_version) if press_open: open_button = page.get_by_test_id("openResource") if template_id is not None: @@ -573,9 +603,9 @@ def wait_for_done(response): response = api_request_context.delete( f"{product_url}v0/projects/{project_uuid}" ) - assert ( - response.status == 204 - ), f"Unexpected error while deleting project: '{response.json()}'" + assert response.status == 204, ( + f"Unexpected error while deleting project: '{response.json()}'" + ) # SEE https://github.com/ITISFoundation/osparc-simcore/pull/5618#discussion_r1553943415 @@ -644,7 +674,7 @@ def create_project_from_new_button( def _(plus_button_test_id: str) -> dict[str, Any]: start_study_from_plus_button(plus_button_test_id) expected_states = (RunningState.UNKNOWN,) - return create_new_project_and_delete(expected_states, False) + return create_new_project_and_delete(expected_states, press_open=False) return _ @@ -657,7 +687,9 @@ def create_project_from_template_dashboard( def _(template_id: str) -> dict[str, Any]: find_and_click_template_in_dashboard(template_id) expected_states = (RunningState.UNKNOWN,) - return create_new_project_and_delete(expected_states, True, template_id) + return create_new_project_and_delete( + expected_states, press_open=True, template_id=template_id + ) return _ @@ -676,7 +708,7 @@ def _( expected_states = (RunningState.UNKNOWN,) if service_type is ServiceType.COMPUTATIONAL: expected_states = (RunningState.NOT_STARTED,) - return create_new_project_and_delete(expected_states, True) + return create_new_project_and_delete(expected_states, press_open=True) return _ diff --git a/tests/e2e-playwright/tests/sim4life/test_sim4life.py b/tests/e2e-playwright/tests/sim4life/test_sim4life.py index 10a9ddcf97ec..5804823ebf53 100644 --- a/tests/e2e-playwright/tests/sim4life/test_sim4life.py +++ b/tests/e2e-playwright/tests/sim4life/test_sim4life.py @@ -28,6 +28,7 @@ def test_sim4life( create_project_from_new_button: Callable[[str], dict[str, Any]], log_in_and_out: RestartableWebSocket, service_key: str, + service_version: str | None, use_plus_button: bool, is_autoscaled: bool, check_videostreaming: bool, From f1665dde773d9738437bbf289b6641e6c82f3833 Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Fri, 7 Mar 2025 08:23:49 +0100 Subject: [PATCH 2/6] fix typing --- tests/e2e-playwright/tests/conftest.py | 44 +++++++++++-------- .../tests/jupyterlabs/test_jupyterlab.py | 4 +- .../tests/sim4life/test_sim4life.py | 4 +- .../tests/sleepers/test_sleepers.py | 10 ++--- 4 files changed, 34 insertions(+), 28 deletions(-) diff --git a/tests/e2e-playwright/tests/conftest.py b/tests/e2e-playwright/tests/conftest.py index 4162bfbfe95c..eec6c3a181a9 100644 --- a/tests/e2e-playwright/tests/conftest.py +++ b/tests/e2e-playwright/tests/conftest.py @@ -472,7 +472,7 @@ def create_new_project_and_delete( api_request_context: APIRequestContext, product_url: AnyUrl, service_version: str | None, -) -> Iterator[Callable[[tuple[RunningState], bool], dict[str, Any]]]: +) -> Iterator[Callable[[tuple[RunningState], bool, str | None], dict[str, Any]]]: """The first available service currently displayed in the dashboard will be opened NOTE: cannot be used multiple times or going back to dashboard will fail!! """ @@ -484,9 +484,9 @@ def _( press_open: bool = True, template_id: str | None = None, ) -> dict[str, Any]: - assert len(created_project_uuids) == 0, ( - "misuse of this fixture! only 1 study can be opened at a time. Otherwise please modify the fixture" - ) + assert ( + len(created_project_uuids) == 0 + ), "misuse of this fixture! only 1 study can be opened at a time. Otherwise please modify the fixture" with log_context( logging.INFO, f"Open project in {product_url=} as {is_product_billable=}", @@ -603,9 +603,9 @@ def wait_for_done(response): response = api_request_context.delete( f"{product_url}v0/projects/{project_uuid}" ) - assert response.status == 204, ( - f"Unexpected error while deleting project: '{response.json()}'" - ) + assert ( + response.status == 204 + ), f"Unexpected error while deleting project: '{response.json()}'" # SEE https://github.com/ITISFoundation/osparc-simcore/pull/5618#discussion_r1553943415 @@ -646,9 +646,12 @@ def _(template_id: str) -> None: @pytest.fixture def find_and_start_service_in_dashboard( page: Page, -) -> Callable[[ServiceType, str, str | None], None]: +) -> Callable[[ServiceType, str, str | None, str | None], None]: def _( - service_type: ServiceType, service_name: str, service_key_prefix: str | None + service_type: ServiceType, + service_name: str, + service_key_prefix: str | None, + service_version: str | None, ) -> None: with log_context(logging.INFO, f"Finding {service_name=} in dashboard"): page.get_by_test_id("servicesTabBtn").click() @@ -674,7 +677,7 @@ def create_project_from_new_button( def _(plus_button_test_id: str) -> dict[str, Any]: start_study_from_plus_button(plus_button_test_id) expected_states = (RunningState.UNKNOWN,) - return create_new_project_and_delete(expected_states, press_open=False) + return create_new_project_and_delete(expected_states, False) return _ @@ -683,32 +686,35 @@ def _(plus_button_test_id: str) -> dict[str, Any]: def create_project_from_template_dashboard( find_and_click_template_in_dashboard: Callable[[str], None], create_new_project_and_delete: Callable[[tuple[RunningState]], dict[str, Any]], -) -> Callable[[ServiceType, str, str | None], dict[str, Any]]: +) -> Callable[[str], dict[str, Any]]: def _(template_id: str) -> dict[str, Any]: find_and_click_template_in_dashboard(template_id) expected_states = (RunningState.UNKNOWN,) - return create_new_project_and_delete( - expected_states, press_open=True, template_id=template_id - ) + return create_new_project_and_delete(expected_states, True, template_id) return _ @pytest.fixture def create_project_from_service_dashboard( - find_and_start_service_in_dashboard: Callable[[ServiceType, str, str | None], None], + find_and_start_service_in_dashboard: Callable[ + [ServiceType, str, str | None, str | None], None + ], create_new_project_and_delete: Callable[[tuple[RunningState]], dict[str, Any]], -) -> Callable[[ServiceType, str, str | None], dict[str, Any]]: +) -> Callable[[ServiceType, str, str | None, str | None], dict[str, Any]]: def _( - service_type: ServiceType, service_name: str, service_key_prefix: str | None + service_type: ServiceType, + service_name: str, + service_key_prefix: str | None, + service_version: str | None, ) -> dict[str, Any]: find_and_start_service_in_dashboard( - service_type, service_name, service_key_prefix + service_type, service_name, service_key_prefix, service_version ) expected_states = (RunningState.UNKNOWN,) if service_type is ServiceType.COMPUTATIONAL: expected_states = (RunningState.NOT_STARTED,) - return create_new_project_and_delete(expected_states, press_open=True) + return create_new_project_and_delete(expected_states, True) return _ diff --git a/tests/e2e-playwright/tests/jupyterlabs/test_jupyterlab.py b/tests/e2e-playwright/tests/jupyterlabs/test_jupyterlab.py index fcd20bbbd042..8351c76ad104 100644 --- a/tests/e2e-playwright/tests/jupyterlabs/test_jupyterlab.py +++ b/tests/e2e-playwright/tests/jupyterlabs/test_jupyterlab.py @@ -64,7 +64,7 @@ def test_jupyterlab( page: Page, log_in_and_out: RestartableWebSocket, create_project_from_service_dashboard: Callable[ - [ServiceType, str, str | None], dict[str, Any] + [ServiceType, str, str | None, str | None], dict[str, Any] ], service_key: str, large_file_size: ByteSize, @@ -86,7 +86,7 @@ def test_jupyterlab( ), ): project_data = create_project_from_service_dashboard( - ServiceType.DYNAMIC, service_key, None + ServiceType.DYNAMIC, service_key, None, None ) assert "workbench" in project_data, "Expected workbench to be in project data!" assert isinstance( diff --git a/tests/e2e-playwright/tests/sim4life/test_sim4life.py b/tests/e2e-playwright/tests/sim4life/test_sim4life.py index 5804823ebf53..b3747da27b17 100644 --- a/tests/e2e-playwright/tests/sim4life/test_sim4life.py +++ b/tests/e2e-playwright/tests/sim4life/test_sim4life.py @@ -23,7 +23,7 @@ def test_sim4life( page: Page, create_project_from_service_dashboard: Callable[ - [ServiceType, str, str | None], dict[str, Any] + [ServiceType, str, str | None, str | None], dict[str, Any] ], create_project_from_new_button: Callable[[str], dict[str, Any]], log_in_and_out: RestartableWebSocket, @@ -39,7 +39,7 @@ def test_sim4life( project_data = create_project_from_new_button(service_key) else: project_data = create_project_from_service_dashboard( - ServiceType.DYNAMIC, service_key, None + ServiceType.DYNAMIC, service_key, None, service_version ) assert "workbench" in project_data, "Expected workbench to be in project data!" diff --git a/tests/e2e-playwright/tests/sleepers/test_sleepers.py b/tests/e2e-playwright/tests/sleepers/test_sleepers.py index 72a506ef9792..570511b158d3 100644 --- a/tests/e2e-playwright/tests/sleepers/test_sleepers.py +++ b/tests/e2e-playwright/tests/sleepers/test_sleepers.py @@ -37,9 +37,9 @@ _WAITING_FOR_CLUSTER_MAX_WAITING_TIME: Final[int] = 5 * MINUTE _WAITING_FOR_STARTED_MAX_WAITING_TIME: Final[int] = 5 * MINUTE _WAITING_FOR_SUCCESS_MAX_WAITING_TIME_PER_SLEEPER: Final[int] = 1 * MINUTE -_WAITING_FOR_FILE_NAMES_MAX_WAITING_TIME: Final[ - datetime.timedelta -] = datetime.timedelta(seconds=30) +_WAITING_FOR_FILE_NAMES_MAX_WAITING_TIME: Final[datetime.timedelta] = ( + datetime.timedelta(seconds=30) +) _WAITING_FOR_FILE_NAMES_WAIT_INTERVAL: Final[datetime.timedelta] = datetime.timedelta( seconds=1 ) @@ -82,14 +82,14 @@ def test_sleepers( page: Page, log_in_and_out: RestartableWebSocket, create_project_from_service_dashboard: Callable[ - [ServiceType, str, str | None], dict[str, Any] + [ServiceType, str, str | None, str | None], dict[str, Any] ], start_and_stop_pipeline: Callable[..., SocketIOEvent], num_sleepers: int, input_sleep_time: int | None, ): project_data = create_project_from_service_dashboard( - ServiceType.COMPUTATIONAL, "sleeper", "itis" + ServiceType.COMPUTATIONAL, "sleeper", "itis", None ) # we are now in the workbench From db433ed8f5fc2a408fe0972f60ae99c7f8bc9e06 Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Fri, 7 Mar 2025 08:43:55 +0100 Subject: [PATCH 3/6] added version for s4l --- tests/e2e-playwright/tests/conftest.py | 35 ++++++++++++---------- tests/e2e-playwright/tests/tip/conftest.py | 4 +-- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/tests/e2e-playwright/tests/conftest.py b/tests/e2e-playwright/tests/conftest.py index eec6c3a181a9..6a8f5f711a29 100644 --- a/tests/e2e-playwright/tests/conftest.py +++ b/tests/e2e-playwright/tests/conftest.py @@ -456,8 +456,8 @@ def _open_with_resources(page: Page, *, click_it: bool): def _select_service_version(page: Page, *, version: str) -> None: try: # since https://github.com/ITISFoundation/osparc-simcore/pull/7060 - page.get_by_test_id("serviceSelectBox", timeout=5 * SECOND).select_option( - version + page.get_by_test_id("serviceSelectBox").select_option( + f"serviceVersionItem_{version}" ) except TimeoutError: # we try the non robust way @@ -471,8 +471,9 @@ def create_new_project_and_delete( is_product_billable: bool, api_request_context: APIRequestContext, product_url: AnyUrl, - service_version: str | None, -) -> Iterator[Callable[[tuple[RunningState], bool, str | None], dict[str, Any]]]: +) -> Iterator[ + Callable[[tuple[RunningState], bool, str | None, str | None], dict[str, Any]] +]: """The first available service currently displayed in the dashboard will be opened NOTE: cannot be used multiple times or going back to dashboard will fail!! """ @@ -483,6 +484,7 @@ def _( *, press_open: bool = True, template_id: str | None = None, + service_version: str | None, ) -> dict[str, Any]: assert ( len(created_project_uuids) == 0 @@ -646,12 +648,11 @@ def _(template_id: str) -> None: @pytest.fixture def find_and_start_service_in_dashboard( page: Page, -) -> Callable[[ServiceType, str, str | None, str | None], None]: +) -> Callable[[ServiceType, str, str | None], None]: def _( service_type: ServiceType, service_name: str, service_key_prefix: str | None, - service_version: str | None, ) -> None: with log_context(logging.INFO, f"Finding {service_name=} in dashboard"): page.get_by_test_id("servicesTabBtn").click() @@ -671,13 +672,13 @@ def _( def create_project_from_new_button( start_study_from_plus_button: Callable[[str], None], create_new_project_and_delete: Callable[ - [tuple[RunningState], bool], dict[str, Any] + [tuple[RunningState], bool, str | None, str | None], dict[str, Any] ], ) -> Callable[[str], dict[str, Any]]: def _(plus_button_test_id: str) -> dict[str, Any]: start_study_from_plus_button(plus_button_test_id) expected_states = (RunningState.UNKNOWN,) - return create_new_project_and_delete(expected_states, False) + return create_new_project_and_delete(expected_states, False, None, None) return _ @@ -685,22 +686,24 @@ def _(plus_button_test_id: str) -> dict[str, Any]: @pytest.fixture def create_project_from_template_dashboard( find_and_click_template_in_dashboard: Callable[[str], None], - create_new_project_and_delete: Callable[[tuple[RunningState]], dict[str, Any]], + create_new_project_and_delete: Callable[ + [tuple[RunningState], bool, str | None, str | None], dict[str, Any] + ], ) -> Callable[[str], dict[str, Any]]: def _(template_id: str) -> dict[str, Any]: find_and_click_template_in_dashboard(template_id) expected_states = (RunningState.UNKNOWN,) - return create_new_project_and_delete(expected_states, True, template_id) + return create_new_project_and_delete(expected_states, True, template_id, None) return _ @pytest.fixture def create_project_from_service_dashboard( - find_and_start_service_in_dashboard: Callable[ - [ServiceType, str, str | None, str | None], None + find_and_start_service_in_dashboard: Callable[[ServiceType, str, str | None], None], + create_new_project_and_delete: Callable[ + [tuple[RunningState], bool, str | None, str | None], dict[str, Any] ], - create_new_project_and_delete: Callable[[tuple[RunningState]], dict[str, Any]], ) -> Callable[[ServiceType, str, str | None, str | None], dict[str, Any]]: def _( service_type: ServiceType, @@ -709,12 +712,14 @@ def _( service_version: str | None, ) -> dict[str, Any]: find_and_start_service_in_dashboard( - service_type, service_name, service_key_prefix, service_version + service_type, service_name, service_key_prefix ) expected_states = (RunningState.UNKNOWN,) if service_type is ServiceType.COMPUTATIONAL: expected_states = (RunningState.NOT_STARTED,) - return create_new_project_and_delete(expected_states, True) + return create_new_project_and_delete( + expected_states, True, None, service_version + ) return _ diff --git a/tests/e2e-playwright/tests/tip/conftest.py b/tests/e2e-playwright/tests/tip/conftest.py index b0d979921ed0..952c7309b507 100644 --- a/tests/e2e-playwright/tests/tip/conftest.py +++ b/tests/e2e-playwright/tests/tip/conftest.py @@ -27,12 +27,12 @@ def _( def create_tip_plan_from_dashboard( find_and_start_tip_plan_in_dashboard: Callable[[str], None], create_new_project_and_delete: Callable[ - [tuple[RunningState], bool], dict[str, Any] + [tuple[RunningState], bool, str | None, str | None], dict[str, Any] ], ) -> Callable[[str], dict[str, Any]]: def _(plan_name_test_id: str) -> dict[str, Any]: find_and_start_tip_plan_in_dashboard(plan_name_test_id) expected_states = (RunningState.UNKNOWN,) - return create_new_project_and_delete(expected_states, press_open=False) + return create_new_project_and_delete(expected_states, False, None) return _ From 3876cc513f898850b08a0ec6c900fdc783f6c4eb Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Fri, 7 Mar 2025 08:46:18 +0100 Subject: [PATCH 4/6] syntax --- tests/e2e-playwright/tests/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e-playwright/tests/conftest.py b/tests/e2e-playwright/tests/conftest.py index 6a8f5f711a29..c1a2ae958e2d 100644 --- a/tests/e2e-playwright/tests/conftest.py +++ b/tests/e2e-playwright/tests/conftest.py @@ -482,8 +482,8 @@ def create_new_project_and_delete( def _( expected_states: tuple[RunningState] = (RunningState.NOT_STARTED,), *, - press_open: bool = True, - template_id: str | None = None, + press_open: bool, + template_id: str | None, service_version: str | None, ) -> dict[str, Any]: assert ( From e21caa02dcad53ce13e4aa53bcee793ecc360694 Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Fri, 7 Mar 2025 08:50:05 +0100 Subject: [PATCH 5/6] add service version --- tests/e2e-playwright/Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/e2e-playwright/Makefile b/tests/e2e-playwright/Makefile index dfee6eb774ae..c322c21c3e8d 100644 --- a/tests/e2e-playwright/Makefile +++ b/tests/e2e-playwright/Makefile @@ -173,6 +173,12 @@ $(SLEEPERS_INPUT_FILE) $(JUPYTER_LAB_INPUT_FILE) $(CLASSIC_TIP_INPUT_FILE) $(S4L else \ read -p "Enter the service key: " SERVICE_KEY; \ echo "--service-key=$$SERVICE_KEY" >> $@; \ + 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; \ elif [ "$@" = "$(SLEEPERS_INPUT_FILE)" ]; then \ read -p "Enter the number of sleepers: " NUM_SLEEPERS; \ From d405a39c6463dd8c0dbac9bb17bad422f4eb6ca4 Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Fri, 7 Mar 2025 13:49:00 +0100 Subject: [PATCH 6/6] service version works for s4l and jupyterlab --- tests/e2e-playwright/Makefile | 6 ++++++ tests/e2e-playwright/tests/conftest.py | 18 +++++++++++------- .../tests/jupyterlabs/test_jupyterlab.py | 3 ++- tests/e2e-playwright/tests/tip/conftest.py | 2 +- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/tests/e2e-playwright/Makefile b/tests/e2e-playwright/Makefile index c322c21c3e8d..4b684cfa8230 100644 --- a/tests/e2e-playwright/Makefile +++ b/tests/e2e-playwright/Makefile @@ -161,6 +161,12 @@ $(SLEEPERS_INPUT_FILE) $(JUPYTER_LAB_INPUT_FILE) $(CLASSIC_TIP_INPUT_FILE) $(S4L if [ "$@" = "$(JUPYTER_LAB_INPUT_FILE)" ]; then \ read -p "Enter the size of the large file (human readable form e.g. 3Gib): " LARGE_FILE_SIZE; \ echo "--service-key=jupyter-math --large-file-size=$$LARGE_FILE_SIZE" >> $@; \ + 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; \ elif [ "$@" = "$(S4L_INPUT_FILE)" ]; then \ read -p "Do you want to check the videostreaming ? (requires to run with chrome/msedge) [y/n]: " VIDEOSTREAM; \ if [ "$$VIDEOSTREAM" = "y" ]; then \ diff --git a/tests/e2e-playwright/tests/conftest.py b/tests/e2e-playwright/tests/conftest.py index c1a2ae958e2d..5bf3d71a932e 100644 --- a/tests/e2e-playwright/tests/conftest.py +++ b/tests/e2e-playwright/tests/conftest.py @@ -456,9 +456,14 @@ def _open_with_resources(page: Page, *, click_it: bool): def _select_service_version(page: Page, *, version: str) -> None: try: # since https://github.com/ITISFoundation/osparc-simcore/pull/7060 - page.get_by_test_id("serviceSelectBox").select_option( - f"serviceVersionItem_{version}" - ) + with log_context(logging.INFO, msg=f"selecting version {version}"): + page.get_by_test_id("serviceSelectBox").click(timeout=5 * SECOND) + with page.expect_response( + re.compile(r"/catalog/services/.+/resources"), timeout=1.5 * 5 * SECOND + ): + page.get_by_test_id(f"serviceVersionItem_{version}").click( + timeout=5 * SECOND + ) except TimeoutError: # we try the non robust way page.get_by_label("Version").select_option(version) @@ -480,8 +485,7 @@ def create_new_project_and_delete( created_project_uuids = [] def _( - expected_states: tuple[RunningState] = (RunningState.NOT_STARTED,), - *, + expected_states: tuple[RunningState], press_open: bool, template_id: str | None, service_version: str | None, @@ -509,8 +513,6 @@ def _( ): open_with_resources_clicked = False # Project detail view pop-ups shows - if service_version is not None: - _select_service_version(page, version=service_version) if press_open: open_button = page.get_by_test_id("openResource") if template_id is not None: @@ -559,6 +561,8 @@ def wait_for_done(response): # not expected in the sim4life context though ... else: + if service_version is not None: + _select_service_version(page, version=service_version) open_button.click() if is_product_billable: _open_with_resources(page, click_it=True) diff --git a/tests/e2e-playwright/tests/jupyterlabs/test_jupyterlab.py b/tests/e2e-playwright/tests/jupyterlabs/test_jupyterlab.py index 8351c76ad104..f61d510b09b3 100644 --- a/tests/e2e-playwright/tests/jupyterlabs/test_jupyterlab.py +++ b/tests/e2e-playwright/tests/jupyterlabs/test_jupyterlab.py @@ -67,6 +67,7 @@ def test_jupyterlab( [ServiceType, str, str | None, str | None], dict[str, Any] ], service_key: str, + service_version: str | None, large_file_size: ByteSize, large_file_block_size: ByteSize, product_url: AnyUrl, @@ -86,7 +87,7 @@ def test_jupyterlab( ), ): project_data = create_project_from_service_dashboard( - ServiceType.DYNAMIC, service_key, None, None + ServiceType.DYNAMIC, service_key, None, service_version ) assert "workbench" in project_data, "Expected workbench to be in project data!" assert isinstance( diff --git a/tests/e2e-playwright/tests/tip/conftest.py b/tests/e2e-playwright/tests/tip/conftest.py index 952c7309b507..094c8b8f78e6 100644 --- a/tests/e2e-playwright/tests/tip/conftest.py +++ b/tests/e2e-playwright/tests/tip/conftest.py @@ -33,6 +33,6 @@ def create_tip_plan_from_dashboard( def _(plan_name_test_id: str) -> dict[str, Any]: find_and_start_tip_plan_in_dashboard(plan_name_test_id) expected_states = (RunningState.UNKNOWN,) - return create_new_project_and_delete(expected_states, False, None) + return create_new_project_and_delete(expected_states, False, None, None) return _