Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix(tests): fix test that was leaking a context (#933)
Joel Einbinder6105d8a26a26
diff --git a/test/browser.spec.js b/test/browser.spec.jsindex c79494a343..f5e032ef8e 100644--- a/test/browser.spec.js+++ b/test/browser.spec.js@@ -42,6 +42,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WEconst page = await browser.newPage();let error;await page.context().newPage().catch(e => error = e);+ await page.close();expect(error.message).toContain('Please use browser.newContext()');});});diff --git a/test/playwright.spec.js b/test/playwright.spec.jsindex 38590dba63..9385c7c093 100644--- a/test/playwright.spec.js+++ b/test/playwright.spec.js@@ -118,6 +118,7 @@ module.exports.describe = ({testRunner, product, playwrightPath}) => {state.tearDown = async () => {await Promise.all(contexts.map(c => c.close()));+ expect((await state.browser.contexts()).length).toBe(0, `"${test.fullName}" leaked a context`);if (rl) {rl.removeListener('line', onLine);rl.close();