Skip to content

Commit

Permalink
tests: mark tests that launch() twice or use fixtures as slow (#1455)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgozman authored Mar 21, 2020
1 parent 5a42cbd commit e115e8e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
22 changes: 11 additions & 11 deletions test/fixtures.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion test/headful.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions test/launcher.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() });
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion test/multiclient.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit e115e8e

Please sign in to comment.