chore(test): dont throw in tear down if setup failed (#118)

This commit is contained in:
Yury Semikhatsky 2020-12-14 11:50:12 -08:00 committed by GitHub
parent fa2e0f0237
commit 4b33bd6704
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,9 +87,11 @@ public class TestBase {
@AfterAll @AfterAll
static void closeBrowser() { static void closeBrowser() {
if (browser != null) {
browser.close(); browser.close();
browser = null; browser = null;
} }
}
@BeforeAll @BeforeAll
static void startServer() throws IOException { static void startServer() throws IOException {
@ -99,17 +101,23 @@ public class TestBase {
@AfterAll @AfterAll
static void stopServer() throws IOException { static void stopServer() throws IOException {
if (server != null) {
server.stop(); server.stop();
server = null; server = null;
}
if (httpsServer != null) {
httpsServer.stop(); httpsServer.stop();
httpsServer = null; httpsServer = null;
} }
}
@AfterAll @AfterAll
static void closePlaywright() throws Exception { static void closePlaywright() throws Exception {
if (playwright != null) {
playwright.close(); playwright.close();
playwright = null; playwright = null;
} }
}
BrowserContext createContext() { BrowserContext createContext() {
return browser.newContext(); return browser.newContext();