Skip to content

Commit

Permalink
🎨 improve tip e2e test (ITISFoundation#6448)
Browse files Browse the repository at this point in the history
  • Loading branch information
matusdrobuliak66 authored Sep 25, 2024
1 parent e08b486 commit 2889c20
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions packages/pytest-simcore/src/pytest_simcore/helpers/playwright.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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}"]'
Expand Down

0 comments on commit 2889c20

Please sign in to comment.