feat(Browser): introduce browser.process() variable (#1581)

This patch adds a `browser.process()` getter to expose the child process
with running browser.

Fixes #1539.
This commit is contained in:
Andrey Lushnikov
2017-12-11 12:11:12 -08:00
committed by GitHub
parent a164524c72
commit 4eaf52fa1d
4 changed files with 30 additions and 5 deletions

View File

@@ -263,6 +263,16 @@ describe('Page', function() {
}));
});
describe('Browser.process', function() {
it('should return child_process instance', SX(async function() {
const process = await browser.process();
expect(process.pid).toBeGreaterThan(0);
const browserWSEndpoint = browser.wsEndpoint();
const remoteBrowser = await puppeteer.connect({browserWSEndpoint});
expect(remoteBrowser.process()).toBe(null);
}));
});
describe('Browser.Events.disconnected', function() {
it('should emitted when: browser gets closed, disconnected or underlying websocket gets closed', SX(async function() {
const originalBrowser = await puppeteer.launch(defaultBrowserOptions);