Skip to content

Commit

Permalink
✅ e2e: Final touches to tip testing (#6459)
Browse files Browse the repository at this point in the history
  • Loading branch information
pcrespov authored Sep 27, 2024
1 parent a50d80c commit 9609abd
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions packages/pytest-simcore/src/pytest_simcore/helpers/playwright.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ def __call__(self, message: str) -> None:
class SocketIONodeProgressCompleteWaiter:
node_id: str
logger: logging.Logger
_last_call_return: bool = False
_current_progress: dict[NodeProgressType, float] = field(
default_factory=defaultdict
)
Expand Down Expand Up @@ -224,24 +223,24 @@ def __call__(self, message: str) -> bool:
self._current_progress[
node_progress_event.progress_type
] = new_progress

self.logger.info(
"current startup progress: %s",
"Current startup progress [expected number of node-progress-types=%d]: %s",
NodeProgressType.required_types_for_started_service(),
f"{json.dumps({k:round(v,1) for k,v in self._current_progress.items()})}",
)

self._last_call_return = all(
progress_type in self._current_progress
for progress_type in NodeProgressType.required_types_for_started_service()
) and all(
return self.got_expected_node_progress_types() and all(
round(progress, 1) == 1.0
for progress in self._current_progress.values()
)
return self._last_call_return
self._last_call_return = False
return False

def get_last_call_return(self):
return self._last_call_return
def got_expected_node_progress_types(self):
return all(
progress_type in self._current_progress
for progress_type in NodeProgressType.required_types_for_started_service()
)

def get_current_progress(self):
return self._current_progress.values()
Expand Down Expand Up @@ -339,16 +338,17 @@ def expected_service_running(
service_running = ServiceRunning(iframe_locator=None)

try:

with websocket.expect_event("framereceived", waiter, timeout=timeout):
if press_start_button:
_trigger_service_start(page, node_id)

yield service_running

except PlaywrightTimeoutError:
if waiter.get_last_call_return() is False:
if waiter.got_expected_node_progress_types():
ctx.logger.warning(
"⚠️ Progress bar didn't receive 100 percent: %s ⚠️", # https://github.com/ITISFoundation/osparc-simcore/issues/6449
"⚠️ Progress bar didn't receive 100 percent but all expected node-progress-types are in place: %s ⚠️", # https://github.com/ITISFoundation/osparc-simcore/issues/6449
waiter.get_current_progress(),
)
else:
Expand Down

0 comments on commit 9609abd

Please sign in to comment.