parent
eda109388e
commit
4f8680f7a3
|
|
@ -203,14 +203,14 @@ export class BrowserContext extends ChannelOwner<channels.BrowserContextChannel>
|
||||||
await bindingCall.call(func);
|
await bindingCall.call(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
setDefaultNavigationTimeout(timeout: number) {
|
setDefaultNavigationTimeout(timeout: number | undefined) {
|
||||||
this._timeoutSettings.setDefaultNavigationTimeout(timeout);
|
this._timeoutSettings.setDefaultNavigationTimeout(timeout);
|
||||||
this._wrapApiCall(async () => {
|
this._wrapApiCall(async () => {
|
||||||
this._channel.setDefaultNavigationTimeoutNoReply({ timeout }).catch(() => {});
|
this._channel.setDefaultNavigationTimeoutNoReply({ timeout }).catch(() => {});
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
setDefaultTimeout(timeout: number) {
|
setDefaultTimeout(timeout: number | undefined) {
|
||||||
this._timeoutSettings.setDefaultTimeout(timeout);
|
this._timeoutSettings.setDefaultTimeout(timeout);
|
||||||
this._wrapApiCall(async () => {
|
this._wrapApiCall(async () => {
|
||||||
this._channel.setDefaultTimeoutNoReply({ timeout }).catch(() => {});
|
this._channel.setDefaultTimeoutNoReply({ timeout }).catch(() => {});
|
||||||
|
|
|
||||||
|
|
@ -681,10 +681,14 @@ export class Page extends ChannelOwner<channels.PageChannel> implements api.Page
|
||||||
async pause() {
|
async pause() {
|
||||||
if (require('inspector').url())
|
if (require('inspector').url())
|
||||||
return;
|
return;
|
||||||
|
const defaultNavigationTimeout = this._browserContext._timeoutSettings.defaultNavigationTimeout();
|
||||||
|
const defaultTimeout = this._browserContext._timeoutSettings.defaultTimeout();
|
||||||
this._browserContext.setDefaultNavigationTimeout(0);
|
this._browserContext.setDefaultNavigationTimeout(0);
|
||||||
this._browserContext.setDefaultTimeout(0);
|
this._browserContext.setDefaultTimeout(0);
|
||||||
this._instrumentation?.onWillPause();
|
this._instrumentation?.onWillPause();
|
||||||
await this._closedOrCrashedRace.safeRace(this.context()._channel.pause());
|
await this._closedOrCrashedRace.safeRace(this.context()._channel.pause());
|
||||||
|
this._browserContext.setDefaultNavigationTimeout(defaultNavigationTimeout);
|
||||||
|
this._browserContext.setDefaultTimeout(defaultTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
async pdf(options: PDFOptions = {}): Promise<Buffer> {
|
async pdf(options: PDFOptions = {}): Promise<Buffer> {
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,14 @@ export class TimeoutSettings {
|
||||||
this._defaultNavigationTimeout = timeout;
|
this._defaultNavigationTimeout = timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defaultNavigationTimeout() {
|
||||||
|
return this._defaultNavigationTimeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultTimeout() {
|
||||||
|
return this._defaultTimeout;
|
||||||
|
}
|
||||||
|
|
||||||
navigationTimeout(options: { timeout?: number }): number {
|
navigationTimeout(options: { timeout?: number }): number {
|
||||||
if (typeof options.timeout === 'number')
|
if (typeof options.timeout === 'number')
|
||||||
return options.timeout;
|
return options.timeout;
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,20 @@ it('should resume when closing inspector', async ({ page, recorderPageGetter, cl
|
||||||
await scriptPromise;
|
await scriptPromise;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not reset timeouts', async ({ page, recorderPageGetter, closeRecorder, server }) => {
|
||||||
|
page.context().setDefaultNavigationTimeout(1000);
|
||||||
|
page.context().setDefaultTimeout(1000);
|
||||||
|
|
||||||
|
const pausePromise = page.pause();
|
||||||
|
await recorderPageGetter();
|
||||||
|
await closeRecorder();
|
||||||
|
await pausePromise;
|
||||||
|
|
||||||
|
server.setRoute('/empty.html', () => {});
|
||||||
|
const error = await page.goto(server.EMPTY_PAGE).catch(e => e);
|
||||||
|
expect(error.message).toContain('page.goto: Timeout 1000ms exceeded.');
|
||||||
|
});
|
||||||
|
|
||||||
it.describe('pause', () => {
|
it.describe('pause', () => {
|
||||||
it.skip(({ mode }) => mode !== 'default');
|
it.skip(({ mode }) => mode !== 'default');
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue