From 3974d1b3591fa58b644a264e8274d7582650fac5 Mon Sep 17 00:00:00 2001 From: Ross Wollman Date: Mon, 13 Jun 2022 17:20:59 -0700 Subject: [PATCH] revert(#14797): fix(test runner): collect artifacts when calling `browser.close()` (#14846) Revert "fix(test runner): collect artifacts when calling `browser.close()` (#14797)" This reverts commit c7a28ac7e9eab63b40ce22fe96597410dbd08ed7. Looks like it broke a bunch of tracing tests: * Good: https://github.com/microsoft/playwright/runs/6838098316?check_suite_focus=true * First Bad: https://github.com/microsoft/playwright/runs/6838104691?check_suite_focus=true * Still bad on HEAD (88664c39c9ee36adfda3eed04bbd845587e27e4a): https://github.com/microsoft/playwright/runs/6868333846?check_suite_focus=true --- .../playwright-core/src/client/browser.ts | 2 -- .../playwright-test/playwright.trace.spec.ts | 21 ------------------- 2 files changed, 23 deletions(-) diff --git a/packages/playwright-core/src/client/browser.ts b/packages/playwright-core/src/client/browser.ts index 0c5599e660..077f8c1902 100644 --- a/packages/playwright-core/src/client/browser.ts +++ b/packages/playwright-core/src/client/browser.ts @@ -104,8 +104,6 @@ export class Browser extends ChannelOwner implements ap async close(): Promise { try { - for (const context of this.contexts()) - await this._browserType?._onWillCloseContext?.(context); if (this._shouldCloseConnectionOnClose) this._connection.close(kBrowserClosedError); else diff --git a/tests/playwright-test/playwright.trace.spec.ts b/tests/playwright-test/playwright.trace.spec.ts index 27a713a63d..adcc69deb3 100644 --- a/tests/playwright-test/playwright.trace.spec.ts +++ b/tests/playwright-test/playwright.trace.spec.ts @@ -241,27 +241,6 @@ test('should not override trace file in afterAll', async ({ runInlineTest, serve expect(fs.existsSync(testInfo.outputPath('test-results', 'a-test-1', 'trace-1.zip'))).toBeTruthy(); }); -test('should record trace on manual browser closure', async ({ runInlineTest }, testInfo) => { - const result = await runInlineTest({ - 'a.spec.ts': ` - const { test } = pwt; - - test.use({ trace: 'on' }); - - test.afterAll(async ({ browser }) => { - await browser.close(); - }); - - test('test 1', async ({ page }) => { - await page.goto('about:blank'); - }); - `, - }, { workers: 1 }); - - expect(result.exitCode).toBe(0); - expect(result.passed).toBe(1); - expect(fs.existsSync(testInfo.outputPath('test-results', 'a-test-1', 'trace.zip'))).toBeTruthy(); -}); async function parseTrace(file: string): Promise> { const zipFS = new ZipFileSystem(file);