mirror of
https://github.com/microsoft/playwright.git
synced 2024-11-24 06:49:04 +03:00
Some options, usually paths, do not make sense when running remotely.
This commit is contained in:
parent
8da3502df5
commit
ea963a8e86
@ -57,6 +57,7 @@ export class PlaywrightConnection {
|
||||
this._ws = ws;
|
||||
this._preLaunched = preLaunched;
|
||||
this._options = options;
|
||||
options.launchOptions = filterLaunchOptions(options.launchOptions);
|
||||
if (clientType === 'reuse-browser' || clientType === 'pre-launched-browser-or-android')
|
||||
assert(preLaunched.playwright);
|
||||
if (clientType === 'pre-launched-browser-or-android')
|
||||
@ -271,6 +272,21 @@ function launchOptionsHash(options: LaunchOptions) {
|
||||
return JSON.stringify(copy);
|
||||
}
|
||||
|
||||
function filterLaunchOptions(options: LaunchOptions) {
|
||||
return {
|
||||
channel: options.channel,
|
||||
args: options.args,
|
||||
ignoreAllDefaultArgs: options.ignoreAllDefaultArgs,
|
||||
ignoreDefaultArgs: options.ignoreDefaultArgs,
|
||||
timeout: options.timeout,
|
||||
headless: options.headless,
|
||||
proxy: options.proxy,
|
||||
chromiumSandbox: options.chromiumSandbox,
|
||||
firefoxUserPrefs: options.firefoxUserPrefs,
|
||||
slowMo: options.slowMo,
|
||||
};
|
||||
}
|
||||
|
||||
const defaultLaunchOptions: LaunchOptions = {
|
||||
ignoreAllDefaultArgs: false,
|
||||
handleSIGINT: false,
|
||||
|
@ -576,6 +576,19 @@ for (const kind of ['launchServer', 'run-server'] as const) {
|
||||
expect(entry.request.url).toBe(server.EMPTY_PAGE);
|
||||
});
|
||||
|
||||
test('should filter launch options', async ({ connect, startRemoteServer, server, browserType }, testInfo) => {
|
||||
const tracesDir = testInfo.outputPath('traces');
|
||||
const oldTracesDir = (browserType as any)._defaultLaunchOptions.tracesDir;
|
||||
(browserType as any)._defaultLaunchOptions.tracesDir = tracesDir;
|
||||
const remoteServer = await startRemoteServer(kind);
|
||||
const browser = await connect(remoteServer.wsEndpoint());
|
||||
const page = await browser.newPage();
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await browser.close();
|
||||
(browserType as any)._defaultLaunchOptions.tracesDir = oldTracesDir;
|
||||
expect(fs.existsSync(tracesDir)).toBe(false);
|
||||
});
|
||||
|
||||
test('should record trace with sources', async ({ connect, startRemoteServer, server, trace }, testInfo) => {
|
||||
test.skip(trace === 'on');
|
||||
const remoteServer = await startRemoteServer(kind);
|
||||
|
Loading…
Reference in New Issue
Block a user