Skip to content

Commit 3200fe2

Browse files
matusdrobuliak66mrnicegyu11
authored andcommitted
🐛 fix tip e2e test (ITISFoundation#6458)
1 parent f01b218 commit 3200fe2

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

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

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
from enum import Enum, unique
99
from typing import Any, Final
1010

11-
from playwright.sync_api import FrameLocator, Page, Request, WebSocket
11+
from playwright.sync_api import FrameLocator, Page, Request
12+
from playwright.sync_api import TimeoutError as PlaywrightTimeoutError
13+
from playwright.sync_api import WebSocket
1214
from pytest_simcore.helpers.logging_tools import log_context
1315

1416
SECOND: Final[int] = 1000
@@ -194,6 +196,7 @@ def __call__(self, message: str) -> None:
194196
class SocketIONodeProgressCompleteWaiter:
195197
node_id: str
196198
logger: logging.Logger
199+
_last_call_return: bool = False
197200
_current_progress: dict[NodeProgressType, float] = field(
198201
default_factory=defaultdict
199202
)
@@ -226,20 +229,19 @@ def __call__(self, message: str) -> bool:
226229
f"{json.dumps({k:round(v,1) for k,v in self._current_progress.items()})}",
227230
)
228231

229-
return all(
232+
self._last_call_return = all(
230233
progress_type in self._current_progress
231234
for progress_type in NodeProgressType.required_types_for_started_service()
232235
) and all(
233236
round(progress, 1) == 1.0
234237
for progress in self._current_progress.values()
235238
)
236-
239+
return self._last_call_return
240+
self._last_call_return = False
237241
return False
238242

239-
def is_progress_succesfully_finished(self) -> bool:
240-
return all(
241-
round(progress, 1) == 1.0 for progress in self._current_progress.values()
242-
)
243+
def get_last_call_return(self):
244+
return self._last_call_return
243245

244246
def get_current_progress(self):
245247
return self._current_progress.values()
@@ -340,17 +342,18 @@ def expected_service_running(
340342
with websocket.expect_event("framereceived", waiter, timeout=timeout):
341343
if press_start_button:
342344
_trigger_service_start(page, node_id)
343-
except TimeoutError:
344-
if waiter.is_progress_succesfully_finished() is False:
345+
346+
yield service_running
347+
348+
except PlaywrightTimeoutError:
349+
if waiter.get_last_call_return() is False:
345350
ctx.logger.warning(
346-
"⚠️ Progress bar didn't receive 100 percent: %s ⚠️", # https://github.com/ITISFoundation/osparc-simcore/issues/6449
351+
"⚠️ Progress bar didn't receive 100 percent: %s ⚠️", # https://github.com/ITISFoundation/osparc-simcore/issues/6449
347352
waiter.get_current_progress(),
348353
)
349354
else:
350355
raise
351356

352-
yield service_running
353-
354357
service_running.iframe_locator = page.frame_locator(
355358
f'[osparc-test-id="iframe_{node_id}"]'
356359
)

0 commit comments

Comments
 (0)