1
0
mirror of synced 2026-05-22 18:53:15 +00:00

test: update web socket tests to properly dispatch ws messages (#1683)

This commit is contained in:
Yury Semikhatsky
2024-10-03 11:19:15 -07:00
committed by GitHub
parent ab443d1638
commit 9c220cd359
@@ -148,8 +148,8 @@ public class TestRouteWebSocket {
page.evaluate("window.log"));
Future<String> messagePromise = webSocketServer.waitForMessage();
page.evaluate("() => window.ws.send(new Blob([new Uint8Array(['h'.charCodeAt(0), 'i'.charCodeAt(0)])]))");
// Without this the blob message is not sent in pass-through!
assertEquals(1, page.evaluate("window.ws.readyState"));
// Dispatch messages until web socket route is received.
page.waitForCondition(() -> messagePromise.isDone());
assertEquals("hi", messagePromise.get());
}
@@ -171,8 +171,8 @@ public class TestRouteWebSocket {
page.evaluate("window.log"));
Future<String> messagePromise = webSocketServer.waitForMessage();
page.evaluate("() => window.ws.send(new Blob([new Uint8Array(['h'.charCodeAt(0), 'i'.charCodeAt(0)])]))");
// Without this the blob message is not sent in pass-through!
assertEquals(1, page.evaluate("window.ws.readyState"));
// Dispatch messages until web socket route is received.
page.waitForCondition(() -> messagePromise.isDone());
assertEquals("hi", messagePromise.get());
}