From 81897d52c442ab6bacb42a5f98e6720f7c2e51e7 Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Tue, 23 Jul 2024 10:11:49 +0200 Subject: [PATCH] improve usage --- .../e2e-playwright/tests/tip/test_ti_plan.py | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/e2e-playwright/tests/tip/test_ti_plan.py b/tests/e2e-playwright/tests/tip/test_ti_plan.py index 52f229c298e6..e721b7f5ab30 100644 --- a/tests/e2e-playwright/tests/tip/test_ti_plan.py +++ b/tests/e2e-playwright/tests/tip/test_ti_plan.py @@ -19,6 +19,7 @@ MINUTE, SECOND, app_mode_trigger_next_app, + expected_service_running, wait_for_service_running, ) @@ -158,9 +159,7 @@ def test_tip( # noqa: PLR0915 else _JLAB_MAX_STARTUP_MAX_TIME ), ) as ws_info: - # NOTE: separated calls, but dangerous as we could miss some socket event (which is highly unlikely though as the calls are one after the other) - app_mode_trigger_next_app(page) - ti_iframe = wait_for_service_running( + with expected_service_running( page=page, node_id=node_ids[1], websocket=log_in_and_out, @@ -170,7 +169,11 @@ def test_tip( # noqa: PLR0915 else _JLAB_MAX_STARTUP_MAX_TIME ), press_start_button=False, - ) + ) as service_running: + app_mode_trigger_next_app(page) + ti_iframe = service_running.iframe_locator + assert ti_iframe + jlab_websocket = ws_info.value with ( @@ -209,9 +212,7 @@ def test_tip( # noqa: PLR0915 page.get_by_test_id("outputsBtn").get_by_text(text_on_output_button).click() with log_context(logging.INFO, "Exposure Analysis step"): - # NOTE: separated calls, but dangerous as we could miss some socket event (which is highly unlikely though as the calls are one after the other) - app_mode_trigger_next_app(page) - s4l_postpro_iframe = wait_for_service_running( + with expected_service_running( page=page, node_id=node_ids[2], websocket=log_in_and_out, @@ -221,7 +222,10 @@ def test_tip( # noqa: PLR0915 else _POST_PRO_MAX_STARTUP_TIME ), press_start_button=False, - ) + ) as service_running: + app_mode_trigger_next_app(page) + s4l_postpro_iframe = service_running.iframe_locator + assert s4l_postpro_iframe with log_context(logging.INFO, "Post process"): # click on the postpro mode button