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(inspector): do not show internal calls (#10982)
Dmitry Gozmandd5784340481
diff --git a/packages/playwright-core/src/client/browserContext.ts b/packages/playwright-core/src/client/browserContext.tsindex e243675545..64e71a65ab 100644--- a/packages/playwright-core/src/client/browserContext.ts+++ b/packages/playwright-core/src/client/browserContext.ts@@ -167,12 +167,16 @@ export class BrowserContext extends ChannelOwner<channels.BrowserContextChannel>setDefaultNavigationTimeout(timeout: number) {this._timeoutSettings.setDefaultNavigationTimeout(timeout);- this._channel.setDefaultNavigationTimeoutNoReply({ timeout });+ this._wrapApiCall(async () => {+ this._channel.setDefaultNavigationTimeoutNoReply({ timeout });+ }, true);}setDefaultTimeout(timeout: number) {this._timeoutSettings.setDefaultTimeout(timeout);- this._channel.setDefaultTimeoutNoReply({ timeout });+ this._wrapApiCall(async () => {+ this._channel.setDefaultTimeoutNoReply({ timeout });+ }, true);}browser(): Browser | null {diff --git a/packages/playwright-core/src/client/page.ts b/packages/playwright-core/src/client/page.tsindex 33b1e93841..e587548933 100644--- a/packages/playwright-core/src/client/page.ts+++ b/packages/playwright-core/src/client/page.ts@@ -238,12 +238,16 @@ export class Page extends ChannelOwner<channels.PageChannel> implements api.PagesetDefaultNavigationTimeout(timeout: number) {this._timeoutSettings.setDefaultNavigationTimeout(timeout);- this._channel.setDefaultNavigationTimeoutNoReply({ timeout });+ this._wrapApiCall(async () => {+ this._channel.setDefaultNavigationTimeoutNoReply({ timeout });+ }, true);}setDefaultTimeout(timeout: number) {this._timeoutSettings.setDefaultTimeout(timeout);- this._channel.setDefaultTimeoutNoReply({ timeout });+ this._wrapApiCall(async () => {+ this._channel.setDefaultTimeoutNoReply({ timeout });+ }, true);}private _forceVideo(): Video {diff --git a/packages/playwright-core/src/server/supplements/recorderSupplement.ts b/packages/playwright-core/src/server/supplements/recorderSupplement.tsindex 33ce9f22a3..d99550fe4e 100644--- a/packages/playwright-core/src/server/supplements/recorderSupplement.ts+++ b/packages/playwright-core/src/server/supplements/recorderSupplement.ts@@ -257,7 +257,7 @@ export class RecorderSupplement implements InstrumentationListener {return;const logs: CallLog[] = [];for (const metadata of metadatas) {- if (!metadata.method)+ if (!metadata.method || metadata.internal)continue;let status: CallLogStatus = 'done';if (this._currentCallsMetadata.has(metadata))diff --git a/tests/inspector/pause.spec.ts b/tests/inspector/pause.spec.tsindex 01b3ad1f1d..26566560e3 100644--- a/tests/inspector/pause.spec.ts+++ b/tests/inspector/pause.spec.ts@@ -173,6 +173,30 @@ it.describe('pause', () => {await scriptPromise;});+ it('should hide internal calls', async ({ page, recorderPageGetter, trace }) => {+ it.skip(trace === 'on');++ const scriptPromise = (async () => {+ await page.pause();+ await page.context().tracing.start();+ page.setDefaultTimeout(0);+ page.context().setDefaultNavigationTimeout(0);+ await page.context().tracing.stop();+ await page.pause(); // 2+ })();+ const recorderPage = await recorderPageGetter();+ await recorderPage.click('[title="Resume"]');+ await recorderPage.waitForSelector('.source-line-paused:has-text("page.pause(); // 2")');+ expect(await sanitizeLog(recorderPage)).toEqual([+ 'page.pause- XXms',+ 'tracing.start- XXms',+ 'tracing.stop- XXms',+ 'page.pause',+ ]);+ await recorderPage.click('[title="Resume"]');+ await scriptPromise;+ });+it('should show expect.toHaveText', async ({ page, recorderPageGetter }) => {await page.setContent('<button>Submit</button>');const scriptPromise = (async () => {