fix(test): browser.disconnect should not be awaited (#4446)

browser.disconnect does not return a promise
This commit is contained in:
Darío Kondratiuk 2019-05-21 11:26:04 -03:00 committed by Andrey Lushnikov
parent 90a1032300
commit bad98baf70
3 changed files with 5 additions and 5 deletions

View File

@ -57,7 +57,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
const browserWSEndpoint = browser.wsEndpoint(); const browserWSEndpoint = browser.wsEndpoint();
const remoteBrowser = await puppeteer.connect({browserWSEndpoint}); const remoteBrowser = await puppeteer.connect({browserWSEndpoint});
expect(remoteBrowser.process()).toBe(null); expect(remoteBrowser.process()).toBe(null);
await remoteBrowser.disconnect(); remoteBrowser.disconnect();
}); });
}); });
@ -66,7 +66,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
const browserWSEndpoint = browser.wsEndpoint(); const browserWSEndpoint = browser.wsEndpoint();
const newBrowser = await puppeteer.connect({browserWSEndpoint}); const newBrowser = await puppeteer.connect({browserWSEndpoint});
expect(newBrowser.isConnected()).toBe(true); expect(newBrowser.isConnected()).toBe(true);
await newBrowser.disconnect(); newBrowser.disconnect();
expect(newBrowser.isConnected()).toBe(false); expect(newBrowser.isConnected()).toBe(false);
}); });
}); });

View File

@ -149,7 +149,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
}); });
const contexts = remoteBrowser.browserContexts(); const contexts = remoteBrowser.browserContexts();
expect(contexts.length).toBe(2); expect(contexts.length).toBe(2);
await remoteBrowser.disconnect(); remoteBrowser.disconnect();
await context.close(); await context.close();
}); });
}); });

View File

@ -67,7 +67,7 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
const page = await remote.newPage(); const page = await remote.newPage();
const navigationPromise = page.goto(server.PREFIX + '/one-style.html', {timeout: 60000}).catch(e => e); const navigationPromise = page.goto(server.PREFIX + '/one-style.html', {timeout: 60000}).catch(e => e);
await server.waitForRequest('/one-style.css'); await server.waitForRequest('/one-style.css');
await remote.disconnect(); remote.disconnect();
const error = await navigationPromise; const error = await navigationPromise;
expect(error.message).toBe('Navigation failed because browser has disconnected!'); expect(error.message).toBe('Navigation failed because browser has disconnected!');
await browser.close(); await browser.close();
@ -78,7 +78,7 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
const remote = await puppeteer.connect({browserWSEndpoint: browser.wsEndpoint()}); const remote = await puppeteer.connect({browserWSEndpoint: browser.wsEndpoint()});
const page = await remote.newPage(); const page = await remote.newPage();
const watchdog = page.waitForSelector('div', {timeout: 60000}).catch(e => e); const watchdog = page.waitForSelector('div', {timeout: 60000}).catch(e => e);
await remote.disconnect(); remote.disconnect();
const error = await watchdog; const error = await watchdog;
expect(error.message).toContain('Protocol error'); expect(error.message).toContain('Protocol error');
await browser.close(); await browser.close();