tests: mark tests that launch() twice or use fixtures as slow (#1455)

This commit is contained in:
Dmitry Gozman 2020-03-20 19:49:35 -07:00 committed by GitHub
parent 5a42cbd491
commit e115e8e2a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 16 deletions

View file

@ -69,21 +69,21 @@ module.exports.describe = function({testRunner, expect, product, browserType, pl
} }
describe('Fixtures', function() { describe('Fixtures', function() {
it('should dump browser process stderr', async({server}) => { it.slow()('should dump browser process stderr', async({server}) => {
let dumpioData = ''; let dumpioData = '';
const res = spawn('node', [path.join(__dirname, 'fixtures', 'dumpio.js'), playwrightPath, product, 'usewebsocket']); const res = spawn('node', [path.join(__dirname, 'fixtures', 'dumpio.js'), playwrightPath, product, 'usewebsocket']);
res.stderr.on('data', data => dumpioData += data.toString('utf8')); res.stderr.on('data', data => dumpioData += data.toString('utf8'));
await new Promise(resolve => res.on('close', resolve)); await new Promise(resolve => res.on('close', resolve));
expect(dumpioData).toContain('message from dumpio'); 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 = ''; let dumpioData = '';
const res = spawn('node', [path.join(__dirname, 'fixtures', 'dumpio.js'), playwrightPath, product]); const res = spawn('node', [path.join(__dirname, 'fixtures', 'dumpio.js'), playwrightPath, product]);
res.stderr.on('data', data => dumpioData += data.toString('utf8')); res.stderr.on('data', data => dumpioData += data.toString('utf8'));
await new Promise(resolve => res.on('close', resolve)); await new Promise(resolve => res.on('close', resolve));
expect(dumpioData).toContain('message from dumpio'); 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 => { const result = await testSignal(child => {
if (WIN) if (WIN)
execSync(`taskkill /pid ${child.pid} /T /F`); execSync(`taskkill /pid ${child.pid} /T /F`);
@ -96,7 +96,7 @@ module.exports.describe = function({testRunner, expect, product, browserType, pl
}); });
if (!WIN) { if (!WIN) {
// Cannot reliably send signals on Windows. // 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) => { const result = await testSignal((child, browserPid) => {
process.kill(browserPid); process.kill(browserPid);
process.kill(child.pid, 'SIGINT'); 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.browserExitCode).toBe('null');
expect(result.browserSignal).toBe('SIGTERM'); 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) => { const result = await testSignal((child, browserPid) => {
process.kill(browserPid, 'SIGKILL'); process.kill(browserPid, 'SIGKILL');
process.kill(child.pid, 'SIGINT'); 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.browserExitCode).toBe('null');
expect(result.browserSignal).toBe('SIGKILL'); 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')); const result = await testSignal(child => process.kill(child.pid, 'SIGINT'));
expect(result.exitCode).toBe(130); expect(result.exitCode).toBe(130);
expect(result.browserExitCode).toBe('0'); expect(result.browserExitCode).toBe('0');
expect(result.browserSignal).toBe('null'); 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')); const result = await testSignal(child => process.kill(child.pid, 'SIGTERM'));
expect(result.exitCode).toBe(0); expect(result.exitCode).toBe(0);
expect(result.browserExitCode).toBe('0'); expect(result.browserExitCode).toBe('0');
expect(result.browserSignal).toBe('null'); 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')); const result = await testSignal(child => process.kill(child.pid, 'SIGHUP'));
expect(result.exitCode).toBe(0); expect(result.exitCode).toBe(0);
expect(result.browserExitCode).toBe('0'); expect(result.browserExitCode).toBe('0');
expect(result.browserSignal).toBe('null'); 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 => { const result = await testSignal(child => {
process.kill(child.pid, 'SIGINT'); process.kill(child.pid, 'SIGINT');
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 // TODO: ideally, we would expect the SIGKILL on the browser from
// force kill, but that's racy with sending two signals. // 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 => { const result = await testSignal(child => {
process.kill(child.pid, 'SIGINT'); process.kill(child.pid, 'SIGINT');
process.kill(child.pid, 'SIGTERM'); 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 // TODO: ideally, we would expect the SIGKILL on the browser from
// force kill, but that's racy with sending two signals. // 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 => { const result = await testSignal(child => {
process.kill(child.pid, 'SIGTERM'); process.kill(child.pid, 'SIGTERM');
process.kill(child.pid, 'SIGINT'); process.kill(child.pid, 'SIGINT');

View file

@ -41,7 +41,7 @@ module.exports.describe = function({testRunner, expect, browserType, defaultBrow
await removeUserDataDir(userDataDir); await removeUserDataDir(userDataDir);
}); });
// see https://github.com/microsoft/playwright/issues/717 // 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(); const userDataDir = await makeUserDataDir();
// Write a cookie in headful chrome // Write a cookie in headful chrome
const headfulContext = await browserType.launchPersistentContext(userDataDir, headfulOptions); const headfulContext = await browserType.launchPersistentContext(userDataDir, headfulOptions);

View file

@ -258,7 +258,7 @@ module.exports.describe = function({testRunner, expect, defaultBrowserOptions, p
}); });
describe('browserType.connect', function() { 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 browserServer = await browserType.launchServer(defaultBrowserOptions);
{ {
const browser = await browserType.connect({ wsEndpoint: browserServer.wsEndpoint() }); 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 // This might throw. See https://github.com/GoogleChrome/puppeteer/issues/2778
await removeUserDataDir(userDataDir); 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 userDataDir = await makeUserDataDir();
const browserContext = await browserType.launchPersistentContext(userDataDir, defaultBrowserOptions); const browserContext = await browserType.launchPersistentContext(userDataDir, defaultBrowserOptions);
const page = await browserContext.newPage(); const page = await browserContext.newPage();
@ -317,7 +317,7 @@ module.exports.describe = function({testRunner, expect, defaultBrowserOptions, p
await removeUserDataDir(userDataDir2); await removeUserDataDir(userDataDir2);
}); });
// See https://github.com/microsoft/playwright/issues/717 // 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 userDataDir = await makeUserDataDir();
const browserContext = await browserType.launchPersistentContext(userDataDir, defaultBrowserOptions); const browserContext = await browserType.launchPersistentContext(userDataDir, defaultBrowserOptions);
const page = await browserContext.newPage(); const page = await browserContext.newPage();

View file

@ -44,7 +44,7 @@ module.exports.describe = function({testRunner, expect, defaultBrowserOptions, b
}); });
describe('Browser.Events.disconnected', function() { 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 browserServer = await browserType.launchServer(defaultBrowserOptions);
const originalBrowser = await browserType.connect({ wsEndpoint: browserServer.wsEndpoint() }); const originalBrowser = await browserType.connect({ wsEndpoint: browserServer.wsEndpoint() });
const wsEndpoint = browserServer.wsEndpoint(); const wsEndpoint = browserServer.wsEndpoint();