chore: release from pause when the page closes (#19975)
Fixes: https://github.com/microsoft/playwright/issues/19168
This commit is contained in:
parent
8f62aa9335
commit
3f0adf5dd0
|
|
@ -1,6 +1,7 @@
|
||||||
/* eslint-disable notice/notice */
|
/* eslint-disable notice/notice */
|
||||||
|
|
||||||
import { test, expect, Page } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
|
import type { Page } from '@playwright/test';
|
||||||
|
|
||||||
test.describe.configure({ mode: 'parallel' });
|
test.describe.configure({ mode: 'parallel' });
|
||||||
|
|
||||||
|
|
@ -396,8 +397,7 @@ test.describe('Routing', () => {
|
||||||
await expect(page.getByRole('link', { name: 'All' })).toHaveClass('selected');
|
await expect(page.getByRole('link', { name: 'All' })).toHaveClass('selected');
|
||||||
await page.getByRole('link', { name: 'Active' }).click();
|
await page.getByRole('link', { name: 'Active' }).click();
|
||||||
// Page change - active items.
|
// Page change - active items.
|
||||||
await expect(page.getByRole('link', { name: 'Active' })).
|
await expect(page.getByRole('link', { name: 'Active' })).toHaveClass('selected');
|
||||||
toHaveClass('selected');
|
|
||||||
await page.getByRole('link', { name: 'Completed' }).click();
|
await page.getByRole('link', { name: 'Completed' }).click();
|
||||||
// Page change - completed items.
|
// Page change - completed items.
|
||||||
await expect(page.getByRole('link', { name: 'Completed' })).toHaveClass('selected');
|
await expect(page.getByRole('link', { name: 'Completed' })).toHaveClass('selected');
|
||||||
|
|
|
||||||
|
|
@ -697,8 +697,12 @@ export class Page extends ChannelOwner<channels.PageChannel> implements api.Page
|
||||||
}
|
}
|
||||||
|
|
||||||
async pause() {
|
async pause() {
|
||||||
if (!require('inspector').url())
|
if (require('inspector').url())
|
||||||
await this.context()._channel.pause();
|
return;
|
||||||
|
await Promise.race([
|
||||||
|
this.context()._channel.pause(),
|
||||||
|
this._closedOrCrashedPromise
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
async pdf(options: PDFOptions = {}): Promise<Buffer> {
|
async pdf(options: PDFOptions = {}): Promise<Buffer> {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue