From 682d1f41c74d97f46914d16a6003734e1ee9a086 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Tue, 30 Nov 2021 19:59:35 +0100 Subject: [PATCH] fix(test-runner): wrong test-runner options got determined (#10607) Follow-up for #10507 --- packages/playwright-test/src/index.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/playwright-test/src/index.ts b/packages/playwright-test/src/index.ts index 1016709065..86ca60ad35 100644 --- a/packages/playwright-test/src/index.ts +++ b/packages/playwright-test/src/index.ts @@ -21,7 +21,6 @@ import type { TestType, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWor import { rootTestType } from './testType'; import { createGuid, removeFolders } from 'playwright-core/lib/utils/utils'; import { GridClient } from 'playwright-core/lib/grid/gridClient'; -import { chromium, firefox, webkit } from 'playwright-core'; import { prependToTestError } from './util'; export { expect } from './expect'; export const _baseTest: TestType<{}, {}> = rootTestType.test; @@ -172,7 +171,7 @@ export const test = _baseTest.extend({ _snapshotSuffix: [process.env.PLAYWRIGHT_DOCKER ? 'docker' : process.platform, { scope: 'worker' }], - _setupContextOptionsAndArtifacts: [async ({ _snapshotSuffix, _combinedContextOptions, _artifactsDir, trace, screenshot, actionTimeout, navigationTimeout }, use, testInfo) => { + _setupContextOptionsAndArtifacts: [async ({ playwright, _snapshotSuffix, _combinedContextOptions, _artifactsDir, trace, screenshot, actionTimeout, navigationTimeout }, use, testInfo) => { testInfo.snapshotSuffix = _snapshotSuffix; if (process.env.PWDEBUG) testInfo.setTimeout(0); @@ -248,7 +247,7 @@ export const test = _baseTest.extend({ }; // 1. Setup instrumentation and process existing contexts. - for (const browserType of [chromium, firefox, webkit]) { + for (const browserType of [playwright.chromium, playwright.firefox, playwright.webkit]) { (browserType as any)._onDidCreateContext = onDidCreateContext; (browserType as any)._onWillCloseContext = onWillCloseContext; (browserType as any)._defaultContextOptions = _combinedContextOptions; @@ -283,7 +282,7 @@ export const test = _baseTest.extend({ // 4. Cleanup instrumentation. const leftoverContexts: BrowserContext[] = []; - for (const browserType of [chromium, firefox, webkit]) { + for (const browserType of [playwright.chromium, playwright.firefox, playwright.webkit]) { leftoverContexts.push(...(browserType as any)._contexts); (browserType as any)._onDidCreateContext = undefined; (browserType as any)._onWillCloseContext = undefined;