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
fix(tracing): fall back to protocol naming in ports w/o apiName (#9896)
Pavel Feldmanbd505ed07c74
diff --git a/packages/playwright-core/src/client/connection.ts b/packages/playwright-core/src/client/connection.tsindex 4a11fef924..7deabaabeb 100644--- a/packages/playwright-core/src/client/connection.ts+++ b/packages/playwright-core/src/client/connection.ts@@ -99,7 +99,7 @@ export class Connection extends EventEmitter {const converted = { id, guid, method, params };// Do not include metadata in debug logs to avoid noise.debugLogger.log('channel:command', converted);- const metadata: channels.Metadata = { stack: frames, apiName };+ const metadata: channels.Metadata = { stack: frames, apiName, internal: !apiName };this.onmessage({ ...converted, metadata });return await new Promise((resolve, reject) => this._callbacks.set(id, { resolve, reject, stackTrace }));diff --git a/packages/playwright-core/src/dispatchers/dispatcher.ts b/packages/playwright-core/src/dispatchers/dispatcher.tsindex 45ba25afea..10a4b06493 100644--- a/packages/playwright-core/src/dispatchers/dispatcher.ts+++ b/packages/playwright-core/src/dispatchers/dispatcher.ts@@ -224,6 +224,7 @@ export class DispatcherConnection {id: `call@${id}`,stack: validMetadata.stack,apiName: validMetadata.apiName,+ internal: validMetadata.internal,objectId: sdkObject?.guid,pageId: sdkObject?.attribution?.page?.guid,frameId: sdkObject?.attribution?.frame?.guid,diff --git a/packages/playwright-core/src/protocol/callMetadata.ts b/packages/playwright-core/src/protocol/callMetadata.tsindex 65a159fec7..f6dd2f6a2a 100644--- a/packages/playwright-core/src/protocol/callMetadata.ts+++ b/packages/playwright-core/src/protocol/callMetadata.ts@@ -26,6 +26,7 @@ export type CallMetadata = {method: string;params: any;apiName?: string;+ internal?: boolean;stack?: StackFrame[];log: string[];afterSnapshot?: string;diff --git a/packages/playwright-core/src/protocol/channels.ts b/packages/playwright-core/src/protocol/channels.tsindex 4cbd5a1c80..353d5af358 100644--- a/packages/playwright-core/src/protocol/channels.ts+++ b/packages/playwright-core/src/protocol/channels.ts@@ -33,6 +33,7 @@ export type StackFrame = {export type Metadata = {stack?: StackFrame[],apiName?: string,+ internal?: boolean,};export type Point = {diff --git a/packages/playwright-core/src/protocol/protocol.yml b/packages/playwright-core/src/protocol/protocol.ymlindex 1e607e8a06..1f40e01b97 100644--- a/packages/playwright-core/src/protocol/protocol.yml+++ b/packages/playwright-core/src/protocol/protocol.yml@@ -29,6 +29,7 @@ Metadata:type: array?items: StackFrameapiName: string?+ internal: boolean?Point:diff --git a/packages/playwright-core/src/protocol/validator.ts b/packages/playwright-core/src/protocol/validator.tsindex 57af3d49e1..af4114e5a1 100644--- a/packages/playwright-core/src/protocol/validator.ts+++ b/packages/playwright-core/src/protocol/validator.ts@@ -42,6 +42,7 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {scheme.Metadata = tObject({stack: tOptional(tArray(tType('StackFrame'))),apiName: tOptional(tString),+ internal: tOptional(tBoolean),});scheme.Point = tObject({x: tNumber,diff --git a/packages/playwright-core/src/web/traceViewer/traceModel.ts b/packages/playwright-core/src/web/traceViewer/traceModel.tsindex 14ab4c759f..320633aa37 100644--- a/packages/playwright-core/src/web/traceViewer/traceModel.ts+++ b/packages/playwright-core/src/web/traceViewer/traceModel.ts@@ -111,9 +111,12 @@ export class TraceModel {break;}case 'action': {- const include = !!event.metadata.apiName && !isTracing(event.metadata);- if (include)+ const include = !isTracing(event.metadata) && (!event.metadata.internal || event.metadata.apiName);+ if (include) {+ if (!event.metadata.apiName)+ event.metadata.apiName = event.metadata.type + '.' + event.metadata.method;this.contextEntry!.actions.push(event);+ }break;}case 'event': {