MCPcopy Index your code
hub / github.com/microsoft/playwright-python / test_should_work

Function test_should_work

tests/async/test_websocket.py:24–37  ·  view source on GitHub ↗
(page: Page, server: Server)

Source from the content-addressed store, hash-verified

22
23
24async def test_should_work(page: Page, server: Server) -> None:
25 server.send_on_web_socket_connection(b"incoming")
26 value = await page.evaluate(
27 """port => {
28 let cb;
29 const result = new Promise(f => cb = f);
30 const ws = new WebSocket('ws://localhost:' + port + '/ws');
31 ws.addEventListener('message', data => { ws.close(); cb(data.data); });
32 return result;
33 }""",
34 server.PORT,
35 )
36 assert value == "incoming"
37 pass
38
39
40async def test_should_emit_close_events(page: Page, server: Server) -> None:

Callers

nothing calls this directly

Calls 2

evaluateMethod · 0.45

Tested by

no test coverage detected