Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: two-line trace view (1) (#36025)
Pavel Feldman6a2a70619a2f
diff --git a/packages/playwright-core/src/client/browser.ts b/packages/playwright-core/src/client/browser.tsindex 5031656dc7..f55e73774a 100644--- a/packages/playwright-core/src/client/browser.ts+++ b/packages/playwright-core/src/client/browser.ts@@ -67,7 +67,7 @@ export class Browser extends ChannelOwner<channels.BrowserChannel> implements apcontext._onClose();}return await this._innerNewContext(options, true);- }, true);+ }, { internal: true });}async _stopPendingOperations(reason: string) {@@ -104,7 +104,7 @@ export class Browser extends ChannelOwner<channels.BrowserChannel> implements appage._ownedContext = context;context._ownerPage = page;return page;- });+ }, { title: 'Create page' });}isConnected(): boolean {diff --git a/packages/playwright-core/src/client/browserContext.ts b/packages/playwright-core/src/client/browserContext.tsindex 765551fb1f..f16b6f5d1c 100644--- a/packages/playwright-core/src/client/browserContext.ts+++ b/packages/playwright-core/src/client/browserContext.ts@@ -503,7 +503,7 @@ export class BrowserContext extends ChannelOwner<channels.BrowserContextChannel>}await artifact.delete();}- }, true);+ }, { internal: true });await this._channel.close(options);await this._closedPromise;}diff --git a/packages/playwright-core/src/client/channelOwner.ts b/packages/playwright-core/src/client/channelOwner.tsindex bb12d92703..9fb73a5df0 100644--- a/packages/playwright-core/src/client/channelOwner.ts+++ b/packages/playwright-core/src/client/channelOwner.ts@@ -152,18 +152,18 @@ export abstract class ChannelOwner<T extends channels.Channel = channels.Channelreturn async (params: any) => {return await this._wrapApiCall(async apiZone => {const validatedParams = validator(params, '', this._validatorToWireContext());- if (!apiZone.isInternal && !apiZone.reported) {+ if (!apiZone.internal && !apiZone.reported) {// Reporting/tracing/logging this api call for the first time.apiZone.params = params;apiZone.reported = true;this._instrumentation.onApiCallBegin(apiZone);logApiCall(this._platform, this._logger, `=> ${apiZone.apiName} started`);- return await this._connection.sendMessageToServer(this, prop, validatedParams, apiZone.apiName, apiZone.frames, apiZone.stepId);+ return await this._connection.sendMessageToServer(this, prop, validatedParams, apiZone);}// Since this api call is either internal, or has already been reported/traced once,- // passing undefined apiName will avoid an extra unneeded tracing entry.- return await this._connection.sendMessageToServer(this, prop, validatedParams, undefined, [], undefined);- }, internal);+ // passing as internal.+ return await this._connection.sendMessageToServer(this, prop, validatedParams, { internal: true });+ }, { internal });};}}@@ -174,18 +174,18 @@ export abstract class ChannelOwner<T extends channels.Channel = channels.Channelreturn channel;}- async _wrapApiCall<R>(func: (apiZone: ApiZone) => Promise<R>, isInternal: boolean = false): Promise<R> {+ async _wrapApiCall<R>(func: (apiZone: ApiZone) => Promise<R>, options?: { internal?: boolean, title?: string }): Promise<R> {const logger = this._logger;const existingApiZone = this._platform.zones.current().data<ApiZone>();if (existingApiZone)return await func(existingApiZone);const stackTrace = captureLibraryStackTrace(this._platform);- const apiZone: ApiZone = { apiName: stackTrace.apiName, frames: stackTrace.frames, isInternal, reported: false, userData: undefined, stepId: undefined };+ const apiZone: ApiZone = { title: options?.title, apiName: stackTrace.apiName, frames: stackTrace.frames, internal: options?.internal ?? false, reported: false, userData: undefined, stepId: undefined };try {const result = await this._platform.zones.current().push(apiZone).run(async () => await func(apiZone));- if (!isInternal) {+ if (!options?.internal) {logApiCall(this._platform, logger, `<= ${apiZone.apiName} succeeded`);this._instrumentation.onApiCallEnd(apiZone);}@@ -199,7 +199,7 @@ export abstract class ChannelOwner<T extends channels.Channel = channels.Channele.stack = e.message + stackFrames;elsee.stack = '';- if (!isInternal) {+ if (!options?.internal) {apiZone.error = e;logApiCall(this._platform, logger, `<= ${apiZone.apiName} failed`);this._instrumentation.onApiCallEnd(apiZone);@@ -240,7 +240,8 @@ type ApiZone = {apiName: string;params?: Record<string, any>;frames: channels.StackFrame[];- isInternal: boolean;+ title?: string;+ internal?: boolean;reported: boolean;userData: any;stepId?: string;diff --git a/packages/playwright-core/src/client/clientInstrumentation.ts b/packages/playwright-core/src/client/clientInstrumentation.tsindex 479a88003d..d17b8b85bc 100644--- a/packages/playwright-core/src/client/clientInstrumentation.ts+++ b/packages/playwright-core/src/client/clientInstrumentation.ts@@ -21,6 +21,7 @@ import type { StackFrame } from '@protocol/channels';// Instrumentation can mutate the data, for example change apiName or stepId.export interface ApiCallData {apiName: string;+ title?: string;params?: Record<string, any>;frames: StackFrame[];userData: any;diff --git a/packages/playwright-core/src/client/connection.ts b/packages/playwright-core/src/client/connection.tsindex f439c8bb22..cfafb4f929 100644--- a/packages/playwright-core/src/client/connection.ts+++ b/packages/playwright-core/src/client/connection.ts@@ -67,7 +67,7 @@ export class Connection extends EventEmitter {readonly _objects = new Map<string, ChannelOwner>();onmessage = (message: object): void => {};private _lastId = 0;- private _callbacks = new Map<number, { resolve: (a: any) => void, reject: (a: Error) => void, apiName: string | undefined, type: string, method: string }>();+ private _callbacks = new Map<number, { resolve: (a: any) => void, reject: (a: Error) => void, title: string | undefined, type: string, method: string }>();private _rootObject: Root;private _closedError: Error | undefined;private _isRemote = false;@@ -123,7 +123,7 @@ export class Connection extends EventEmitter {this._tracingCount--;}- async sendMessageToServer(object: ChannelOwner, method: string, params: any, apiName: string | undefined, frames: channels.StackFrame[], stepId?: string): Promise<any> {+ async sendMessageToServer(object: ChannelOwner, method: string, params: any, options: { apiName?: string, title?: string, internal?: boolean, frames?: channels.StackFrame[], stepId?: string }): Promise<any> {if (this._closedError)throw this._closedError;if (object._wasCollected)@@ -137,14 +137,14 @@ export class Connection extends EventEmitter {// Do not include metadata in debug logs to avoid noise.this._platform.log('channel', 'SEND> ' + JSON.stringify(message));}- const location = frames[0] ? { file: frames[0].file, line: frames[0].line, column: frames[0].column } : undefined;- const metadata: channels.Metadata = { apiName, location, internal: !apiName, stepId };- if (this._tracingCount && frames && type !== 'LocalUtils')- this._localUtils?.addStackToTracingNoReply({ callData: { stack: frames, id } }).catch(() => {});+ const location = options.frames?.[0] ? { file: options.frames[0].file, line: options.frames[0].line, column: options.frames[0].column } : undefined;+ const metadata: channels.Metadata = { title: options.title, location, internal: options.internal, stepId: options.stepId, apiName: options.apiName };+ if (this._tracingCount && options.frames && type !== 'LocalUtils')+ this._localUtils?.addStackToTracingNoReply({ callData: { stack: options.frames ?? [], id } }).catch(() => {});// We need to exit zones before calling into the server, otherwise// when we receive events from the server, we would be in an API zone.this._platform.zones.empty.run(() => this.onmessage({ ...message, metadata }));- return await new Promise((resolve, reject) => this._callbacks.set(id, { resolve, reject, apiName, type, method }));+ return await new Promise((resolve, reject) => this._callbacks.set(id, { resolve, reject, title: options.title, type, method }));}private _validatorFromWireContext(): ValidatorContext {diff --git a/packages/playwright-core/src/client/elementHandle.ts b/packages/playwright-core/src/client/elementHandle.tsindex 7e7519d298..85c91e8c22 100644--- a/packages/playwright-core/src/client/elementHandle.ts+++ b/packages/playwright-core/src/client/elementHandle.ts@@ -300,7 +300,7 @@ export async function convertInputFiles(platform: Platform, files: string | FilelastModifiedMs};})),- }), true);+ }), { internal: true });for (let i = 0; i < files.length; i++) {const writable = WritableStream.from(writableStreams[i]);await platform.streamFile(files[i], writable.stream());diff --git a/packages/playwright-core/src/client/fetch.ts b/packages/playwright-core/src/client/fetch.tsindex c16a24069f..31029eaca9 100644--- a/packages/playwright-core/src/client/fetch.ts+++ b/packages/playwright-core/src/client/fetch.ts@@ -352,7 +352,7 @@ export class APIResponse implements api.APIResponse {throw new Error('Response has been disposed');throw e;}- }, true);+ }, { internal: true });}async text(): Promise<string> {diff --git a/packages/playwright-core/src/client/frame.ts b/packages/playwright-core/src/client/frame.tsindex 68aa895b8a..32fa6b0997 100644--- a/packages/playwright-core/src/client/frame.ts+++ b/packages/playwright-core/src/client/frame.ts@@ -157,7 +157,7 @@ export class Frame extends ChannelOwner<channels.FrameChannel> implements api.Frconst response = request ? await waiter.waitForPromise(request._finalRequest()._internalResponse()) : null;waiter.dispose();return response;- });+ }, { title: 'Wait for navigation' });}async waitForLoadState(state: LifecycleEvent = 'load', options: { timeout?: number } = {}): Promise<void> {@@ -173,7 +173,7 @@ export class Frame extends ChannelOwner<channels.FrameChannel> implements api.Fr});}waiter.dispose();- });+ }, { title: `Wait for load state "${state}"` });}async waitForURL(url: URLMatch, options: { waitUntil?: LifecycleEvent, timeout?: number } = {}): Promise<void> {diff --git a/packages/playwright-core/src/client/input.ts b/packages/playwright-core/src/client/input.tsindex 3d40deccdf..d77fc3b54d 100644--- a/packages/playwright-core/src/client/input.ts+++ b/packages/playwright-core/src/client/input.ts@@ -71,7 +71,9 @@ export class Mouse implements api.Mouse {}async dblclick(x: number, y: number, options: Omit<channels.PageMouseClickOptions, 'clickCount'> = {}) {- await this.click(x, y, { ...options, clickCount: 2 });+ await this._page._wrapApiCall(async () => {+ await this.click(x, y, { ...options, clickCount: 2 });+ }, { title: 'Double click' });}async wheel(deltaX: number, deltaY: number) {diff --git a/packages/playwright-core/src/client/locator.ts b/packages/playwright-core/src/client/locator.tsindex 071a7eee5e..08050901e6 100644--- a/packages/playwright-core/src/client/locator.ts+++ b/packages/playwright-core/src/client/locator.ts@@ -73,8 +73,8 @@ export class Locator implements api.Locator {(this as any)[this._frame._platform.inspectCustom] = () => this._inspect();}- private async _withElement<R>(task: (handle: ElementHandle<SVGElement | HTMLElement>, timeout?: number) => Promise<R>, timeout?: number): Promise<R> {- timeout = this._frame._timeout({ timeout });+ private async _withElement<R>(task: (handle: ElementHandle<SVGElement | HTMLElement>, timeout?: number) => Promise<R>, options: { title: string, internal?: boolean, timeout?: number }): Promise<R> {+ const timeout = this._frame._timeout({ timeout: options.timeout });const deadline = timeout ? monotonicTime() + timeout : 0;return await this._frame._wrapApiCall<R>(async () => {@@ -87,7 +87,7 @@ export class Locator implements api.Locator {} finally {await handle.dispose();}- });+ }, { title: options.title, internal: options.internal });}_equals(locator: Locator) {@@ -99,7 +99,7 @@ export class Locator implements api.Locator {}async boundingBox(options?: TimeoutOptions): Promise<Rect | null> {- return await this._withElement(h => h.boundingBox(), options?.timeout);+ return await this._withElement(h => h.boundingBox(), { title: 'Bounding box', timeout: options?.timeout });}async check(options: channels.ElementHandleCheckOptions & TimeoutOptions = {}) {@@ -111,7 +111,9 @@ export class Locator implements api.Locator {}async dblclick(options: channels.ElementHandleDblclickOptions & TimeoutOptions = {}): Promise<void> {- return await this._frame.dblclick(this._selector, { strict: true, ...options });+ await this._frame._wrapApiCall(async () => {+ return await this._frame.dblclick(this._selector, { strict: true, ...options });+ }, { title: 'Double click' });}async dispatchEvent(type: string, eventInit: Object = {}, options?: TimeoutOptions) {@@ -126,7 +128,7 @@ export class Locator implements api.Locator {}async evaluate<R, Arg>(pageFunction: structs.PageFunctionOn<SVGElement | HTMLElement, Arg, R>, arg?: Arg, options?: TimeoutOptions): Promise<R> {- return await this._withElement(h => h.evaluate(pageFunction, arg), options?.timeout);+ return await this._withElement(h => h.evaluate(pageFunction, arg), { title: 'Evaluate', timeout: options?.timeout });}async evaluateAll<R, Arg>(pageFunction: structs.PageFunctionOn<Element[], Arg, R>, arg?: Arg): Promise<R> {@@ -134,7 +136,7 @@ export class Locator implements api.Locator {}async evaluateHandle<R, Arg>(pageFunction: structs.PageFunctionOn<any, Arg, R>, arg?: Arg, options?: TimeoutOptions): Promise<structs.SmartHandle<R>> {- return await this._withElement(h => h.evaluateHandle(pageFunction, arg), options?.timeout);+ return await this._withElement(h => h.evaluateHandle(pageFunction, arg), { title: 'Evaluate', timeout: options?.timeout });}async fill(value: string, options: channels.ElementHandleFillOptions & TimeoutOptions = {}): Promise<void> {@@ -251,7 +253,7 @@ export class Locator implements api.Locator {}async _generateLocatorString(): Promise<string | null> {- return await this._withElement(h => h._generateLocatorString());+ return await this._withElement(h => h._generateLocatorString(), { title: 'Generate locator string', internal: true });}async getAttribute(name: string, options?: TimeoutOptions): Promise<string | null> {@@ -304,7 +306,7 @@ export class Locator implements api.Locator {async screenshot(options: Omit<channels.ElementHandleScreenshotOptions, 'mask'> & TimeoutOptions & { path?: string, mask?: api.Locator[] } = {}): Promise<Buffer> {const mask = options.mask as Locator[] | undefined;- return await this._withElement((h, timeout) => h.screenshot({ ...options, mask, timeout }), options.timeout);+ return await this._withElement((h, timeout) => h.screenshot({ ...options, mask, timeout }), { title: 'Screenshot', timeout: options.timeout });}async ariaSnapshot(options?: TimeoutOptions): Promise<string> {@@ -313,7 +315,7 @@ export class Locator implements api.Locator {}async scrollIntoViewIfNeeded(options: channels.ElementHandleScrollIntoViewIfNeededOptions & TimeoutOptions = {}) {- return await this._withElement((h, timeout) => h.scrollIntoViewIfNeeded({ ...options, timeout }), options.timeout);+ return await this._withElement((h, timeout) => h.scrollIntoViewIfNeeded({ ...options, timeout }), { title: 'Scroll into view', timeout: options.timeout });}async selectOption(values: string | api.ElementHandle | SelectOption | string[] | api.ElementHandle[] | SelectOption[] | null, options: SelectOptionOptions = {}): Promise<string[]> {@@ -321,7 +323,7 @@ export class Locator implements api.Locator {}async selectText(options: channels.ElementHandleSelectTextOptions & TimeoutOptions = {}): Promise<void> {- return await this._withElement((h, timeout) => h.selectText({ ...options, timeout }), options.timeout);+ return await this._withElement((h, timeout) => h.selectText({ ...options, timeout }), { title: 'Select text', timeout: options.timeout });}async setChecked(checked: boolean, options?: channels.ElementHandleCheckOptions & TimeoutOptions) {diff --git a/packages/playwright-core/src/client/network.ts b/packages/playwright-core/src/client/network.tsindex 7121659828..f2314f1328 100644--- a/packages/playwright-core/src/client/network.ts+++ b/packages/playwright-core/src/client/network.ts@@ -176,7 +176,7 @@ export class Request extends ChannelOwner<channels.RequestChannel> implements apif (!this._actualHeadersPromise) {this._actualHeadersPromise = this._wrapApiCall(async () => {return new RawHeaders((await this._channel.rawRequestHeaders()).headers);- }, true);+ }, { internal: true });}return await this._actualHeadersPromise;}@@ -348,7 +348,7 @@ export class Route extends ChannelOwner<channels.RouteChannel> implements api.Roawait this._handleRoute(async () => {await this._wrapApiCall(async () => {await this._innerFulfill(options);- }, true);+ }, { internal: true });});}diff --git a/packages/playwright-core/src/client/page.ts b/packages/playwright-core/src/client/page.tsindex 68a7ea04f9..ecb9d9cf70 100644--- a/packages/playwright-core/src/client/page.ts+++ b/packages/playwright-core/src/client/page.ts@@ -203,7 +203,7 @@ export class Page extends ChannelOwner<channels.PageChannel> implements api.Pagethis._routes.splice(index, 1);const handled = await routeHandler.handle(route);if (!this._routes.length)- this._wrapApiCall(() => this._updateInterceptionPatterns(), true).catch(() => {});+ this._wrapApiCall(() => this._updateInterceptionPatterns(), { internal: true }).catch(() => {});if (handled)return;}@@ -398,7 +398,7 @@ export class Page extends ChannelOwner<channels.PageChannel> implements api.Page} finally {if (remove)this._locatorHandlers.delete(uid);- this._wrapApiCall(() => this._channel.resolveLocatorHandlerNoReply({ uid, remove }), true).catch(() => {});+ this._wrapApiCall(() => this._channel.resolveLocatorHandlerNoReply({ uid, remove }), { internal: true }).catch(() => {});}}@@ -543,8 +543,10 @@ export class Page extends ChannelOwner<channels.PageChannel> implements api.Page}async unrouteAll(options?: { behavior?: 'wait'|'ignoreErrors'|'default' }): Promise<void> {- await this._unrouteInternal(this._routes, [], options?.behavior);- this._disposeHarRouters();+ await this._wrapApiCall(async () => {+ await this._unrouteInternal(this._routes, [], options?.behavior);+ this._disposeHarRouters();+ }, { title: 'Unroute all' });}async unroute(url: URLMatch, handler?: RouteHandlerCallback): Promise<void> {@@ -654,7 +656,9 @@ export class Page extends ChannelOwner<channels.PageChannel> implements api.Page}async dblclick(selector: string, options?: channels.FrameDblclickOptions & TimeoutOptions) {- return await this._mainFrame.dblclick(selector, options);+ await this._wrapApiCall(async () => {+ return await this._mainFrame.dblclick(selector, options);+ }, { title: 'Double click' });}async tap(selector: string, options?: channels.FrameTapOptions & TimeoutOptions) {diff --git a/packages/playwright-core/src/client/waiter.ts b/packages/playwright-core/src/client/waiter.tsindex e106ebd2bb..94736099e0 100644--- a/packages/playwright-core/src/client/waiter.ts+++ b/packages/playwright-core/src/client/waiter.ts@@ -41,7 +41,7 @@ export class Waiter {this._dispose = [() => this._channelOwner._wrapApiCall(async () => {await this._channelOwner._channel.waitForEventInfo({ info: { waitId: this._waitId, phase: 'after', error: this._error } });- }, true).catch(() => {}),+ }, { internal: true }).catch(() => {}),];}@@ -97,7 +97,7 @@ export class Waiter {this._logs.push(s);this._channelOwner._wrapApiCall(async () => {await this._channelOwner._channel.waitForEventInfo({ info: { waitId: this._waitId, phase: 'log', message: s } });- }, true).catch(() => {});+ }, { internal: true }).catch(() => {});}private _rejectOn(promise: Promise<any>, dispose?: () => void) {diff --git a/packages/playwright-core/src/protocol/debug.ts b/packages/playwright-core/src/protocol/debug.tsindex a2ca74c380..26194db5ee 100644--- a/packages/playwright-core/src/protocol/debug.ts+++ b/packages/playwright-core/src/protocol/debug.ts@@ -17,7 +17,7 @@// This file is generated by generate_channels.js, do not edit manually.export const methodMetainfo = new Map<string, { internal?: boolean, title?: string, slowMo?: boolean, snapshot?: boolean, pausesBeforeInput?: boolean }>([- ['APIRequestContext.fetch', { title: 'Fetch', }],+ ['APIRequestContext.fetch', { title: 'Fetch "{url}"', }],['APIRequestContext.fetchResponseBody', { internal: true, }],['APIRequestContext.fetchLog', { internal: true, }],['APIRequestContext.storageState', { internal: true, }],@@ -56,13 +56,18 @@ export const methodMetainfo = new Map<string, { internal?: boolean, title?: stri['Browser.close', { title: 'Close browser', }],['Browser.killForTests', { internal: true, }],['Browser.defaultUserAgentForTest', { internal: true, }],- ['Browser.newContext', { title: 'Create new context', }],+ ['Browser.newContext', { title: 'Create context', }],['Browser.newContextForReuse', { internal: true, }],['Browser.stopPendingOperations', { internal: true, title: 'Stop pending operations', }],['Browser.newBrowserCDPSession', { internal: true, title: 'Create CDP session', }],['Browser.startTracing', { internal: true, }],['Browser.stopTracing', { internal: true, }],- ['EventTarget.waitForEventInfo', { internal: true, snapshot: true, }],+ ['EventTarget.waitForEventInfo', { title: 'Wait for event "{info.event}"', snapshot: true, }],+ ['BrowserContext.waitForEventInfo', { title: 'Wait for event "{info.event}"', snapshot: true, }],+ ['Page.waitForEventInfo', { title: 'Wait for event "{info.event}"', snapshot: true, }],+ ['WebSocket.waitForEventInfo', { title: 'Wait for event "{info.event}"', snapshot: true, }],+ ['ElectronApplication.waitForEventInfo', { title: 'Wait for event "{info.event}"', snapshot: true, }],+ ['AndroidDevice.waitForEventInfo', { title: 'Wait for event "{info.event}"', snapshot: true, }],['BrowserContext.addCookies', { title: 'Add cookies', }],['BrowserContext.addInitScript', { title: 'Add init script', }],['BrowserContext.clearCookies', { title: 'Clear cookies', }],@@ -71,7 +76,7 @@ export const methodMetainfo = new Map<string, { internal?: boolean, title?: stri['BrowserContext.cookies', { title: 'Get cookies', }],['BrowserContext.exposeBinding', { title: 'Expose binding', }],['BrowserContext.grantPermissions', { title: 'Grant permissions', }],- ['BrowserContext.newPage', { title: 'Create new page', }],+ ['BrowserContext.newPage', { title: 'Create page', }],['BrowserContext.registerSelectorEngine', { internal: true, }],['BrowserContext.setTestIdAttributeName', { internal: true, }],['BrowserContext.setExtraHTTPHeaders', { title: 'Set extra HTTP headers', }],@@ -88,15 +93,15 @@ export const methodMetainfo = new Map<string, { internal?: boolean, title?: stri['BrowserContext.harExport', { internal: true, }],['BrowserContext.createTempFiles', { internal: true, }],['BrowserContext.updateSubscription', { internal: true, }],- ['BrowserContext.clockFastForward', { title: 'Fast forward clock', }],- ['BrowserContext.clockInstall', { title: 'Install clock', }],- ['BrowserContext.clockPauseAt', { title: 'Pause clock', }],+ ['BrowserContext.clockFastForward', { title: 'Fast forward clock "{ticksNumber}{ticksString}"', }],+ ['BrowserContext.clockInstall', { title: 'Install clock "{timeNumber}{timeString}"', }],+ ['BrowserContext.clockPauseAt', { title: 'Pause clock "{timeNumber}{timeString}"', }],['BrowserContext.clockResume', { title: 'Resume clock', }],- ['BrowserContext.clockRunFor', { title: 'Run clock', }],- ['BrowserContext.clockSetFixedTime', { title: 'Set fixed time', }],- ['BrowserContext.clockSetSystemTime', { title: 'Set system time', }],+ ['BrowserContext.clockRunFor', { title: 'Run clock "{ticksNumber}{ticksString}"', }],+ ['BrowserContext.clockSetFixedTime', { title: 'Set fixed time "{timeNumber}{timeString}"', }],+ ['BrowserContext.clockSetSystemTime', { title: 'Set system time "{timeNumber}{timeString}"', }],['Page.addInitScript', { }],- ['Page.close', { }],+ ['Page.close', { title: 'Close', }],['Page.emulateMedia', { title: 'Emulate media', snapshot: true, }],['Page.exposeBinding', { title: 'Expose binding', }],['Page.goBack', { title: 'Go back', slowMo: true, snapshot: true, }],@@ -112,12 +117,12 @@ export const methodMetainfo = new Map<string, { internal?: boolean, title?: stri['Page.setNetworkInterceptionPatterns', { title: 'Route', }],['Page.setWebSocketInterceptionPatterns', { title: 'Route web sockets', }],['Page.setViewportSize', { title: 'Set viewport size', snapshot: true, }],- ['Page.keyboardDown', { title: 'Key down', slowMo: true, snapshot: true, }],- ['Page.keyboardUp', { title: 'Key up', slowMo: true, snapshot: true, }],- ['Page.keyboardInsertText', { title: 'Insert text', slowMo: true, snapshot: true, }],- ['Page.keyboardType', { title: 'Type', slowMo: true, snapshot: true, }],- ['Page.keyboardPress', { title: 'Press', slowMo: true, snapshot: true, }],- ['Page.mouseMove', { title: 'Move mouse', slowMo: true, snapshot: true, }],+ ['Page.keyboardDown', { title: 'Key down "{key}"', slowMo: true, snapshot: true, }],+ ['Page.keyboardUp', { title: 'Key up "{key}"', slowMo: true, snapshot: true, }],+ ['Page.keyboardInsertText', { title: 'Insert "{text}"', slowMo: true, snapshot: true, }],+ ['Page.keyboardType', { title: 'Type "{text}"', slowMo: true, snapshot: true, }],+ ['Page.keyboardPress', { title: 'Press "{key}"', slowMo: true, snapshot: true, }],+ ['Page.mouseMove', { title: 'Mouse move', slowMo: true, snapshot: true, }],['Page.mouseDown', { title: 'Mouse down', slowMo: true, snapshot: true, }],['Page.mouseUp', { title: 'Mouse up', slowMo: true, snapshot: true, }],['Page.mouseClick', { title: 'Click', slowMo: true, snapshot: true, }],@@ -143,15 +148,15 @@ export const methodMetainfo = new Map<string, { internal?: boolean, title?: stri['Frame.content', { title: 'Get content', snapshot: true, }],['Frame.dragAndDrop', { title: 'Drag and drop', slowMo: true, snapshot: true, pausesBeforeInput: true, }],['Frame.dblclick', { title: 'Double click', slowMo: true, snapshot: true, pausesBeforeInput: true, }],- ['Frame.dispatchEvent', { title: 'Dispatch event', slowMo: true, snapshot: true, }],+ ['Frame.dispatchEvent', { title: 'Dispatch "{type}"', slowMo: true, snapshot: true, }],['Frame.evaluateExpression', { title: 'Evaluate', snapshot: true, }],['Frame.evaluateExpressionHandle', { title: 'Evaluate', snapshot: true, }],- ['Frame.fill', { title: 'Fill', slowMo: true, snapshot: true, pausesBeforeInput: true, }],+ ['Frame.fill', { title: 'Fill "{value}"', slowMo: true, snapshot: true, pausesBeforeInput: true, }],['Frame.focus', { title: 'Focus', slowMo: true, snapshot: true, }],['Frame.frameElement', { internal: true, }],['Frame.highlight', { internal: true, }],['Frame.getAttribute', { internal: true, snapshot: true, }],- ['Frame.goto', { title: 'Navigate', slowMo: true, snapshot: true, }],+ ['Frame.goto', { title: 'Navigate to "{url}"', slowMo: true, snapshot: true, }],['Frame.hover', { title: 'Hover', slowMo: true, snapshot: true, pausesBeforeInput: true, }],['Frame.innerHTML', { title: 'Get HTML', snapshot: true, }],['Frame.innerText', { title: 'Get inner text', snapshot: true, }],@@ -162,7 +167,7 @@ export const methodMetainfo = new Map<string, { internal?: boolean, title?: stri['Frame.isHidden', { title: 'Is hidden', snapshot: true, }],['Frame.isVisible', { title: 'Is visible', snapshot: true, }],['Frame.isEditable', { title: 'Is editable', snapshot: true, }],- ['Frame.press', { title: 'Press', slowMo: true, snapshot: true, pausesBeforeInput: true, }],+ ['Frame.press', { title: 'Press "{key}"', slowMo: true, snapshot: true, pausesBeforeInput: true, }],['Frame.querySelector', { title: 'Query selector', snapshot: true, }],['Frame.querySelectorAll', { title: 'Query selector all', snapshot: true, }],['Frame.queryCount', { title: 'Query count', snapshot: true, }],@@ -177,15 +182,21 @@ export const methodMetainfo = new Map<string, { internal?: boolean, title?: stri['Frame.waitForTimeout', { title: 'Wait for timeout', snapshot: true, }],['Frame.waitForFunction', { title: 'Wait for function', snapshot: true, }],['Frame.waitForSelector', { title: 'Wait for selector', snapshot: true, }],- ['Frame.expect', { title: 'Expect', snapshot: true, }],+ ['Frame.expect', { title: 'Expect "{expression}"', snapshot: true, }],['Worker.evaluateExpression', { title: 'Evaluate', }],['Worker.evaluateExpressionHandle', { title: 'Evaluate', }],['JSHandle.dispose', { }],+ ['ElementHandle.dispose', { }],['JSHandle.evaluateExpression', { title: 'Evaluate', snapshot: true, }],+ ['ElementHandle.evaluateExpression', { title: 'Evaluate', snapshot: true, }],['JSHandle.evaluateExpressionHandle', { title: 'Evaluate', snapshot: true, }],+ ['ElementHandle.evaluateExpressionHandle', { title: 'Evaluate', snapshot: true, }],['JSHandle.getPropertyList', { internal: true, }],+ ['ElementHandle.getPropertyList', { internal: true, }],['JSHandle.getProperty', { internal: true, }],+ ['ElementHandle.getProperty', { internal: true, }],['JSHandle.jsonValue', { internal: true, }],+ ['ElementHandle.jsonValue', { internal: true, }],['ElementHandle.evalOnSelector', { title: 'Evaluate', snapshot: true, }],['ElementHandle.evalOnSelectorAll', { title: 'Evaluate', snapshot: true, }],['ElementHandle.boundingBox', { title: 'Get bounding box', snapshot: true, }],@@ -194,7 +205,7 @@ export const methodMetainfo = new Map<string, { internal?: boolean, title?: stri['ElementHandle.contentFrame', { internal: true, snapshot: true, }],['ElementHandle.dblclick', { title: 'Double click', slowMo: true, snapshot: true, pausesBeforeInput: true, }],['ElementHandle.dispatchEvent', { title: 'Dispatch event', slowMo: true, snapshot: true, }],- ['ElementHandle.fill', { title: 'Fill', slowMo: true, snapshot: true, pausesBeforeInput: true, }],+ ['ElementHandle.fill', { title: 'Fill "{value}"', slowMo: true, snapshot: true, pausesBeforeInput: true, }],['ElementHandle.focus', { title: 'Focus', slowMo: true, snapshot: true, }],['ElementHandle.generateLocatorString', { internal: true, }],['ElementHandle.getAttribute', { internal: true, }],@@ -209,7 +220,7 @@ export const methodMetainfo = new Map<string, { internal?: boolean, title?: stri['ElementHandle.isHidden', { title: 'Is hidden', snapshot: true, }],['ElementHandle.isVisible', { title: 'Is visible', snapshot: true, }],['ElementHandle.ownerFrame', { title: 'Get owner frame', }],- ['ElementHandle.press', { title: 'Press', slowMo: true, snapshot: true, pausesBeforeInput: true, }],+ ['ElementHandle.press', { title: 'Press "{key}"', slowMo: true, snapshot: true, pausesBeforeInput: true, }],['ElementHandle.querySelector', { title: 'Query selector', snapshot: true, }],['ElementHandle.querySelectorAll', { title: 'Query selector all', snapshot: true, }],['ElementHandle.screenshot', { title: 'Screenshot', snapshot: true, }],@@ -246,7 +257,7 @@ export const methodMetainfo = new Map<string, { internal?: boolean, title?: stri['Dialog.dismiss', { title: 'Dismiss dialog', }],['Tracing.tracingStart', { internal: true, }],['Tracing.tracingStartChunk', { internal: true, }],- ['Tracing.tracingGroup', { title: 'Group', }],+ ['Tracing.tracingGroup', { }],['Tracing.tracingGroupEnd', { title: 'Group end', }],['Tracing.tracingStopChunk', { internal: true, }],['Tracing.tracingStop', { internal: true, }],@@ -272,7 +283,7 @@ export const methodMetainfo = new Map<string, { internal?: boolean, title?: stri['AndroidSocket.write', { internal: true, }],['AndroidSocket.close', { internal: true, }],['AndroidDevice.wait', { }],- ['AndroidDevice.fill', { title: 'Fill', }],+ ['AndroidDevice.fill', { title: 'Fill "{text}"', }],['AndroidDevice.tap', { title: 'Tap', }],['AndroidDevice.drag', { title: 'Drag', }],['AndroidDevice.fling', { title: 'Fling', }],diff --git a/packages/playwright-core/src/protocol/validator.ts b/packages/playwright-core/src/protocol/validator.tsindex 68c6ec930a..66a3b4dc47 100644--- a/packages/playwright-core/src/protocol/validator.ts+++ b/packages/playwright-core/src/protocol/validator.ts@@ -33,6 +33,7 @@ scheme.Metadata = tObject({column: tOptional(tNumber),})),apiName: tOptional(tString),+ title: tOptional(tString),internal: tOptional(tBoolean),stepId: tOptional(tString),});diff --git a/packages/playwright-core/src/server/debugger.ts b/packages/playwright-core/src/server/debugger.tsindex 643714aaf8..2006461f4c 100644--- a/packages/playwright-core/src/server/debugger.ts+++ b/packages/playwright-core/src/server/debugger.ts@@ -131,7 +131,7 @@ function shouldPauseOnCall(sdkObject: SdkObject, metadata: CallMetadata): booleafunction shouldPauseBeforeStep(metadata: CallMetadata): boolean {// Don't stop on internal.- if (!metadata.apiName)+ if (!metadata.apiName || metadata.internal)return false;// Always stop on 'close'if (metadata.method === 'close')@@ -142,6 +142,8 @@ function shouldPauseBeforeStep(metadata: CallMetadata): boolean {// Stop before everything that generates snapshot. But don't stop before those marked as pausesBeforeInputActions// since we stop in them on a separate instrumentation signal.const metainfo = methodMetainfo.get(step);+ if (metainfo?.internal)+ return false;return !!metainfo?.snapshot && !metainfo.pausesBeforeInput;}diff --git a/packages/playwright-core/src/server/dispatchers/dispatcher.ts b/packages/playwright-core/src/server/dispatchers/dispatcher.tsindex 4b78f25c93..5f45296367 100644--- a/packages/playwright-core/src/server/dispatchers/dispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/dispatcher.ts@@ -24,6 +24,7 @@ import { TargetClosedError, isTargetClosedError, serializeError } from '../errorimport { SdkObject } from '../instrumentation';import { isProtocolError } from '../protocolError';import { compressCallLog } from '../callLog';+import { methodMetainfo } from '../../protocol/debug';import type { CallMetadata } from '../instrumentation';import type { PlaywrightDispatcher } from './playwrightDispatcher';@@ -309,6 +310,7 @@ export class DispatcherConnection {id: `call@${id}`,location: validMetadata.location,apiName: validMetadata.apiName,+ title: renderTitle(dispatcher._type, method, params, validMetadata.title),internal: validMetadata.internal,stepId: validMetadata.stepId,objectId: sdkObject?.guid,@@ -388,3 +390,43 @@ function closeReason(sdkObject: SdkObject): string | undefined {sdkObject.attribution.context?._closeReason ||sdkObject.attribution.browser?._closeReason;}++function formatParam(params: Record<string, string> | undefined, name: string): string {+ if (!params)+ return '';+ if (name === 'url') {+ try {+ const urlObject = new URL(params[name]);+ if (urlObject.protocol === 'data:')+ return urlObject.protocol;+ if (urlObject.protocol === 'about:')+ return params[name];+ return urlObject.pathname + urlObject.search;+ } catch (error) {+ return params[name];+ }+ }+ if (name === 'timeNumber')+ return new Date(params[name]).toString();+ return deepParam(params, name);+}++function deepParam(params: Record<string, any>, name: string): string {+ const tokens = name.split('.');+ let current = params;+ for (const token of tokens) {+ if (typeof current !== 'object' || current === null)+ return '';+ current = current[token];+ }+ if (current === undefined)+ return '';+ return String(current);+}++function renderTitle(type: string, method: string, params: Record<string, string> | undefined, title?: string) {+ const titleFormat = title ?? methodMetainfo.get(type + '.' + method)?.title ?? method;+ return titleFormat.replace(/\{([^}]+)\}/g, (_, p1) => {+ return formatParam(params, p1);+ });+}diff --git a/packages/playwright-core/src/server/recorder/recorderUtils.ts b/packages/playwright-core/src/server/recorder/recorderUtils.tsindex 39e8c07557..39b13fb2bf 100644--- a/packages/playwright-core/src/server/recorder/recorderUtils.ts+++ b/packages/playwright-core/src/server/recorder/recorderUtils.ts@@ -25,10 +25,7 @@ export function buildFullSelector(framePath: string[], selector: string) {}export function metadataToCallLog(metadata: CallMetadata, status: CallLogStatus): CallLog {- let title = metadata.apiName || metadata.method;- if (metadata.method === 'waitForEventInfo')- title += `(${metadata.params.info.event})`;- title = title.replace('object.expect', 'expect');+ const title = metadata.title;if (metadata.error)status = 'error';const params = {@@ -43,7 +40,7 @@ export function metadataToCallLog(metadata: CallMetadata, status: CallLogStatus)const callLog: CallLog = {id: metadata.id,messages: metadata.log,- title,+ title: title ?? '',status,error: metadata.error?.error?.message,params,diff --git a/packages/playwright-core/src/server/trace/recorder/tracing.ts b/packages/playwright-core/src/server/trace/recorder/tracing.tsindex 313292ef9f..1b77156e47 100644--- a/packages/playwright-core/src/server/trace/recorder/tracing.ts+++ b/packages/playwright-core/src/server/trace/recorder/tracing.ts@@ -650,10 +650,7 @@ function createBeforeActionTraceEvent(metadata: CallMetadata, parentId?: string)type: 'before',callId: metadata.id,startTime: metadata.startTime,- // This will disappear for action trace events, their titles will be- // built based on the protocol metainfo. If I don't do this now,- // trace ill get frame.click instead of page.click in trace viewer.- title: metadata.apiName,+ title: metadata.title,class: metadata.type,method: metadata.method,params: metadata.params,diff --git a/packages/playwright/src/index.ts b/packages/playwright/src/index.tsindex ec70869b61..470a83454d 100644--- a/packages/playwright/src/index.ts+++ b/packages/playwright/src/index.ts@@ -115,7 +115,7 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({await use(browser);await (browser as any)._wrapApiCall(async () => {await browser.close({ reason: 'Test ended.' });- }, true);+ }, { internal: true });return;}@@ -123,7 +123,7 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({await use(browser);await (browser as any)._wrapApiCall(async () => {await browser.close({ reason: 'Test ended.' });- }, true);+ }, { internal: true });}, { scope: 'worker', timeout: 0 }],acceptDownloads: [({ contextOptions }, use) => use(contextOptions.acceptDownloads ?? true), { option: true }],@@ -267,7 +267,10 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({if (zone && zone.category === 'expect') {// Display the internal locator._expect call under the name of the enclosing expect call,// and connect it to the existing expect step.- data.apiName = zone.title;+ if (zone.apiName)+ data.apiName = zone.apiName;+ if (zone.title)+ data.title = zone.title;data.stepId = zone.stepId;return;}@@ -357,11 +360,11 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({await (context as any)._wrapApiCall(async () => {await context.clock.install({ time: 0 });await context.clock.pauseAt(1000);- }, true);+ }, { internal: true });} else if (process.env.PW_CLOCK === 'realtime') {await (context as any)._wrapApiCall(async () => {await context.clock.install({ time: 0 });- }, true);+ }, { internal: true });}return context;@@ -372,7 +375,7 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({await Promise.all([...contexts.keys()].map(async context => {await (context as any)._wrapApiCall(async () => {await context.close({ reason: closeReason });- }, true);+ }, { internal: true });const testFailed = testInfo.status !== testInfo.expectedStatus;const preserveVideo = captureVideo && (videoMode === 'on' || (testFailed && videoMode === 'retain-on-failure') || (videoMode === 'on-first-retry' && testInfo.retry === 1));if (preserveVideo) {diff --git a/packages/playwright/src/matchers/expect.ts b/packages/playwright/src/matchers/expect.tsindex f9bfa5cc36..06c4243e32 100644--- a/packages/playwright/src/matchers/expect.ts+++ b/packages/playwright/src/matchers/expect.ts@@ -343,7 +343,8 @@ class ExpectMetaInfoProxyHandler implements ProxyHandler<any> {const customMessage = this._info.message || '';const argsSuffix = computeArgsSuffix(matcherName, args);- const defaultTitle = `expect${this._info.poll ? '.poll' : ''}${this._info.isSoft ? '.soft' : ''}${this._info.isNot ? '.not' : ''}.${matcherName}${argsSuffix}`;+ const defaultTitle = `Expect ${this._info.poll ? 'poll ' : ''}${this._info.isSoft ? 'soft ' : ''}${this._info.isNot ? 'not ' : ''}${matcherName}${argsSuffix}`;+ const apiName = `expect${this._info.poll ? '.poll ' : ''}${this._info.isSoft ? '.soft ' : ''}${this._info.isNot ? '.not' : ''}.${matcherName}${argsSuffix}`;const title = customMessage || defaultTitle;// This looks like it is unnecessary, but it isn't - we need to filter@@ -354,6 +355,7 @@ class ExpectMetaInfoProxyHandler implements ProxyHandler<any> {// so they behave like a retriable step.const stepInfo = {category: (matcherName === 'toPass' || this._info.poll) ? 'step' : 'expect',+ apiName,title: trimLongString(title, 1024),params: args[0] ? { expected: args[0] } : undefined,infectParentStepsWithError: this._info.isSoft,diff --git a/packages/protocol/src/callMetadata.d.ts b/packages/protocol/src/callMetadata.d.tsindex 36e8b828c0..560d9a354f 100644--- a/packages/protocol/src/callMetadata.d.ts+++ b/packages/protocol/src/callMetadata.d.ts@@ -26,6 +26,7 @@ export type CallMetadata = {method: string;params: any;apiName?: string;+ title?: string;// Client is making an internal call that should not show up in// the inspector or trace.internal?: boolean;diff --git a/packages/protocol/src/channels.d.ts b/packages/protocol/src/channels.d.tsindex 30e63c71be..8e4cdca103 100644--- a/packages/protocol/src/channels.d.ts+++ b/packages/protocol/src/channels.d.ts@@ -148,6 +148,7 @@ export type Metadata = {column?: number,},apiName?: string,+ title?: string,internal?: boolean,stepId?: string,};diff --git a/packages/protocol/src/protocol.yml b/packages/protocol/src/protocol.ymlindex da8f500cb6..e62b34698d 100644--- a/packages/protocol/src/protocol.yml+++ b/packages/protocol/src/protocol.yml@@ -32,6 +32,7 @@ Metadata:line: number?column: number?apiName: string?+ title: string?internal: boolean?# Test runner step id.stepId: string?@@ -362,7 +363,7 @@ APIRequestContext:commands:fetch:- title: Fetch+ title: Fetch "{url}"parameters:url: stringencodedParams: string?@@ -1072,7 +1073,7 @@ Browser:userAgent: stringnewContext:- title: Create new context+ title: Create contextparameters:$mixin: ContextOptionsproxy:@@ -1168,7 +1169,7 @@ EventTarget:commands:waitForEventInfo:- internal: true+ title: Wait for event "{info.event}"parameters:info:type: object@@ -1257,7 +1258,7 @@ BrowserContext:origin: string?newPage:- title: Create new page+ title: Create pagereturns:page: Page@@ -1416,19 +1417,19 @@ BrowserContext:enabled: booleanclockFastForward:- title: Fast forward clock+ title: Fast forward clock "{ticksNumber}{ticksString}"parameters:ticksNumber: number?ticksString: string?clockInstall:- title: Install clock+ title: Install clock "{timeNumber}{timeString}"parameters:timeNumber: number?timeString: string?clockPauseAt:- title: Pause clock+ title: Pause clock "{timeNumber}{timeString}"parameters:timeNumber: number?timeString: string?@@ -1437,19 +1438,19 @@ BrowserContext:title: Resume clockclockRunFor:- title: Run clock+ title: Run clock "{ticksNumber}{ticksString}"parameters:ticksNumber: number?ticksString: string?clockSetFixedTime:- title: Set fixed time+ title: Set fixed time "{timeNumber}{timeString}"parameters:timeNumber: number?timeString: string?clockSetSystemTime:- title: Set system time+ title: Set system time "{timeNumber}{timeString}"parameters:timeNumber: number?timeString: string?@@ -1546,6 +1547,7 @@ Page:source: stringclose:+ title: Closeparameters:runBeforeUnload: boolean?reason: string?@@ -1739,7 +1741,7 @@ Page:snapshot: truekeyboardDown:- title: Key down+ title: Key down "{key}"parameters:key: stringflags:@@ -1747,7 +1749,7 @@ Page:snapshot: truekeyboardUp:- title: Key up+ title: Key up "{key}"parameters:key: stringflags:@@ -1755,7 +1757,7 @@ Page:snapshot: truekeyboardInsertText:- title: Insert text+ title: Insert "{text}"parameters:text: stringflags:@@ -1763,7 +1765,7 @@ Page:snapshot: truekeyboardType:- title: Type+ title: Type "{text}"parameters:text: stringdelay: number?@@ -1772,7 +1774,7 @@ Page:snapshot: truekeyboardPress:- title: Press+ title: Press "{key}"parameters:key: stringdelay: number?@@ -1781,7 +1783,7 @@ Page:snapshot: truemouseMove:- title: Move mouse+ title: Mouse moveparameters:x: numbery: number@@ -2215,7 +2217,7 @@ Frame:pausesBeforeInput: truedispatchEvent:- title: Dispatch event+ title: Dispatch "{type}"parameters:selector: stringstrict: boolean?@@ -2249,7 +2251,7 @@ Frame:snapshot: truefill:- title: Fill+ title: Fill "{value}"parameters:selector: stringstrict: boolean?@@ -2294,7 +2296,7 @@ Frame:snapshot: truegoto:- title: Navigate+ title: Navigate to "{url}"parameters:url: stringtimeout: number@@ -2428,7 +2430,7 @@ Frame:snapshot: truepress:- title: Press+ title: Press "{key}"parameters:selector: stringstrict: boolean?@@ -2644,7 +2646,7 @@ Frame:snapshot: trueexpect:- title: Expect+ title: Expect "{expression}"parameters:selector: stringexpression: string@@ -2908,7 +2910,7 @@ ElementHandle:snapshot: truefill:- title: Fill+ title: Fill "{value}"parameters:value: stringforce: boolean?@@ -3027,7 +3029,7 @@ ElementHandle:frame: Frame?press:- title: Press+ title: Press "{key}"parameters:key: stringdelay: number?@@ -3544,7 +3546,6 @@ Tracing:traceName: stringtracingGroup:- title: Groupparameters:name: stringlocation:@@ -3846,7 +3847,7 @@ AndroidDevice:timeout: numberfill:- title: Fill+ title: Fill "{text}"parameters:selector: AndroidSelectortext: stringdiff --git a/packages/trace-viewer/src/ui/actionList.css b/packages/trace-viewer/src/ui/actionList.cssindex f167352593..26bc56165b 100644--- a/packages/trace-viewer/src/ui/actionList.css+++ b/packages/trace-viewer/src/ui/actionList.css@@ -14,12 +14,32 @@limitations under the License.*/-.action-title {+.action-title-line {display: block;overflow: hidden;text-overflow: ellipsis;}+.action-title-selector {+ text-overflow: ellipsis;+ overflow: hidden;+ color: var(--vscode-tab-inactiveForeground);+ margin-top: -8px;+}++.action-title-method {+ white-space: pre;+ overflow: hidden;+ text-overflow: ellipsis;+ text-transform: uppercase;+ font-weight: 600;+}++.action-title-param {+ color: var(--vscode-editorBracketHighlight-foreground1);+ text-transform: none;+}+.action-location {display: flex;flex: none;diff --git a/packages/trace-viewer/src/ui/actionList.tsx b/packages/trace-viewer/src/ui/actionList.tsxindex b1c8c7f1a9..ee3b819c16 100644--- a/packages/trace-viewer/src/ui/actionList.tsx+++ b/packages/trace-viewer/src/ui/actionList.tsx@@ -19,7 +19,7 @@ import { clsx, msToString } from '@web/uiUtils';import * as React from 'react';import './actionList.css';import * as modelUtil from './modelUtil';-import { asLocatorDescription, asLocator, type Language } from '@isomorphic/locatorGenerators';+import { asLocator, asLocatorDescription, type Language } from '@isomorphic/locatorGenerators';import type { TreeState } from '@web/components/treeView';import { TreeView } from '@web/components/treeView';import type { ActionTraceEventInContext, ActionTreeItem } from './modelUtil';@@ -118,7 +118,7 @@ export const renderAction = (const { errors, warnings } = modelUtil.stats(action);const showAttachments = !!action.attachments?.length && !!revealAttachment;- const parameterString = actionParameterDisplayString(action, sdkLanguage || 'javascript');+ const locator = action.params.selector ? asLocatorDescription(action.params.selector) ?? asLocator(sdkLanguage || 'javascript', action.params.selector) : undefined;const isSkipped = action.class === 'Test' && action.method === 'step' && action.annotations?.some(a => a.type === 'skip');let time: string = '';@@ -128,197 +128,36 @@ export const renderAction = (time = 'Timed out';else if (!isLive)time = '-';- const title = action.title ?? action.class.toLowerCase() + '.' + action.method;- return <>- <div className='action-title' title={title}>- <span>{title}</span>- {parameterString &&- (parameterString.type === 'locator' ? (- <>- <span className='action-parameter action-locator-parameter'>- {parameterString.value}- </span>- {parameterString.childDisplayString && (- <span className='action-parameter action-generic-parameter'>- {parameterString.childDisplayString.value}- </span>- )}- </>- ) : (- <span className='action-parameter action-generic-parameter'>- {parameterString.value}- </span>- ))}- {action.method === 'goto' && action.params.url && <div className='action-url' title={action.params.url}>{action.params.url}</div>}- {action.class === 'APIRequestContext' && action.params.url && <div className='action-url' title={action.params.url}>{excludeOrigin(action.params.url)}</div>}+ const renderedTitle = highlightQuotedText(action.title || action.method);+ return <div className='action-title vbox'>+ <div className='hbox'>+ <span className='action-title-method' title={action.title || action.method}>{renderedTitle}</span>+ {(showDuration || showBadges || showAttachments || isSkipped) && <div className='spacer'></div>}+ {showAttachments && <ToolbarButton icon='attach' title='Open Attachment' onClick={() => revealAttachment(action.attachments![0])} />}+ {showDuration && !isSkipped && <div className='action-duration'>{time || <span className='codicon codicon-loading'></span>}</div>}+ {isSkipped && <span className={clsx('action-skipped', 'codicon', testStatusIcon('skipped'))} title='skipped'></span>}+ {showBadges && <div className='action-icons' onClick={() => revealConsole?.()}>+ {!!errors && <div className='action-icon'><span className='codicon codicon-error'></span><span className='action-icon-value'>{errors}</span></div>}+ {!!warnings && <div className='action-icon'><span className='codicon codicon-warning'></span><span className='action-icon-value'>{warnings}</span></div>}+ </div>}</div>- {(showDuration || showBadges || showAttachments || isSkipped) && <div className='spacer'></div>}- {showAttachments && <ToolbarButton icon='attach' title='Open Attachment' onClick={() => revealAttachment(action.attachments![0])} />}- {showDuration && !isSkipped && <div className='action-duration'>{time || <span className='codicon codicon-loading'></span>}</div>}- {isSkipped && <span className={clsx('action-skipped', 'codicon', testStatusIcon('skipped'))} title='skipped'></span>}- {showBadges && <div className='action-icons' onClick={() => revealConsole?.()}>- {!!errors && <div className='action-icon'><span className='codicon codicon-error'></span><span className='action-icon-value'>{errors}</span></div>}- {!!warnings && <div className='action-icon'><span className='codicon codicon-warning'></span><span className='action-icon-value'>{warnings}</span></div>}- </div>}- </>;+ {locator && <div className='action-title-selector' title={locator}>{locator}</div>}+ </div>;};-function excludeOrigin(url: string): string {- try {- const urlObject = new URL(url);- return urlObject.pathname + urlObject.search;- } catch (error) {- return url;+function highlightQuotedText(text: string): React.ReactNode[] {+ const result: React.ReactNode[] = [];+ let currentIndex = 0;+ const regex = /("[^"]*")/g;+ let match;++ while ((match = regex.exec(text)) !== null) {+ const [fullMatch, quotedText] = match;+ result.push(text.slice(currentIndex, match.index));+ result.push(<span className='action-title-param'>{quotedText}</span>);+ currentIndex = match.index + fullMatch.length;}+ if (currentIndex < text.length)+ result.push(text.slice(currentIndex));+ return result;}--type ActionParameterDisplayString =- | {- type: 'generic';- value: string;- }- | {- type: 'locator';- value: string;- childDisplayString?: ActionParameterDisplayString;- };--const clockDisplayString = (- action: ActionTraceEvent,-): ActionParameterDisplayString | undefined => {- switch (action.method) {- case 'clockPauseAt':- case 'clockSetFixedTime':- case 'clockSetSystemTime': {- if (- action.params.timeString === undefined &&- action.params.timeNumber === undefined- )- return undefined;- return {- type: 'generic',- value: new Date(- action.params.timeString ?? action.params.timeNumber,- ).toLocaleString(undefined, { timeZone: 'UTC' }),- };- }- case 'clockFastForward':- case 'clockRunFor': {- if (- action.params.ticksNumber === undefined &&- action.params.ticksString === undefined- )- return undefined;- return {- type: 'generic',- value: action.params.ticksString ?? `${action.params.ticksNumber}ms`,- };- }- }-- return undefined;-};--const keyboardDisplayString = (- action: ActionTraceEvent,-): ActionParameterDisplayString | undefined => {- switch (action.method) {- case 'press':- case 'keyboardPress':- case 'keyboardDown':- case 'keyboardUp': {- if (action.params.key === undefined)- return undefined;- return { type: 'generic', value: action.params.key };- }- case 'type':- case 'fill':- case 'keyboardType':- case 'keyboardInsertText': {- const string = action.params.text ?? action.params.value;- if (string === undefined)- return undefined;- return { type: 'generic', value: `"${string}"` };- }- }-};--const mouseDisplayString = (- action: ActionTraceEvent,-): ActionParameterDisplayString | undefined => {- switch (action.method) {- case 'click':- case 'dblclick':- case 'mouseClick':- case 'mouseMove': {- if (action.params.x === undefined || action.params.y === undefined)- return undefined;- return {- type: 'generic',- value: `(${action.params.x}, ${action.params.y})`,- };- }- case 'mouseWheel': {- if (- action.params.deltaX === undefined ||- action.params.deltaY === undefined- )- return undefined;- return {- type: 'generic',- value: `(${action.params.deltaX}, ${action.params.deltaY})`,- };- }- }-};--const touchscreenDisplayString = (- action: ActionTraceEvent,-): ActionParameterDisplayString | undefined => {- switch (action.method) {- case 'tap': {- if (action.params.x === undefined || action.params.y === undefined)- return undefined;- return {- type: 'generic',- value: `(${action.params.x}, ${action.params.y})`,- };- }- }-};--const actionParameterDisplayString = (- action: ActionTraceEvent,- sdkLanguage: Language,- ignoreLocator: boolean = false,-): ActionParameterDisplayString | undefined => {- const params = action.params;-- // Locators have many possible classes, so follow existing logic and use `selector` presence- if (!ignoreLocator && params.selector !== undefined) {- return {- type: 'locator',- value: asLocatorDescription(params.selector) ?? asLocator(sdkLanguage, params.selector),- childDisplayString: actionParameterDisplayString(- action,- sdkLanguage,- true,- ),- };- }-- switch (action.class.toLowerCase()) {- case 'browsercontext':- return clockDisplayString(action);- case 'page':- case 'frame':- case 'elementhandle':- return (- keyboardDisplayString(action) ??- mouseDisplayString(action) ??- touchscreenDisplayString(action)- );- }-- return undefined;-};diff --git a/tests/library/inspector/pause.spec.ts b/tests/library/inspector/pause.spec.tsindex c06222493e..d27a941fb0 100644--- a/tests/library/inspector/pause.spec.ts+++ b/tests/library/inspector/pause.spec.ts@@ -243,9 +243,9 @@ it.describe('pause', () => {await recorderPage.click('[title="Resume (F8)"]');await recorderPage.waitForSelector('.source-line-paused:has-text("page.pause({ __testHookKeepTestTimeout: true }); // 2")');expect(await sanitizeLog(recorderPage)).toEqual([- 'page.pause- XXms',- 'page.click(page.locator(\'button\'))- XXms',- 'page.pause',+ 'Pause- XXms',+ 'Click(page.locator(\'button\'))- XXms',+ 'Pause',]);await recorderPage.click('[title="Resume (F8)"]');await scriptPromise;@@ -268,8 +268,8 @@ it.describe('pause', () => {await recorderPage.click('[title="Resume (F8)"]');await recorderPage.waitForSelector('.source-line-paused:has-text("page.pause({ __testHookKeepTestTimeout: true }); // 2")');expect(await sanitizeLog(recorderPage)).toEqual([- 'page.pause- XXms',- 'page.pause',+ 'Pause- XXms',+ 'Pause',]);await recorderPage.click('[title="Resume (F8)"]');await scriptPromise;@@ -289,10 +289,10 @@ it.describe('pause', () => {await recorderPage.click('[title="Resume (F8)"]');await recorderPage.waitForSelector('.source-line-paused:has-text("page.pause({ __testHookKeepTestTimeout: true }); // 2")');expect(await sanitizeLog(recorderPage)).toEqual([- 'page.pause- XXms',- 'expect(page.locator(\'button\')).toHaveText()- XXms',- 'expect(page.locator(\'button\')).not.toHaveText()- XXms',- 'page.pause',+ 'Pause- XXms',+ 'Expect toHaveText(page.locator(\'button\'))- XXms',+ 'Expect not toHaveText(page.locator(\'button\'))- XXms',+ 'Pause',]);await recorderPage.click('[title="Resume (F8)"]');await scriptPromise;@@ -332,10 +332,10 @@ it.describe('pause', () => {await recorderPage.click('[title="Resume (F8)"]');await recorderPage.waitForSelector('.source-line-paused:has-text("page.pause({ __testHookKeepTestTimeout: true }); // 2")');expect(await sanitizeLog(recorderPage)).toEqual([- 'page.pause- XXms',- 'page.waitForEvent(console)',- 'page.getByRole(\'button\', { name: \'Submit\' }).click()- XXms',- 'page.pause',+ 'Pause- XXms',+ 'Wait for event "console"- XXms',+ 'Click(page.getByRole(\'button\', { name: \'Submit\' }))- XXms',+ 'Pause',]);await recorderPage.click('[title="Resume (F8)"]');await scriptPromise;@@ -352,8 +352,8 @@ it.describe('pause', () => {await recorderPage.click('[title="Resume (F8)"]');await recorderPage.waitForSelector('.source-line-error-underline');expect(await sanitizeLog(recorderPage)).toEqual([- 'page.pause- XXms',- 'page.getByRole(\'button\').isChecked()- XXms',+ 'Pause- XXms',+ 'Is checked(page.getByRole(\'button\'))- XXms','waiting for getByRole(\'button\')','error: Error: Not a checkbox or radio button',]);@@ -377,11 +377,11 @@ it.describe('pause', () => {await recorderPage.waitForSelector('.source-line-paused:has-text("page.pause")');await recorderPage.waitForSelector('.source-line-error:has-text("page.waitForEvent")');expect(await sanitizeLog(recorderPage)).toEqual([- 'page.pause- XXms',- 'page.waitForEvent(console)',- 'waiting for event \"console\"',- 'error: Timeout 1ms exceeded while waiting for event \"console\"',- 'page.pause',+ 'Pause- XXms',+ 'Wait for event "console"- XXms',+ 'waiting for event "console"',+ 'error: Timeout 1ms exceeded while waiting for event "console"',+ 'Pause',]);await recorderPage.click('[title="Resume (F8)"]');await scriptPromise;diff --git a/tests/library/trace-viewer.spec.ts b/tests/library/trace-viewer.spec.tsindex 663c000e75..e80caa040e 100644--- a/tests/library/trace-viewer.spec.ts+++ b/tests/library/trace-viewer.spec.ts@@ -124,19 +124,19 @@ test('should show tracing.group in the action list with location', async ({ runAawait expect(traceViewer.actionTitles).toHaveText([/outer group/,- /page.goto/,+ /Navigate/,/inner group 1/,/inner group 2/,- /expect.toBeVisible/,+ /Expect toBeVisible/,]);await traceViewer.selectAction('inner group 1');await traceViewer.expandAction('inner group 1');await expect(traceViewer.actionTitles).toHaveText([/outer group/,- /page.goto/,+ /Navigate/,/inner group 1/,- /locator.click/,+ /Click.*locator/,/inner group 2/,]);await traceViewer.showSourceTab();@@ -149,20 +149,20 @@ test('should show tracing.group in the action list with location', async ({ runAtest('should open simple trace viewer', async ({ showTraceViewer }) => {const traceViewer = await showTraceViewer([traceFile]);await expect(traceViewer.actionTitles).toHaveText([- /browserContext.newPage/,- /page.gotodata:text\/html,<!DOCTYPE html><html>Hello world<\/html>/,- /page.setContent/,- /expect.toHaveTextlocator\('button'\)/,- /expect.toBeHiddengetByTestId\('amazing-btn'\)/,- /expect.toBeHiddengetByTestId\(\/amazing-btn-regex\/\)/,- /page.evaluate/,- /page.evaluate/,- /locator.clickgetByText\('Click'\)/,- /page.waitForNavigation/,- /page.waitForResponse/,- /page.waitForTimeout/,- /page.gotohttp:\/\/localhost:\d+\/frames\/frame.html/,- /page.setViewportSize/,+ /Create page/,+ /Navigate to "data:"/,+ /Set content/,+ /Expect toHaveText.*locator/,+ /Expect toBeHidden.*getByTestId/,+ /Expect toBeHidden.*getByTestId/,+ /Evaluate/,+ /Evaluate/,+ /Click/,+ /Wait for navigation/,+ /Wait for event "response"/,+ /Wait for timeout/,+ /Navigate to "\/frames\/frame.html"/,+ /Set viewport size/,]);});@@ -197,27 +197,27 @@ test('should show action context on locators and other common actions', async ({});await expect(traceViewer.actionTitles).toHaveText([- /page.setContent/,- /locator.clicklocator\('input'\)/,- /locator.clickgetByRole\('textbox'\)/,- /expect.toHaveTextlocator\('input'\)/,- /locator.presslocator\('input'\)Enter/,- /keyboard.type\"Hello world this is a very long string what happens when it overflows\?\"/,- /keyboard.pressControl\+c/,- /keyboard.downShift/,- /keyboard.insertText\"Hello world\"/,- /keyboard.upShift/,- /mouse.move\(0, 0\)/,- /mouse.down/,- /mouse.move\(100, 200\)/,- /mouse.wheel\(5, 7\)/,- /mouse.up/,- /clock.fastForward1000ms/,- /clock.fastForward30:00/,- /clock.pauseAt2\/2\/2020, 12:00:00 AM/,- /clock.runFor10ms/,- /clock.setFixedTime2\/2\/2020, 12:00:00 AM/,- /clock.setSystemTime2\/2\/2020, 12:00:00 AM/,+ /Set content/,+ /Click.*locator\('input'\)/,+ /Click.*getByRole\('textbox'\)/,+ /Expect toHaveText.*locator\('input'\)/,+ /Press "Enter".*locator\('input'\)/,+ /Type "Hello world.*/,+ /Press "Control\+c"/,+ /Key down "Shift"/,+ /Insert "Hello world"/,+ /Key up "Shift"/,+ /Mouse move/,+ /Mouse down/,+ /Mouse move/,+ /Mouse wheel/,+ /Mouse up/,+ /Fast forward clock "1000"/,+ /Fast forward clock "30:00"/,+ /Pause clock ".*:00.*"/,+ /Run clock/,+ /Set fixed time ".*:00.*"/,+ /Set system time ".*:00.*"/,]);});@@ -236,7 +236,7 @@ test('should properly synchronize local and remote time', async ({ showTraceViewtest('should contain action info', async ({ showTraceViewer }) => {const traceViewer = await showTraceViewer([traceFile]);- await traceViewer.selectAction('locator.click');+ await traceViewer.selectAction('Click');await traceViewer.page.getByText('Log', { exact: true }).click();await expect(traceViewer.logLines).toContainText([/\d+m?sattempting click action/,@@ -271,7 +271,7 @@ test('should render console', async ({ showTraceViewer, browserName }) => {await expect.soft(traceViewer.consoleLines.filter({ hasText: 'Cheers!' }).locator('.codicon')).toHaveClass('codicon codicon-browser status-none');await expect(traceViewer.consoleStacks.first()).toContainText('Error: Unhandled exception');- await traceViewer.selectAction('page.evaluate');+ await traceViewer.selectAction('EVALUATE');const listViews = traceViewer.page.locator('.console-tab').locator('.list-view-entry');await expect(listViews.nth(0)).toHaveClass('list-view-entry');@@ -284,17 +284,17 @@ test('should render console', async ({ showTraceViewer, browserName }) => {test('should open console errors on click', async ({ showTraceViewer, browserName }) => {const traceViewer = await showTraceViewer([traceFile]);- expect(await traceViewer.actionIconsText('page.evaluate')).toEqual(['2', '1']);+ expect(await traceViewer.actionIconsText('EVALUATE')).toEqual(['2', '1']);expect(await traceViewer.page.isHidden('.console-tab')).toBeTruthy();- await (await traceViewer.actionIcons('page.evaluate')).click();+ await (await traceViewer.actionIcons('EVALUATE')).click();expect(await traceViewer.page.waitForSelector('.console-tab')).toBeTruthy();});test('should show params and return value', async ({ showTraceViewer }) => {const traceViewer = await showTraceViewer([traceFile]);- await traceViewer.selectAction('page.evaluate');+ await traceViewer.selectAction('EVALUATE');await expect(traceViewer.callLines).toHaveText([- /page.evaluate/,+ /Evaluate/,/start:[\d\.]+m?s/,/duration:[\d]+ms/,/expression:"\({↵ a↵ }\) => {↵ console\.log\(\'Info\'\);↵ console\.warn\(\'Warning\'\);↵ console/,@@ -305,7 +305,7 @@ test('should show params and return value', async ({ showTraceViewer }) => {await traceViewer.selectAction(`locator('button')`);await expect(traceViewer.callLines).toContainText([- /expect.toHaveText/,+ /Expect toHaveText/,/start:[\d\.]+m?s/,/duration:[\d]+ms/,/locator:locator\('button'\)/,@@ -318,9 +318,9 @@ test('should show params and return value', async ({ showTraceViewer }) => {test('should show null as a param', async ({ showTraceViewer, browserName }) => {const traceViewer = await showTraceViewer([traceFile]);- await traceViewer.selectAction('page.evaluate', 1);+ await traceViewer.selectAction('EVALUATE', 1);await expect(traceViewer.callLines).toHaveText([- /page.evaluate/,+ /Evaluate/,/start:[\d\.]+m?s/,/duration:[\d]+ms/,'expression:"() => 1 + 1"',@@ -332,7 +332,7 @@ test('should show null as a param', async ({ showTraceViewer, browserName }) =>test('should have correct snapshot size', async ({ showTraceViewer }, testInfo) => {const traceViewer = await showTraceViewer([traceFile]);- await traceViewer.selectAction('page.setViewport');+ await traceViewer.selectAction('SET VIEWPORT');await traceViewer.selectSnapshot('Before');await expect(traceViewer.snapshotContainer).toHaveCSS('width', '1280px');await expect(traceViewer.snapshotContainer).toHaveCSS('height', '720px');@@ -344,7 +344,7 @@ test('should have correct snapshot size', async ({ showTraceViewer }, testInfo)test('should have correct stack trace', async ({ showTraceViewer }) => {const traceViewer = await showTraceViewer([traceFile]);- await traceViewer.selectAction('locator.click');+ await traceViewer.selectAction('Click');await traceViewer.showSourceTab();await expect(traceViewer.stackFrames).toContainText([/doClick\s+trace-viewer.spec.ts\s+:\d+/,@@ -354,7 +354,7 @@ test('should have correct stack trace', async ({ showTraceViewer }) => {test('should have network requests', async ({ showTraceViewer }) => {const traceViewer = await showTraceViewer([traceFile]);- await traceViewer.selectAction('http://localhost');+ await traceViewer.selectAction('NAVIGATE');await traceViewer.showNetworkTab();await expect(traceViewer.networkRequests).toContainText([/frame.htmlGET200text\/html/]);await expect(traceViewer.networkRequests).toContainText([/style.cssGET200text\/css/]);@@ -369,7 +369,7 @@ test('should filter network requests by resource type', async ({ page, runAndTraawait page.goto(`${server.PREFIX}/network-tab/network.html`);await page.evaluate(() => (window as any).donePromise);});- await traceViewer.selectAction('http://localhost');+ await traceViewer.selectAction('NAVIGATE');await traceViewer.showNetworkTab();await traceViewer.page.getByText('JS', { exact: true }).click();@@ -402,7 +402,7 @@ test('should show font preview', async ({ page, runAndTrace, server }) => {await page.goto(`${server.PREFIX}/network-tab/network.html`);await page.evaluate(() => (window as any).donePromise);});- await traceViewer.selectAction('http://localhost');+ await traceViewer.selectAction('NAVIGATE');await traceViewer.showNetworkTab();await traceViewer.page.getByText('Font', { exact: true }).click();@@ -417,7 +417,7 @@ test('should filter network requests by url', async ({ page, runAndTrace, serverawait page.goto(`${server.PREFIX}/network-tab/network.html`);await page.evaluate(() => (window as any).donePromise);});- await traceViewer.selectAction('http://localhost');+ await traceViewer.selectAction('NAVIGATE');await traceViewer.showNetworkTab();await traceViewer.page.getByPlaceholder('Filter network').fill('script.');@@ -446,7 +446,7 @@ test('should have network request overrides', async ({ page, server, runAndTraceawait page.route('**/style.css', route => route.abort());await page.goto(server.PREFIX + '/frames/frame.html');});- await traceViewer.selectAction('http://localhost');+ await traceViewer.selectAction('NAVIGATE');await traceViewer.showNetworkTab();await expect(traceViewer.networkRequests).toContainText([/frame.htmlGET200text\/html/]);await expect(traceViewer.networkRequests).toContainText([/style.cssGETx-unknown.*aborted/]);@@ -458,7 +458,7 @@ test('should have network request overrides 2', async ({ page, server, runAndTraawait page.route('**/script.js', route => route.continue());await page.goto(server.PREFIX + '/frames/frame.html');});- await traceViewer.selectAction('http://localhost');+ await traceViewer.selectAction('NAVIGATE');await traceViewer.showNetworkTab();await expect.soft(traceViewer.networkRequests).toContainText([/frame.htmlGET200text\/html.*/]);await expect.soft(traceViewer.networkRequests).toContainText([/script.jsGET200application\/javascript.*continued/]);@@ -469,7 +469,7 @@ test('should show snapshot URL', async ({ page, runAndTrace, server }) => {await page.goto(server.EMPTY_PAGE);await page.evaluate('2+2');});- await traceViewer.snapshotFrame('page.evaluate');+ await traceViewer.snapshotFrame('Evaluate');const browserFrameAddressBarLocator = traceViewer.page.locator('.browser-frame-address-bar');await expect(browserFrameAddressBarLocator).toHaveText(server.EMPTY_PAGE);const copySelectorLocator = browserFrameAddressBarLocator.getByRole('button', { name: 'Copy' });@@ -486,7 +486,7 @@ test('should popup snapshot', async ({ page, runAndTrace, server }) => {await page.goto(server.EMPTY_PAGE);await page.setContent('hello äöü 🙂');});- await traceViewer.snapshotFrame('page.setContent');+ await traceViewer.snapshotFrame('Set content');const popupPromise = traceViewer.page.context().waitForEvent('page');await traceViewer.page.getByTitle('Open snapshot in a new tab').click();const popup = await popupPromise;@@ -517,7 +517,7 @@ test('should capture iframe with sandbox attribute', async ({ page, server, runA});// Render snapshot, check expectations.- const snapshotFrame = await traceViewer.snapshotFrame('page.evaluate', 0, true);+ const snapshotFrame = await traceViewer.snapshotFrame('Evaluate', 0, true);const button = snapshotFrame.frameLocator('iframe').locator('button');expect(await button.textContent()).toBe('Hello iframe');});@@ -540,7 +540,7 @@ test('should capture data-url svg iframe', async ({ page, server, runAndTrace })});// Render snapshot, check expectations.- const snapshotFrame = await traceViewer.snapshotFrame('page.evaluate', 0, true);+ const snapshotFrame = await traceViewer.snapshotFrame('Evaluate', 0, true);await expect(snapshotFrame.frameLocator('iframe').locator('> body > svg')).toBeVisible();const content = await snapshotFrame.frameLocator('iframe').locator(':root').innerHTML();expect(content).toContain(`d="M16.5 3c-1.74 0-3.41.81-4.5 2.09C10.91 3.81 9.24 3 7.5 3 4.42 3 2 5.42 2 8.5c0 3.78 3.4 6.86 8.55 11.54L12 21.35l1.45-1.32C18.6 15.36 22 12.28 22 8.5 22 5.42 19.58 3 16.5 3zm-4.4 15.55l-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05z"`);@@ -568,7 +568,7 @@ test('should contain adopted style sheets', async ({ page, runAndTrace, browserN});});- const frame = await traceViewer.snapshotFrame('page.evaluate');+ const frame = await traceViewer.snapshotFrame('Evaluate');await expect(frame.locator('button')).toHaveCSS('color', 'rgb(255, 0, 0)');await expect(frame.locator('div')).toHaveCSS('color', 'rgb(0, 0, 255)');await expect(frame.locator('span')).toHaveCSS('color', 'rgb(0, 0, 255)');@@ -593,15 +593,15 @@ test('should work with adopted style sheets and replace/replaceSync', async ({ p});{- const frame = await traceViewer.snapshotFrame('page.evaluate', 0);+ const frame = await traceViewer.snapshotFrame('Evaluate', 0);await expect(frame.locator('button')).toHaveCSS('color', 'rgb(255, 0, 0)');}{- const frame = await traceViewer.snapshotFrame('page.evaluate', 1);+ const frame = await traceViewer.snapshotFrame('Evaluate', 1);await expect(frame.locator('button')).toHaveCSS('color', 'rgb(0, 0, 255)');}{- const frame = await traceViewer.snapshotFrame('page.evaluate', 2);+ const frame = await traceViewer.snapshotFrame('Evaluate', 2);await expect(frame.locator('button')).toHaveCSS('color', 'rgb(0, 255, 0)');}});@@ -621,7 +621,7 @@ test('should work with adopted style sheets and all: unset', async ({ page, runAawait page.getByRole('button').click();});{- const frame = await traceViewer.snapshotFrame('page.evaluate', 0);+ const frame = await traceViewer.snapshotFrame('Evaluate', 0);await expect(frame.locator('button')).toHaveCSS('border-radius', '24px');await expect(frame.locator('button')).toHaveCSS('background-color', 'rgb(0, 191, 255)');await expect(frame.locator('button')).toHaveCSS('color', 'rgb(0, 0, 0)');@@ -649,7 +649,7 @@ test('should work with nesting CSS selectors', async ({ page, runAndTrace }) =>await page.evaluate(() => { });});{- const frame = await traceViewer.snapshotFrame('page.evaluate', 0);+ const frame = await traceViewer.snapshotFrame('Evaluate', 0);await expect(frame.getByTestId('green-element')).toHaveCSS('color', /* green */'rgb(0, 128, 0)');await expect(frame.getByTestId('red-element')).toHaveCSS('color', /* red */'rgb(255, 0, 0)');}@@ -682,7 +682,7 @@ test('should restore scroll positions', async ({ page, runAndTrace }) => {});// Render snapshot, check expectations.- const frame = await traceViewer.snapshotFrame('scrollIntoViewIfNeeded');+ const frame = await traceViewer.snapshotFrame('Scroll into view');expect(await frame.locator('div').evaluate(div => div.scrollTop)).toBe(136);});@@ -714,7 +714,7 @@ test('should restore control values', async ({ page, runAndTrace, asset }) => {});// Render snapshot, check expectations.- const frame = await traceViewer.snapshotFrame('page.click');+ const frame = await traceViewer.snapshotFrame('Click');const text = frame.locator('[type=text]');await expect(text).toHaveAttribute('value', 'old');@@ -759,7 +759,7 @@ test('should work with meta CSP', async ({ page, runAndTrace, browserName }) =>});// Render snapshot, check expectations.- const frame = await traceViewer.snapshotFrame('$eval');+ const frame = await traceViewer.snapshotFrame('Evaluate');// Should render shadow dom with post-processing script.await expect(frame.locator('span')).toHaveText('World');});@@ -776,7 +776,7 @@ test('should handle multiple headers', async ({ page, server, runAndTrace, browsawait page.setContent(`<head><link rel=stylesheet href="/foo.css"></head><body><div>Hello</div></body>`);});- const frame = await traceViewer.snapshotFrame('setContent');+ const frame = await traceViewer.snapshotFrame('Set content');await frame.locator('div').waitFor();await expect(frame.locator('body')).toHaveCSS('padding-left', '42px');});@@ -799,7 +799,7 @@ test('should handle src=blob', async ({ page, server, runAndTrace, browserName }});});- const frame = await traceViewer.snapshotFrame('page.evaluate');+ const frame = await traceViewer.snapshotFrame('Evaluate');const size = await frame.locator('img').evaluate(e => (e as HTMLImageElement).naturalWidth);expect(size).toBe(10);});@@ -811,7 +811,7 @@ test('should handle file URIs', async ({ page, runAndTrace, browserName }) => {await page.goto(pathToFileURL(path.join(__dirname, '..', 'assets', 'one-style.html')).href);});- const frame = await traceViewer.snapshotFrame('goto');+ const frame = await traceViewer.snapshotFrame('Navigate');await expect(frame.locator('body')).toHaveCSS('background-color', 'rgb(255, 192, 203)');});@@ -832,7 +832,7 @@ test('should preserve currentSrc', async ({ browser, server, showTraceViewer })await page.close();const traceViewer = await showTraceViewer([traceFile]);- const frame = await traceViewer.snapshotFrame('page.setContent');+ const frame = await traceViewer.snapshotFrame('Set content');await expect(frame.locator('#target1')).toHaveAttribute('src', server.PREFIX + '/digits/3.png');await expect(frame.locator('#target2')).toHaveAttribute('src', server.PREFIX + '/digits/6.png');});@@ -862,7 +862,7 @@ test('should register custom elements', async ({ page, server, runAndTrace }) =>`);});- const frame = await traceViewer.snapshotFrame('page.setContent');+ const frame = await traceViewer.snapshotFrame('Set content');await expect(frame.getByText('worldhello')).toBeVisible();});@@ -902,7 +902,7 @@ test('should highlight target elements', async ({ page, runAndTrace, browserName});}- const framePageClick = await traceViewer.snapshotFrame('page.click');+ const framePageClick = await traceViewer.snapshotFrame('Click');await expect.poll(() => highlightedDivs(framePageClick)).toEqual(['t1']);const box1 = await framePageClick.getByText('t1').boundingBox();const box2 = await framePageClick.locator('x-pw-pointer').boundingBox();@@ -913,35 +913,35 @@ test('should highlight target elements', async ({ page, runAndTrace, browserNameexpect(Math.abs(x1 - x2) < 2).toBeTruthy();expect(Math.abs(y1 - y2) < 2).toBeTruthy();- const framePageInnerText = await traceViewer.snapshotFrame('page.innerText');+ const framePageInnerText = await traceViewer.snapshotFrame('Inner text');await expect.poll(() => highlightedDivs(framePageInnerText)).toEqual(['t2']);- const frameHandleClick = await traceViewer.snapshotFrame('elementHandle.click');+ const frameHandleClick = await traceViewer.snapshotFrame('Click', 1);await expect.poll(() => highlightedDivs(frameHandleClick)).toEqual(['t3']);- const frameHandleInnerText = await traceViewer.snapshotFrame('elementHandle.innerText');+ const frameHandleInnerText = await traceViewer.snapshotFrame('Inner text', 1);await expect.poll(() => highlightedDivs(frameHandleInnerText)).toEqual(['t4']);- const frameLocatorInnerText = await traceViewer.snapshotFrame('locator.innerText');+ const frameLocatorInnerText = await traceViewer.snapshotFrame('Inner text', 2);await expect.poll(() => highlightedDivs(frameLocatorInnerText)).toEqual(['t5']);- const frameExpect1 = await traceViewer.snapshotFrame('expect.toHaveText', 0);+ const frameExpect1 = await traceViewer.snapshotFrame('Expect', 0);await expect.poll(() => highlightedDivs(frameExpect1)).toEqual(['t6']);- const frameExpect2 = await traceViewer.snapshotFrame('expect.toHaveText', 1);+ const frameExpect2 = await traceViewer.snapshotFrame('Expect', 1);await expect.poll(() => highlightedDivs(frameExpect2)).toEqual(['multi', 'multi']);await expect(frameExpect2.locator('x-pw-pointer')).not.toBeVisible();- const frameMouseMove = await traceViewer.snapshotFrame('mouse.move');+ const frameMouseMove = await traceViewer.snapshotFrame('Mouse move');await expect(frameMouseMove.locator('x-pw-pointer')).toBeVisible();- const frameClickStrictViolation = await traceViewer.snapshotFrame('locator.click');+ const frameClickStrictViolation = await traceViewer.snapshotFrame('Click', 2);await expect.poll(() => highlightedDivs(frameClickStrictViolation)).toEqual(['t1', 't2', 't3', 't4', 't5', 't6']);- const frameExpectStrictViolation = await traceViewer.snapshotFrame('expect.toBeVisible');+ const frameExpectStrictViolation = await traceViewer.snapshotFrame('Expect', 2);await expect.poll(() => highlightedDivs(frameExpectStrictViolation)).toEqual(['t3', 't4']);- const frameUpdatedListOfTargets = await traceViewer.snapshotFrame('expect.toHaveText', 2);+ const frameUpdatedListOfTargets = await traceViewer.snapshotFrame('Expect', 3);await expect.poll(() => highlightedDivs(frameUpdatedListOfTargets)).toEqual(['t4']);});@@ -952,10 +952,10 @@ test('should highlight target element in shadow dom', async ({ page, server, runawait expect(page.locator('h1')).toHaveText('Hellow Shadow DOM v1');});- const framePageClick = await traceViewer.snapshotFrame('locator.click');+ const framePageClick = await traceViewer.snapshotFrame('Click');await expect(framePageClick.locator('button')).toHaveCSS('background-color', 'rgba(111, 168, 220, 0.498)');- const frameExpect = await traceViewer.snapshotFrame('expect.toHaveText');+ const frameExpect = await traceViewer.snapshotFrame('Expect');await expect(frameExpect.locator('h1')).toHaveCSS('background-color', 'rgba(111, 168, 220, 0.498)');});@@ -969,21 +969,21 @@ test('should highlight expect failure', async ({ page, server, runAndTrace }) =>}});- await expect(traceViewer.actionTitles.getByText('expect.toHaveTitle')).toHaveCSS('color', 'rgb(176, 16, 17)');+ await expect(traceViewer.actionTitles.getByText('EXPECT')).toHaveCSS('color', 'rgb(176, 16, 17)');await traceViewer.showErrorsTab();await expect(traceViewer.errorMessages.nth(0)).toHaveText('Expect failed');});test('should show action source', async ({ showTraceViewer }) => {const traceViewer = await showTraceViewer([traceFile]);- await traceViewer.selectAction('locator.click');+ await traceViewer.selectAction('Click');const page = traceViewer.page;await page.click('text=Source');await expect(page.locator('.source-line-running')).toContainText('await page.getByText(\'Click\').click()');await expect(page.getByTestId('stack-trace-list').locator('.list-view-entry.selected')).toHaveText(/doClick.*trace-viewer\.spec\.ts:[\d]+/);- await traceViewer.hoverAction('page.waitForNavigation');+ await traceViewer.hoverAction('Wait for navigation');await expect(page.locator('.source-line-running')).toContainText('page.waitForNavigation()');});@@ -1009,7 +1009,7 @@ test('should follow redirects', async ({ page, runAndTrace, server, asset }) =>await page.goto(server.EMPTY_PAGE);expect(await page.evaluate(() => (window as any).img.naturalWidth)).toBe(10);});- const snapshotFrame = await traceViewer.snapshotFrame('page.evaluate');+ const snapshotFrame = await traceViewer.snapshotFrame('Evaluate');await expect(snapshotFrame.locator('img')).toHaveJSProperty('naturalWidth', 10);});@@ -1051,18 +1051,18 @@ test('should open two trace files', async ({ context, page, request, server, shoawait (request as any)._tracing.stop({ path: apiTrace });await context.tracing.stop({ path: contextTrace });-const traceViewer = await showTraceViewer([contextTrace, apiTrace]);- await traceViewer.selectAction('apiRequestContext.head');- await traceViewer.selectAction('apiRequestContext.get');- await traceViewer.selectAction('apiRequestContext.post');++ await traceViewer.selectAction('FETCH', 0);+ await traceViewer.selectAction('FETCH', 1);+ await traceViewer.selectAction('FETCH', 2);await expect(traceViewer.actionTitles).toHaveText([- `apiRequestContext.get/simple.json`,- `page.gotohttp://localhost:${server.PORT}/input/button.html`,- `apiRequestContext.head/simplezip.json`,- `locator.clicklocator('button')`,- `locator.clicklocator('button')`,- `apiRequestContext.post/one-style.css`,+ /Fetch "\/simple\.json"/,+ /Navigate to "\/input\/button\.html"/,+ /Fetch "\/simplezip\.json"/,+ /Click.*locator\('button'\)/,+ /Click.*locator\('button'\)/,+ /Fetch "\/one-style\.css"/,]);await traceViewer.page.locator('text=Metadata').click();@@ -1084,14 +1084,14 @@ test('should open two trace files of the same test (v6)', async ({ showTraceViewconst traceViewer = await showTraceViewer([asset('test-trace1.zip'), asset('test-trace2.zip')]);// Same actions from different test runs should not be merged.await expect(traceViewer.actionTitles).toHaveText([- 'Before Hooks',- 'Before Hooks',- 'page.gotohttps://playwright.dev/',- 'page.gotohttps://playwright.dev/',- 'expect.toBe',- 'After Hooks',- 'expect.toBe',- 'After Hooks',+ /Before Hooks/,+ /Before Hooks/,+ /page.goto/, // Legacy trace does not have titles+ /page.goto/, // Legacy trace does not have titles+ /expect.toBe/,+ /After Hooks/,+ /expect.toBe/,+ /After Hooks/,]);});@@ -1124,7 +1124,7 @@ test('should serve overridden request', async ({ page, runAndTrace, server }) =>await page.goto(server.PREFIX + '/one-style.html');});// Render snapshot, check expectations.- const snapshotFrame = await traceViewer.snapshotFrame('page.goto');+ const snapshotFrame = await traceViewer.snapshotFrame('Navigate');await expect(snapshotFrame.locator('body')).toHaveCSS('background-color', 'rgb(255, 0, 0)');});@@ -1135,9 +1135,9 @@ test('should display waitForLoadState even if did not wait for it', async ({ runawait page.waitForLoadState('load');});await expect(traceViewer.actionTitles).toHaveText([- /page.goto/,- /page.waitForLoadState/,- /page.waitForLoadState/,+ /Navigate/,+ /Wait for load state "load"/,+ /Wait for load state "load"/,]);});@@ -1148,8 +1148,8 @@ test('should display language-specific locators', async ({ runAndTrace, server,await page.getByRole('button', { name: 'Submit' }).click();});await expect(traceViewer.actionTitles).toHaveText([- /page.setContent/,- /locator.clickget_by_role\("button", name="Submit"\)/,+ /Set content/,+ /Click.*get_by_role\("button", name="Submit"\)/,]);toImpl(page).attribution.playwright.options.sdkLanguage = 'javascript';});@@ -1159,7 +1159,7 @@ test('should pick locator', async ({ page, runAndTrace, server }) => {await page.goto(server.EMPTY_PAGE);await page.setContent('<button>Submit</button>');});- const snapshot = await traceViewer.snapshotFrame('page.setContent');+ const snapshot = await traceViewer.snapshotFrame('Set content');await traceViewer.page.getByTitle('Pick locator').click();await snapshot.locator('button').click();await expect(traceViewer.page.locator('.cm-wrapper').first()).toContainText(`getByRole('button', { name: 'Submit' })`);@@ -1171,7 +1171,7 @@ test('should update highlight when typing locator', async ({ page, runAndTrace,await page.goto(server.EMPTY_PAGE);await page.setContent('<button>Submit</button>');});- const snapshot = await traceViewer.snapshotFrame('page.setContent');+ const snapshot = await traceViewer.snapshotFrame('Set content');await traceViewer.page.getByText('Locator').click();await traceViewer.page.locator('.CodeMirror').first().click();await traceViewer.page.keyboard.type('button');@@ -1188,7 +1188,7 @@ test('should update highlight when typing snapshot', async ({ page, runAndTrace,await page.goto(server.EMPTY_PAGE);await page.setContent('<button>Submit</button>');});- const snapshot = await traceViewer.snapshotFrame('page.setContent');+ const snapshot = await traceViewer.snapshotFrame('Set content');await traceViewer.page.getByText('Locator').click();await traceViewer.page.locator('.CodeMirror').last().click();await traceViewer.page.keyboard.type('- button');@@ -1201,7 +1201,7 @@ test('should update highlight when typing snapshot', async ({ page, runAndTrace,test('should open trace-1.31', async ({ showTraceViewer }) => {const traceViewer = await showTraceViewer([path.join(__dirname, '../assets/trace-1.31.zip')]);- const snapshot = await traceViewer.snapshotFrame('locator.click');+ const snapshot = await traceViewer.snapshotFrame('Click');await expect(snapshot.locator('[__playwright_target__]')).toHaveText(['Submit']);});@@ -1263,9 +1263,9 @@ test('should prefer later resource request with the same method', async ({ page,await headRequest;await page.locator('div').click();});- const frame1 = await traceViewer.snapshotFrame('page.goto');+ const frame1 = await traceViewer.snapshotFrame('Navigate');await expect(frame1.locator('body')).toHaveCSS('background-color', 'rgb(123, 123, 123)');- const frame2 = await traceViewer.snapshotFrame('locator.click');+ const frame2 = await traceViewer.snapshotFrame('Click');await expect(frame2.locator('body')).toHaveCSS('background-color', 'rgb(123, 123, 123)');});@@ -1302,7 +1302,7 @@ test('should ignore 304 responses', async ({ page, server, runAndTrace }) => {await page.waitForTimeout(1000);await page.locator('div').click();});- const frame = await traceViewer.snapshotFrame('locator.click');+ const frame = await traceViewer.snapshotFrame('Click');await expect(frame.locator('body')).toHaveCSS('background-color', 'rgb(123, 123, 123)');});@@ -1329,7 +1329,7 @@ test('should pick locator in iframe', async ({ page, runAndTrace, server }) => {await traceViewer.page.getByTitle('Pick locator').click();const cmWrapper = traceViewer.page.locator('.cm-wrapper').first();- const snapshot = await traceViewer.snapshotFrame('page.evaluate');+ const snapshot = await traceViewer.snapshotFrame('Evaluate');await snapshot.frameLocator('#frame1').getByText('Hello1').click();await expect.soft(cmWrapper).toContainText(`locator('#frame1').contentFrame().getByText('Hello1')`);@@ -1365,7 +1365,7 @@ test('should highlight locator in iframe while typing', async ({ page, runAndTraawait page.evaluate('2+2');});- const snapshot = await traceViewer.snapshotFrame('page.evaluate');+ const snapshot = await traceViewer.snapshotFrame('Evaluate');await traceViewer.page.getByText('Locator').click();await traceViewer.page.locator('.CodeMirror').first().click();@@ -1413,7 +1413,7 @@ test('should preserve noscript when javascript is disabled', async ({ browser, sawait page.close();const traceViewer = await showTraceViewer([traceFile]);- const frame = await traceViewer.snapshotFrame('page.setContent');+ const frame = await traceViewer.snapshotFrame('Set content');await expect(frame.getByText('javascript is disabled!')).toBeVisible();});@@ -1430,7 +1430,7 @@ test('should remove noscript by default', async ({ browser, server, showTraceVieawait page.close();const traceViewer = await showTraceViewer([traceFile]);- const frame = await traceViewer.snapshotFrame('page.setContent');+ const frame = await traceViewer.snapshotFrame('Set content');await expect(frame.getByText('Always visible')).toBeVisible();await expect(frame.getByText('Enable JavaScript to run this app.')).toBeHidden();});@@ -1448,7 +1448,7 @@ test('should remove noscript when javaScriptEnabled is set to true', async ({ brawait page.close();const traceViewer = await showTraceViewer([traceFile]);- const frame = await traceViewer.snapshotFrame('page.setContent');+ const frame = await traceViewer.snapshotFrame('Set content');await expect(frame.getByText('Always visible')).toBeVisible();await expect(frame.getByText('Enable JavaScript to run this app.')).toBeHidden();});@@ -1458,7 +1458,7 @@ test('should open snapshot in new browser context', async ({ browser, page, runAawait page.goto(server.EMPTY_PAGE);await page.setContent('hello');});- await traceViewer.snapshotFrame('page.setContent');+ await traceViewer.snapshotFrame('Set content');const popupPromise = traceViewer.page.context().waitForEvent('page');await traceViewer.page.getByTitle('Open snapshot in a new tab').click();const popup = await popupPromise;@@ -1470,14 +1470,14 @@ test('should open snapshot in new browser context', async ({ browser, page, runAawait newPage.close();});-test('should show similar actions from library-only trace', async ({ showTraceViewer, asset }) => {+test('should show similar actions from legacy library-only trace', async ({ showTraceViewer, asset }) => {const traceViewer = await showTraceViewer([asset('trace-library-1.46.zip')]);await expect(traceViewer.actionTitles).toHaveText([- /page.setContent/,- /locator.getAttributelocator\('div'\)/,- /locator.isVisiblelocator\('div'\)/,- /locator.getAttributelocator\('div'\)/,- /locator.isVisiblelocator\('div'\)/,+ /page\.setContent/,+ /locator\.getAttribute/,+ /locator\.isVisible.*locator\('div'\)/,+ /locator\.getAttribute/,+ /locator\.isVisible.*locator\('div'\)/,]);});@@ -1506,7 +1506,7 @@ test('should show correct request start time', {return fetch('/api').then(r => r.text());});});- await traceViewer.selectAction('page.evaluate');+ await traceViewer.selectAction('EVALUATE');await traceViewer.showNetworkTab();await expect(traceViewer.networkRequests).toContainText([/apiGET200text/]);const line = traceViewer.networkRequests.getByText(/apiGET200text/);@@ -1527,8 +1527,8 @@ test('should not record route actions', {});await expect(traceViewer.actionTitles).toHaveText([- /page.route/,- /page.goto.*empty.html/,+ /Route/,+ /Navigate to "\/empty.html"/,]);});@@ -1546,7 +1546,7 @@ test('should not record network actions', {});await expect(traceViewer.actionTitles).toHaveText([- /page.goto.*empty.html/,+ /Navigate.*empty.html/,]);});@@ -1554,7 +1554,7 @@ test('should show baseURL in metadata pane', {annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/31847' },}, async ({ showTraceViewer }) => {const traceViewer = await showTraceViewer([traceFile]);- await traceViewer.selectAction('page.evaluate');+ await traceViewer.selectAction('EVALUATE');await traceViewer.showMetadataTab();await expect(traceViewer.metadataTab).toContainText('baseURL:https://example.com');});@@ -1596,22 +1596,22 @@ test('should not leak recorders', {await expect(traceViewer.snapshotContainer.contentFrame().locator('body')).toContainText(`Hi, I'm frame`);- const frame1 = await forceRecorder('page.goto');+ const frame1 = await forceRecorder('NAVIGATE');await expect(frame1.locator('body')).toContainText('Hello world');- const frame2 = await forceRecorder('page.evaluate');+ const frame2 = await forceRecorder('EVALUATE');await expect(frame2.locator('button')).toBeVisible();await traceViewer.page.requestGC();await expect.poll(() => aliveCount()).toBeLessThanOrEqual(2); // two snapshot iframes- const frame3 = await forceRecorder('page.setViewportSize');+ const frame3 = await forceRecorder('SET VIEWPORT SIZE');await expect(frame3.locator('body')).toContainText(`Hi, I'm frame`);- const frame4 = await forceRecorder('page.goto');+ const frame4 = await forceRecorder('NAVIGATE');await expect(frame4.locator('body')).toContainText('Hello world');- const frame5 = await forceRecorder('page.evaluate');+ const frame5 = await forceRecorder('EVALUATE');await expect(frame5.locator('button')).toBeVisible();await traceViewer.page.requestGC();@@ -1626,7 +1626,7 @@ test('should serve css without content-type', async ({ page, runAndTrace, serverconst traceViewer = await runAndTrace(async () => {await page.goto(server.PREFIX + '/one-style.html');});- const snapshotFrame = await traceViewer.snapshotFrame('page.goto');+ const snapshotFrame = await traceViewer.snapshotFrame('Navigate');await expect(snapshotFrame.locator('body')).toHaveCSS('background-color', 'rgb(255, 0, 0)', { timeout: 0 });});@@ -1636,7 +1636,7 @@ test('canvas disabled title', async ({ runAndTrace, page, server }) => {await rafraf(page, 5);});- const snapshot = await traceViewer.snapshotFrame('page.goto');+ const snapshot = await traceViewer.snapshotFrame('Navigate');await expect(snapshot.locator('canvas')).toHaveAttribute('title', `Canvas content display is disabled.`);});@@ -1655,7 +1655,7 @@ test('canvas clipping', async ({ runAndTrace, page, server }) => {]);expect(msg.text()).toEqual('canvas drawn: [0,91,11,20]');- const snapshot = await traceViewer.snapshotFrame('page.goto');+ const snapshot = await traceViewer.snapshotFrame('Navigate');await expect(snapshot.locator('canvas')).toHaveAttribute('title', `Playwright couldn't capture full canvas contents because it's located partially outside the viewport.`);});@@ -1677,7 +1677,7 @@ test('canvas clipping in iframe', async ({ runAndTrace, page, server }) => {]);expect(msg.text()).toEqual('canvas drawn: [1,1,11,20]');- const snapshot = await traceViewer.snapshotFrame('page.evaluate');+ const snapshot = await traceViewer.snapshotFrame('Evaluate');const canvas = snapshot.locator('iframe').contentFrame().locator('canvas');await expect(canvas).toHaveAttribute('title', 'Canvas contents are displayed on a best-effort basis based on viewport screenshots taken during test execution.');});@@ -1702,7 +1702,7 @@ test('should show only one pointer with multilevel iframes', async ({ page, runAawait page.goto(server.PREFIX + '/level-0.html');await page.frameLocator('iframe').frameLocator('iframe').locator('button').click({ position: { x: 5, y: 5 } });});- const snapshotFrame = await traceViewer.snapshotFrame('locator.click');+ const snapshotFrame = await traceViewer.snapshotFrame('Click');await expect.soft(snapshotFrame.locator('x-pw-pointer')).not.toBeAttached();await expect.soft(snapshotFrame.frameLocator('iframe').locator('x-pw-pointer')).not.toBeAttached();await expect.soft(snapshotFrame.frameLocator('iframe').frameLocator('iframe').locator('x-pw-pointer')).toBeVisible();@@ -1721,7 +1721,7 @@ test('should show a popover', async ({ runAndTrace, page, server, platform, browawait expect(page.locator('div')).toBeVisible();});- const snapshot = await traceViewer.snapshotFrame('expect.toBeVisible');+ const snapshot = await traceViewer.snapshotFrame('Expect');const popover = snapshot.locator('#pop');await expect.poll(() => popover.evaluate(e => e.matches(':popover-open'))).toBe(true);});@@ -1744,7 +1744,7 @@ test('should show a modal dialog', async ({ runAndTrace, page, platform, browserawait expect(page.locator('p')).toBeVisible();});- const snapshot = await traceViewer.snapshotFrame('expect.toBeVisible');+ const snapshot = await traceViewer.snapshotFrame('Expect');const dialog = snapshot.locator('dialog');await expect.poll(() => dialog.evaluate(e => e.matches(':open'))).toBe(true);await expect.poll(() => dialog.evaluate(e => e.matches(':modal'))).toBe(true);@@ -1752,14 +1752,14 @@ test('should show a modal dialog', async ({ runAndTrace, page, platform, browsertest('should open settings dialog', async ({ showTraceViewer }) => {const traceViewer = await showTraceViewer([traceFile]);- await traceViewer.selectAction('http://localhost');+ await traceViewer.selectAction('NAVIGATE');await traceViewer.showSettings();await expect(traceViewer.settingsDialog).toBeVisible();});test('should toggle theme color', async ({ showTraceViewer, page }) => {const traceViewer = await showTraceViewer([traceFile]);- await traceViewer.selectAction('http://localhost');+ await traceViewer.selectAction('NAVIGATE');await traceViewer.showSettings();await expect(traceViewer.darkModeSetting).toBeChecked({ checked: false });@@ -1782,7 +1782,7 @@ test('should toggle canvas rendering', async ({ runAndTrace, page }) => {let snapshotRequestPromise = traceViewer.page.waitForRequest(request => request.url().includes('/snapshot/'));// Click on the action with a canvas snapshot- await traceViewer.selectAction('goto', 0);+ await traceViewer.selectAction('NAVIGATE', 0);let snapshotRequest = await snapshotRequestPromise;@@ -1795,12 +1795,12 @@ test('should toggle canvas rendering', async ({ runAndTrace, page }) => {await expect(traceViewer.displayCanvasContentSetting).toBeChecked({ checked: true });// Deselect canvas- await traceViewer.selectAction('goto', 1);+ await traceViewer.selectAction('NAVIGATE', 1);snapshotRequestPromise = traceViewer.page.waitForRequest(request => request.url().includes('/snapshot/'));// Select canvas again- await traceViewer.selectAction('goto', 0);+ await traceViewer.selectAction('NAVIGATE', 0);snapshotRequest = await snapshotRequestPromise;@@ -1826,20 +1826,20 @@ test('should render blob trace received from message', async ({ showTraceViewerawait expect(traceViewer.page.locator('.drop-target')).not.toBeVisible();await expect(traceViewer.actionTitles).toHaveText([- /browserContext.newPage/,- /page.gotodata:text\/html,<!DOCTYPE html><html>Hello world<\/html>/,- /page.setContent/,- /expect.toHaveTextlocator\('button'\)/,- /expect.toBeHiddengetByTestId\('amazing-btn'\)/,- /expect.toBeHiddengetByTestId\(\/amazing-btn-regex\/\)/,- /page.evaluate/,- /page.evaluate/,- /locator.clickgetByText\('Click'\)/,- /page.waitForNavigation/,- /page.waitForResponse/,- /page.waitForTimeout/,- /page.gotohttp:\/\/localhost:\d+\/frames\/frame.html/,- /page.setViewportSize/,+ /Create page/,+ /Navigate to "data:"/,+ /Set content/,+ /Expect toHaveText.*locator/,+ /Expect toBeHidden.*getByTestId/,+ /Expect toBeHidden.*getByTestId/,+ /Evaluate/,+ /Evaluate/,+ /Click.*getByText\('Click'\)/,+ /Wait for navigation/,+ /Wait for event "response"/,+ /Wait for timeout/,+ /Navigate to "\/frames\/frame.html"/,+ /Set viewport size/,]);});@@ -1891,7 +1891,7 @@ test('should not trip over complex urls in style tags', {await page.evaluate(css => document.querySelector('style').textContent = css, css);});- const snapshot = await traceViewer.snapshotFrame('page.evaluate');+ const snapshot = await traceViewer.snapshotFrame('Evaluate');// Just "hello world", no gibberish from the <style>.await expect(snapshot.locator('body')).toHaveText('hello world');await expect(snapshot.locator('div')).toHaveCSS('color', 'rgb(1, 2, 3)');@@ -1905,6 +1905,6 @@ test('should render locator descriptions', async ({ runAndTrace, page }) => {});await expect(traceViewer.page.locator('body')).toMatchAriaSnapshot(`- - treeitem /locator\\.clickmain input/+ - treeitem /Click.*main input/`);});diff --git a/tests/library/tracing.spec.ts b/tests/library/tracing.spec.tsindex 6f836b3d44..9cfb2c5fff 100644--- a/tests/library/tracing.spec.ts+++ b/tests/library/tracing.spec.ts@@ -42,16 +42,16 @@ test('should collect trace with resources, but no js', async ({ context, page, sconst { events, actions } = await parseTraceRaw(testInfo.outputPath('trace.zip'));expect(events[0].type).toBe('context-options');expect(actions).toEqual([- 'page.goto',- 'page.setContent',- 'page.click',- 'mouse.move',- 'mouse.dblclick',- 'keyboard.insertText',- 'page.goto',- 'locator.setInputFiles',- 'page.waitForTimeout',- 'page.close',+ 'Navigate to "/frames/frame.html"',+ 'Set content',+ 'Click',+ 'Mouse move',+ 'Double click',+ 'Insert "abc"',+ 'Navigate to "/input/fileupload.html"',+ 'Set input files',+ 'Wait for timeout',+ 'Close',]);expect(events.some(e => e.type === 'frame-snapshot')).toBeTruthy();@@ -84,13 +84,13 @@ test('should use the correct title for event driven callbacks', async ({ contextconst { events, actions } = await parseTraceRaw(testInfo.outputPath('trace.zip'));expect(events[0].type).toBe('context-options');expect(actions).toEqual([- 'page.route',- 'page.goto',- 'page.goto',- 'page.evaluate',- 'page.reload',- 'page.evaluate',- 'dialog.accept',+ 'Route',+ 'Navigate to "/empty.html"',+ 'Navigate to "/grid.html"',+ 'Evaluate',+ 'Reload',+ 'Evaluate',+ 'Accept dialog',]);});@@ -135,7 +135,7 @@ test('should not include buffers in the trace', async ({ context, page, server }await page.screenshot();await context.tracing.stop({ path: testInfo.outputPath('trace.zip') });const { actionObjects } = await parseTraceRaw(testInfo.outputPath('trace.zip'));- const screenshotEvent = actionObjects.find(a => a.title === 'page.screenshot');+ const screenshotEvent = actionObjects.find(a => a.title === 'Screenshot');expect(screenshotEvent.beforeSnapshot).toBeTruthy();expect(screenshotEvent.afterSnapshot).toBeTruthy();expect(screenshotEvent.result).toEqual({@@ -166,7 +166,7 @@ test('should include context API requests', async ({ browserName, context, page,await page.request.post(server.PREFIX + '/simple.json', { data: { foo: 'bar' } });await context.tracing.stop({ path: testInfo.outputPath('trace.zip') });const { events } = await parseTraceRaw(testInfo.outputPath('trace.zip'));- const postEvent = events.find(e => e.title === 'apiRequestContext.post');+ const postEvent = events.find(e => e.title === 'Fetch "/simple.json"');expect(postEvent).toBeTruthy();const harEntry = events.find(e => e.type === 'resource-snapshot');expect(harEntry).toBeTruthy();@@ -190,9 +190,9 @@ test('should collect two traces', async ({ context, page, server }, testInfo) =>const { events, actions } = await parseTraceRaw(testInfo.outputPath('trace1.zip'));expect(events[0].type).toBe('context-options');expect(actions).toEqual([- 'page.goto',- 'page.setContent',- 'page.click',+ 'Navigate to "/empty.html"',+ 'Set content',+ 'Click',]);}@@ -200,8 +200,8 @@ test('should collect two traces', async ({ context, page, server }, testInfo) =>const { events, actions } = await parseTraceRaw(testInfo.outputPath('trace2.zip'));expect(events[0].type).toBe('context-options');expect(actions).toEqual([- 'page.dblclick',- 'page.close',+ 'Double click',+ 'Close',]);}});@@ -236,7 +236,7 @@ test('should respect tracesDir and name', async ({ browserType, server, mode },{const { resources, actions } = await parseTraceRaw(testInfo.outputPath('trace1.zip'));- expect(actions).toEqual(['page.goto']);+ expect(actions).toEqual(['Navigate to "/one-style.html"']);expect(resourceNames(resources)).toEqual(['resources/XXX.css','resources/XXX.html',@@ -248,7 +248,7 @@ test('should respect tracesDir and name', async ({ browserType, server, mode },{const { resources, actions } = await parseTraceRaw(testInfo.outputPath('trace2.zip'));- expect(actions).toEqual(['page.goto']);+ expect(actions).toEqual(['Navigate to "/har.html"']);expect(resourceNames(resources)).toEqual(['resources/XXX.css','resources/XXX.html',@@ -484,7 +484,7 @@ test('should include interrupted actions', async ({ context, page, server }, tesawait context.close();const { events } = await parseTraceRaw(testInfo.outputPath('trace.zip'));- const clickEvent = events.find(e => e.title === 'page.click');+ const clickEvent = events.find(e => e.title === 'Click');expect(clickEvent).toBeTruthy();});@@ -525,10 +525,10 @@ test('should work with multiple chunks', async ({ context, page, server }, testIconst trace1 = await parseTraceRaw(testInfo.outputPath('trace.zip'));expect(trace1.events[0].type).toBe('context-options');expect(trace1.actions).toEqual([- 'page.setContent',- 'page.click',- 'page.click',- 'page.evaluate',+ 'Set content',+ 'Click',+ 'Click',+ 'Evaluate',]);expect(trace1.events.some(e => e.type === 'frame-snapshot')).toBeTruthy();expect(trace1.events.some(e => e.type === 'resource-snapshot' && e.snapshot.request.url.endsWith('style.css'))).toBeTruthy();@@ -536,7 +536,7 @@ test('should work with multiple chunks', async ({ context, page, server }, testIconst trace2 = await parseTraceRaw(testInfo.outputPath('trace2.zip'));expect(trace2.events[0].type).toBe('context-options');expect(trace2.actions).toEqual([- 'page.hover',+ 'Hover',]);expect(trace2.events.some(e => e.type === 'frame-snapshot')).toBeTruthy();expect(trace2.events.some(e => e.type === 'resource-snapshot' && e.snapshot.request.url.endsWith('style.css'))).toBeTruthy();@@ -584,9 +584,7 @@ test('should ignore iframes in head', async ({ context, page, server }, testInfoawait context.tracing.stopChunk({ path: testInfo.outputPath('trace.zip') });const trace = await parseTraceRaw(testInfo.outputPath('trace.zip'));- expect(trace.actions).toEqual([- 'page.click',- ]);+ expect(trace.actions).toEqual(['Click']);expect(trace.events.find(e => e.type === 'frame-snapshot')).toBeTruthy();expect(trace.events.find(e => e.type === 'frame-snapshot' && JSON.stringify(e.snapshot.html).includes('IFRAME'))).toBeFalsy();});@@ -744,7 +742,7 @@ test('should not flush console events', async ({ context, page, mode }, testInfoawait expect(async () => {const traceName = fs.readdirSync(dir).find(name => name.endsWith(testId + '.trace'));content = await fs.promises.readFile(path.join(dir, traceName), 'utf8');- expect(content).toContain('page.evaluate');+ expect(content).toContain('Evaluate');expect(content).toContain('31415926');}).toPass();expect(content).not.toContain('hello 0');@@ -826,12 +824,12 @@ test('should not emit after w/o before', async ({ browserType, mode }, testInfo){type: 'before',callId: expect.any(Number),- title: 'page.evaluate'+ title: 'Evaluate'},{type: 'before',callId: expect.any(Number),- title: 'page.waitForEvent'+ title: 'Wait for event "console"'},{type: 'after',@@ -852,7 +850,7 @@ test('should not emit after w/o before', async ({ browserType, mode }, testInfo){type: 'before',callId: expect.any(Number),- title: 'page.evaluateHandle'+ title: 'Evaluate'},{type: 'after',diff --git a/tests/playwright-test/playwright.connect.spec.ts b/tests/playwright-test/playwright.connect.spec.tsindex 8b945b5166..eaac03cfbd 100644--- a/tests/playwright-test/playwright.connect.spec.ts+++ b/tests/playwright-test/playwright.connect.spec.ts@@ -218,8 +218,8 @@ test('should record trace', async ({ runInlineTest }) => {'fixture: context','browser.newContext','fixture: page',- 'browserContext.newPage',- 'expect.toBe',+ 'Create page',+ 'Expect toBe','After Hooks','fixture: page','fixture: context',diff --git a/tests/playwright-test/playwright.reuse.spec.ts b/tests/playwright-test/playwright.reuse.spec.tsindex c9e3b58c01..08e9ab47c3 100644--- a/tests/playwright-test/playwright.reuse.spec.ts+++ b/tests/playwright-test/playwright.reuse.spec.ts@@ -132,9 +132,9 @@ test('should reuse context with trace if mode=when-possible', async ({ runInline' browserType.launch',' fixture: context',' fixture: page',- ' browserContext.newPage',- 'page.setContent',- 'page.click',+ ' Create page',+ 'Set content',+ 'Click','After Hooks',' fixture: page',' fixture: context',@@ -147,10 +147,10 @@ test('should reuse context with trace if mode=when-possible', async ({ runInline'Before Hooks',' fixture: context',' fixture: page',- 'expect.toBe',- 'page.setContent',- 'page.fill',- 'locator.click',+ 'Expect toBe',+ 'Set content',+ 'Fill "value"',+ 'Click','After Hooks',' fixture: page',' fixture: context',@@ -479,16 +479,16 @@ test('should reset tracing', async ({ runInlineTest }, testInfo) => {const trace1 = await parseTrace(traceFile1);expect(trace1.titles).toEqual([- 'page.setContent',- 'page.click',+ 'Set content',+ 'Click',]);expect(trace1.traceModel.storage().snapshotsForTest().length).toBeGreaterThan(0);const trace2 = await parseTrace(traceFile2);expect(trace2.titles).toEqual([- 'page.setContent',- 'page.fill',- 'locator.click',+ 'Set content',+ 'Fill "value"',+ 'Click',]);expect(trace1.traceModel.storage().snapshotsForTest().length).toBeGreaterThan(0);});diff --git a/tests/playwright-test/playwright.trace.spec.ts b/tests/playwright-test/playwright.trace.spec.tsindex d6a2c25b02..6bbb2663ca 100644--- a/tests/playwright-test/playwright.trace.spec.ts+++ b/tests/playwright-test/playwright.trace.spec.ts@@ -96,9 +96,9 @@ test('should record api trace', async ({ runInlineTest, server }, testInfo) => {' fixture: context',' browser.newContext',' fixture: page',- ' browserContext.newPage',- 'page.goto',- 'apiRequestContext.get',+ ' Create page',+ 'Navigate to "about:blank"',+ 'Fetch "/empty.html"','After Hooks',' fixture: page',' fixture: context',@@ -108,7 +108,7 @@ test('should record api trace', async ({ runInlineTest, server }, testInfo) => {expect(trace2.actionTree).toEqual(['Before Hooks','apiRequest.newContext',- 'apiRequestContext.get',+ 'Fetch "/empty.html"','After Hooks',]);const trace3 = await parseTrace(testInfo.outputPath('test-results', 'a-fail', 'trace.zip'));@@ -119,10 +119,10 @@ test('should record api trace', async ({ runInlineTest, server }, testInfo) => {' fixture: context',' browser.newContext',' fixture: page',- ' browserContext.newPage',- 'page.goto',- 'apiRequestContext.get',- 'expect.toBe',+ ' Create page',+ 'Navigate to "about:blank"',+ 'Fetch "/empty.html"',+ 'Expect toBe','After Hooks',' fixture: page',' fixture: context',@@ -321,15 +321,15 @@ test('should not override trace file in afterAll', async ({ runInlineTest, serve' fixture: context',' browser.newContext',' fixture: page',- ' browserContext.newPage',- 'page.goto',+ ' Create page',+ 'Navigate to "about:blank"','After Hooks',' fixture: page',' fixture: context',' afterAll hook',' fixture: request',' apiRequest.newContext',- ' apiRequestContext.get',+ ' Fetch "/empty.html"',' fixture: request','Worker Cleanup',' fixture: browser',@@ -465,7 +465,7 @@ test(`trace:retain-on-failure should create trace if context is closed before fa}, { trace: 'retain-on-failure' });const tracePath = test.info().outputPath('test-results', 'a-passing-test', 'trace.zip');const trace = await parseTrace(tracePath);- expect(trace.titles).toContain('page.goto');+ expect(trace.titles).toContain('Navigate to "about:blank"');expect(result.failed).toBe(1);});@@ -487,7 +487,7 @@ test(`trace:retain-on-failure should create trace if context is closed before fa}, { trace: 'retain-on-failure' });const tracePath = test.info().outputPath('test-results', 'a-passing-test', 'trace.zip');const trace = await parseTrace(tracePath);- expect(trace.titles).toContain('page.goto');+ expect(trace.titles).toContain('Navigate to "about:blank"');expect(result.failed).toBe(1);});@@ -507,7 +507,7 @@ test(`trace:retain-on-failure should create trace if request context is disposed}, { trace: 'retain-on-failure' });const tracePath = test.info().outputPath('test-results', 'a-passing-test', 'trace.zip');const trace = await parseTrace(tracePath);- expect(trace.titles).toContain('apiRequestContext.get');+ expect(trace.titles).toContain('Fetch "/empty.html"');expect(result.failed).toBe(1);});@@ -623,14 +623,14 @@ test('should expand expect.toPass', async ({ runInlineTest }, testInfo) => {' fixture: context',' browser.newContext',' fixture: page',- ' browserContext.newPage',- 'expect.toPass',- ' page.goto',- ' expect.toBe',- ' page.goto',- ' expect.toBe',- ' page.goto',- ' expect.toBe',+ ' Create page',+ 'Expect toPass',+ ' Navigate to "data:"',+ ' Expect toBe',+ ' Navigate to "data:"',+ ' Expect toBe',+ ' Navigate to "data:"',+ ' Expect toBe','After Hooks',' fixture: page',' fixture: context',@@ -662,8 +662,8 @@ test('should show non-expect error in trace', async ({ runInlineTest }, testInfo' fixture: context',' browser.newContext',' fixture: page',- ' browserContext.newPage',- 'expect.toBe',+ ' Create page',+ 'Expect toBe','After Hooks',' fixture: page',' fixture: context',@@ -790,7 +790,7 @@ test('should use custom expect message in trace', async ({ runInlineTest }, test' fixture: context',' browser.newContext',' fixture: page',- ' browserContext.newPage',+ ' Create page','expect to have text: find a hotel','After Hooks',' fixture: page',@@ -942,11 +942,11 @@ test('should record nested steps, even after timeout', async ({ runInlineTest },' barPage setup',' browser.newPage',' step in barPage setup',- ' page.setContent',+ ' Set content',' beforeAll start',- ' page.setContent',+ ' Set content',' step in beforeAll',- ' page.setContent',+ ' Set content',' fixture: barPage',' barPage teardown',' step in barPage teardown',@@ -955,27 +955,27 @@ test('should record nested steps, even after timeout', async ({ runInlineTest },' fixture: context',' browser.newContext',' fixture: page',- ' browserContext.newPage',+ ' Create page',' fixture: fooPage',' fooPage setup',- ' page.setContent',+ ' Set content',' step in fooPage setup',- ' page.setContent',+ ' Set content',' beforeEach start',- ' page.setContent',+ ' Set content',' step in beforeEach',- ' page.setContent',+ ' Set content','After Hooks',' afterEach hook',' afterEach start',- ' page.setContent',+ ' Set content',' step in afterEach',- ' page.setContent',+ ' Set content',' fixture: fooPage',' fooPage teardown',- ' page.setContent',+ ' Set content',' step in fooPage teardown',- ' page.setContent',+ ' Set content',' fixture: page',' fixture: context',' afterAll hook',@@ -983,11 +983,11 @@ test('should record nested steps, even after timeout', async ({ runInlineTest },' barPage setup',' browser.newPage',' step in barPage setup',- ' page.setContent',+ ' Set content',' afterAll start',- ' page.setContent',+ ' Set content',' step in afterAll',- ' page.setContent',+ ' Set content',' fixture: barPage',' barPage teardown',' step in barPage teardown',@@ -1028,11 +1028,11 @@ test('should not produce an action entry for calling a binding', async ({ runInl' fixture: context',' browser.newContext',' fixture: page',- ' browserContext.newPage',- 'page.exposeBinding',- 'page.evaluate',- 'expect.toBe',- 'expect.toBe',+ ' Create page',+ 'Expose binding',+ 'Evaluate',+ 'Expect toBe',+ 'Expect toBe','After Hooks',' fixture: page',' fixture: context',@@ -1102,7 +1102,7 @@ test('trace:retain-on-first-failure should create trace but only on first failurconst tracePath = test.info().outputPath('test-results', 'a-fail', 'trace.zip');const trace = await parseTrace(tracePath);- expect(trace.titles).toContain('page.goto');+ expect(trace.titles).toContain('Navigate to "about:blank"');expect(result.failed).toBe(1);});@@ -1119,7 +1119,7 @@ test('trace:retain-on-first-failure should create trace if context is closed bef}, { trace: 'retain-on-first-failure' });const tracePath = test.info().outputPath('test-results', 'a-fail', 'trace.zip');const trace = await parseTrace(tracePath);- expect(trace.titles).toContain('page.goto');+ expect(trace.titles).toContain('Navigate to "about:blank"');expect(result.failed).toBe(1);});@@ -1138,7 +1138,7 @@ test('trace:retain-on-first-failure should create trace if context is closed bef}, { trace: 'retain-on-first-failure' });const tracePath = test.info().outputPath('test-results', 'a-fail', 'trace.zip');const trace = await parseTrace(tracePath);- expect(trace.titles).toContain('page.goto');+ expect(trace.titles).toContain('Navigate to "about:blank"');expect(result.failed).toBe(1);});@@ -1155,7 +1155,7 @@ test('trace:retain-on-first-failure should create trace if request context is di}, { trace: 'retain-on-first-failure' });const tracePath = test.info().outputPath('test-results', 'a-fail', 'trace.zip');const trace = await parseTrace(tracePath);- expect(trace.titles).toContain('apiRequestContext.get');+ expect(trace.titles).toContain('Fetch "/empty.html"');expect(result.failed).toBe(1);});@@ -1183,11 +1183,11 @@ test('should not corrupt actions when no library trace is present', async ({ runexpect(trace.actionTree).toEqual(['Before Hooks',' fixture: foo',- ' expect.toBe',- 'expect.toBe',+ ' Expect toBe',+ 'Expect toBe','After Hooks',' fixture: foo',- ' expect.toBe',+ ' Expect toBe','Attach "error-context-0"','Worker Cleanup',]);@@ -1216,8 +1216,8 @@ test('should record trace for manually created context in a failed test', async' fixture: browser',' browserType.launch','browser.newPage',- 'page.setContent',- 'expect.toBe',+ 'Set content',+ 'Expect toBe','After Hooks','Attach "error-context-0"','Worker Cleanup',@@ -1261,12 +1261,12 @@ test('should not nest top level expect into unfinished api calls ', {' fixture: context',' browser.newContext',' fixture: page',- ' browserContext.newPage',- 'page.route',- 'page.goto',- 'route.fetch',- 'expect.toBeVisible',- 'page.unrouteAll',+ ' Create page',+ 'Route',+ 'Navigate to "/index"',+ 'Fetch "/hang"',+ 'Expect toBeVisible',+ 'Unroute all','After Hooks',' fixture: page',' fixture: context',@@ -1303,9 +1303,9 @@ test('should record trace after fixture teardown timeout', {' fixture: context',' browser.newContext',' fixture: page',- ' browserContext.newPage',+ ' Create page',' fixture: fixture',- 'page.evaluate',+ 'Evaluate','After Hooks',' fixture: fixture','Worker Cleanup',@@ -1338,23 +1338,23 @@ test('should record trace snapshot for more obscure commands', async ({ runInlin' fixture: browser',' browserType.launch','browser.newPage',- 'page.setContent',- 'locator.count',- 'expect.toBe',- 'locator.boundingBox',+ 'Set content',+ 'Query count',+ 'Expect toBe',+ 'Bounding box','After Hooks',]);const snapshots = trace.traceModel.storage();const snapshotFrameOrPageId = snapshots.snapshotsForTest()[0];- const countAction = trace.actions.find(a => a.title === 'locator.count');+ const countAction = trace.actions.find(a => a.title === 'Query count');expect(countAction.beforeSnapshot).toBeTruthy();expect(countAction.afterSnapshot).toBeTruthy();expect(snapshots.snapshotByName(snapshotFrameOrPageId, countAction.beforeSnapshot)).toBeTruthy();expect(snapshots.snapshotByName(snapshotFrameOrPageId, countAction.afterSnapshot)).toBeTruthy();- const boundingBoxAction = trace.actions.find(a => a.title === 'locator.boundingBox');+ const boundingBoxAction = trace.actions.find(a => a.title === 'Bounding box');expect(boundingBoxAction.beforeSnapshot).toBeTruthy();expect(boundingBoxAction.afterSnapshot).toBeTruthy();expect(snapshots.snapshotByName(snapshotFrameOrPageId, boundingBoxAction.beforeSnapshot)).toBeTruthy();diff --git a/tests/playwright-test/reporter-blob.spec.ts b/tests/playwright-test/reporter-blob.spec.tsindex a4de72e58f..116cde07a9 100644--- a/tests/playwright-test/reporter-blob.spec.ts+++ b/tests/playwright-test/reporter-blob.spec.ts@@ -709,7 +709,10 @@ test('generate html with attachment urls', async ({ runInlineTest, mergeReports,// Check that trace loads.await page.locator('.test-file-test').filter({ hasText: /failing 1/ }).getByRole('link', { name: 'View Trace' }).click();await expect(page).toHaveTitle('Playwright Trace Viewer');- await expect(page.getByTestId('actions-tree').locator('div').filter({ hasText: /^expect\.toBe$/ })).toBeVisible();+ await expect(page.getByTestId('actions-tree')).toMatchAriaSnapshot(`+ - tree:+ - treeitem /Expect toBe \\d+[hmsp]+/ [selected]+ `);});test('resource names should not clash between runs', async ({ runInlineTest, showReport, mergeReports, page }) => {@@ -1207,15 +1210,15 @@ test('preserve steps in html report', async ({ runInlineTest, mergeReports, showawait page.getByText('Before Hooks').click();await page.getByText('beforeAll hook').click();- await expect(page.getByText('expect.toBe')).toBeVisible();+ await expect(page.getByText('EXPECT toBe')).toBeVisible();// Collapse hooks.await page.getByText('Before Hooks').click();- await expect(page.getByText('expect.toBe')).not.toBeVisible();+ await expect(page.getByText('EXPECT toBe')).not.toBeVisible();// Check that 'my step' location is relative.await expect(page.getByText('— tests/a.test.js:7')).toBeVisible();await page.getByText('my step').click();- await expect(page.getByText('expect.toBe')).toBeVisible();+ await expect(page.getByText('EXPECT toBe')).toBeVisible();});test('support fileName option', async ({ runInlineTest, mergeReports }) => {diff --git a/tests/playwright-test/reporter-html.spec.ts b/tests/playwright-test/reporter-html.spec.tsindex 7707b549e0..e67867cb96 100644--- a/tests/playwright-test/reporter-html.spec.ts+++ b/tests/playwright-test/reporter-html.spec.ts@@ -517,7 +517,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {await showReport();await page.getByRole('link', { name: 'passes' }).click();await page.click('img');- await page.click('.action-title >> text=page.evaluate');+ await page.click('.action-title >> text=EVALUATE');await page.click('text=Source');await expect(page.locator('.CodeMirror-line')).toContainText([@@ -550,7 +550,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {await showReport();await page.getByRole('link', { name: 'passes' }).click();await page.click('img');- await page.click('.action-title >> text=page.evaluate');+ await page.click('.action-title >> text=EVALUATE');await page.click('text=Source');await expect(page.locator('.CodeMirror-line')).toContainText([@@ -608,11 +608,11 @@ for (const useIntermediateMergeReport of [true, false] as const) {await expect(page.locator('a', { hasText: 'trace' })).toHaveText(['trace']);await page.click('img');- await page.click('.action-title >> text=page.evaluate');+ await page.click('.action-title >> text=EVALUATE');await page.click('text=Source');await expect(page.locator('.source-line-running')).toContainText('page.evaluate');- await page.click('.action-title >> text=apiRequestContext.get');+ await page.click('.action-title >> text=FETCH');await page.click('text=Source');await expect(page.locator('.source-line-running')).toContainText('request.get');});@@ -643,10 +643,10 @@ for (const useIntermediateMergeReport of [true, false] as const) {await page.getByRole('link', { name: 'View Trace' }).click();// Trace viewer should not hang here when displaying parallal requests.- await expect(page.getByTestId('actions-tree')).toContainText('apiRequestContext.get');- await page.getByText('apiRequestContext.get').nth(2).click();- await page.getByText('apiRequestContext.get').nth(1).click();- await page.getByText('apiRequestContext.get').nth(0).click();+ await expect(page.getByTestId('actions-tree')).toContainText('Fetch');+ await page.getByText('Fetch').nth(2).click();+ await page.getByText('Fetch').nth(1).click();+ await page.getByText('Fetch').nth(0).click();});test('should warn user when viewing via file:// protocol', async ({ runInlineTest, page, showReport }, testInfo) => {@@ -728,7 +728,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {await page.click('.tree-item:has-text("outer error") >> text=outer error');await page.click('.tree-item:has-text("outer error") >> .tree-item >> text=inner error');await expect(page.locator('.tree-item:has-text("outer error") svg.color-text-danger')).toHaveCount(3);- await expect(page.locator('.tree-item:has-text("expect.soft.toBe"):not(:has-text("inner"))')).toBeVisible();+ await expect(page.locator('.tree-item:has-text("toBe"):not(:has-text("inner"))')).toBeVisible();await page.click('text=outer step');await expect(page.locator('.tree-item:has-text("outer step") svg.color-text-danger')).toHaveCount(2);@@ -771,7 +771,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {await showReport();await page.getByRole('link', { name: 'example' }).click();await page.click('text=step title');- await page.click('text=expect.toBe');+ await page.click('text=EXPECT toBe');await expect(page.getByTestId('test-snippet')).toContainText([`await test.step('step title', async () => {`,'expect(1).toBe(1);',@@ -1215,8 +1215,8 @@ for (const useIntermediateMergeReport of [true, false] as const) {await page.locator('text=sample').first().click();await expect(page.locator('.tree-item-title')).toContainText([- /expect\.toBe.*10/,- /expect\.toEqual.*20/,+ /Expect toBe.*10/,+ /Expect toEqual.*20/,]);});@@ -1266,7 +1266,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {await expect(page.locator('text=a.spec.js')).toBeVisible();await page.locator('text=sample').first().click();await expect(page.locator('.tree-item-title')).toContainText([- /expect\.toBe/,+ /Expect toBe/,]);});diff --git a/tests/playwright-test/reporter.spec.ts b/tests/playwright-test/reporter.spec.tsindex b2a68bfeb0..6f7403d35c 100644--- a/tests/playwright-test/reporter.spec.ts+++ b/tests/playwright-test/reporter.spec.ts@@ -480,7 +480,7 @@ var import_test = __toModule(require("@playwright/test"));onBegin: 1 tests totalonTestBegin: > a.spec.js > test; retry #0onStepEnd: Before Hooks-onStepEnd: expect.toBe+onStepEnd: Expect toBeerror: Error: expect(received).toBe(expected) // Object.is equality @ a.spec.js:5======3 | test('test', async () => {diff --git a/tests/playwright-test/test-step.spec.ts b/tests/playwright-test/test-step.spec.tsindex 99ebf63cea..9710da56ac 100644--- a/tests/playwright-test/test-step.spec.ts+++ b/tests/playwright-test/test-step.spec.ts@@ -302,7 +302,7 @@ test('should report expect step locations', async ({ runInlineTest }) => {expect(result.exitCode).toBe(0);expect(result.output).toBe(`hook |Before Hooks-expect |expect.toBeTruthy @ a.test.ts:4+expect |Expect toBeTruthy @ a.test.ts:4hook |After Hooks`);});@@ -355,8 +355,8 @@ test('should report custom expect steps', async ({ runInlineTest }) => {expect(result.exitCode).toBe(1);expect(result.output).toBe(`hook |Before Hooks-expect |expect.toBeWithinRange @ a.test.ts:32-expect |expect.toBeFailingAsync @ a.test.ts:33+expect |Expect toBeWithinRange @ a.test.ts:32+expect |Expect toBeFailingAsync @ a.test.ts:33expect |↪ error: Error: It fails!hook |After Hookshook |Worker Cleanup@@ -487,7 +487,7 @@ test.step |outer @ a.test.ts:4test.step |↪ error: Error: expect(received).toBe(expected) // Object.is equalitytest.step | inner @ a.test.ts:5test.step | ↪ error: Error: expect(received).toBe(expected) // Object.is equality-expect | expect.soft.toBe @ a.test.ts:6+expect | Expect soft toBe @ a.test.ts:6expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalitytest.step |passing @ a.test.ts:9hook |After Hooks@@ -560,7 +560,7 @@ test.step | child1 @ a.test.ts:23pw:api | page.click(body) @ a.test.ts:24test.step | parent2 @ a.test.ts:27test.step | child2 @ a.test.ts:28-expect | expect.toBeVisible @ a.test.ts:29+expect | Expect toBeVisible @ a.test.ts:29hook |After Hookshook | afterEach hook @ a.test.ts:15test.step | in afterEach @ a.test.ts:16@@ -637,12 +637,12 @@ test('should not propagate errors from within toPass', async ({ runInlineTest })expect(result.exitCode).toBe(0);expect(result.output).toBe(`hook |Before Hooks-step |expect.toPass @ a.test.ts:7-expect | expect.toBe @ a.test.ts:6+step |Expect toPass @ a.test.ts:7+expect | Expect toBe @ a.test.ts:6expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equality-expect | expect.toBe @ a.test.ts:6+expect | Expect toBe @ a.test.ts:6expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equality-expect | expect.toBe @ a.test.ts:6+expect | Expect toBe @ a.test.ts:6hook |After Hooks`);});@@ -664,9 +664,9 @@ test('should show final toPass error', async ({ runInlineTest }) => {expect(result.exitCode).toBe(1);expect(stripAnsi(result.output)).toBe(`hook |Before Hooks-step |expect.toPass @ a.test.ts:6+step |Expect toPass @ a.test.ts:6step |↪ error: Error: expect(received).toBe(expected) // Object.is equality-expect | expect.toBe @ a.test.ts:5+expect | Expect toBe @ a.test.ts:5expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalityhook |After Hookshook |Worker Cleanup@@ -703,13 +703,13 @@ test.step |first outer @ a.test.ts:4test.step |↪ error: Error: expect(received).toBe(expected) // Object.is equalitytest.step | first inner @ a.test.ts:5test.step | ↪ error: Error: expect(received).toBe(expected) // Object.is equality-expect | expect.soft.toBe @ a.test.ts:6+expect | Expect soft toBe @ a.test.ts:6expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalitytest.step |second outer @ a.test.ts:10test.step |↪ error: Error: expect(received).toBe(expected) // Object.is equalitytest.step | second inner @ a.test.ts:11test.step | ↪ error: Error: expect(received).toBe(expected) // Object.is equality-expect | expect.toBe @ a.test.ts:12+expect | Expect toBe @ a.test.ts:12expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalityhook |After Hookshook |Worker Cleanup@@ -748,13 +748,13 @@ test('should not propagate nested hard errors', async ({ runInlineTest }) => {hook |Before Hookstest.step |first outer @ a.test.ts:4test.step | first inner @ a.test.ts:5-expect | expect.toBe @ a.test.ts:7+expect | Expect toBe @ a.test.ts:7expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalitytest.step |second outer @ a.test.ts:13test.step |↪ error: Error: expect(received).toBe(expected) // Object.is equalitytest.step | second inner @ a.test.ts:14test.step | ↪ error: Error: expect(received).toBe(expected) // Object.is equality-expect | expect.toBe @ a.test.ts:15+expect | Expect toBe @ a.test.ts:15expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalityhook |After Hookshook |Worker Cleanup@@ -783,7 +783,7 @@ test.step |boxed step @ a.test.ts:3test.step |↪ error: Error: expect(received).toBe(expected) // Object.is equality @ a.test.ts:4test.step | at a.test.ts:4:27test.step | at a.test.ts:3:26-expect | expect.toBe @ a.test.ts:4+expect | Expect toBe @ a.test.ts:4expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equality @ a.test.ts:4expect | at a.test.ts:4:27expect | at a.test.ts:3:26@@ -818,7 +818,7 @@ hook |Before Hookstest.step |boxed step @ a.test.ts:8test.step |↪ error: Error: expect(received).toBe(expected) // Object.is equality @ a.test.ts:8test.step | at a.test.ts:8:21-expect | expect.toBe @ a.test.ts:5+expect | Expect toBe @ a.test.ts:5expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equality @ a.test.ts:8expect | at a.test.ts:8:21hook |After Hooks@@ -851,7 +851,7 @@ hook |Before Hookstest.step |boxed step @ a.test.ts:8test.step |↪ error: Error: expect(received).toBe(expected) // Object.is equality @ a.test.ts:8test.step | at a.test.ts:8:21-expect | expect.soft.toBe @ a.test.ts:5+expect | Expect soft toBe @ a.test.ts:5expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equality @ a.test.ts:8expect | at a.test.ts:8:21hook |After Hooks@@ -896,7 +896,7 @@ fixture | fixture: context`);});-test('step inside expect.toPass', async ({ runInlineTest }) => {+test('step inside Expect toPass', async ({ runInlineTest }) => {test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/30322' });const result = await runInlineTest({'reporter.ts': stepIndentReporter,@@ -930,21 +930,21 @@ test('step inside expect.toPass', async ({ runInlineTest }) => {expect(stripAnsi(result.output)).toBe(`hook |Before Hookstest.step |step 1 @ a.test.ts:4-step | expect.toPass @ a.test.ts:11+step | Expect toPass @ a.test.ts:11test.step | step 2, attempt: 0 @ a.test.ts:7test.step | ↪ error: Error: expect(received).toBe(expected) // Object.is equality-expect | expect.toBe @ a.test.ts:9+expect | Expect toBe @ a.test.ts:9expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalitytest.step | step 2, attempt: 1 @ a.test.ts:7-expect | expect.toBe @ a.test.ts:9+expect | Expect toBe @ a.test.ts:9test.step | step 3 @ a.test.ts:12test.step | step 4 @ a.test.ts:13-expect | expect.toBe @ a.test.ts:14+expect | Expect toBe @ a.test.ts:14hook |After Hooks`);});-test('library API call inside expect.toPass', async ({ runInlineTest }) => {+test('library API call inside Expect toPass', async ({ runInlineTest }) => {test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/30322' });const result = await runInlineTest({'reporter.ts': stepIndentReporter,@@ -977,15 +977,15 @@ fixture | fixture: contextpw:api | browser.newContextfixture | fixture: pagepw:api | browserContext.newPage-step |expect.toPass @ a.test.ts:11+step |Expect toPass @ a.test.ts:11pw:api | page.goto(about:blank) @ a.test.ts:6test.step | inner step attempt: 0 @ a.test.ts:7test.step | ↪ error: Error: expect(received).toBe(expected) // Object.is equality-expect | expect.toBe @ a.test.ts:9+expect | Expect toBe @ a.test.ts:9expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalitypw:api | page.goto(about:blank) @ a.test.ts:6test.step | inner step attempt: 1 @ a.test.ts:7-expect | expect.toBe @ a.test.ts:9+expect | Expect toBe @ a.test.ts:9hook |After Hooksfixture | fixture: pagefixture | fixture: context@@ -1028,16 +1028,16 @@ fixture | fixture: contextpw:api | browser.newContextfixture | fixture: pagepw:api | browserContext.newPage-step |expect.poll.toHaveLength @ a.test.ts:14+step |Expect poll toHaveLength @ a.test.ts:14pw:api | page.goto(about:blank) @ a.test.ts:7test.step | inner step attempt: 0 @ a.test.ts:8-expect | expect.toBe @ a.test.ts:10-expect | expect.toHaveLength @ a.test.ts:6+expect | Expect toBe @ a.test.ts:10+expect | Expect toHaveLength @ a.test.ts:6expect | ↪ error: Error: expect(received).toHaveLength(expected)pw:api | page.goto(about:blank) @ a.test.ts:7test.step | inner step attempt: 1 @ a.test.ts:8-expect | expect.toBe @ a.test.ts:10-expect | expect.toHaveLength @ a.test.ts:6+expect | Expect toBe @ a.test.ts:10+expect | Expect toHaveLength @ a.test.ts:6hook |After Hooksfixture | fixture: pagefixture | fixture: context@@ -1080,16 +1080,16 @@ pw:api | browser.newContextfixture | fixture: pagepw:api | browserContext.newPagepw:api |page.setContent @ a.test.ts:4-step |expect.poll.toBe @ a.test.ts:13-expect | expect.toHaveText @ a.test.ts:7+step |Expect poll toBe @ a.test.ts:13+expect | Expect toHaveText @ a.test.ts:7test.step | iteration 1 @ a.test.ts:9-expect | expect.toBeVisible @ a.test.ts:10-expect | expect.toBe @ a.test.ts:6+expect | Expect toBeVisible @ a.test.ts:10+expect | Expect toBe @ a.test.ts:6expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equality-expect | expect.toHaveText @ a.test.ts:7+expect | Expect toHaveText @ a.test.ts:7test.step | iteration 2 @ a.test.ts:9-expect | expect.toBeVisible @ a.test.ts:10-expect | expect.toBe @ a.test.ts:6+expect | Expect toBeVisible @ a.test.ts:10+expect | Expect toBe @ a.test.ts:6hook |After Hooksfixture | fixture: pagefixture | fixture: context@@ -1122,14 +1122,14 @@ test('should report expect steps', async ({ runInlineTest }) => {expect(result.exitCode).toBe(1);expect(stripAnsi(result.output)).toBe(`hook |Before Hooks-expect |expect.toBeTruthy @ a.test.ts:4-expect |expect.toBeTruthy @ a.test.ts:5+expect |Expect toBeTruthy @ a.test.ts:4+expect |Expect toBeTruthy @ a.test.ts:5expect |↪ error: Error: expect(received).toBeTruthy()hook |After Hookshook |Worker Cleanup|Error: expect(received).toBeTruthy()hook |Before Hooks-expect |expect.not.toBeTruthy @ a.test.ts:8+expect |Expect not toBeTruthy @ a.test.ts:8hook |After Hookshook |Before Hooksfixture | fixture: browser@@ -1138,7 +1138,7 @@ fixture | fixture: contextpw:api | browser.newContextfixture | fixture: pagepw:api | browserContext.newPage-expect |expect.not.toHaveTitle @ a.test.ts:11+expect |Expect not toHaveTitle @ a.test.ts:11hook |After Hooksfixture | fixture: pagefixture | fixture: context@@ -1435,8 +1435,8 @@ pw:api | page.waitForResponse @ a.test.ts:7pw:api | page.click(div) @ a.test.ts:14pw:api | page.content @ a.test.ts:8pw:api | page.content @ a.test.ts:9-expect | expect.toContainText @ a.test.ts:10-expect |expect.toBe @ a.test.ts:18+expect | Expect toContainText @ a.test.ts:10+expect |Expect toBe @ a.test.ts:18hook |After Hooksfixture | fixture: pagefixture | fixture: context@@ -1517,7 +1517,7 @@ test.step |custom step @ a.test.ts:4pw:api | page.route @ a.test.ts:5pw:api | page.goto(${server.EMPTY_PAGE}) @ a.test.ts:12pw:api | route.fetch(${server.EMPTY_PAGE}) @ a.test.ts:6-expect | expect.toBe @ a.test.ts:8+expect | Expect toBe @ a.test.ts:8hook |After Hooksfixture | fixture: pagefixture | fixture: context@@ -1557,7 +1557,7 @@ test.step |outer step 1 @ a.test.ts:4 (skipped)test.step |outer step 2 @ a.test.ts:11test.step | inner step 2.1 @ a.test.ts:12 (skipped)test.step | inner step 2.2 @ a.test.ts:13-expect | expect.toBe @ a.test.ts:14+expect | Expect toBe @ a.test.ts:14hook |After Hooks`);});@@ -1586,7 +1586,7 @@ test('skip test.step.skip body', async ({ runInlineTest }) => {hook |Before Hookstest.step |outer step 2 @ a.test.ts:5test.step | inner step 2 @ a.test.ts:6 (skipped)-expect |expect.toBe @ a.test.ts:10+expect |Expect toBe @ a.test.ts:10hook |After Hooks`);});@@ -1629,7 +1629,7 @@ test.step | inner step 1.3 @ a.test.ts:11test.step |outer step 2 @ a.test.ts:13test.step | inner step 2.1 @ a.test.ts:14 (skipped)test.step | inner step 2.2 @ a.test.ts:15-expect | expect.toBe @ a.test.ts:16+expect | Expect toBe @ a.test.ts:16hook |After Hooks`);});@@ -1693,22 +1693,22 @@ pw:api | browser.newContextfixture | fixture: pagepw:api | browserContext.newPagepw:api |page.setContent @ a.test.ts:16-expect |expect.toBeInvisible @ a.test.ts:17-step | expect.poll.toBe @ a.test.ts:7+expect |Expect toBeInvisible @ a.test.ts:17+step | Expect poll toBe @ a.test.ts:7pw:api | locator.isVisible(div) @ a.test.ts:7-expect | expect.toBe @ a.test.ts:7+expect | Expect toBe @ a.test.ts:7expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalitypw:api | locator.isVisible(div) @ a.test.ts:7-expect | expect.toBe @ a.test.ts:7+expect | Expect toBe @ a.test.ts:7expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalitypw:api | locator.isVisible(div) @ a.test.ts:7-expect | expect.toBe @ a.test.ts:7+expect | Expect toBe @ a.test.ts:7expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalitypw:api | locator.isVisible(div) @ a.test.ts:7-expect | expect.toBe @ a.test.ts:7+expect | Expect toBe @ a.test.ts:7expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalitypw:api | locator.isVisible(div) @ a.test.ts:7-expect | expect.toBe @ a.test.ts:7+expect | Expect toBe @ a.test.ts:7pw:api |page.waitForTimeout @ a.test.ts:18pw:api |page.setContent @ a.test.ts:19hook |After Hooksdiff --git a/tests/playwright-test/to-have-screenshot.spec.ts b/tests/playwright-test/to-have-screenshot.spec.tsindex 76dc01e27d..ce5b089b60 100644--- a/tests/playwright-test/to-have-screenshot.spec.ts+++ b/tests/playwright-test/to-have-screenshot.spec.ts@@ -263,8 +263,8 @@ test('should report toHaveScreenshot step with expectation name in title', async`end browserContext.newPage`,`end fixture: page`,`end Before Hooks`,- `end expect.toHaveScreenshot(foo.png)`,- `end expect.toHaveScreenshot(is-a-test-1.png)`,+ `end Expect toHaveScreenshot(foo.png)`,+ `end Expect toHaveScreenshot(is-a-test-1.png)`,`end fixture: page`,`end fixture: context`,`end After Hooks`,@@ -700,7 +700,7 @@ test('should attach missing expectations to right step', async ({ runInlineTest}, { reporter: '' });expect(result.exitCode).toBe(1);- expect(result.outputLines).toEqual(['expect.toHaveScreenshot(snapshot.png): snapshot-expected.png, snapshot-actual.png']);+ expect(result.outputLines).toEqual(['Expect toHaveScreenshot(snapshot.png): snapshot-expected.png, snapshot-actual.png']);});test('shouldn\'t write missing expectations locally for negated matcher', async ({ runInlineTest }, testInfo) => {@@ -785,7 +785,7 @@ test('should respect config.snapshotPathTemplate and sanitize the name', {expect(result.passed).toBe(1);});-test('should respect config.expect.toHaveScreenshot.pathTemplate', async ({ runInlineTest }, testInfo) => {+test('should respect config.EXPECT toHaveScreenshot.pathTemplate', async ({ runInlineTest }, testInfo) => {const result = await runInlineTest({...playwrightConfig({snapshotPathTemplate: '__screenshots__/{testFilePath}/{arg}{ext}',diff --git a/tests/playwright-test/ui-mode-test-attachments.spec.ts b/tests/playwright-test/ui-mode-test-attachments.spec.tsindex 1a9e5b56c2..6d466acec5 100644--- a/tests/playwright-test/ui-mode-test-attachments.spec.ts+++ b/tests/playwright-test/ui-mode-test-attachments.spec.ts@@ -91,7 +91,7 @@ test('should contain string attachment', async ({ runUITest }) => {await page.getByTitle('Run all').click();await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');await page.getByText('Attachments').click();- await page.getByText('attach "note"', { exact: true }).click();+ await page.getByText('note', { exact: true }).click();const downloadPromise = page.waitForEvent('download');await page.locator('.expandable-title', { hasText: 'note' }).getByRole('link').click();const download = await downloadPromise;diff --git a/tests/playwright-test/ui-mode-test-progress.spec.ts b/tests/playwright-test/ui-mode-test-progress.spec.tsindex 1b397f8f9a..c8dcc4eb97 100644--- a/tests/playwright-test/ui-mode-test-progress.spec.ts+++ b/tests/playwright-test/ui-mode-test-progress.spec.ts@@ -53,13 +53,13 @@ test('should update trace live', async ({ runUITest, server }) => {'action list').toHaveText([/Before Hooks[\d.]+m?s/,- /page.gotohttp:\/\/localhost:\d+\/one.html/+ /Navigate to "\/one.html"/,]);await expect(listItem.locator(':scope[aria-selected="true"]'),'last action to be selected'- ).toHaveText(/page.goto/);+ ).toHaveText(/Navigate to/);await expect(listItem.locator(':scope[aria-selected="true"] .codicon.codicon-loading'),'spinner'@@ -79,13 +79,13 @@ test('should update trace live', async ({ runUITest, server }) => {).toHaveText('One');await expect(listItem).toHaveText([/Before Hooks[\d.]+m?s/,- /page.gotohttp:\/\/localhost:\d+\/one.html[\d.]+m?s/,- /page.gotohttp:\/\/localhost:\d+\/two.html/+ /Navigate to "\/one.html"/,+ /Navigate to "\/two.html"/]);await expect(listItem.locator(':scope[aria-selected="true"]'),'last action to be selected'- ).toHaveText(/page.goto/);+ ).toHaveText(/Navigate to/);await expect(listItem.locator(':scope[aria-selected="true"] .codicon.codicon-loading'),'spinner'@@ -106,8 +106,8 @@ test('should update trace live', async ({ runUITest, server }) => {await expect(listItem).toHaveText([/Before Hooks[\d.]+m?s/,- /page.gotohttp:\/\/localhost:\d+\/one.html[\d.]+m?s/,- /page.gotohttp:\/\/localhost:\d+\/two.html[\d.]+m?s/,+ /Navigate to "\/one.html"/,+ /Navigate to "\/two.html"/,/After Hooks[\d.]+m?s/,]);});@@ -138,12 +138,12 @@ test('should preserve action list selection upon live trace update', async ({ ru'action list').toHaveText([/Before Hooks[\d.]+m?s/,- /page.gotoabout:blank[\d.]+m?s/,- /page.setContent[\d.]+m?s/,+ /Navigate to "about:blank"/,+ /Set content/,]);// Manually select page.goto.- await page.getByTestId('actions-tree').getByText('page.goto').click();+ await page.getByTestId('actions-tree').getByText('Navigate to').click();// Generate more actions and check that we are still on the page.goto action.latch.open();@@ -152,14 +152,14 @@ test('should preserve action list selection upon live trace update', async ({ ru'action list').toHaveText([/Before Hooks[\d.]+m?s/,- /page.gotoabout:blank[\d.]+m?s/,- /page.setContent[\d.]+m?s/,- /page.setContent[\d.]+m?s/,+ /Navigate to "about:blank"/,+ /Set content/,+ /Set content/,]);await expect(listItem.locator(':scope[aria-selected="true"]'),'selected action stays the same'- ).toHaveText(/page.goto/);+ ).toHaveText(/Navigate to/);});test('should update tracing network live', async ({ runUITest, server }) => {@@ -199,13 +199,13 @@ test('should update tracing network live', async ({ runUITest, server }) => {'action list').toHaveText([/Before Hooks[\d.]+m?s/,- /page.gotohttp:\/\/localhost:\d+\/one.html[\d.]+m?s/,- /page.setContent[\d.]+m?s/,+ /Navigate to "\/one.html"/,+ /Set content/,]);// Once page.setContent is visible, we can be sure that page.goto has all required// resources in the trace. Switch to it and check that everything renders.- await page.getByTestId('actions-tree').getByText('page.goto').click();+ await page.getByTestId('actions-tree').getByText('NAVIGATE').click();await expect(page.frameLocator('iframe.snapshot-visible[name=snapshot]').locator('body'),@@ -239,7 +239,7 @@ test('should show trace w/ multiple contexts', async ({ runUITest, server, creat'action list').toHaveText([/Before Hooks[\d.]+m?s/,- /page.gotoabout:blank[\d.]+m?s/,+ /Navigate to "about:blank"/,]);latch.open();@@ -284,8 +284,8 @@ test('should show live trace for serial', async ({ runUITest, server, createLatc'action list').toHaveText([/Before Hooks[\d.]+m?s/,- /locator.unchecklocator\('input'\)[\d.]+m?s/,- /expect.not.toBeCheckedlocator\('input'\)[\d.]/,+ /Uncheck.*locator/,+ /Expect not toBeChecked/,]);});@@ -344,7 +344,7 @@ test('should show live trace from hooks', async ({ runUITest, createLatch }) =>'action list').toHaveText([/Before Hooks/,- /page.setContent/,+ /Set content/,/After Hooks/,]);});diff --git a/tests/playwright-test/ui-mode-test-screencast.spec.ts b/tests/playwright-test/ui-mode-test-screencast.spec.tsindex 23e4f5872e..4affc726bc 100644--- a/tests/playwright-test/ui-mode-test-screencast.spec.ts+++ b/tests/playwright-test/ui-mode-test-screencast.spec.ts@@ -38,10 +38,10 @@ test('should show screenshots', async ({ runUITest }) => {await expect(page.getByTestId('status-line')).toHaveText('2/2 passed (100%)');await page.getByText('test 1', { exact: true }).click();- await expect(page.getByTestId('actions-tree')).toContainText('expect.toBeVisible');+ await expect(page.getByTestId('actions-tree')).toContainText('Expect');await expect(page.locator('.film-strip-frame').first()).toBeVisible();await page.getByText('test 2', { exact: true }).click();- await expect(page.getByTestId('actions-tree')).toContainText('expect.toHaveText');+ await expect(page.getByTestId('actions-tree')).toContainText('Expect');await expect(page.locator('.film-strip-frame').first()).toBeVisible();});diff --git a/tests/playwright-test/ui-mode-trace.spec.ts b/tests/playwright-test/ui-mode-trace.spec.tsindex 3d9d666a35..0f99bd521b 100644--- a/tests/playwright-test/ui-mode-trace.spec.ts+++ b/tests/playwright-test/ui-mode-trace.spec.ts@@ -40,10 +40,10 @@ test('should merge trace events', async ({ runUITest }) => {'action list').toHaveText([/Before Hooks[\d.]+m?s/,- /page.setContent[\d.]+m?s/,- /expect.toBe[\d.]+m?s/,- /locator.clickgetByRole\('button'\)[\d.]+m?s/,- /expect.toBe[\d.]+m?s/,+ /Set content/,+ /Expect toBe/,+ /Click.*getByRole/,+ /Expect toBe/,/After Hooks[\d.]+m?s/,]);});@@ -67,8 +67,8 @@ test('should merge web assertion events', async ({ runUITest }, testInfo) => {'action list').toHaveText([/Before Hooks[\d.]+m?s/,- /page.setContent[\d.]+m?s/,- /expect.toBeVisiblelocator\('button'\)[\d.]+m?s/,+ /Set content/,+ /Expect toBeVisible.*locator/,/After Hooks[\d.]+m?s/,]);});@@ -92,8 +92,8 @@ test('should merge screenshot assertions', async ({ runUITest }, testInfo) => {'action list').toHaveText([/Before Hooks[\d.]+m?s/,- /page.setContent[\d.]+m?s/,- /expect.toHaveScreenshot[\d.]+m?s/,+ /Set content/,+ /Expect toHaveScreenshot[\d.]+m?s/,/After Hooks[\d.]+m?s/,/Worker Cleanup[\d.]+m?s/,]);@@ -110,7 +110,7 @@ test('should locate sync assertions in source', async ({ runUITest }) => {});await page.getByText('trace test').dblclick();- await page.getByText('expect.toBe').click();+ await page.getByText('EXPECT toBe').click();await expect(page.locator('.CodeMirror .source-line-running'),@@ -138,9 +138,9 @@ test('should show snapshots for sync assertions', async ({ runUITest }) => {'action list').toHaveText([/Before Hooks[\d.]+m?s/,- /page\.setContent[\d.]+m?s/,- /locator\.clickgetByRole\('button'\)[\d.]+m?s/,- /expect\.toBe[\d.]+m?s/,+ /Set content/,+ /Click.*getByRole/,+ /Expect toBe/,/After Hooks[\d.]+m?s/,]);@@ -274,10 +274,10 @@ test('should not fail on internal page logs', async ({ runUITest, server }) => {'action list').toHaveText([/Before Hooks[\d.]+m?s/,- /browser.newContext[\d.]+m?s/,- /browserContext.newPage[\d.]+m?s/,- /page.goto/,- /browserContext.storageState[\d.]+m?s/,+ /browser.newContext/,+ /Create page/,+ /Navigate to "\/empty.html"/,+ /Get storage state/,/After Hooks/,]);});@@ -301,8 +301,8 @@ test('should not show caught errors in the errors tab', async ({ runUITest }, te'action list').toHaveText([/Before Hooks[\d.]+m?s/,- /page.setContent/,- /expect.toBeCheckedlocator.*[\d.]+m?s/,+ /Set content/,+ /Expect toBeChecked.*locator/,/After Hooks/,]);@@ -414,9 +414,9 @@ test('should work behind reverse proxy', { annotation: { type: 'issue', descriptawait expect(page.getByTestId('actions-tree')).toMatchAriaSnapshot(`- tree:- treeitem /Before Hooks \\d+[hmsp]+/- - treeitem /page\\.setContent \\d+[hmsp]+/- - treeitem /locator\\.clickgetByRole\\('button'\\) \\d+[hmsp]+/- - treeitem /expect\\.toBe \\d+[hmsp]+/ [selected]+ - treeitem /Set content \\d+[hmsp]+/+ - treeitem /Click.*getByRole/+ - treeitem /Expect toBe/- treeitem /After Hooks \\d+[hmsp]+/`);@@ -440,12 +440,12 @@ test('should filter actions tab on double-click', async ({ runUITest, server })const actionsTree = page.getByTestId('actions-tree');await expect(actionsTree.getByRole('treeitem')).toHaveText([/Before Hooks/,- /page.goto/,+ /Navigate to "\/empty.html"/,/After Hooks/,]);- await actionsTree.getByRole('treeitem', { name: 'page.goto' }).dblclick();+ await actionsTree.getByRole('treeitem', { name: 'Navigate to "\/empty.html"' }).dblclick();await expect(actionsTree.getByRole('treeitem')).toHaveText([- /page.goto/,+ /Navigate to "\/empty.html"/,]);});diff --git a/utils/generate_channels.js b/utils/generate_channels.jsindex 144d4bce26..8746941be5 100755--- a/utils/generate_channels.js+++ b/utils/generate_channels.js@@ -277,12 +277,15 @@ for (const [name, item] of Object.entries(protocol)) {if (method === null)method = {};- const internalProp = method.internal ? ` internal: ${method.internal},` : '';- const titleProp = method.title ? ` title: '${method.title}',` : '';- const slowMoProp = method.flags?.slowMo ? ` slowMo: ${method.flags.slowMo},` : '';- const snapshotProp = method.flags?.snapshot ? ` snapshot: ${method.flags.snapshot},` : '';- const pauseProp = method.flags?.pausesBeforeInput ? ` pausesBeforeInput: ${method.flags.pausesBeforeInput},` : '';- methodMetainfo.push(`['${name + '.' + methodName}', {${internalProp}${titleProp}${slowMoProp}${snapshotProp}${pauseProp} }]`);++ for (const className of [name, ...(derivedClasses.get(name) || [])]) {+ const internalProp = method.internal ? ` internal: ${method.internal},` : '';+ const titleProp = method.title ? ` title: '${method.title}',` : '';+ const slowMoProp = method.flags?.slowMo ? ` slowMo: ${method.flags.slowMo},` : '';+ const snapshotProp = method.flags?.snapshot ? ` snapshot: ${method.flags.snapshot},` : '';+ const pauseProp = method.flags?.pausesBeforeInput ? ` pausesBeforeInput: ${method.flags.pausesBeforeInput},` : '';+ methodMetainfo.push(`['${className + '.' + methodName}', {${internalProp}${titleProp}${slowMoProp}${snapshotProp}${pauseProp} }]`);+ }const parameters = objectType(method.parameters || {}, '');const paramsName = `${channelName}${titleCase(methodName)}Params`;