Skip to content

Commit

Permalink
fix(test): browser.disconnect should not be awaited (puppeteer#4446)
Browse files Browse the repository at this point in the history
browser.disconnect does not return a promise
  • Loading branch information
kblok authored and aslushnikov committed May 21, 2019
1 parent 90a1032 commit bad98ba
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions test/browser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
const browserWSEndpoint = browser.wsEndpoint();
const remoteBrowser = await puppeteer.connect({browserWSEndpoint});
expect(remoteBrowser.process()).toBe(null);
await remoteBrowser.disconnect();
remoteBrowser.disconnect();
});
});

Expand All @@ -66,7 +66,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
const browserWSEndpoint = browser.wsEndpoint();
const newBrowser = await puppeteer.connect({browserWSEndpoint});
expect(newBrowser.isConnected()).toBe(true);
await newBrowser.disconnect();
newBrowser.disconnect();
expect(newBrowser.isConnected()).toBe(false);
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/browsercontext.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
});
const contexts = remoteBrowser.browserContexts();
expect(contexts.length).toBe(2);
await remoteBrowser.disconnect();
remoteBrowser.disconnect();
await context.close();
});
});
Expand Down
4 changes: 2 additions & 2 deletions test/launcher.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
const page = await remote.newPage();
const navigationPromise = page.goto(server.PREFIX + '/one-style.html', {timeout: 60000}).catch(e => e);
await server.waitForRequest('/one-style.css');
await remote.disconnect();
remote.disconnect();
const error = await navigationPromise;
expect(error.message).toBe('Navigation failed because browser has disconnected!');
await browser.close();
Expand All @@ -78,7 +78,7 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
const remote = await puppeteer.connect({browserWSEndpoint: browser.wsEndpoint()});
const page = await remote.newPage();
const watchdog = page.waitForSelector('div', {timeout: 60000}).catch(e => e);
await remote.disconnect();
remote.disconnect();
const error = await watchdog;
expect(error.message).toContain('Protocol error');
await browser.close();
Expand Down

0 comments on commit bad98ba

Please sign in to comment.