fix(inspector): do not show internal calls (#10982)

Also mark setDefault{Navigation,}Timeout as always internal.
This commit is contained in:
Dmitry Gozman 2021-12-16 17:17:24 -08:00 committed by GitHub
parent 773ebe04c6
commit dd57843404
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 5 deletions

View file

@ -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 {

View file

@ -238,12 +238,16 @@ export class Page extends ChannelOwner<channels.PageChannel> implements api.Page
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);
}
private _forceVideo(): Video {

View file

@ -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))

View file

@ -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 () => {