Родитель
b0b429fed0
Коммит
1ab99fe1b8
|
@ -142,3 +142,6 @@ Maximum time in milliseconds to wait for the application to start. Defaults to `
|
|||
|
||||
### option: Electron.launch.timezoneId = %%-context-option-timezoneid-%%
|
||||
* since: v1.12
|
||||
|
||||
### option: Electron.launch.tracesDir = %%-browser-option-tracesdir-%%
|
||||
* since: v1.36
|
||||
|
|
|
@ -51,6 +51,7 @@ export class Electron extends ChannelOwner<channels.ElectronChannel> implements
|
|||
const params: channels.ElectronLaunchParams = {
|
||||
...await prepareBrowserContextParams(options),
|
||||
env: envObjectToArray(options.env ? options.env : process.env),
|
||||
tracesDir: options.tracesDir,
|
||||
};
|
||||
const app = ElectronApplication.from((await this._channel.launch(params)).electronApplication);
|
||||
app._context._options = params;
|
||||
|
|
|
@ -2240,6 +2240,7 @@ scheme.ElectronLaunchParams = tObject({
|
|||
})),
|
||||
strictSelectors: tOptional(tBoolean),
|
||||
timezoneId: tOptional(tString),
|
||||
tracesDir: tOptional(tString),
|
||||
});
|
||||
scheme.ElectronLaunchResult = tObject({
|
||||
electronApplication: tChannel(['ElectronApplication']),
|
||||
|
|
|
@ -231,7 +231,7 @@ export class Electron extends SdkObject {
|
|||
browserLogsCollector,
|
||||
artifactsDir,
|
||||
downloadsPath: artifactsDir,
|
||||
tracesDir: artifactsDir,
|
||||
tracesDir: options.tracesDir || artifactsDir,
|
||||
originalLaunchOptions: {},
|
||||
};
|
||||
validateBrowserContextOptions(contextOptions, browserOptions);
|
||||
|
|
|
@ -16995,6 +16995,11 @@ export interface Electron {
|
|||
* for a list of supported timezone IDs. Defaults to the system timezone.
|
||||
*/
|
||||
timezoneId?: string;
|
||||
|
||||
/**
|
||||
* If specified, traces are saved into this directory.
|
||||
*/
|
||||
tracesDir?: string;
|
||||
}): Promise<ElectronApplication>;
|
||||
}
|
||||
|
||||
|
|
|
@ -4015,6 +4015,7 @@ export type ElectronLaunchParams = {
|
|||
},
|
||||
strictSelectors?: boolean,
|
||||
timezoneId?: string,
|
||||
tracesDir?: string,
|
||||
};
|
||||
export type ElectronLaunchOptions = {
|
||||
executablePath?: string,
|
||||
|
@ -4049,6 +4050,7 @@ export type ElectronLaunchOptions = {
|
|||
},
|
||||
strictSelectors?: boolean,
|
||||
timezoneId?: string,
|
||||
tracesDir?: string,
|
||||
};
|
||||
export type ElectronLaunchResult = {
|
||||
electronApplication: ElectronApplicationChannel,
|
||||
|
|
|
@ -3176,6 +3176,7 @@ Electron:
|
|||
height: number
|
||||
strictSelectors: boolean?
|
||||
timezoneId: string?
|
||||
tracesDir: string?
|
||||
|
||||
returns:
|
||||
electronApplication: ElectronApplication
|
||||
|
|
|
@ -15,9 +15,10 @@
|
|||
*/
|
||||
|
||||
import { electronTest as test, expect } from './electronTest';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
test.skip(({ trace }) => trace === 'on');
|
||||
// test.slow();
|
||||
|
||||
test('should record trace', async ({ newWindow, server, runAndTrace }) => {
|
||||
const traceViewer = await runAndTrace(async () => {
|
||||
|
@ -45,3 +46,17 @@ test('should support custom protocol', async ({ electronApp, newWindow, server,
|
|||
await expect(frame.locator('button')).toHaveCSS('color', 'rgb(255, 0, 0)');
|
||||
await expect(frame.locator('button')).toHaveCSS('font-weight', '700');
|
||||
});
|
||||
|
||||
test('should respect tracesDir and name', async ({ launchElectronApp, server }, testInfo) => {
|
||||
const tracesDir = testInfo.outputPath('traces');
|
||||
const electronApp = await launchElectronApp('electron-window-app.js', [], { tracesDir });
|
||||
|
||||
await electronApp.context().tracing.start({ name: 'name1', snapshots: true });
|
||||
const page = await electronApp.firstWindow();
|
||||
await page.goto(server.PREFIX + '/one-style.html');
|
||||
await electronApp.context().tracing.stopChunk({ path: testInfo.outputPath('trace1.zip') });
|
||||
expect(fs.existsSync(path.join(tracesDir, 'name1.trace'))).toBe(true);
|
||||
expect(fs.existsSync(path.join(tracesDir, 'name1.network'))).toBe(true);
|
||||
|
||||
await electronApp.close();
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче