Skip to content

Commit fc62ac0

Browse files
authored
♻️E2e: definite fix to ensure idle timeout is always smaller than waiting timeout (#7637)
1 parent 21fce72 commit fc62ac0

File tree

6 files changed

+8
-18
lines changed

6 files changed

+8
-18
lines changed

packages/pytest-simcore/src/pytest_simcore/helpers/playwright.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from dataclasses import dataclass, field
1414
from datetime import UTC, datetime, timedelta
1515
from enum import Enum, unique
16-
from pathlib import Path
1716
from typing import Any, Final
1817

1918
import arrow
@@ -590,7 +589,6 @@ def expected_service_running(
590589
press_start_button: bool,
591590
product_url: AnyUrl,
592591
is_service_legacy: bool,
593-
assertion_output_folder: Path,
594592
) -> Generator[ServiceRunning, None, None]:
595593
started = arrow.utcnow()
596594
with contextlib.ExitStack() as stack:
@@ -610,6 +608,10 @@ def expected_service_running(
610608
waiter = SocketIONodeProgressCompleteWaiter(
611609
node_id=node_id,
612610
logger=ctx.logger,
611+
max_idle_timeout=min(
612+
_SOCKET_IO_NODE_PROGRESS_WAITER_MAX_IDLE_TIMEOUT,
613+
timedelta(seconds=timeout / 1000 - 10),
614+
),
613615
)
614616
stack.enter_context(
615617
websocket.expect_event("framereceived", waiter, timeout=timeout)
@@ -647,7 +649,6 @@ def wait_for_service_running(
647649
press_start_button: bool,
648650
product_url: AnyUrl,
649651
is_service_legacy: bool,
650-
assertion_output_folder: Path,
651652
) -> FrameLocator:
652653
"""NOTE: if the service was already started this will not work as some of the required websocket events will not be emitted again
653654
In which case this will need further adjutment"""
@@ -669,6 +670,10 @@ def wait_for_service_running(
669670
waiter = SocketIONodeProgressCompleteWaiter(
670671
node_id=node_id,
671672
logger=ctx.logger,
673+
max_idle_timeout=min(
674+
_SOCKET_IO_NODE_PROGRESS_WAITER_MAX_IDLE_TIMEOUT,
675+
timedelta(seconds=timeout / 1000 - 10),
676+
),
672677
)
673678
stack.enter_context(
674679
websocket.expect_event("framereceived", waiter, timeout=timeout)

packages/pytest-simcore/src/pytest_simcore/helpers/playwright_sim4life.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import logging
33
import re
44
from dataclasses import dataclass
5-
from pathlib import Path
65
from typing import Final, TypedDict
76

87
import arrow
@@ -108,7 +107,6 @@ def wait_for_launched_s4l(
108107
copy_workspace: bool,
109108
product_url: AnyUrl,
110109
is_service_legacy: bool,
111-
assertion_output_folder: Path,
112110
) -> WaitForS4LDict:
113111
with log_context(logging.INFO, "launch S4L") as ctx:
114112
predicate = S4LWaitForWebsocket(logger=ctx.logger)
@@ -136,7 +134,6 @@ def wait_for_launched_s4l(
136134
press_start_button=False,
137135
product_url=product_url,
138136
is_service_legacy=is_service_legacy,
139-
assertion_output_folder=assertion_output_folder,
140137
)
141138
s4l_websocket = ws_info.value
142139
ctx.logger.info("acquired S4L websocket!")

tests/e2e-playwright/tests/jupyterlabs/test_jupyterlab.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import re
1212
from collections.abc import Callable
1313
from dataclasses import dataclass
14-
from pathlib import Path
1514
from typing import Any, Final, Literal
1615

1716
from playwright.sync_api import Page, WebSocket
@@ -73,7 +72,6 @@ def test_jupyterlab(
7372
large_file_block_size: ByteSize,
7473
product_url: AnyUrl,
7574
is_service_legacy: bool,
76-
playwright_test_results_dir: Path,
7775
):
7876
# NOTE: this waits for the jupyter to send message, but is not quite enough
7977
with (
@@ -106,7 +104,6 @@ def test_jupyterlab(
106104
press_start_button=False,
107105
product_url=product_url,
108106
is_service_legacy=is_service_legacy,
109-
assertion_output_folder=playwright_test_results_dir,
110107
)
111108

112109
iframe = page.frame_locator("iframe")

tests/e2e-playwright/tests/sim4life/test_sim4life.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99

1010
from collections.abc import Callable
11-
from pathlib import Path
1211
from typing import Any
1312

1413
from playwright.sync_api import Page
@@ -35,7 +34,6 @@ def test_sim4life(
3534
check_videostreaming: bool,
3635
product_url: AnyUrl,
3736
is_service_legacy: bool,
38-
playwright_test_results_dir: Path,
3937
):
4038
if use_plus_button:
4139
project_data = create_project_from_new_button(service_key)
@@ -59,7 +57,6 @@ def test_sim4life(
5957
copy_workspace=False,
6058
product_url=product_url,
6159
is_service_legacy=is_service_legacy,
62-
assertion_output_folder=playwright_test_results_dir,
6360
)
6461
s4l_websocket = resp["websocket"]
6562
s4l_iframe = resp["iframe"]

tests/e2e-playwright/tests/sim4life/test_template.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99

1010
from collections.abc import Callable
11-
from pathlib import Path
1211
from typing import Any
1312

1413
from playwright.sync_api import Page
@@ -30,7 +29,6 @@ def test_template(
3029
check_videostreaming: bool,
3130
product_url: AnyUrl,
3231
is_service_legacy: bool,
33-
playwright_test_results_dir: Path,
3432
):
3533
project_data = create_project_from_template_dashboard(template_id)
3634

@@ -49,7 +47,6 @@ def test_template(
4947
copy_workspace=True,
5048
product_url=product_url,
5149
is_service_legacy=is_service_legacy,
52-
assertion_output_folder=playwright_test_results_dir,
5350
)
5451
s4l_websocket = resp["websocket"]
5552
s4l_iframe = resp["iframe"]

tests/e2e-playwright/tests/tip/test_ti_plan.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ def test_classic_ti_plan( # noqa: PLR0915
161161
press_start_button=False,
162162
product_url=product_url,
163163
is_service_legacy=is_service_legacy,
164-
assertion_output_folder=playwright_test_results_dir,
165164
)
166165
# NOTE: Sometimes this iframe flicks and shows a white page. This wait will avoid it
167166
page.wait_for_timeout(_ELECTRODE_SELECTOR_FLICKERING_WAIT_TIME)
@@ -227,7 +226,6 @@ def test_classic_ti_plan( # noqa: PLR0915
227226
press_start_button=False,
228227
product_url=product_url,
229228
is_service_legacy=is_service_legacy,
230-
assertion_output_folder=playwright_test_results_dir,
231229
) as service_running:
232230
app_mode_trigger_next_app(page)
233231
ti_iframe = service_running.iframe_locator
@@ -345,7 +343,6 @@ def test_classic_ti_plan( # noqa: PLR0915
345343
press_start_button=False,
346344
product_url=product_url,
347345
is_service_legacy=is_service_legacy,
348-
assertion_output_folder=playwright_test_results_dir,
349346
) as service_running:
350347
app_mode_trigger_next_app(page)
351348
s4l_postpro_iframe = service_running.iframe_locator

0 commit comments

Comments
 (0)