(
self,
event: str,
predicate: Callable = None,
timeout: float = None,
)
| 1561 | ) |
| 1562 | |
| 1563 | def expect_event( |
| 1564 | self, |
| 1565 | event: str, |
| 1566 | predicate: Callable = None, |
| 1567 | timeout: float = None, |
| 1568 | ) -> EventContextManagerImpl: |
| 1569 | if timeout is None: |
| 1570 | if self._page: |
| 1571 | timeout = self._page._timeout_settings.timeout() |
| 1572 | elif self._context: |
| 1573 | timeout = self._context._timeout_settings.timeout() |
| 1574 | else: |
| 1575 | timeout = 30000 |
| 1576 | waiter = Waiter(self, f"worker.expect_event({event})") |
| 1577 | waiter.reject_on_timeout( |
| 1578 | cast(float, timeout), |
| 1579 | f'Timeout {timeout}ms exceeded while waiting for event "{event}"', |
| 1580 | ) |
| 1581 | if event != Worker.Events.Close: |
| 1582 | waiter.reject_on_event( |
| 1583 | self, Worker.Events.Close, lambda: TargetClosedError() |
| 1584 | ) |
| 1585 | waiter.wait_for_event(self, event, predicate) |
| 1586 | return EventContextManagerImpl(waiter.result()) |
| 1587 | |
| 1588 | |
| 1589 | class BindingCall(ChannelOwner): |
nothing calls this directly
no test coverage detected