chore: throw when using headless-shell with headed mode (#33292)
This commit is contained in:
parent
19e863191c
commit
5c0fdfed50
|
@ -294,6 +294,8 @@ export class Chromium extends BrowserType {
|
|||
throw new Error('Playwright manages remote debugging connection itself.');
|
||||
if (args.find(arg => !arg.startsWith('-')))
|
||||
throw new Error('Arguments can not specify page to be opened');
|
||||
if (!options.headless && options.channel === 'chromium-headless-shell')
|
||||
throw new Error('Cannot launch headed Chromium with `chromium-headless-shell` channel. Consider using regular Chromium instead.');
|
||||
const chromeArguments = [...chromiumSwitches];
|
||||
|
||||
if (os.platform() === 'darwin') {
|
||||
|
|
|
@ -184,3 +184,10 @@ it('should not create pages automatically', async ({ browserType }) => {
|
|||
await browser.close();
|
||||
expect(targets.length).toBe(0);
|
||||
});
|
||||
|
||||
it('should throw helpful error when launching chromium-headless-shell channel as headed', async ({ browserType, channel }) => {
|
||||
it.skip(channel !== 'chromium-headless-shell');
|
||||
await expect(browserType.launch({ channel: 'chromium-headless-shell', headless: false })).rejects.toThrow(
|
||||
'Cannot launch headed Chromium with `chromium-headless-shell` channel. Consider using regular Chromium instead.'
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue