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: use plugin story for components (#13717)
Pavel Feldman5e51c17d4112
diff --git a/docs/src/test-api/class-testconfig.md b/docs/src/test-api/class-testconfig.mdindex 472e09baf2..29a01f8642 100644--- a/docs/src/test-api/class-testconfig.md+++ b/docs/src/test-api/class-testconfig.md@@ -319,6 +319,9 @@ 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]>>+## 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.mdnew file mode 100644index 0000000000..f94de5b1be--- /dev/null+++ b/docs/src/test-api/class-testplugin.md@@ -0,0 +1,14 @@+# class: TestPlugin+* langs: js++## optional async method: TestPlugin.configure+### param: TestPlugin.configure.config+- `config` <[TestConfig]>++### param: TestPlugin.configure.configDir+- `configDir` <[string]>++## optional async method: TestPlugin.setup++## optional async method: TestPlugin.teardown+diff --git a/packages/html-reporter/package.json b/packages/html-reporter/package.jsonindex 50d48ccfbf..b11334c5b1 100644--- a/packages/html-reporter/package.json+++ b/packages/html-reporter/package.json@@ -5,8 +5,6 @@"scripts": {"dev": "vite","build": "vite build && tsc",- "preview": "vite preview",- "playwright-build": "vite --config playwright.vite.config.ts build",- "playwright-dev": "vite --config playwright.vite.config.ts"+ "preview": "vite preview"}}diff --git a/packages/html-reporter/playwright.config.ts b/packages/html-reporter/playwright.config.tsindex f06fece59e..c79ad6e22a 100644--- a/packages/html-reporter/playwright.config.ts+++ b/packages/html-reporter/playwright.config.ts@@ -17,6 +17,7 @@import type { PlaywrightTestConfig } from '@playwright/test';import path from 'path';import { devices } from '@playwright/test';+import vite from '@playwright/experimental-ct-react/vitePlugin';const config: PlaywrightTestConfig = {testDir: 'src',@@ -27,14 +28,10 @@ const config: PlaywrightTestConfig = {] : [['html', { open: 'on-failure' }]],- webServer: {- url: 'http://localhost:3101/playwright/index.html',- command: 'npm run playwright-dev',- cwd: __dirname,- reuseExistingServer: !process.env.CI,- },+ plugins: [+ vite({ port: 3101 })+ ],use: {- baseURL: 'http://localhost:3101/playwright/index.html',trace: 'on-first-retry',},projects: [ ],diff --git a/packages/html-reporter/playwright.vite.config.ts b/packages/html-reporter/playwright.vite.config.tsdeleted file mode 100644index 25d883b5b7..0000000000--- a/packages/html-reporter/playwright.vite.config.ts+++ /dev/null@@ -1,37 +0,0 @@-/**- * Copyright (c) Microsoft Corporation.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { defineConfig } from 'vite';-import react from '@vitejs/plugin-react';-import playwright from '@playwright/experimental-ct-react/vitePlugin';-import path from 'path';--// https://vitejs.dev/config/-export default defineConfig({- plugins: [- react(),- playwright(),- ],- resolve: {- alias: {- '@web': path.resolve(__dirname, '../web/src'),- '@playwright-core': path.resolve(__dirname, '../playwright-core/src'),- },- },- server: {- port: 3101,- },-});diff --git a/packages/playwright-ct-react/vitePlugin.d.ts b/packages/playwright-ct-react/vitePlugin.d.tsindex 7e7d635c28..afba441940 100644--- a/packages/playwright-ct-react/vitePlugin.d.ts+++ b/packages/playwright-ct-react/vitePlugin.d.ts@@ -14,4 +14,11 @@* limitations under the License.*/-export default function(options?: { include?: string }): any;+import { TestPlugin } from '@playwright/test';+import type { InlineConfig } from 'vite';++export default function(options?: {+ config?: InlineConfig,+ include?: string+ port?: number,+}): TestPlugin;diff --git a/packages/playwright-ct-react/vitePlugin.js b/packages/playwright-ct-react/vitePlugin.jsindex d1c92f4472..2e60d9d5d3 100644--- a/packages/playwright-ct-react/vitePlugin.js+++ b/packages/playwright-ct-react/vitePlugin.js@@ -14,5 +14,8 @@* limitations under the License.*/-const { createVitePlugin } = require('@playwright/test/lib/vitePlugin');-module.exports = createVitePlugin('@playwright/experimental-ct-react/register');+const { createPlugin } = require('@playwright/test/lib/plugins/vitePlugin');++module.exports = (options = {}) => {+ return createPlugin('@playwright/experimental-ct-react/register', options);+};diff --git a/packages/playwright-ct-svelte/vitePlugin.d.ts b/packages/playwright-ct-svelte/vitePlugin.d.tsindex 7e7d635c28..afba441940 100644--- a/packages/playwright-ct-svelte/vitePlugin.d.ts+++ b/packages/playwright-ct-svelte/vitePlugin.d.ts@@ -14,4 +14,11 @@* limitations under the License.*/-export default function(options?: { include?: string }): any;+import { TestPlugin } from '@playwright/test';+import type { InlineConfig } from 'vite';++export default function(options?: {+ config?: InlineConfig,+ include?: string+ port?: number,+}): TestPlugin;diff --git a/packages/playwright-ct-svelte/vitePlugin.js b/packages/playwright-ct-svelte/vitePlugin.jsindex 1ea068e3a9..8b18a0fea7 100644--- a/packages/playwright-ct-svelte/vitePlugin.js+++ b/packages/playwright-ct-svelte/vitePlugin.js@@ -14,5 +14,8 @@* limitations under the License.*/-const { createVitePlugin } = require('@playwright/test/lib/vitePlugin');-module.exports = createVitePlugin('@playwright/experimental-ct-svelte/register');+const { createPlugin } = require('@playwright/test/lib/plugins/vitePlugin');++module.exports = (options = {}) => {+ return createPlugin('@playwright/experimental-ct-svelte/register', options);+};diff --git a/packages/playwright-ct-vue/vitePlugin.d.ts b/packages/playwright-ct-vue/vitePlugin.d.tsindex 7e7d635c28..3d8f50b042 100644--- a/packages/playwright-ct-vue/vitePlugin.d.ts+++ b/packages/playwright-ct-vue/vitePlugin.d.ts@@ -14,4 +14,11 @@* limitations under the License.*/-export default function(options?: { include?: string }): any;+import { TestPlugin } from '@playwright/test';+import type { InlineConfig } from 'vite';++export default function(options?: {+ config?: InlineConfig,+ include?: string,+ port?: number,+}): TestPlugin;diff --git a/packages/playwright-ct-vue/vitePlugin.js b/packages/playwright-ct-vue/vitePlugin.jsindex 2293958f86..5c172456d9 100644--- a/packages/playwright-ct-vue/vitePlugin.js+++ b/packages/playwright-ct-vue/vitePlugin.js@@ -14,5 +14,8 @@* limitations under the License.*/-const { createVitePlugin } = require('@playwright/test/lib/vitePlugin');-module.exports = createVitePlugin('@playwright/experimental-ct-vue/register');+const { createPlugin } = require('@playwright/test/lib/plugins/vitePlugin');++module.exports = (options = {}) => {+ return createPlugin('@playwright/experimental-ct-vue/register', options);+};diff --git a/packages/playwright-test/package.json b/packages/playwright-test/package.jsonindex f5292d4f10..e5c637a3b7 100644--- a/packages/playwright-test/package.json+++ b/packages/playwright-test/package.json@@ -19,7 +19,7 @@"./lib/cli": "./lib/cli.js","./lib/experimentalLoader": "./lib/experimentalLoader.js","./lib/mount": "./lib/mount.js",- "./lib/vitePlugin": "./lib/vitePlugin.js",+ "./lib/plugins/vitePlugin": "./lib/plugins/vitePlugin.js","./reporter": "./reporter.js"},"bin": {diff --git a/packages/playwright-test/src/loader.ts b/packages/playwright-test/src/loader.tsindex 7a5a70943a..ccbfc9faf2 100644--- a/packages/playwright-test/src/loader.ts+++ b/packages/playwright-test/src/loader.ts@@ -76,6 +76,9 @@ export class Loader {}private _processConfigObject(config: Config, configDir: string) {+ for (const plugin of config.plugins || [])+ plugin.configure?.(config, configDir);+this._configDir = configDir;const packageJsonPath = getPackageJsonPath(configDir);const packageJsonDir = packageJsonPath ? path.dirname(packageJsonPath) : undefined;@@ -121,6 +124,7 @@ export class Loader {this._fullConfig.updateSnapshots = takeFirst(this._configOverrides.updateSnapshots, config.updateSnapshots, baseFullConfig.updateSnapshots);this._fullConfig.workers = takeFirst(this._configOverrides.workers, config.workers, baseFullConfig.workers);this._fullConfig.webServer = takeFirst(this._configOverrides.webServer, config.webServer, baseFullConfig.webServer);+ this._fullConfig._plugins = takeFirst(this._configOverrides.plugins, config.plugins, baseFullConfig._plugins);const projects: Project[] = ('projects' in config) && config.projects !== undefined ? config.projects : [config];for (const project of projects)@@ -480,6 +484,7 @@ 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/plugins/DEPS.list b/packages/playwright-test/src/plugins/DEPS.listnew file mode 100644index 0000000000..77c0cb3cd8--- /dev/null+++ b/packages/playwright-test/src/plugins/DEPS.list@@ -0,0 +1,2 @@+[*]+../diff --git a/packages/playwright-test/src/vitePlugin.ts b/packages/playwright-test/src/plugins/vitePlugin.tssimilarity index 60%rename from packages/playwright-test/src/vitePlugin.tsrename to packages/playwright-test/src/plugins/vitePlugin.tsindex 202012a48d..ad9af28ec4 100644--- a/packages/playwright-test/src/vitePlugin.ts+++ b/packages/playwright-test/src/plugins/vitePlugin.ts@@ -14,29 +14,63 @@* limitations under the License.*/+import type { PlaywrightTestConfig, TestPlugin } from '@playwright/test';import fs from 'fs';import path from 'path';import { glob } from 'playwright-core/lib/utilsBundle';-import { parse, types as t, traverse } from './babelBundle';-import type { Plugin } from 'vite';-import { componentInfo, collectComponentUsages } from './tsxTransform';-import type { ComponentInfo } from './tsxTransform';+import type { InlineConfig, Plugin, ViteDevServer } from 'vite';+import { parse, traverse, types as t } from '../babelBundle';+import type { ComponentInfo } from '../tsxTransform';+import { collectComponentUsages, componentInfo } from '../tsxTransform';-const imports: Map<string, ComponentInfo> = new Map();+let viteDevServer: ViteDevServer;-export function createVitePlugin(registerFunction: string) {- return (options?: { include: string }) => {- return vitePlugin({ ...(options || {}), registerFunction });+export function createPlugin(+ registerFunction: string,+ options: {+ include?: string,+ port?: number,+ config?: InlineConfig+ } = {}): TestPlugin {+ const viteConfig = options.config || {};+ const port = options.port || 3100;+ let configDir: string;+ return {+ configure: async (config: PlaywrightTestConfig, configDirectory: string) => {+ configDir = configDirectory;+ const url = `http://localhost:${port}/playwright/index.html`;+ if (!config.use)+ config.use = {};+ config.use!.baseURL = url;+ },++ setup: async () => {+ viteConfig.root = viteConfig.root || configDir;+ viteConfig.plugins = viteConfig.plugins || [];+ viteConfig.plugins.push(vitePlugin(registerFunction, options.include));+ viteConfig.configFile = viteConfig.configFile || false;+ viteConfig.server = viteConfig.server || {};+ viteConfig.server.port = port;+ const { createServer } = require('vite');+ viteDevServer = await createServer(viteConfig);+ await viteDevServer.listen(port);+ },++ teardown: async () => {+ await viteDevServer.close();+ },};}-function vitePlugin(options: { include?: string, registerFunction: string }): Plugin {+const imports: Map<string, ComponentInfo> = new Map();++function vitePlugin(registerFunction: string, include: string | undefined): Plugin {return {- name: 'playwright-gallery',+ name: 'playwright:component-index',configResolved: async config => {const files = await new Promise<string[]>((f, r) => {- glob(options.include || config.root + '/**/*.{test,spec}.[tj]s{x,}', {}, function(err, files) {+ glob(include || config.root + '/**/*.{test,spec}.[tj]s{x,}', {}, function(err, files) {if (err)r(err);else@@ -76,7 +110,7 @@ function vitePlugin(options: { include?: string, registerFunction: string }): Plconst folder = path.dirname(id);const lines = [content, ''];- lines.push(`import register from '${options.registerFunction}';`);+ lines.push(`import register from '${registerFunction}';`);for (const [alias, value] of imports) {const importPath = value.isModuleOrAlias ? value.importPath : './' + path.relative(folder, value.importPath).replace(/\\/g, '/');diff --git a/packages/playwright-test/src/runner.ts b/packages/playwright-test/src/runner.tsindex 0176de5800..ce575440b8 100644--- a/packages/playwright-test/src/runner.ts+++ b/packages/playwright-test/src/runner.ts@@ -50,8 +50,6 @@ const readDirAsync = promisify(fs.readdir);const readFileAsync = promisify(fs.readFile);export const kDefaultConfigFiles = ['playwright.config.ts', 'playwright.config.js', 'playwright.config.mjs'];-type InternalGlobalSetupFunction = () => Promise<() => Promise<void>>;-type RunOptions = {listOnly?: boolean;filePatternFilter?: FilePatternFilter[];@@ -61,7 +59,6 @@ type RunOptions = {export class Runner {private _loader: Loader;private _reporter!: Reporter;- private _internalGlobalSetups: Array<InternalGlobalSetupFunction> = [];private _globalInfo: GlobalInfoImpl;constructor(configOverrides: Config, options: { defaultConfig?: Config } = {}) {@@ -70,7 +67,7 @@ export class Runner {}async loadConfigFromResolvedFile(resolvedConfigFile: string): Promise<Config> {- return this._loader.loadConfigFile(resolvedConfigFile);+ return await this._loader.loadConfigFile(resolvedConfigFile);}loadEmptyConfig(configFileOrDirectory: string): Config {@@ -148,10 +145,6 @@ export class Runner {return new Multiplexer(reporters);}- addInternalGlobalSetup(internalGlobalSetup: InternalGlobalSetupFunction) {- this._internalGlobalSetups.push(internalGlobalSetup);- }-async runAllTests(options: RunOptions = {}): Promise<FullResult> {this._reporter = await this._createReporter(!!options.listOnly);const config = this._loader.fullConfig();@@ -430,11 +423,12 @@ export class Runner {private async _performGlobalSetup(config: FullConfigInternal): Promise<(() => Promise<void>) | undefined> {const result: FullResult = { status: 'passed' };- const internalGlobalTeardowns: (() => Promise<void>)[] = [];+ const pluginTeardowns: (() => Promise<void>)[] = [];let globalSetupResult: any;let webServer: WebServer | undefined;const tearDown = async () => {+ // Reverse to setup.await this._runAndReportError(async () => {if (globalSetupResult && typeof globalSetupResult === 'function')await globalSetupResult(this._loader.fullConfig());@@ -449,16 +443,26 @@ export class Runner {await webServer?.kill();}, result);- await this._runAndReportError(async () => {- for (const internalGlobalTeardown of internalGlobalTeardowns)- await internalGlobalTeardown();- }, result);+ for (const teardown of pluginTeardowns) {+ await this._runAndReportError(async () => {+ await teardown();+ }, result);+ }};await this._runAndReportError(async () => {- for (const internalGlobalSetup of this._internalGlobalSetups)- internalGlobalTeardowns.push(await internalGlobalSetup());+ // 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 config._plugins) {+ await plugin.setup?.();+ if (plugin.teardown)+ pluginTeardowns.unshift(plugin.teardown);+ }++ // Then do legacy web server.webServer = config.webServer ? await WebServer.create(config.webServer, this._reporter) : undefined;++ // The do global setup.if (config.globalSetup)globalSetupResult = await (await this._loader.loadGlobalHook(config.globalSetup, 'globalSetup'))(this._loader.fullConfig(), this._globalInfo);}, result);diff --git a/packages/playwright-test/src/types.ts b/packages/playwright-test/src/types.tsindex bb85b30e25..c5583805b9 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 } from '../types/test';+import type { Fixtures, TestError, Project, TestPlugin } from '../types/test';import type { Location } from '../types/testReporter';import type { FullConfig as FullConfigPublic, FullProject as FullProjectPublic } from './types';export * from '../types/test';@@ -48,6 +48,7 @@ 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 8c2f482f7f..5ae5425570 100644--- a/packages/playwright-test/types/test.d.ts+++ b/packages/playwright-test/types/test.d.ts@@ -685,6 +685,8 @@ interface TestConfig {*/snapshotDir?: string;+ plugins?: Array<TestPlugin>;+/*** Whether to preserve test output in the* [testConfig.outputDir](https://playwright.dev/docs/api/class-testconfig#test-config-output-dir). Defaults to `'always'`.@@ -3723,6 +3725,18 @@ export interface TestError {value?: string;}+export interface TestPlugin {+ /**+ * @param config+ * @param configDir+ */+ configure?(config: TestConfig, configDir: string): Promise<void>;++ setup?(): Promise<void>;++ teardown?(): Promise<void>;+}+/*** Playwright Test supports running multiple test projects at the same time. This is useful for running tests in multiple* configurations. For example, consider running tests against multiple browsers.diff --git a/packages/web/playwright.config.ts b/packages/web/playwright.config.tsindex 3d89da498c..96dd9f7d70 100644--- a/packages/web/playwright.config.ts+++ b/packages/web/playwright.config.ts@@ -16,6 +16,7 @@import type { PlaywrightTestConfig } from '@playwright/test';import { devices } from '@playwright/test';+import vite from '@playwright/experimental-ct-react/vitePlugin';const config: PlaywrightTestConfig = {testDir: 'src',@@ -26,14 +27,10 @@ const config: PlaywrightTestConfig = {] : [['html', { open: 'on-failure' }]],- webServer: {- url: 'http://localhost:3102/playwright/index.html',- command: 'npx vite --config playwright.vite.config.ts dev',- cwd: __dirname,- reuseExistingServer: !process.env.CI,- },+ plugins: [+ vite({ port: 3101 })+ ],use: {- baseURL: 'http://localhost:3102/playwright/index.html',trace: 'on-first-retry',},projects: [diff --git a/packages/web/playwright.vite.config.ts b/packages/web/playwright.vite.config.tsdeleted file mode 100644index fc576a0ede..0000000000--- a/packages/web/playwright.vite.config.ts+++ /dev/null@@ -1,30 +0,0 @@-/**- * Copyright (c) Microsoft Corporation.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { defineConfig } from 'vite';-import react from '@vitejs/plugin-react';-import playwright from '@playwright/experimental-ct-react/vitePlugin';--// https://vitejs.dev/config/-export default defineConfig({- plugins: [- react(),- playwright(),- ],- server: {- port: 3102,- },-});diff --git a/tests/components/ct-react-vite/playwright.config.ts b/tests/components/ct-react-vite/playwright.config.tsindex d02b5fb0e5..0a5a6162a0 100644--- a/tests/components/ct-react-vite/playwright.config.ts+++ b/tests/components/ct-react-vite/playwright.config.ts@@ -15,6 +15,7 @@*/import { PlaywrightTestConfig, devices } from '@playwright/test';+import vite from '@playwright/experimental-ct-react/vitePlugin';const config: PlaywrightTestConfig = {testDir: 'src',@@ -25,13 +26,10 @@ const config: PlaywrightTestConfig = {] : [['html', { open: 'on-failure' }]],- webServer: {- url: 'http://localhost:3000/playwright/index.html',- command: 'npm run playwright-dev',- reuseExistingServer: !process.env.CI,- },+ plugins: [+ vite(),+ ],use: {- baseURL: 'http://localhost:3000/playwright/index.html',trace: 'on-first-retry',},projects: [diff --git a/tests/components/ct-react-vite/playwright.vite.config.ts b/tests/components/ct-react-vite/playwright.vite.config.tsdeleted file mode 100644index 1c9fd0014a..0000000000--- a/tests/components/ct-react-vite/playwright.vite.config.ts+++ /dev/null@@ -1,11 +0,0 @@-import { defineConfig } from 'vite';-import react from '@vitejs/plugin-react';-import playwright from '@playwright/experimental-ct-react/vitePlugin';--// https://vitejs.dev/config/-export default defineConfig({- plugins: [- react(),- playwright(),- ]-});diff --git a/tests/components/ct-react-vite/src/App.tsx b/tests/components/ct-react-vite/src/App.tsxindex 3d9bd71e51..78b8518c54 100644--- a/tests/components/ct-react-vite/src/App.tsx+++ b/tests/components/ct-react-vite/src/App.tsx@@ -1,3 +1,4 @@+import React from 'react'import { useState } from 'react'import logo from './logo.svg'import './App.css'diff --git a/tests/components/ct-svelte-vite/playwright.config.ts b/tests/components/ct-svelte-vite/playwright.config.tsindex b56cbe175a..8c3beb0e6c 100644--- a/tests/components/ct-svelte-vite/playwright.config.ts+++ b/tests/components/ct-svelte-vite/playwright.config.ts@@ -16,6 +16,8 @@import type { PlaywrightTestConfig } from '@playwright/test';import { devices } from '@playwright/test';+import vite from '@playwright/experimental-ct-svelte/vitePlugin';+import { svelte } from '@sveltejs/vite-plugin-svelte';const config: PlaywrightTestConfig = {testDir: 'src',@@ -26,13 +28,12 @@ const config: PlaywrightTestConfig = {] : [['html', { open: 'on-failure' }]],- webServer: {- url: 'http://localhost:3000/playwright/index.html',- command: 'npm run playwright-dev',- reuseExistingServer: !process.env.CI,- },+ plugins: [+ vite({+ config: { plugins: [ svelte() ] }+ }),+ ],use: {- baseURL: 'http://localhost:3000/playwright/index.html',trace: 'on-first-retry',},projects: [diff --git a/tests/components/ct-svelte-vite/playwright.vite.config.ts b/tests/components/ct-svelte-vite/playwright.vite.config.tsdeleted file mode 100644index 46e99c1b4b..0000000000--- a/tests/components/ct-svelte-vite/playwright.vite.config.ts+++ /dev/null@@ -1,11 +0,0 @@-import { defineConfig } from 'vite'-import { svelte } from '@sveltejs/vite-plugin-svelte'-import playwright from '@playwright/experimental-ct-svelte/vitePlugin';--// https://vitejs.dev/config/-export default defineConfig({- plugins: [- svelte(),- playwright(),- ]-})diff --git a/tests/components/ct-svelte-vite/vite.config.ts b/tests/components/ct-svelte-vite/vite.config.tsdeleted file mode 100644index 401b4d4bd6..0000000000--- a/tests/components/ct-svelte-vite/vite.config.ts+++ /dev/null@@ -1,7 +0,0 @@-import { defineConfig } from 'vite'-import { svelte } from '@sveltejs/vite-plugin-svelte'--// https://vitejs.dev/config/-export default defineConfig({- plugins: [svelte()]-})diff --git a/tests/components/ct-vue-vite/playwright.config.ts b/tests/components/ct-vue-vite/playwright.config.tsindex d02b5fb0e5..98569d2d3c 100644--- a/tests/components/ct-vue-vite/playwright.config.ts+++ b/tests/components/ct-vue-vite/playwright.config.ts@@ -15,6 +15,8 @@*/import { PlaywrightTestConfig, devices } from '@playwright/test';+import vite from '@playwright/experimental-ct-vue/vitePlugin';+import vue from '@vitejs/plugin-vue'const config: PlaywrightTestConfig = {testDir: 'src',@@ -25,13 +27,14 @@ const config: PlaywrightTestConfig = {] : [['html', { open: 'on-failure' }]],- webServer: {- url: 'http://localhost:3000/playwright/index.html',- command: 'npm run playwright-dev',- reuseExistingServer: !process.env.CI,- },+ plugins: [+ vite({+ config: {+ plugins: [ vue() ]+ }+ }),+ ],use: {- baseURL: 'http://localhost:3000/playwright/index.html',trace: 'on-first-retry',},projects: [diff --git a/tests/components/ct-vue-vite/playwright.vite.config.js b/tests/components/ct-vue-vite/playwright.vite.config.jsdeleted file mode 100644index 9b77c81fdd..0000000000--- a/tests/components/ct-vue-vite/playwright.vite.config.js+++ /dev/null@@ -1,11 +0,0 @@-import { defineConfig } from 'vite'-import vue from '@vitejs/plugin-vue'-import playwright from '@playwright/experimental-ct-vue/vitePlugin';--// https://vitejs.dev/config/-export default defineConfig({- plugins: [- vue(),- playwright(),- ]-})diff --git a/tests/config/experimental.d.ts b/tests/config/experimental.d.tsindex d9766b419f..16faefe788 100644--- a/tests/config/experimental.d.ts+++ b/tests/config/experimental.d.ts@@ -16893,6 +16893,8 @@ interface TestConfig {*/snapshotDir?: string;+ plugins?: Array<TestPlugin>;+/*** Whether to preserve test output in the* [testConfig.outputDir](https://playwright.dev/docs/api/class-testconfig#test-config-output-dir). Defaults to `'always'`.@@ -20155,6 +20157,18 @@ export interface TestError {value?: string;}+export interface TestPlugin {+ /**+ * @param config+ * @param configDir+ */+ configure?(config: TestConfig, configDir: string): Promise<void>;++ setup?(): Promise<void>;++ teardown?(): Promise<void>;+}+/*** Playwright Test supports running multiple test projects at the same time. This is useful for running tests in multiple* configurations. For example, consider running tests against multiple browsers.