Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: move testInfo and timeoutManager to worker/ (#20803)
Dmitry Gozmanab4cd83e449b
diff --git a/packages/playwright-test/src/common/DEPS.list b/packages/playwright-test/src/common/DEPS.listindex 4e8d9c6e0b..926458602b 100644--- a/packages/playwright-test/src/common/DEPS.list+++ b/packages/playwright-test/src/common/DEPS.list@@ -1,8 +1,9 @@[*]-../common/-../matchers/../util.ts../utilsBundle.ts[transform.ts]../third_party/tsconfig-loader.ts++[testType.ts]+../matchers/expect.tsdiff --git a/packages/playwright-test/src/common/globals.ts b/packages/playwright-test/src/common/globals.tsindex 2ed5aed020..ff60e5a4e9 100644--- a/packages/playwright-test/src/common/globals.ts+++ b/packages/playwright-test/src/common/globals.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import type { TestInfoImpl } from './testInfo';+import type { TestInfoImpl } from '../worker/testInfo';import type { Suite } from './test';let currentTestInfoValue: TestInfoImpl | null = null;diff --git a/packages/playwright-test/src/common/types.ts b/packages/playwright-test/src/common/types.tsindex 89be4ecea0..2c5f8e55d1 100644--- a/packages/playwright-test/src/common/types.ts+++ b/packages/playwright-test/src/common/types.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import type { Fixtures, TestInfoError, Project } from '../../types/test';+import type { Fixtures, Project } from '../../types/test';import type { Location } from '../../types/testReporter';import type { TestRunnerPluginRegistration } from '../plugins';import type { Matcher } from '../util';@@ -29,16 +29,6 @@ export type FixturesWithLocation = {};export type Annotation = { type: string, description?: string };-export interface TestStepInternal {- complete(result: { error?: Error | TestInfoError }): void;- title: string;- category: string;- canHaveChildren: boolean;- forceNoParent: boolean;- location?: Location;- refinedTitle?: string;-}-type ConfigInternal = {globalOutputDir: string;configDir: string;diff --git a/packages/playwright-test/src/index.ts b/packages/playwright-test/src/index.tsindex 89f37ef5b6..7b683f62e6 100644--- a/packages/playwright-test/src/index.ts+++ b/packages/playwright-test/src/index.ts@@ -20,7 +20,7 @@ import type { APIRequestContext, BrowserContext, BrowserContextOptions, LaunchOpimport * as playwrightLibrary from 'playwright-core';import { createGuid, debugMode, removeFolders, addStackIgnoreFilter } from 'playwright-core/lib/utils';import type { Fixtures, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, ScreenshotMode, TestInfo, TestType, TraceMode, VideoMode } from '../types/test';-import type { TestInfoImpl } from './common/testInfo';+import type { TestInfoImpl } from './worker/testInfo';import { rootTestType } from './common/testType';import { type ContextReuseMode } from './common/types';export { expect } from './matchers/expect';diff --git a/packages/playwright-test/src/matchers/DEPS.list b/packages/playwright-test/src/matchers/DEPS.listindex 78d2f051e8..4e5606ac50 100644--- a/packages/playwright-test/src/matchers/DEPS.list+++ b/packages/playwright-test/src/matchers/DEPS.list@@ -1,6 +1,3 @@[*]../common/-../expect.ts-../globals.ts-../testInfo.ts../util.tsdiff --git a/packages/playwright-test/src/matchers/matchers.ts b/packages/playwright-test/src/matchers/matchers.tsindex 6a579e066c..e504115330 100644--- a/packages/playwright-test/src/matchers/matchers.ts+++ b/packages/playwright-test/src/matchers/matchers.ts@@ -20,7 +20,7 @@ import { colors } from 'playwright-core/lib/utilsBundle';import type { Expect } from '../common/types';import { expectTypes, callLogText } from '../util';import { currentTestInfo } from '../common/globals';-import type { TestInfoErrorState } from '../common/testInfo';+import type { TestInfoErrorState } from '../worker/testInfo';import { toBeTruthy } from './toBeTruthy';import { toEqual } from './toEqual';import { toExpectedTextValues, toMatchText } from './toMatchText';diff --git a/packages/playwright-test/src/matchers/toMatchSnapshot.ts b/packages/playwright-test/src/matchers/toMatchSnapshot.tsindex c4cba149d8..db87f84690 100644--- a/packages/playwright-test/src/matchers/toMatchSnapshot.ts+++ b/packages/playwright-test/src/matchers/toMatchSnapshot.ts@@ -30,7 +30,7 @@ import { colors } from 'playwright-core/lib/utilsBundle';import fs from 'fs';import path from 'path';import { mime } from 'playwright-core/lib/utilsBundle';-import type { TestInfoImpl } from '../common/testInfo';+import type { TestInfoImpl } from '../worker/testInfo';import type { SyncExpectationResult } from './expect';type NameOrSegments = string | string[];diff --git a/packages/playwright-test/src/reporters/DEPS.list b/packages/playwright-test/src/reporters/DEPS.listindex a936a7bf2b..5b441c9e4e 100644--- a/packages/playwright-test/src/reporters/DEPS.list+++ b/packages/playwright-test/src/reporters/DEPS.list@@ -1,6 +1,4 @@[*]../common/-../babelBundle.ts-../test.ts../util.ts../utilsBundle.tsdiff --git a/packages/playwright-test/src/runner/DEPS.list b/packages/playwright-test/src/runner/DEPS.listindex 0ea818521f..c5f0d18fbf 100644--- a/packages/playwright-test/src/runner/DEPS.list+++ b/packages/playwright-test/src/runner/DEPS.list@@ -1,7 +1,6 @@[*]../../types.ts../common/-../matchers/../reporters/../third_party/../plugins/diff --git a/packages/playwright-test/src/worker/fixtureRunner.ts b/packages/playwright-test/src/worker/fixtureRunner.tsindex 69ab6ca1bf..42b3203674 100644--- a/packages/playwright-test/src/worker/fixtureRunner.ts+++ b/packages/playwright-test/src/worker/fixtureRunner.ts@@ -17,8 +17,8 @@import { formatLocation, debugTest } from '../util';import type { Location, WorkerInfo } from '../common/types';import { ManualPromise } from 'playwright-core/lib/utils';-import type { TestInfoImpl } from '../common/testInfo';-import type { FixtureDescription, TimeoutManager } from '../common/timeoutManager';+import type { TestInfoImpl } from './testInfo';+import type { FixtureDescription, TimeoutManager } from './timeoutManager';import { fixtureParameterNames, type FixturePool, type FixtureRegistration, type FixtureScope } from '../common/fixtures';class Fixture {diff --git a/packages/playwright-test/src/common/testInfo.ts b/packages/playwright-test/src/worker/testInfo.tssimilarity index 97%rename from packages/playwright-test/src/common/testInfo.tsrename to packages/playwright-test/src/worker/testInfo.tsindex 0895ac9590..8fe9d28c27 100644--- a/packages/playwright-test/src/common/testInfo.ts+++ b/packages/playwright-test/src/worker/testInfo.ts@@ -18,10 +18,10 @@ import fs from 'fs';import path from 'path';import { monotonicTime } from 'playwright-core/lib/utils';import type { TestInfoError, TestInfo, TestStatus } from '../../types/test';-import type { StepBeginPayload, StepEndPayload, WorkerInitParams } from './ipc';-import type { TestCase } from './test';+import type { StepBeginPayload, StepEndPayload, WorkerInitParams } from '../common/ipc';+import type { TestCase } from '../common/test';import { TimeoutManager } from './timeoutManager';-import type { Annotation, FullConfigInternal, FullProjectInternal, TestStepInternal } from './types';+import type { Annotation, FullConfigInternal, FullProjectInternal, Location } from '../common/types';import { getContainedPath, normalizeAndSaveAttachment, sanitizeForFilePath, serializeError, trimLongString } from '../util';export type TestInfoErrorState = {@@ -30,6 +30,16 @@ export type TestInfoErrorState = {hasHardError: boolean,};+interface TestStepInternal {+ complete(result: { error?: Error | TestInfoError }): void;+ title: string;+ category: string;+ canHaveChildren: boolean;+ forceNoParent: boolean;+ location?: Location;+ refinedTitle?: string;+}+export class TestInfoImpl implements TestInfo {private _onStepBegin: (payload: StepBeginPayload) => void;private _onStepEnd: (payload: StepEndPayload) => void;diff --git a/packages/playwright-test/src/common/timeoutManager.ts b/packages/playwright-test/src/worker/timeoutManager.tssimilarity index 98%rename from packages/playwright-test/src/common/timeoutManager.tsrename to packages/playwright-test/src/worker/timeoutManager.tsindex 9fe8a149ed..66e8dbcc2e 100644--- a/packages/playwright-test/src/common/timeoutManager.ts+++ b/packages/playwright-test/src/worker/timeoutManager.ts@@ -16,7 +16,7 @@import { colors } from 'playwright-core/lib/utilsBundle';import { TimeoutRunner, TimeoutRunnerError } from 'playwright-core/lib/utils';-import type { Location, TestInfoError } from './types';+import type { Location, TestInfoError } from '../common/types';export type TimeSlot = {timeout: number;diff --git a/packages/playwright-test/src/worker/workerMain.ts b/packages/playwright-test/src/worker/workerMain.tsindex 420c8bf1bd..507a65057a 100644--- a/packages/playwright-test/src/worker/workerMain.ts+++ b/packages/playwright-test/src/worker/workerMain.ts@@ -24,9 +24,8 @@ import type { Suite, TestCase } from '../common/test';import type { Annotation, FullConfigInternal, FullProjectInternal, TestInfoError } from '../common/types';import { FixtureRunner } from './fixtureRunner';import { ManualPromise } from 'playwright-core/lib/utils';-import { TestInfoImpl } from '../common/testInfo';-import type { TimeSlot } from '../common/timeoutManager';-import { TimeoutManager } from '../common/timeoutManager';+import { TestInfoImpl } from './testInfo';+import { TimeoutManager, type TimeSlot } from './timeoutManager';import { ProcessRunner } from '../common/process';import { loadTestFile } from '../common/testLoader';import { buildFileSuiteForProject, filterTestsRemoveEmptySuites } from '../common/suiteUtils';