mirror of
https://github.com/microsoft/playwright-java.git
synced 2025-09-08 21:01:00 +00:00
fix: unflake exposeBindingHandleShouldNotThrowDuringNavigation (#37)
This commit is contained in:
parent
5f578aae41
commit
f9fc50b6de
@ -187,14 +187,18 @@ public class PageImpl extends ChannelOwner implements Page {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addListener(EventType type, Listener<EventType> listener) {
|
public void addListener(EventType type, Listener<EventType> listener) {
|
||||||
willAddFileChooserListener();
|
if (type == EventType.FILECHOOSER) {
|
||||||
|
willAddFileChooserListener();
|
||||||
|
}
|
||||||
listeners.add(type, listener);
|
listeners.add(type, listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeListener(EventType type, Listener<EventType> listener) {
|
public void removeListener(EventType type, Listener<EventType> listener) {
|
||||||
listeners.remove(type, listener);
|
listeners.remove(type, listener);
|
||||||
didRemoveFileChooserListener();
|
if (type == EventType.FILECHOOSER) {
|
||||||
|
didRemoveFileChooserListener();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,56 +24,61 @@ import org.junit.jupiter.api.BeforeEach;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class TestBase {
|
public class TestBase {
|
||||||
static Server server;
|
static Server server;
|
||||||
static Server httpsServer;
|
static Server httpsServer;
|
||||||
static BrowserType browserType;
|
static BrowserType browserType;
|
||||||
static Playwright playwright;
|
static Playwright playwright;
|
||||||
static Browser browser;
|
static Browser browser;
|
||||||
static boolean isChromium;
|
static boolean isChromium;
|
||||||
static boolean isWebKit;
|
static boolean isWebKit;
|
||||||
static boolean isFirefox;
|
static boolean isFirefox;
|
||||||
static boolean headful;
|
static boolean headful;
|
||||||
Page page;
|
Page page;
|
||||||
BrowserContext context;
|
BrowserContext context;
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
static void launchBrowser() {
|
static void launchBrowser() {
|
||||||
playwright = Playwright.create();
|
playwright = Playwright.create();
|
||||||
BrowserType.LaunchOptions options = new BrowserType.LaunchOptions();
|
BrowserType.LaunchOptions options = new BrowserType.LaunchOptions();
|
||||||
browserType = playwright.chromium();
|
browserType = playwright.chromium();
|
||||||
browser = browserType.launch(options);
|
browser = browserType.launch(options);
|
||||||
isChromium = true;
|
isChromium = true;
|
||||||
isWebKit = false;
|
isWebKit = false;
|
||||||
headful = false;
|
headful = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeAll
|
@AfterAll
|
||||||
static void startServer() throws IOException {
|
static void closeBrowser() {
|
||||||
server = Server.createHttp(8907);
|
browser.close();
|
||||||
httpsServer = Server.createHttps(8908);
|
browser = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterAll
|
@BeforeAll
|
||||||
static void stopServer() throws IOException {
|
static void startServer() throws IOException {
|
||||||
browser.close();
|
server = Server.createHttp(8907);
|
||||||
server.stop();
|
httpsServer = Server.createHttps(8908);
|
||||||
server = null;
|
}
|
||||||
httpsServer.stop();
|
|
||||||
httpsServer = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@BeforeEach
|
@AfterAll
|
||||||
void setUp() {
|
static void stopServer() throws IOException {
|
||||||
server.reset();
|
server.stop();
|
||||||
httpsServer.reset();
|
server = null;
|
||||||
context = browser.newContext();
|
httpsServer.stop();
|
||||||
page = context.newPage();
|
httpsServer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterEach
|
@BeforeEach
|
||||||
void tearDown() {
|
void createContextAndPage() {
|
||||||
context.close();
|
server.reset();
|
||||||
context = null;
|
httpsServer.reset();
|
||||||
page = null;
|
context = browser.newContext();
|
||||||
}
|
page = context.newPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterEach
|
||||||
|
void closeContext() {
|
||||||
|
context.close();
|
||||||
|
context = null;
|
||||||
|
page = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user