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: hide plugins again (#14038)
Pavel Feldmane9378ba5fcd3
diff --git a/docs/src/test-api/class-testconfig.md b/docs/src/test-api/class-testconfig.mdindex 3682646cd6..14e01de17b 100644--- a/docs/src/test-api/class-testconfig.md+++ b/docs/src/test-api/class-testconfig.md@@ -318,9 +318,6 @@ The directory for each test can be accessed by [`property: TestInfo.snapshotDir`This path will serve as the base directory for each test file snapshot directory. Setting `snapshotDir` to `'snapshots'`, the [`property: TestInfo.snapshotDir`] would resolve to `snapshots/a.spec.js-snapshots`.-## property: TestConfig.plugins-- type: ?<[Array]<[TestPlugin]|[string]>>-## property: TestConfig.preserveOutput- type: ?<[PreserveOutput]<"always"|"never"|"failures-only">>diff --git a/docs/src/test-api/class-testplugin.md b/docs/src/test-api/class-testplugin.mddeleted file mode 100644index 786f35cb33..0000000000--- a/docs/src/test-api/class-testplugin.md+++ /dev/null@@ -1,20 +0,0 @@-# class: TestPlugin-* langs: js--## property: TestPlugin.name-- type: <[string]>--## optional async method: TestPlugin.setup-### param: TestPlugin.setup.config-- `config` <[FullConfig]>--### param: TestPlugin.setup.configDir-- `configDir` <[string]>--### param: TestPlugin.setup.suite-- `suite` <[Suite]>--## optional async method: TestPlugin.teardown--## optional property: TestPlugin.fixtures-- `fixtures` <[any]>diff --git a/packages/playwright-test/src/loader.ts b/packages/playwright-test/src/loader.tsindex 46b967b4d6..aa3820057c 100644--- a/packages/playwright-test/src/loader.ts+++ b/packages/playwright-test/src/loader.ts@@ -15,7 +15,7 @@*/import { installTransform, setCurrentlyLoadingTestFile } from './transform';-import type { Config, Project, ReporterDescription, FullProjectInternal, FullConfigInternal, Fixtures, FixturesWithLocation, TestPlugin } from './types';+import type { Config, Project, ReporterDescription, FullProjectInternal, FullConfigInternal, Fixtures, FixturesWithLocation } from './types';import { getPackageJsonPath, mergeObjects, errorWithFile } from './util';import { setCurrentlyLoadingFileSuite } from './globals';import { Suite, type TestCase } from './test';@@ -123,19 +123,6 @@ export class Loader {if (config.snapshotDir !== undefined)config.snapshotDir = path.resolve(configDir, config.snapshotDir);- config.plugins = await Promise.all((config.plugins || []).map(async plugin => {- if (typeof plugin === 'string')- return (await this._requireOrImportDefaultObject(resolveScript(plugin, configDir))) as TestPlugin;- return plugin;- }));-- for (const plugin of config.plugins || []) {- if (!plugin.fixtures)- continue;- if (typeof plugin.fixtures === 'string')- plugin.fixtures = await this._requireOrImportDefaultObject(resolveScript(plugin.fixtures, configDir));- }-this._fullConfig._configDir = configDir;this._fullConfig.rootDir = config.testDir || this._configDir;this._fullConfig._globalOutputDir = takeFirst(config.outputDir, throwawayArtifactsPath, baseFullConfig._globalOutputDir);@@ -155,7 +142,6 @@ export class Loader {this._fullConfig.updateSnapshots = takeFirst(config.updateSnapshots, baseFullConfig.updateSnapshots);this._fullConfig.workers = takeFirst(config.workers, baseFullConfig.workers);this._fullConfig.webServer = takeFirst(config.webServer, baseFullConfig.webServer);- this._fullConfig._plugins = takeFirst(config.plugins, baseFullConfig._plugins);this._fullConfig.metadata = takeFirst(config.metadata, baseFullConfig.metadata);this._fullConfig.projects = (config.projects || [config]).map(p => this._resolveProject(config, this._fullConfig, p, throwawayArtifactsPath));}@@ -354,16 +340,6 @@ class ProjectSuiteBuilder {if (!this._testPools.has(test)) {let pool = this._buildTestTypePool(test._testType);- for (const plugin of this._project._fullConfig._plugins) {- if (!plugin.fixtures)- continue;- const pluginFixturesWithLocation: FixturesWithLocation = {- fixtures: plugin.fixtures,- location: { file: '', line: 0, column: 0 },- };- pool = new FixturePool([pluginFixturesWithLocation], pool, false);- }-const parents: Suite[] = [];for (let parent: Suite | undefined = test.parent; parent; parent = parent.parent)parents.push(parent);@@ -653,7 +629,6 @@ export const baseFullConfig: FullConfigInternal = {_globalOutputDir: path.resolve(process.cwd()),_configDir: '',_testGroupsCount: 0,- _plugins: [],};function resolveReporters(reporters: Config['reporter'], rootDir: string): ReporterDescription[]|undefined {diff --git a/packages/playwright-test/src/runner.ts b/packages/playwright-test/src/runner.tsindex 95cfc8cb98..0c96244364 100644--- a/packages/playwright-test/src/runner.ts+++ b/packages/playwright-test/src/runner.ts@@ -448,7 +448,7 @@ export class Runner {await (await this._loader.loadGlobalHook(config.globalTeardown, 'globalTeardown'))(this._loader.fullConfig());}, result);- for (const plugin of [...this._plugins, ...config._plugins].reverse()) {+ for (const plugin of [...this._plugins].reverse()) {await this._runAndReportError(async () => {await plugin.teardown?.();}, result);@@ -462,7 +462,7 @@ export class Runner {// First run the plugins, if plugin is a web server we want it to run before the// config's global setup.- for (const plugin of [...this._plugins, ...config._plugins])+ for (const plugin of this._plugins)await plugin.setup?.(config, config._configDir, rootSuite);// The do global setup.diff --git a/packages/playwright-test/src/types.ts b/packages/playwright-test/src/types.tsindex 226829e96e..5610d61d24 100644--- a/packages/playwright-test/src/types.ts+++ b/packages/playwright-test/src/types.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import type { Fixtures, TestError, Project, TestPlugin } from '../types/test';+import type { Fixtures, TestError, Project } from '../types/test';import type { Location } from '../types/testReporter';import type { FullConfig as FullConfigPublic, FullProject as FullProjectPublic } from './types';export * from '../types/test';@@ -44,7 +44,6 @@ export interface FullConfigInternal extends FullConfigPublic {_globalOutputDir: string;_configDir: string;_testGroupsCount: number;- _plugins: TestPlugin[];// Overrides the public field.projects: FullProjectInternal[];diff --git a/packages/playwright-test/types/test.d.ts b/packages/playwright-test/types/test.d.tsindex 53bbb918ff..b206e25e21 100644--- a/packages/playwright-test/types/test.d.ts+++ b/packages/playwright-test/types/test.d.ts@@ -366,22 +366,6 @@ export interface FullProject<TestArgs = {}, WorkerArgs = {}> {type LiteralUnion<T extends U, U = string> = T | (U & { zz_IGNORE_ME?: never });-/**- *- */-export interface TestPlugin {- fixtures?: Fixtures;- name: string;-- /**- * @param config- * @param configDir- * @param suite- */- setup?(config: FullConfig, configDir: string, suite: Suite): Promise<void>;-- teardown?(): Promise<void>;}-/*** Playwright Test provides many options to configure how your tests are collected and executed, for example `timeout` or* `testDir`. These options are described in the [TestConfig] object in the [configuration file](https://playwright.dev/docs/test-configuration).@@ -475,7 +459,6 @@ interface TestConfig {**/webServer?: TestConfigWebServer;- plugins?: TestPlugin[],/*** Configuration for the `expect` assertion library. Learn more about [various timeouts](https://playwright.dev/docs/test-timeouts).*diff --git a/tests/config/experimental.d.ts b/tests/config/experimental.d.tsindex 33dcfadddd..f93d4dd625 100644--- a/tests/config/experimental.d.ts+++ b/tests/config/experimental.d.ts@@ -16765,22 +16765,6 @@ export interface FullProject<TestArgs = {}, WorkerArgs = {}> {type LiteralUnion<T extends U, U = string> = T | (U & { zz_IGNORE_ME?: never });-/**- *- */-export interface TestPlugin {- fixtures?: Fixtures;- name: string;-- /**- * @param config- * @param configDir- * @param suite- */- setup?(config: FullConfig, configDir: string, suite: Suite): Promise<void>;-- teardown?(): Promise<void>;}-/*** Playwright Test provides many options to configure how your tests are collected and executed, for example `timeout` or* `testDir`. These options are described in the [TestConfig] object in the [configuration file](https://playwright.dev/docs/test-configuration).@@ -16874,7 +16858,6 @@ interface TestConfig {**/webServer?: TestConfigWebServer;- plugins?: TestPlugin[],/*** Configuration for the `expect` assertion library. Learn more about [various timeouts](https://playwright.dev/docs/test-timeouts).*diff --git a/utils/generate_types/overrides-test.d.ts b/utils/generate_types/overrides-test.d.tsindex 40f6621fa7..b1e8648114 100644--- a/utils/generate_types/overrides-test.d.ts+++ b/utils/generate_types/overrides-test.d.ts@@ -56,14 +56,9 @@ export interface FullProject<TestArgs = {}, WorkerArgs = {}> {type LiteralUnion<T extends U, U = string> = T | (U & { zz_IGNORE_ME?: never });-export interface TestPlugin {- fixtures?: Fixtures;-}-interface TestConfig {reporter?: LiteralUnion<'list'|'dot'|'line'|'github'|'json'|'junit'|'null'|'html', string> | ReporterDescription[];webServer?: TestConfigWebServer;- plugins?: TestPlugin[],}export interface Config<TestArgs = {}, WorkerArgs = {}> extends TestConfig {