From e115e8e2a9c5465259b63129188d6070a9c51bb2 Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Fri, 20 Mar 2020 19:49:35 -0700 Subject: [PATCH] tests: mark tests that launch() twice or use fixtures as slow (#1455) --- test/fixtures.spec.js | 22 +++++++++++----------- test/headful.spec.js | 2 +- test/launcher.spec.js | 6 +++--- test/multiclient.spec.js | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/test/fixtures.spec.js b/test/fixtures.spec.js index 2cd9427244..d547c44624 100644 --- a/test/fixtures.spec.js +++ b/test/fixtures.spec.js @@ -69,21 +69,21 @@ module.exports.describe = function({testRunner, expect, product, browserType, pl } describe('Fixtures', function() { - it('should dump browser process stderr', async({server}) => { + it.slow()('should dump browser process stderr', async({server}) => { let dumpioData = ''; const res = spawn('node', [path.join(__dirname, 'fixtures', 'dumpio.js'), playwrightPath, product, 'usewebsocket']); res.stderr.on('data', data => dumpioData += data.toString('utf8')); await new Promise(resolve => res.on('close', resolve)); expect(dumpioData).toContain('message from dumpio'); }); - it('should dump browser process stderr', async({server}) => { + it.slow()('should dump browser process stderr', async({server}) => { let dumpioData = ''; const res = spawn('node', [path.join(__dirname, 'fixtures', 'dumpio.js'), playwrightPath, product]); res.stderr.on('data', data => dumpioData += data.toString('utf8')); await new Promise(resolve => res.on('close', resolve)); expect(dumpioData).toContain('message from dumpio'); }); - it('should close the browser when the node process closes', async () => { + it.slow()('should close the browser when the node process closes', async () => { const result = await testSignal(child => { if (WIN) execSync(`taskkill /pid ${child.pid} /T /F`); @@ -96,7 +96,7 @@ module.exports.describe = function({testRunner, expect, product, browserType, pl }); if (!WIN) { // Cannot reliably send signals on Windows. - it('should report browser close signal', async () => { + it.slow()('should report browser close signal', async () => { const result = await testSignal((child, browserPid) => { process.kill(browserPid); process.kill(child.pid, 'SIGINT'); @@ -105,7 +105,7 @@ module.exports.describe = function({testRunner, expect, product, browserType, pl expect(result.browserExitCode).toBe('null'); expect(result.browserSignal).toBe('SIGTERM'); }); - it('should report browser close signal 2', async () => { + it.slow()('should report browser close signal 2', async () => { const result = await testSignal((child, browserPid) => { process.kill(browserPid, 'SIGKILL'); process.kill(child.pid, 'SIGINT'); @@ -114,25 +114,25 @@ module.exports.describe = function({testRunner, expect, product, browserType, pl expect(result.browserExitCode).toBe('null'); expect(result.browserSignal).toBe('SIGKILL'); }); - it('should close the browser on SIGINT', async () => { + it.slow()('should close the browser on SIGINT', async () => { const result = await testSignal(child => process.kill(child.pid, 'SIGINT')); expect(result.exitCode).toBe(130); expect(result.browserExitCode).toBe('0'); expect(result.browserSignal).toBe('null'); }); - it('should close the browser on SIGTERM', async () => { + it.slow()('should close the browser on SIGTERM', async () => { const result = await testSignal(child => process.kill(child.pid, 'SIGTERM')); expect(result.exitCode).toBe(0); expect(result.browserExitCode).toBe('0'); expect(result.browserSignal).toBe('null'); }); - it('should close the browser on SIGHUP', async () => { + it.slow()('should close the browser on SIGHUP', async () => { const result = await testSignal(child => process.kill(child.pid, 'SIGHUP')); expect(result.exitCode).toBe(0); expect(result.browserExitCode).toBe('0'); expect(result.browserSignal).toBe('null'); }); - it('should kill the browser on double SIGINT', async () => { + it.slow()('should kill the browser on double SIGINT', async () => { const result = await testSignal(child => { process.kill(child.pid, 'SIGINT'); process.kill(child.pid, 'SIGINT'); @@ -141,7 +141,7 @@ module.exports.describe = function({testRunner, expect, product, browserType, pl // TODO: ideally, we would expect the SIGKILL on the browser from // force kill, but that's racy with sending two signals. }); - it('should kill the browser on SIGINT + SIGTERM', async () => { + it.slow()('should kill the browser on SIGINT + SIGTERM', async () => { const result = await testSignal(child => { process.kill(child.pid, 'SIGINT'); process.kill(child.pid, 'SIGTERM'); @@ -150,7 +150,7 @@ module.exports.describe = function({testRunner, expect, product, browserType, pl // TODO: ideally, we would expect the SIGKILL on the browser from // force kill, but that's racy with sending two signals. }); - it('should kill the browser on SIGTERM + SIGINT', async () => { + it.slow()('should kill the browser on SIGTERM + SIGINT', async () => { const result = await testSignal(child => { process.kill(child.pid, 'SIGTERM'); process.kill(child.pid, 'SIGINT'); diff --git a/test/headful.spec.js b/test/headful.spec.js index db1b5128ae..bb9a07b248 100644 --- a/test/headful.spec.js +++ b/test/headful.spec.js @@ -41,7 +41,7 @@ module.exports.describe = function({testRunner, expect, browserType, defaultBrow await removeUserDataDir(userDataDir); }); // see https://github.com/microsoft/playwright/issues/717 - it.fail((WIN && CHROMIUM) || FFOX)('headless should be able to read cookies written by headful', async({server}) => { + it.slow().fail((WIN && CHROMIUM) || FFOX)('headless should be able to read cookies written by headful', async({server}) => { const userDataDir = await makeUserDataDir(); // Write a cookie in headful chrome const headfulContext = await browserType.launchPersistentContext(userDataDir, headfulOptions); diff --git a/test/launcher.spec.js b/test/launcher.spec.js index 33af2c5a5b..739b812814 100644 --- a/test/launcher.spec.js +++ b/test/launcher.spec.js @@ -258,7 +258,7 @@ module.exports.describe = function({testRunner, expect, defaultBrowserOptions, p }); describe('browserType.connect', function() { - it('should be able to reconnect to a browser', async({server}) => { + it.slow()('should be able to reconnect to a browser', async({server}) => { const browserServer = await browserType.launchServer(defaultBrowserOptions); { const browser = await browserType.connect({ wsEndpoint: browserServer.wsEndpoint() }); @@ -291,7 +291,7 @@ module.exports.describe = function({testRunner, expect, defaultBrowserOptions, p // This might throw. See https://github.com/GoogleChrome/puppeteer/issues/2778 await removeUserDataDir(userDataDir); }); - it.fail(FFOX)('userDataDir option should restore state', async({server}) => { + it.slow().fail(FFOX)('userDataDir option should restore state', async({server}) => { const userDataDir = await makeUserDataDir(); const browserContext = await browserType.launchPersistentContext(userDataDir, defaultBrowserOptions); const page = await browserContext.newPage(); @@ -317,7 +317,7 @@ module.exports.describe = function({testRunner, expect, defaultBrowserOptions, p await removeUserDataDir(userDataDir2); }); // See https://github.com/microsoft/playwright/issues/717 - it.fail(FFOX || (WIN && CHROMIUM))('userDataDir option should restore cookies', async({server}) => { + it.slow().fail(FFOX || (WIN && CHROMIUM))('userDataDir option should restore cookies', async({server}) => { const userDataDir = await makeUserDataDir(); const browserContext = await browserType.launchPersistentContext(userDataDir, defaultBrowserOptions); const page = await browserContext.newPage(); diff --git a/test/multiclient.spec.js b/test/multiclient.spec.js index 505228e43b..0883d502e8 100644 --- a/test/multiclient.spec.js +++ b/test/multiclient.spec.js @@ -44,7 +44,7 @@ module.exports.describe = function({testRunner, expect, defaultBrowserOptions, b }); describe('Browser.Events.disconnected', function() { - it('should be emitted when: browser gets closed, disconnected or underlying websocket gets closed', async () => { + it.slow()('should be emitted when: browser gets closed, disconnected or underlying websocket gets closed', async () => { const browserServer = await browserType.launchServer(defaultBrowserOptions); const originalBrowser = await browserType.connect({ wsEndpoint: browserServer.wsEndpoint() }); const wsEndpoint = browserServer.wsEndpoint();