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
|
||||
public void addListener(EventType type, Listener<EventType> listener) {
|
||||
willAddFileChooserListener();
|
||||
if (type == EventType.FILECHOOSER) {
|
||||
willAddFileChooserListener();
|
||||
}
|
||||
listeners.add(type, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(EventType type, Listener<EventType> listener) {
|
||||
listeners.remove(type, listener);
|
||||
didRemoveFileChooserListener();
|
||||
if (type == EventType.FILECHOOSER) {
|
||||
didRemoveFileChooserListener();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,56 +24,61 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
import java.io.IOException;
|
||||
|
||||
public class TestBase {
|
||||
static Server server;
|
||||
static Server httpsServer;
|
||||
static BrowserType browserType;
|
||||
static Playwright playwright;
|
||||
static Browser browser;
|
||||
static boolean isChromium;
|
||||
static boolean isWebKit;
|
||||
static boolean isFirefox;
|
||||
static boolean headful;
|
||||
Page page;
|
||||
BrowserContext context;
|
||||
static Server server;
|
||||
static Server httpsServer;
|
||||
static BrowserType browserType;
|
||||
static Playwright playwright;
|
||||
static Browser browser;
|
||||
static boolean isChromium;
|
||||
static boolean isWebKit;
|
||||
static boolean isFirefox;
|
||||
static boolean headful;
|
||||
Page page;
|
||||
BrowserContext context;
|
||||
|
||||
@BeforeAll
|
||||
static void launchBrowser() {
|
||||
playwright = Playwright.create();
|
||||
BrowserType.LaunchOptions options = new BrowserType.LaunchOptions();
|
||||
browserType = playwright.chromium();
|
||||
browser = browserType.launch(options);
|
||||
isChromium = true;
|
||||
isWebKit = false;
|
||||
headful = false;
|
||||
}
|
||||
@BeforeAll
|
||||
static void launchBrowser() {
|
||||
playwright = Playwright.create();
|
||||
BrowserType.LaunchOptions options = new BrowserType.LaunchOptions();
|
||||
browserType = playwright.chromium();
|
||||
browser = browserType.launch(options);
|
||||
isChromium = true;
|
||||
isWebKit = false;
|
||||
headful = false;
|
||||
}
|
||||
|
||||
@BeforeAll
|
||||
static void startServer() throws IOException {
|
||||
server = Server.createHttp(8907);
|
||||
httpsServer = Server.createHttps(8908);
|
||||
}
|
||||
@AfterAll
|
||||
static void closeBrowser() {
|
||||
browser.close();
|
||||
browser = null;
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
static void stopServer() throws IOException {
|
||||
browser.close();
|
||||
server.stop();
|
||||
server = null;
|
||||
httpsServer.stop();
|
||||
httpsServer = null;
|
||||
}
|
||||
@BeforeAll
|
||||
static void startServer() throws IOException {
|
||||
server = Server.createHttp(8907);
|
||||
httpsServer = Server.createHttps(8908);
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
server.reset();
|
||||
httpsServer.reset();
|
||||
context = browser.newContext();
|
||||
page = context.newPage();
|
||||
}
|
||||
@AfterAll
|
||||
static void stopServer() throws IOException {
|
||||
server.stop();
|
||||
server = null;
|
||||
httpsServer.stop();
|
||||
httpsServer = null;
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
void tearDown() {
|
||||
context.close();
|
||||
context = null;
|
||||
page = null;
|
||||
}
|
||||
@BeforeEach
|
||||
void createContextAndPage() {
|
||||
server.reset();
|
||||
httpsServer.reset();
|
||||
context = browser.newContext();
|
||||
page = context.newPage();
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
void closeContext() {
|
||||
context.close();
|
||||
context = null;
|
||||
page = null;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user