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: cleanup more ct remnants (#42200)
Dmitry Gozman10c9602c0913
diff --git a/packages/playwright/src/isomorphic/testServerInterface.ts b/packages/playwright/src/isomorphic/testServerInterface.tsindex c5b5c471a0..2450cbdc67 100644--- a/packages/playwright/src/isomorphic/testServerInterface.ts+++ b/packages/playwright/src/isomorphic/testServerInterface.ts@@ -28,7 +28,6 @@ export interface TestServerInterface {closeOnDisconnect?: boolean,interceptStdio?: boolean,watchTestDirs?: boolean,- populateDependenciesOnList?: boolean,}): Promise<void>;ping(params: {}): Promise<void>;diff --git a/packages/playwright/src/plugins/index.ts b/packages/playwright/src/plugins/index.tsindex 4f2e878a4b..57963085fa 100644--- a/packages/playwright/src/plugins/index.ts+++ b/packages/playwright/src/plugins/index.ts@@ -14,16 +14,12 @@* limitations under the License.*/-import type { FullConfig, Suite } from '../../types/testReporter';+import type { FullConfig } from '../../types/testReporter';import type { ReporterV2 } from '../reporters/reporterV2';export interface TestRunnerPlugin {name: string;setup?(config: FullConfig, configDir: string, reporter: ReporterV2): Promise<void>;- populateDependencies?(): Promise<void>;- clearCache?(): Promise<void>;- begin?(suite: Suite): Promise<void>;- end?(): Promise<void>;teardown?(): Promise<void>;}diff --git a/packages/playwright/src/runner/tasks.ts b/packages/playwright/src/runner/tasks.tsindex 6699c6292c..c724b6d02e 100644--- a/packages/playwright/src/runner/tasks.ts+++ b/packages/playwright/src/runner/tasks.ts@@ -35,7 +35,6 @@ import { createTitleMatcher, forceRegExp, removeDirAndLogToConsole } from '../utimport type { TestGroup } from '../runner/testGroups';import type { EnvByProjectId } from './dispatcher';-import type { TestRunnerPluginRegistration } from '../plugins';import type { Task } from './taskRunner';import type { FullResult, TestError } from '../../types/testReporter';import type { Matcher, TestCaseFilter } from '../util';@@ -164,7 +163,6 @@ export function createRunTestsTasks(config: FullConfigInternal) {return [createPhasesTask(),createReportBeginTask(),- ...config.plugins.map(plugin => createPluginBeginTask(plugin)),createRunTestsTask(),];}@@ -174,8 +172,6 @@ export function createClearCacheTask(config: FullConfigInternal): Task<TestRun>title: 'clear cache',setup: async () => {await removeDirAndLogToConsole(cc.cacheDir);- for (const plugin of config.plugins)- await plugin.instance?.clearCache?.();},};}@@ -206,18 +202,6 @@ export function createPluginSetupTasks(config: FullConfigInternal): Task<TestRun}));}-function createPluginBeginTask(plugin: TestRunnerPluginRegistration): Task<TestRun> {- return {- title: 'plugin begin',- setup: async testRun => {- await plugin.instance?.begin?.(testRun.rootSuite!);- },- teardown: async () => {- await plugin.instance?.end?.();- },- };-}-function createGlobalSetupTask(file: string, config: FullConfigInternal): Task<TestRun> {let title = 'global setup';if (config.globalSetups.length > 1)@@ -300,7 +284,7 @@ export function createListFilesTask(): Task<TestRun> {};}-export function createLoadTask(mode: 'out-of-process' | 'in-process', options: { filterOnly: boolean, failOnLoadErrors: boolean, doNotRunDepsOutsideProjectFilter?: boolean, populateDependencies?: boolean }): Task<TestRun> {+export function createLoadTask(mode: 'out-of-process' | 'in-process', options: { filterOnly: boolean, failOnLoadErrors: boolean, doNotRunDepsOutsideProjectFilter?: boolean }): Task<TestRun> {return {title: 'load tests',setup: async (testRun, errors, softErrors) => {@@ -342,11 +326,6 @@ export function createLoadTask(mode: 'out-of-process' | 'in-process', options: {await collectProjectsAndTestFiles(testRun, !!options.doNotRunDepsOutsideProjectFilter);await loadFileSuites(testRun, mode, options.failOnLoadErrors ? errors : softErrors);- if (testRun.options.onlyChanged || options.populateDependencies) {- for (const plugin of testRun.config.plugins)- await plugin.instance?.populateDependencies?.();- }-if (testRun.options.onlyChanged) {const changedFiles = await detectChangedTestFiles(testRun.options.onlyChanged, testRun.config.configDir);testRun.preOnlyTestFilters.push(test => changedFiles.has(test.location.file));diff --git a/packages/playwright/src/runner/testRunner.ts b/packages/playwright/src/runner/testRunner.tsindex 6088d44c7e..d8f8451927 100644--- a/packages/playwright/src/runner/testRunner.ts+++ b/packages/playwright/src/runner/testRunner.ts@@ -100,7 +100,6 @@ export class TestRunner extends EventEmitter<TestRunnerEventMap> {private _globalSetup: { cleanup: () => Promise<any> } | undefined;private _plugins: TestRunnerPluginRegistration[] | undefined;private _watchTestDirs = false;- private _populateDependenciesOnList = false;private _startingEnv: NodeJS.ProcessEnv = {};private _lastLoadedConfig: FullConfigInternal | undefined;@@ -117,11 +116,9 @@ export class TestRunner extends EventEmitter<TestRunnerEventMap> {async initialize(params: {watchTestDirs?: boolean;- populateDependenciesOnList?: boolean;}) {setPlaywrightTestProcessEnv();this._watchTestDirs = !!params.watchTestDirs;- this._populateDependenciesOnList = !!params.populateDependenciesOnList;this._startingEnv = { ...process.env };}@@ -195,7 +192,6 @@ export class TestRunner extends EventEmitter<TestRunnerEventMap> {if (!config)return { status: 'failed' };const status = await runTasks(new TestRun(config, reporter), [- ...createPluginSetupTasks(config),createClearCacheTask(config),]);return { status };@@ -251,7 +247,7 @@ export class TestRunner extends EventEmitter<TestRunnerEventMap> {};const status = await runTasks(new TestRun(config, reporter, options), [- createLoadTask('out-of-process', { failOnLoadErrors: false, filterOnly: false, populateDependencies: this._populateDependenciesOnList }),+ createLoadTask('out-of-process', { failOnLoadErrors: false, filterOnly: false }),createReportBeginTask(),]);return { config, status };@@ -360,7 +356,7 @@ export class TestRunner extends EventEmitter<TestRunnerEventMap> {return { errors: errorReporter.errors(), testFiles: [] };const status = await runTasks(new TestRun(config, reporter), [...createPluginSetupTasks(config),- createLoadTask('out-of-process', { failOnLoadErrors: true, filterOnly: false, populateDependencies: true }),+ createLoadTask('out-of-process', { failOnLoadErrors: true, filterOnly: false }),]);if (status !== 'passed')return { errors: errorReporter.errors(), testFiles: [] };diff --git a/packages/playwright/src/runner/watchMode.ts b/packages/playwright/src/runner/watchMode.tsindex c04413c5f9..fe495ae564 100644--- a/packages/playwright/src/runner/watchMode.ts+++ b/packages/playwright/src/runner/watchMode.ts@@ -135,7 +135,6 @@ export async function runWatchModeLoop(configLocation: ConfigLocation, initialOpawait testServerConnection.initialize({interceptStdio: false,watchTestDirs: true,- populateDependenciesOnList: true,});await testServerConnection.runGlobalSetup({});diff --git a/packages/playwright/src/transform/compilationCache.ts b/packages/playwright/src/transform/compilationCache.tsindex dc66827bf8..29b9e6aa49 100644--- a/packages/playwright/src/transform/compilationCache.ts+++ b/packages/playwright/src/transform/compilationCache.ts@@ -34,7 +34,6 @@ export type SerializedCompilationCache = {sourceMaps: [string, string][],memoryCache: [string, MemoryCache][],fileDependencies: [string, string[]][],- externalDependencies: [string, string[]][],};// Assumptions for the compilation cache:@@ -64,8 +63,6 @@ const sourceMaps: Map<string, string> = new Map();const memoryCache = new Map<string, MemoryCache>();// Dependencies resolved by the loader.const fileDependencies = new Map<string, Set<string>>();-// Dependencies resolved by the external bundler.-const externalDependencies = new Map<string, Set<string>>();export function installSourceMapSupport() {Error.stackTraceLimit = 200;@@ -174,7 +171,6 @@ export function serializeCompilationCache(): SerializedCompilationCache {sourceMaps: [...sourceMaps.entries()],memoryCache: [...memoryCache.entries()],fileDependencies: [...fileDependencies.entries()].map(([filename, deps]) => ([filename, [...deps]])),- externalDependencies: [...externalDependencies.entries()].map(([filename, deps]) => ([filename, [...deps]])),};}@@ -187,10 +183,6 @@ export function addToCompilationCache(payload: SerializedCompilationCache) {const existing = fileDependencies.get(entry[0]) || [];fileDependencies.set(entry[0], new Set([...entry[1], ...existing]));}- for (const entry of payload.externalDependencies) {- const existing = externalDependencies.get(entry[0]) || [];- externalDependencies.set(entry[0], new Set([...entry[1], ...existing]));- }}function calculateFilePathHash(filePath: string): string {@@ -237,11 +229,6 @@ export function currentFileDepsCollector(): Set<string> | undefined {return depsCollector;}-export function setExternalDependencies(filename: string, deps: string[]) {- const depsSet = new Set(deps.filter(dep => !belongsToNodeModules(dep) && dep !== filename));- externalDependencies.set(filename, depsSet);-}-export function fileDependenciesForTest() {return Object.fromEntries([...fileDependencies.entries()].map(entry => ([path.basename(entry[0]), [...entry[1]].map(f => path.basename(f)).sort()]@@ -258,18 +245,6 @@ export function collectAffectedTestFiles(changedFile: string, testFileCollector:if (deps.has(changedFile))testFileCollector.add(testFile);}-- for (const [importingFile, depsOfImportingFile] of externalDependencies) {- if (depsOfImportingFile.has(changedFile)) {- if (isTestFile(importingFile))- testFileCollector.add(importingFile);-- for (const [testFile, depsOfTestFile] of fileDependencies) {- if (depsOfTestFile.has(importingFile))- testFileCollector.add(testFile);- }- }- }}export function affectedTestFiles(changes: string[]): string[] {@@ -284,15 +259,7 @@ export function internalDependenciesForTestFile(filename: string): Set<string> |}export function dependenciesForTestFile(filename: string): Set<string> {- const result = new Set<string>();- for (const testDependency of fileDependencies.get(filename) || []) {- result.add(testDependency);- for (const externalDependency of externalDependencies.get(testDependency) || [])- result.add(externalDependency);- }- for (const dep of externalDependencies.get(filename) || [])- result.add(dep);- return result;+ return fileDependencies.get(filename) || new Set();}// This is only used in the dev mode, specifically excluding