diff --git a/packages/playwright-core/src/utils/utils.ts b/packages/playwright-core/src/utils/utils.ts index e977c26f10..249f110fdf 100644 --- a/packages/playwright-core/src/utils/utils.ts +++ b/packages/playwright-core/src/utils/utils.ts @@ -325,6 +325,8 @@ const debugEnv = getFromENV('PWDEBUG') || ''; export function debugMode() { if (debugEnv === 'console') return 'console'; + if (debugEnv === '0' || debugEnv === 'false') + return ''; return debugEnv ? 'inspector' : ''; } diff --git a/packages/playwright-test/src/index.ts b/packages/playwright-test/src/index.ts index 3b10e8f8ee..3374aa3d72 100644 --- a/packages/playwright-test/src/index.ts +++ b/packages/playwright-test/src/index.ts @@ -19,7 +19,7 @@ import * as path from 'path'; import type { LaunchOptions, BrowserContextOptions, Page, BrowserContext, BrowserType, Video, Browser, APIRequestContext } from 'playwright-core'; import type { TestType, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, TestInfo } from '../types/test'; import { rootTestType } from './testType'; -import { createGuid, removeFolders } from 'playwright-core/lib/utils/utils'; +import { createGuid, removeFolders, debugMode } from 'playwright-core/lib/utils/utils'; import { GridClient } from 'playwright-core/lib/grid/gridClient'; import { prependToTestError } from './util'; export { expect } from './expect'; @@ -190,7 +190,7 @@ export const test = _baseTest.extend({ _setupContextOptionsAndArtifacts: [async ({ playwright, _snapshotSuffix, _combinedContextOptions, _artifactsDir, trace, screenshot, actionTimeout, navigationTimeout }, use, testInfo) => { testInfo.snapshotSuffix = _snapshotSuffix; - if (process.env.PWDEBUG) + if (debugMode()) testInfo.setTimeout(0); let traceMode = typeof trace === 'string' ? trace : trace.mode;