Skip to content

Commit

Permalink
test: update web socket tests to properly dispatch ws messages (#1683)
Browse files Browse the repository at this point in the history
  • Loading branch information
yury-s authored Oct 3, 2024
1 parent ab443d1 commit 9c220cd
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ public void shouldWorkWithBinaryTypeBlob(String mock, Page page) throws Exceptio
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());
}

Expand All @@ -171,8 +171,8 @@ public void shouldWorkWithBinaryTypeArrayBuffer(String mock, Page page) throws E
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());
}

Expand Down

0 comments on commit 9c220cd

Please sign in to comment.