mirror of
https://github.com/microsoft/playwright-java.git
synced 2025-12-28 10:20:45 +00:00
test: unflake TestWebSocket.shouldEmitError (#976)
This commit is contained in:
parent
ec8fb9f191
commit
9fac877892
@ -25,6 +25,7 @@ import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
@ -139,9 +140,13 @@ public class TestWebSocket extends TestBase {
|
||||
boolean[] socketError = {false};
|
||||
String[] error = {null};
|
||||
page.onWebSocket(ws -> {
|
||||
ws.onSocketError(e -> {
|
||||
error[0] = e;
|
||||
socketError[0] = true;
|
||||
ws.onSocketError(new Consumer<String>() {
|
||||
@Override
|
||||
public void accept(String e) {
|
||||
ws.offSocketError(this);
|
||||
error[0] = e;
|
||||
socketError[0] = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
page.evaluate("port => {\n" +
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user