chore(chromium): allow passing --remote-debugging-port for debugging (#1857)

This commit is contained in:
Pavel Feldman 2020-04-18 19:06:42 -07:00 committed by GitHub
parent 55b4bc99bd
commit 022bc67c07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -149,7 +149,7 @@ export class Chromium implements BrowserType<CRBrowser> {
const userDataDirArg = args.find(arg => arg.startsWith('--user-data-dir'));
if (userDataDirArg)
throw new Error('Pass userDataDir parameter instead of specifying --user-data-dir argument');
if (args.find(arg => arg.startsWith('--remote-debugging-')))
if (args.find(arg => arg.startsWith('--remote-debugging-pipe')))
throw new Error('Playwright manages remote debugging connection itself.');
if (launchType !== 'persistent' && args.find(arg => !arg.startsWith('-')))
throw new Error('Arguments can not specify page to be opened');

View File

@ -26,11 +26,11 @@ describe('launcher', function() {
const error = await browserType.launchServer(options).catch(e => e);
expect(error.message).toContain('Playwright manages remote debugging connection itself');
});
it('should throw with remote-debugging-port argument', async({browserType, defaultBrowserOptions}) => {
it('should not throw with remote-debugging-port argument', async({browserType, defaultBrowserOptions}) => {
const options = Object.assign({}, defaultBrowserOptions);
options.args = ['--remote-debugging-port=9222'].concat(options.args || []);
const error = await browserType.launchServer(options).catch(e => e);
expect(error.message).toContain('Playwright manages remote debugging connection itself');
options.args = ['--remote-debugging-port=0'].concat(options.args || []);
const browser = await browserType.launchServer(options);
await browser.close();
});
it('should open devtools when "devtools: true" option is given', async({browserType, defaultBrowserOptions}) => {
const browser = await browserType.launch(Object.assign({devtools: true}, {...defaultBrowserOptions, headless: false}));