Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test: crashed page should still be in the list of pages (#43043)

Dmitry Gozman97d7e6add8f5
diff --git a/tests/library/page-event-crash.spec.ts b/tests/library/page-event-crash.spec.ts
index fc1a3bf2a6..0512c1e7e5 100644
--- a/tests/library/page-event-crash.spec.ts
+++ b/tests/library/page-event-crash.spec.ts
@@ -99,12 +99,19 @@ test('should be able to close context when page crashes', async ({ isAndroid, pa
await page.context().close();
});
-test('should be able to close page after crash', async ({ page, crash }) => {
+test('should be able to close page after crash', {
+ annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/42956' },
+}, async ({ page, crash }) => {
await page.setContent(`<div>This page should crash</div>`);
crash();
await page.waitForEvent('crash');
+ // Give the browser a chance to erroneously "close" the crashed page.
+ await new Promise(f => setTimeout(f, 3000));
+ expect(page.isClosed()).toBe(false);
+ expect(page.context().pages()).toEqual([page]);
await page.close();
expect(page.isClosed()).toBe(true);
+ expect(page.context().pages()).toEqual([]);
});
test.fixme('should reject in-flight worker.evaluate when page crashes', async ({ page, crash, server }) => {