mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
feat(tracing): allow including source files in traces (#9946)
This commit is contained in:
parent
d1b43fafd3
commit
85497c5509
@ -127,7 +127,11 @@ a timeline preview.
|
||||
|
||||
Whether to capture DOM snapshot on every action.
|
||||
|
||||
### option: Tracing.start.sources
|
||||
* langs: js
|
||||
- `sources` <[boolean]>
|
||||
|
||||
Whether to include source files for trace actions.
|
||||
|
||||
## async method: Tracing.startChunk
|
||||
|
||||
|
||||
5
packages/playwright-core/types/types.d.ts
vendored
5
packages/playwright-core/types/types.d.ts
vendored
@ -14394,6 +14394,11 @@ export interface Tracing {
|
||||
* Whether to capture DOM snapshot on every action.
|
||||
*/
|
||||
snapshots?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to include source files for trace actions.
|
||||
*/
|
||||
sources?: boolean;
|
||||
}): Promise<void>;
|
||||
|
||||
/**
|
||||
|
||||
@ -188,7 +188,7 @@ export const test = _baseTest.extend<TestFixtures, WorkerAndFileFixtures>({
|
||||
context.setDefaultNavigationTimeout(navigationTimeout || actionTimeout || 0);
|
||||
if (captureTrace) {
|
||||
if (!(context.tracing as any)[kTracingStarted]) {
|
||||
await context.tracing.start({ screenshots: true, snapshots: true, sources: true } as any);
|
||||
await context.tracing.start({ screenshots: true, snapshots: true, sources: true });
|
||||
(context.tracing as any)[kTracingStarted] = true;
|
||||
} else {
|
||||
await context.tracing.startChunk();
|
||||
|
||||
@ -110,7 +110,7 @@ const test = playwrightTest.extend<{ showTraceViewer: (trace: string) => Promise
|
||||
runAndTrace: async ({ context, showTraceViewer }, use, testInfo) => {
|
||||
await use(async (body: () => Promise<void>) => {
|
||||
const traceFile = testInfo.outputPath('trace.zip');
|
||||
await context.tracing.start({ snapshots: true, screenshots: true, sources: true } as any);
|
||||
await context.tracing.start({ snapshots: true, screenshots: true, sources: true });
|
||||
await body();
|
||||
await context.tracing.stop({ path: traceFile });
|
||||
return showTraceViewer(traceFile);
|
||||
@ -124,7 +124,7 @@ let traceFile: string;
|
||||
|
||||
test.beforeAll(async function recordTrace({ browser, browserName, browserType, server }, workerInfo) {
|
||||
const context = await browser.newContext();
|
||||
await context.tracing.start({ name: 'test', screenshots: true, snapshots: true, sources: true } as any);
|
||||
await context.tracing.start({ name: 'test', screenshots: true, snapshots: true, sources: true });
|
||||
const page = await context.newPage();
|
||||
await page.goto('data:text/html,<html>Hello world</html>');
|
||||
await page.setContent('<button>Click</button>');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user