Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust
Rust ai-agentsai-toolsbrowserbrowser-automationcloud-browserheadlessheadless-browserkitesurfplaywrightpuppeteerrustservoweb-crawlerweb-crawlingweb-scraperweb-scraping
fix(frontend-smoke): preserve websocket fixture checkpoints
ldm064ae88627711
diff --git a/moli-frontend-smoke/moli_frontend_smoke/fixture_server.py b/moli-frontend-smoke/moli_frontend_smoke/fixture_server.pyindex dcbba924b..3a2b81a66 100644--- a/moli-frontend-smoke/moli_frontend_smoke/fixture_server.py+++ b/moli-frontend-smoke/moli_frontend_smoke/fixture_server.py@@ -115,26 +115,28 @@ def _handle_websocket_connection() -> None:scenario, token = _websocket_query(connection)state.websocket_opened(token)+ # Client actions may follow a runner-controlled DOM checkpoint. Keep receives tied+ # to the connection lifetime; page and runner deadlines own fixture liveness.try:if scenario == "text-order":connection.send(f"server-open:{token}")for index in range(1, 3):- message = connection.recv(timeout=20)+ message = connection.recv()connection.send(f"echo:{index}:{message}")- connection.recv(timeout=20)+ connection.recv()returnif scenario == "binary-arraybuffer":for _index in range(2):- message = connection.recv(timeout=20, decode=False)+ message = connection.recv(decode=False)assert isinstance(message, bytes)connection.send(bytes(reversed(message)))- connection.recv(timeout=20)+ connection.recv()returnif scenario == "binary-fragmented":connection.send([b"\x00\x01", b"\xfe\xff"], text=False)- connection.recv(timeout=20)+ connection.recv()connection.send([b"\x10", b"\x20\x30"], text=False)- connection.recv(timeout=20)+ connection.recv()returnif scenario == "subprotocol":origin = ""@@ -152,11 +154,11 @@ def _handle_websocket_connection(sort_keys=True,))- connection.recv(timeout=20)+ connection.recv()returnif scenario == "client-close":connection.send(f"client-close-ready:{token}")- connection.recv(timeout=20)+ connection.recv()returnif scenario == "server-close":connection.send(f"server-close-ready:{token}")@@ -164,16 +166,16 @@ def _handle_websocket_connection(returnif scenario == "realm-teardown":connection.send(f"realm-ready:{token}")- connection.recv(timeout=20)+ connection.recv()returnif scenario == "coordinated":connection.send(f"websocket-ready:{token}")- message = connection.recv(timeout=20)+ message = connection.recv()connection.send(f"coordinated:{message}")- connection.recv(timeout=20)+ connection.recv()returnconnection.close(1008, "unknown scenario")- except (ConnectionClosed, TimeoutError):+ except ConnectionClosed:passfinally:state.websocket_closed(token)diff --git a/moli-frontend-smoke/tests/test_fixture_server.py b/moli-frontend-smoke/tests/test_fixture_server.pyindex 430243ee7..02366968d 100644--- a/moli-frontend-smoke/tests/test_fixture_server.py+++ b/moli-frontend-smoke/tests/test_fixture_server.py@@ -6,9 +6,14 @@ import threadingimport urllib.errorimport urllib.requestfrom pathlib import Path+from types import SimpleNamespacefrom urllib.parse import urljoin, urlsplit-from moli_frontend_smoke.fixture_server import FixtureServer+from moli_frontend_smoke.fixture_server import (+ FixtureServer,+ _handle_websocket_connection,+ _RealtimeState,+)from websockets.sync.client import connect@@ -323,6 +328,39 @@ def test_script_and_websocket_fixture_routes(tmp_path: Path) -> None:server.stop()+def test_websocket_fixture_waits_across_runner_checkpoints() -> None:+ class CheckpointDelayedConnection:+ def __init__(self) -> None:+ self.request = SimpleNamespace(+ path="/support/realtime/socket?scenario=text-order&token=delayed-case"+ )+ self.sent: list[str] = []+ self._received = iter(["alpha", "beta", "client-close"])++ def send(self, message: str) -> None:+ self.sent.append(message)++ def recv(+ self,+ timeout: float | None = None,+ *,+ decode: bool | None = None,+ ) -> str:+ del decode+ if timeout is not None:+ raise TimeoutError("runner checkpoint exceeded fixture-local deadline")+ return next(self._received)++ connection = CheckpointDelayedConnection()+ _handle_websocket_connection(connection, _RealtimeState()) # type: ignore[arg-type]++ assert connection.sent == [+ "server-open:delayed-case",+ "echo:1:alpha",+ "echo:2:beta",+ ]++def test_event_source_stream_gate_and_status_are_consumable(tmp_path: Path) -> None:server = FixtureServer(tmp_path)server.start()