improved docs

Signed-off-by: René <snooz@posteo.de>
This commit is contained in:
René 2024-10-17 00:34:57 +02:00
parent 01829d9a58
commit 159bdb0312
3 changed files with 29 additions and 2 deletions

View file

@ -280,6 +280,7 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snaps
throw new Error(`Tracing is already stopping`); throw new Error(`Tracing is already stopping`);
if (this._state.recording) if (this._state.recording)
throw new Error(`Must stop trace file before stopping tracing`); throw new Error(`Must stop trace file before stopping tracing`);
await this._closeAllGroups();
this._harTracer.stop(); this._harTracer.stop();
this.flushHarEntries(); this.flushHarEntries();
await this._fs.syncAndGetError(); await this._fs.syncAndGetError();

View file

@ -21061,10 +21061,34 @@ export interface Tracing {
/** /**
* Creates a new inline group in the trace, causing any subsequent calls to belong to this group, until * Creates a new inline group in the trace, causing any subsequent calls to belong to this group, until
* [tracing.groupEnd()](https://playwright.dev/docs/api/class-tracing#tracing-group-end) is called. * [tracing.groupEnd()](https://playwright.dev/docs/api/class-tracing#tracing-group-end) is called.
* @param name Group name shown in the trace viewer. *
* Groups can be nested and are similar to [test.step()](https://playwright.dev/docs/api/class-test#test-step) in trace.
* However, groups are only visualized in the trace viewer and, unlike test.step, have no effect on the test reports.
*
* **NOTE** Groups should not be used with Playwright Test! This API is intended for Playwright API users that can not use [test.step()](https://playwright.dev/docs/api/class-test#test-step).
*
*
* **Usage**
* ```js
* await context.tracing.start({ screenshots: true, snapshots: true });
* await context.tracing.group('Open Playwright.dev');
* const page = await context.newPage();
* await page.goto('https://playwright.dev/');
* await context.tracing.groupEnd();
* await context.tracing.group('Open API Docs of Tracing');
* await page.getByRole('link', { name: 'API' }).click();
* await page.getByRole('link', { name: 'Tracing' }).click();
* await context.tracing.groupEnd();
* ```
*
* @param name Group name shown in the actions tree in trace viewer.
* @param options * @param options
*/ */
group(name: string, options?: { group(name: string, options?: {
/**
* Specifies a custom location for the group start to be shown in source tab in trace viewer.
* By default, location of the tracing.group() call is shown.
*/
location?: { location?: {
/** /**
* Source file path to be shown in the trace viewer source tab. * Source file path to be shown in the trace viewer source tab.
@ -21084,7 +21108,8 @@ export interface Tracing {
}): Promise<void>; }): Promise<void>;
/** /**
* Closes the last opened inline group in the trace. * Closes the currently open inline group in the trace.
*
*/ */
groupEnd(): Promise<void>; groupEnd(): Promise<void>;

View file

@ -3176,6 +3176,7 @@ Dialog:
dismiss: dismiss:
Tracing: Tracing:
type: interface type: interface