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: remove experimental component testing (#42168)
Pavel Feldman5a617bb6b5b9
diff --git a/.github/workflows/tests_components.yml b/.github/workflows/tests_components.ymldeleted file mode 100644index f2413215d7..0000000000--- a/.github/workflows/tests_components.yml+++ /dev/null@@ -1,47 +0,0 @@-name: "components"--on:- push:- branches:- - main- - release-*- pull_request:- paths-ignore:- - 'browser_patches/**'- - 'docs/**'- - 'packages/extension/**'- - 'packages/playwright-core/src/server/bidi/**'- - 'packages/playwright-core/src/tools/**'- - 'tests/bidi/**'- - 'tests/extension/**'- - 'tests/mcp/**'- branches:- - main- - release-*--env:- FORCE_COLOR: 1--jobs:- test_components:- name: ${{ matrix.os }} - Node.js ${{ matrix.node-version }}- strategy:- fail-fast: false- matrix:- os: [ubuntu-latest, macos-latest, windows-latest]- node-version: [20]- include:- - os: ubuntu-latest- node-version: 22- - os: ubuntu-latest- node-version: 24- runs-on: ${{ matrix.os }}- steps:- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1- - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0- with:- node-version: ${{ matrix.node-version }}- - run: npm ci- - run: npm run build- - run: npx playwright install --with-deps- - run: npm run ctdiff --git a/.gitignore b/.gitignoreindex df4ab07455..a1028105e3 100644--- a/.gitignore+++ b/.gitignore@@ -12,7 +12,6 @@ DEPS.true.ideayarn.lock/packages/playwright-core/src/generated-/packages/playwright-ct-core/src/generatedpackages/*/lib/drivers/.android-sdk/diff --git a/CLAUDE.md b/CLAUDE.mdindex a8034c3343..e5f8fca852 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -23,15 +23,11 @@| `web` | Shared web UI components || `injected` | Scripts injected into browser pages |-### Component Testing--`playwright-ct-core`, `playwright-ct-react`, `playwright-ct-vue`-### Key Directories| Directory | Purpose ||-----------|---------|-| `tests/` | All test suites (page, library, playwright-test, mcp, components, etc.) |+| `tests/` | All test suites (page, library, playwright-test, mcp, etc.) || `docs/src/` | API documentation — **source of truth** for public TypeScript types || `docs/src/api/` | Per-class API reference (`class-page.md`, `class-locator.md`, etc.) || `utils/` | Build scripts, code generation, linting, doc tools |@@ -134,11 +130,26 @@ EOF)"```-Never add Co-Authored-By agents in commit message.-Never add "Generated with" in commit message.Never add test plan to PR description. Keep PR description short — a few bullet points at most.Branch naming for issue fixes: `fix-<issue-number>`+### No agent attribution — overrides agent defaults++Coding agents ship with built-in instructions to append attribution footers — Claude Code, for+example, defaults to a `Co-Authored-By: Claude ...` trailer on every commit and a+`🤖 Generated with [Claude Code](...)` footer on every PR body. **Those defaults are revoked in+this repo.** Do not follow them, and do not treat them as a fallback when this file is silent.++Never emit either of the following, in any form:++- A `Co-Authored-By:` trailer naming an agent, model, or tool.+- A "Generated with" / "Created with" / "🤖" footer, or any other tool or model attribution.++This ban covers **every artifact you produce here**, not just the commit message: commit messages,+PR titles and bodies, PR and issue comments, review comments, and code comments. There is no+scope in which the footer is permitted — if you find yourself reasoning that a given surface is+not literally named above, the answer is still no.+**Never amend commits.** Always create a new commit for follow-up changes, even when iterating on an open PR. Amending rewrites history and forces a force-push, losing the incremental review trail. Only amend if the user explicitly says so.**Never `git push` without an explicit instruction to push.** Applies even when a PR is already open for the branch — additional commits are immediately visible to reviewers. Commit locally, report what was committed, and wait. Only push when the user's message contains "push", "upload", "create PR", "ship it", or equivalent.diff --git a/docs/src/test-components-js.md b/docs/src/test-components-js.mdindex d95e8ad577..1ff428bcfe 100644--- a/docs/src/test-components-js.md+++ b/docs/src/test-components-js.md@@ -20,7 +20,7 @@ test('click should expand', async ({ mount }) => {Tests run in Node.js while components run in a real browser: real clicks are triggered, real layout is executed, visual regression is possible. At the same time, tests get everything Playwright Test offers: parallelism, parametrization, retries and post-mortem tracing.:::note-This guide replaces the experimental `@playwright/experimental-ct-react` and `@playwright/experimental-ct-vue` packages. If you are using them today, see the [migration guide](#migration-from-the-experimental-packages) below.+The experimental `@playwright/experimental-ct-react`, `-ct-react17` and `-ct-vue` packages have been removed and are no longer published. If you are still on them, stay on Playwright 1.62 until you have followed the [migration guide](#migration-from-the-experimental-packages) below.:::## Why a framework-agnostic approach@@ -331,7 +331,7 @@ test('counts clicks', async ({ mount }) => {});```-Migrate incrementally: set up the gallery and the `components` project while the old CT project keeps running, port spec by spec, then drop the `@playwright/experimental-ct-*` dependency along with `playwright/index.html`, `playwright/index.ts` and `playwright/.cache`.+Migrate incrementally: while pinned to Playwright 1.62, set up the gallery and the `components` project alongside the old CT project, port spec by spec, then drop the `@playwright/experimental-ct-*` dependency along with `playwright/index.html`, `playwright/index.ts` and `playwright/.cache` and upgrade.Things to watch for:diff --git a/docs/src/testing-library-js.md b/docs/src/testing-library-js.mdindex c3f3e8f58d..3396f42b89 100644--- a/docs/src/testing-library-js.md+++ b/docs/src/testing-library-js.md@@ -5,12 +5,14 @@ title: "Migrating from Testing Library"## Migration principles-This guide describes migration to Playwright's [Experimental Component Testing](./test-components) from [DOM Testing Library](https://testing-library.com/docs/dom-testing-library/intro/), [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/) and [Vue Testing Library](https://testing-library.com/docs/vue-testing-library/intro).+This guide describes migration to Playwright's [component testing](./test-components) from [DOM Testing Library](https://testing-library.com/docs/dom-testing-library/intro/), [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/) and [Vue Testing Library](https://testing-library.com/docs/vue-testing-library/intro).:::noteIf you use DOM Testing Library in the browser (for example, you bundle end-to-end tests with webpack), you can switch directly to Playwright Test. Examples below are focused on component tests, but for end-to-end test you just need to replace `await mount` with `await page.goto('http://localhost:3000/')` to open the page under test.:::+Playwright renders a component through a **story** — a small wrapper that embeds the component in one specific scenario — served from a **gallery** page by your own dev server. Where Testing Library calls `render()` inline in the test, Playwright moves that setup into the story and refers to it by id from the test. See [Component testing](./test-components) for how to set up the gallery.+## Cheat Sheet| Testing Library | Playwright |@@ -28,9 +30,9 @@ If you use DOM Testing Library in the browser (for example, you bundle end-to-en| `screen.queryByPlaceholderText('...')` | `component.getByPlaceholder('...')` || `screen.findByText('...')` | `component.getByText('...')` || `screen.getByTestId('...')` | `component.getByTestId('...')` |-| `render(<Component />);` | `mount(<Component />);` |-| `const { unmount } = render(<Component />);` | `const { unmount } = await mount(<Component />);` |-| `const { rerender } = render(<Component />);` | `const { update } = await mount(<Component />);` |+| `render(<Component />);` | a story export + `await mount('Component/Default');` |+| `const { unmount } = render(<Component />);` | `const component = await mount('...'); await component.unmount();` |+| `const { rerender } = render(<Component />);` | `const component = await mount('...'); await component.update(props);` |## Example@@ -57,30 +59,39 @@ test('sign in', async () => {});```-Line-by-line migration to Playwright Test:+Line-by-line migration to Playwright Test. First, the scenario moves from the test into a story next to the component:++```js title="src/pages/SignInPage.story.tsx"+import { SignInPage } from './SignInPage';++export const Default = () => <SignInPage />; // 1+```++Then the test mounts that story by id:```js-const { test, expect } = require('@playwright/experimental-ct-react'); // 1+const { test, expect } = require('@playwright/test'); // 2-test('sign in', async ({ mount }) => { // 2+test('sign in', async ({ mount }) => { // 3// Setup the page.- const component = await mount(<SignInPage />); // 3+ const component = await mount('pages/SignInPage/Default'); // 4// Perform actions.- await component.getByLabel('Username').fill('John'); // 4+ await component.getByLabel('Username').fill('John'); // 5await component.getByLabel('Password').fill('secret');await component.getByRole('button', { name: 'Sign in' }).click();// Verify signed in state by waiting until "Welcome" message appears.- await expect(component.getByText('Welcome, John')).toBeVisible(); // 5+ await expect(component.getByText('Welcome, John')).toBeVisible(); // 6});```-Migration highlights (see inline comments in the Playwright Test code snippet):+Migration highlights (see inline comments in the Playwright Test code snippets):-1. Import everything from `@playwright/experimental-ct-react` (or -vue) for component tests, or from `@playwright/test` for end-to-end tests.-1. Test function is given a `page` that is isolated from other tests, and `mount` that renders a component in this page. These are two of the [useful fixtures](./api/class-fixtures) in Playwright Test.-1. Replace `render` with `mount` that returns a [component locator](./locators).+1. Whatever `render()` used to set up inline — props, providers, mock data — becomes a story export. Stories run in the browser, so live objects no longer have to cross into the test.+1. Import everything from `@playwright/test`, for both component and end-to-end tests.+1. Test function is given a `page` that is isolated from other tests, and `mount` that renders a story in this page. These are two of the [useful fixtures](./api/class-fixtures) in Playwright Test.+1. Replace `render` with [`method: Fixtures.mount`], which takes a story id and returns a [component locator](./locators) scoped to the gallery root.1. Use locators created with [`method: Locator.locator`] or [`method: Page.locator`] to perform most of the actions.1. Use [assertions](./test-assertions) to verify the state.@@ -149,7 +160,7 @@ You also get all these ✨ awesome tools ✨ that come bundled with Playwright TLearn more about Playwright Test runner:- [Getting Started](./intro)-- [Experimental Component Testing](./test-components)+- [Component testing](./test-components)- [Locators](./locators.md)- [Assertions](./test-assertions)- [Auto-waiting](./actionability)diff --git a/eslint.config.mjs b/eslint.config.mjsindex cf67709a83..900c53d868 100644--- a/eslint.config.mjs+++ b/eslint.config.mjs@@ -52,7 +52,6 @@ const ignores = ["packages/playwright-core/src/generated/*","packages/playwright-core/src/third_party/","packages/playwright-core/types/*",- "packages/playwright-ct-core/src/generated/*","packages/playwright/bundles/expect/third_party/","packages/playwright-core/src/tools/skills/","packages/html-reporter/bundle.ts",diff --git a/package-lock.json b/package-lock.jsonindex 677337971f..264c8012e6 100644--- a/package-lock.json+++ b/package-lock.json@@ -432,6 +432,7 @@"version": "7.29.7","resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz","integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==",+ "dev": true,"license": "MIT","engines": {"node": ">=6.9.0"@@ -441,6 +442,7 @@"version": "7.29.7","resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz","integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==",+ "dev": true,"license": "MIT","engines": {"node": ">=6.9.0"@@ -474,6 +476,7 @@"version": "7.29.7","resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.7.tgz","integrity": "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==",+ "dev": true,"license": "MIT","dependencies": {"@babel/types": "^7.29.7"@@ -918,6 +921,7 @@"version": "7.29.7","resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.7.tgz","integrity": "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==",+ "dev": true,"license": "MIT","dependencies": {"@babel/helper-string-parser": "^7.29.7",@@ -1178,6 +1182,7 @@"version": "1.11.1","resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.1.tgz","integrity": "sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ==",+ "dev": true,"license": "MIT","optional": true,"dependencies": {@@ -1189,6 +1194,7 @@"version": "1.11.1","resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.1.tgz","integrity": "sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw==",+ "dev": true,"license": "MIT","optional": true,"dependencies": {@@ -1199,6 +1205,7 @@"version": "1.2.2","resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.2.tgz","integrity": "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==",+ "dev": true,"license": "MIT","optional": true,"dependencies": {@@ -1219,6 +1226,7 @@"cpu": ["ppc64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1235,6 +1243,7 @@"cpu": ["arm"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1251,6 +1260,7 @@"cpu": ["arm64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1267,6 +1277,7 @@"cpu": ["x64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1283,6 +1294,7 @@"cpu": ["arm64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1299,6 +1311,7 @@"cpu": ["x64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1315,6 +1328,7 @@"cpu": ["arm64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1331,6 +1345,7 @@"cpu": ["x64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1347,6 +1362,7 @@"cpu": ["arm"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1363,6 +1379,7 @@"cpu": ["arm64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1379,6 +1396,7 @@"cpu": ["ia32"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1395,6 +1413,7 @@"cpu": ["loong64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1411,6 +1430,7 @@"cpu": ["mips64el"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1427,6 +1447,7 @@"cpu": ["ppc64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1443,6 +1464,7 @@"cpu": ["riscv64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1459,6 +1481,7 @@"cpu": ["s390x"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1475,6 +1498,7 @@"cpu": ["x64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1491,6 +1515,7 @@"cpu": ["arm64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1507,6 +1532,7 @@"cpu": ["x64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1523,6 +1549,7 @@"cpu": ["arm64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1539,6 +1566,7 @@"cpu": ["x64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1555,6 +1583,7 @@"cpu": ["arm64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1571,6 +1600,7 @@"cpu": ["x64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1587,6 +1617,7 @@"cpu": ["arm64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1603,6 +1634,7 @@"cpu": ["ia32"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -1619,6 +1651,7 @@"cpu": ["x64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -2075,6 +2108,7 @@"version": "1.5.5","resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz","integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",+ "dev": true,"license": "MIT"},"node_modules/@jridgewell/trace-mapping": {@@ -2157,6 +2191,7 @@"version": "1.1.6","resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.6.tgz","integrity": "sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg==",+ "dev": true,"license": "MIT","optional": true,"dependencies": {@@ -2340,6 +2375,7 @@"version": "0.137.0","resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.137.0.tgz","integrity": "sha512-WT+Gb24i8hmvo85AIv2oEYouEXkRlKAlT9WaCa3TfLgNCN+GhrJOGZuIlMouAh38Qe4QOx26eUOVsq70qXrywA==",+ "dev": true,"license": "MIT","funding": {"url": "https://github.com/sponsors/Boshen"@@ -2375,22 +2411,6 @@"resolved": "packages/dashboard","link": true},- "node_modules/@playwright/experimental-ct-core": {- "resolved": "packages/playwright-ct-core",- "link": true- },- "node_modules/@playwright/experimental-ct-react": {- "resolved": "packages/playwright-ct-react",- "link": true- },- "node_modules/@playwright/experimental-ct-react17": {- "resolved": "packages/playwright-ct-react17",- "link": true- },- "node_modules/@playwright/experimental-ct-vue": {- "resolved": "packages/playwright-ct-vue",- "link": true- },"node_modules/@playwright/extension": {"resolved": "packages/extension","link": true@@ -2406,6 +2426,7 @@"cpu": ["arm64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -2422,6 +2443,7 @@"cpu": ["arm64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -2438,6 +2460,7 @@"cpu": ["x64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -2454,6 +2477,7 @@"cpu": ["x64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -2470,6 +2494,7 @@"cpu": ["arm"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -2486,6 +2511,7 @@"cpu": ["arm64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -2502,6 +2528,7 @@"cpu": ["arm64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -2518,6 +2545,7 @@"cpu": ["ppc64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -2534,6 +2562,7 @@"cpu": ["s390x"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -2550,6 +2579,7 @@"cpu": ["x64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -2566,6 +2596,7 @@"cpu": ["x64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -2582,6 +2613,7 @@"cpu": ["arm64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -2598,6 +2630,7 @@"cpu": ["wasm32"],+ "dev": true,"license": "MIT","optional": true,"dependencies": {@@ -2616,6 +2649,7 @@"cpu": ["arm64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -2632,6 +2666,7 @@"cpu": ["x64"],+ "dev": true,"license": "MIT","optional": true,"os": [@@ -2645,6 +2680,7 @@"version": "1.0.1","resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz","integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==",+ "dev": true,"license": "MIT"},"node_modules/@rtsao/scc": {@@ -2693,6 +2729,7 @@"version": "0.10.3","resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.3.tgz","integrity": "sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==",+ "dev": true,"license": "MIT","optional": true,"dependencies": {@@ -2899,7 +2936,7 @@"version": "20.19.43","resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.43.tgz","integrity": "sha512-6oYBAi5ikg4Pl+kGsoYtawUMBT2zZMCvPNF7pVLnHZfd1zf38DRiWn/gT01RYCdUqkv7Fhr+C9ot4/tb+2sVvA==",- "devOptional": true,+ "dev": true,"license": "MIT","dependencies": {"undici-types": "~6.21.0"@@ -3403,6 +3440,7 @@"version": "6.0.3","resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-6.0.3.tgz","integrity": "sha512-vmFvco5/QuC2f9Oj+wTk0+9XeDFkHxSamwZKYc7MxYwKICfvUvlMhqKI0VuICPltGqh1neqBKDvO4kes1ya8vg==",+ "dev": true,"license": "MIT","dependencies": {"@rolldown/pluginutils": "^1.0.1"@@ -3424,131 +3462,6 @@}}},- "node_modules/@vitejs/plugin-vue": {- "version": "6.0.7",- "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-6.0.7.tgz",- "integrity": "sha512-km+p+XdSz9Sxm5rqUbqcSfZYaAniKxWBj1KURl+Jr7UaPvvX7BmaWMdP69I5rrFDeQGyxAG7NXdc57vz+snhWg==",- "license": "MIT",- "dependencies": {- "@rolldown/pluginutils": "^1.0.1"- },- "engines": {- "node": "^20.19.0 || >=22.12.0"- },- "peerDependencies": {- "vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0",- "vue": "^3.2.25"- }- },- "node_modules/@vue/compiler-core": {- "version": "3.5.39",- "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.39.tgz",- "integrity": "sha512-16KBTEXAJCpDr0mwlw+AZyhu8iyC7R3S2vBwsI7QnWJU6X3WKc9VKeNEZpiMdZ569qWhz9574L3vV55qRL0Vtw==",- "license": "MIT",- "peer": true,- "dependencies": {- "@babel/parser": "^7.29.7",- "@vue/shared": "3.5.39",- "entities": "^7.0.1",- "estree-walker": "^2.0.2",- "source-map-js": "^1.2.1"- }- },- "node_modules/@vue/compiler-dom": {- "version": "3.5.39",- "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.39.tgz",- "integrity": "sha512-oQPigALqYbNxTNPvNgSOe+czwVExfbVF02lz8jP0S3AXJiu3jxYDygNUiqSep4ezzW8XgnubqH63My2A7JR/vg==",- "license": "MIT",- "peer": true,- "dependencies": {- "@vue/compiler-core": "3.5.39",- "@vue/shared": "3.5.39"- }- },- "node_modules/@vue/compiler-sfc": {- "version": "3.5.39",- "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.39.tgz",- "integrity": "sha512-d0ki86iOyN8LoZPBmk5SJWNwHP19CnDDCfuo//+2WJa2g5Ke0Jay983PIBIcSSzldC68I8DrD5GrHV3OSDfodg==",- "license": "MIT",- "peer": true,- "dependencies": {- "@babel/parser": "^7.29.7",- "@vue/compiler-core": "3.5.39",- "@vue/compiler-dom": "3.5.39",- "@vue/compiler-ssr": "3.5.39",- "@vue/shared": "3.5.39",- "estree-walker": "^2.0.2",- "magic-string": "^0.30.21",- "postcss": "^8.5.15",- "source-map-js": "^1.2.1"- }- },- "node_modules/@vue/compiler-ssr": {- "version": "3.5.39",- "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.39.tgz",- "integrity": "sha512-Ce7/wvwMHai74bdszfXExdazFigYnlF9zgCmEQUcM1j0fOymlouZ7XilTYNo8oUjhlnjYOZbGrcYKuqjz89Ucw==",- "license": "MIT",- "peer": true,- "dependencies": {- "@vue/compiler-dom": "3.5.39",- "@vue/shared": "3.5.39"- }- },- "node_modules/@vue/reactivity": {- "version": "3.5.39",- "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.5.39.tgz",- "integrity": "sha512-TpsuBJ9gGlZa5d23XcM2y8EXanz9dZeVDQBXRwzy46ItgvM+rWpzs+UVM0wcRLxGvcav0HE5jz2gNL53xlRAog==",- "license": "MIT",- "peer": true,- "dependencies": {- "@vue/shared": "3.5.39"- }- },- "node_modules/@vue/runtime-core": {- "version": "3.5.39",- "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.39.tgz",- "integrity": "sha512-9GLtNyRvPAUMbX+7ono0RC2j0guo2LXVi8LvcmAooImACUKm0oFf0jjwbX8/H0AE/t1nxhAkn8RSl9PMCzzxZw==",- "license": "MIT",- "peer": true,- "dependencies": {- "@vue/reactivity": "3.5.39",- "@vue/shared": "3.5.39"- }- },- "node_modules/@vue/runtime-dom": {- "version": "3.5.39",- "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.5.39.tgz",- "integrity": "sha512-7Y6aAGboKcXAZ3ECuUy7RrS5yy2r47dhTp2SKaJmYxjopImaVFaNa5Ne66NwGovsrxVAl5S5rwc7m22UG7Lmww==",- "license": "MIT",- "peer": true,- "dependencies": {- "@vue/reactivity": "3.5.39",- "@vue/runtime-core": "3.5.39",- "@vue/shared": "3.5.39",- "csstype": "^3.2.3"- }- },- "node_modules/@vue/server-renderer": {- "version": "3.5.39",- "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.5.39.tgz",- "integrity": "sha512-yZSakiAGw85rZfG7UM8akMnIF+FmeiNk47uvHf2nVBBSe+dIKUhZuZq9+XgJhbV3nS5Z4ALH23/MpXofW+mbcw==",- "license": "MIT",- "peer": true,- "dependencies": {- "@vue/compiler-ssr": "3.5.39",- "@vue/shared": "3.5.39"- },- "peerDependencies": {- "vue": "3.5.39"- }- },- "node_modules/@vue/shared": {- "version": "3.5.39",- "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.39.tgz",- "integrity": "sha512-l1rrBtBfTnmxvtsvdQDXltUUy8S1Y+ZaqdfUzmAnJkTd8Z8rv5v/ytW+TKiqEOWyHPoqtPlNFSs0lhRmYVSHVA==",- "license": "MIT",- "peer": true- },"node_modules/@xterm/addon-fit": {"version": "0.10.0","resolved": "https://registry.npmjs.org/@xterm/addon-fit/-/addon-fit-0.10.0.tgz",@@ -4452,6 +4365,7 @@"version": "3.2.3","resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz","integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",+ "dev": true,"license": "MIT"},"node_modules/data-view-buffer": {@@ -4626,6 +4540,7 @@"version": "2.1.2","resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz","integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",+ "dev": true,"license": "Apache-2.0","engines": {"node": ">=8"@@ -4775,19 +4690,6 @@"node": ">=8.6"}},- "node_modules/entities": {- "version": "7.0.1",- "resolved": "https://registry.npmjs.org/entities/-/entities-7.0.1.tgz",- "integrity": "sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==",- "license": "BSD-2-Clause",- "peer": true,- "engines": {- "node": ">=0.12"- },- "funding": {- "url": "https://github.com/fb55/entities?sponsor=1"- }- },"node_modules/env-paths": {"version": "3.0.0","resolved": "https://registry.npmjs.org/env-paths/-/env-paths-3.0.0.tgz",@@ -5004,7 +4906,7 @@"version": "0.28.1","resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.1.tgz","integrity": "sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==",- "devOptional": true,+ "dev": true,"hasInstallScript": true,"license": "MIT","bin": {@@ -5490,13 +5392,6 @@"node": ">=4.0"}},- "node_modules/estree-walker": {- "version": "2.0.2",- "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",- "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",- "license": "MIT",- "peer": true- },"node_modules/esutils": {"version": "2.0.3","resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",@@ -5645,6 +5540,7 @@"version": "6.5.0","resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz","integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",+ "dev": true,"license": "MIT","engines": {"node": ">=12.0.0"@@ -5807,6 +5703,7 @@"version": "2.3.3","resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz","integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",+ "dev": true,"hasInstallScript": true,"license": "MIT","optional": true,@@ -7052,6 +6949,7 @@"version": "1.32.0","resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz","integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==",+ "dev": true,"license": "MPL-2.0","dependencies": {"detect-libc": "^2.0.3"@@ -7084,6 +6982,7 @@"cpu": ["arm64"],+ "dev": true,"license": "MPL-2.0","optional": true,"os": [@@ -7104,6 +7003,7 @@"cpu": ["arm64"],+ "dev": true,"license": "MPL-2.0","optional": true,"os": [@@ -7124,6 +7024,7 @@"cpu": ["x64"],+ "dev": true,"license": "MPL-2.0","optional": true,"os": [@@ -7144,6 +7045,7 @@"cpu": ["x64"],+ "dev": true,"license": "MPL-2.0","optional": true,"os": [@@ -7164,6 +7066,7 @@"cpu": ["arm"],+ "dev": true,"license": "MPL-2.0","optional": true,"os": [@@ -7184,6 +7087,7 @@"cpu": ["arm64"],+ "dev": true,"license": "MPL-2.0","optional": true,"os": [@@ -7204,6 +7108,7 @@"cpu": ["arm64"],+ "dev": true,"license": "MPL-2.0","optional": true,"os": [@@ -7224,6 +7129,7 @@"cpu": ["x64"],+ "dev": true,"license": "MPL-2.0","optional": true,"os": [@@ -7244,6 +7150,7 @@"cpu": ["x64"],+ "dev": true,"license": "MPL-2.0","optional": true,"os": [@@ -7264,6 +7171,7 @@"cpu": ["arm64"],+ "dev": true,"license": "MPL-2.0","optional": true,"os": [@@ -7284,6 +7192,7 @@"cpu": ["x64"],+ "dev": true,"license": "MPL-2.0","optional": true,"os": [@@ -7350,16 +7259,6 @@"yallist": "^3.0.2"}},- "node_modules/magic-string": {- "version": "0.30.21",- "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz",- "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==",- "license": "MIT",- "peer": true,- "dependencies": {- "@jridgewell/sourcemap-codec": "^1.5.5"- }- },"node_modules/math-intrinsics": {"version": "1.1.0","resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",@@ -7487,6 +7386,7 @@"version": "3.3.15","resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.15.tgz","integrity": "sha512-y7Wygv/7mEOvxTuEQDB8StXdMRBWf1kR/tlhAzBRUFkB2jfcLOAxO/SHmOO2zgz1pVgK29/kyupn059/bCHdjA==",+ "dev": true,"funding": [{"type": "github",@@ -7877,12 +7777,14 @@"version": "1.1.1","resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz","integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",+ "dev": true,"license": "ISC"},"node_modules/picomatch": {"version": "4.0.4","resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz","integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==",+ "dev": true,"license": "MIT","engines": {"node": ">=12"@@ -7945,6 +7847,7 @@"version": "8.5.16","resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.16.tgz","integrity": "sha512-vuwillviilfKZsg0VGj5R/YwwcHx4SLsIOI/7K6mQkWx+l5cUHTjj5g0AasTBcyXsbfTgrwsUNmVUb5xVwyPwg==",+ "dev": true,"funding": [{"type": "opencollective",@@ -8320,6 +8223,7 @@"version": "1.1.3","resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.1.3.tgz","integrity": "sha512-1F1eEtUBtFvcGm1HQ9TiUIUHPQG7mSAODrhIzjxoUEFuo8OcbrGLiVLkevNgj84TE4lnHvnumwFjhJO5Eu135g==",+ "dev": true,"license": "MIT","dependencies": {"@oxc-project/types": "=0.137.0",@@ -8748,6 +8652,7 @@"version": "1.2.1","resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz","integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",+ "dev": true,"license": "BSD-3-Clause","engines": {"node": ">=0.10.0"@@ -8996,6 +8901,7 @@"version": "0.2.17","resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz","integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==",+ "dev": true,"license": "MIT","dependencies": {"fdir": "^6.5.0",@@ -9078,6 +8984,7 @@"version": "2.8.1","resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz","integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",+ "dev": true,"license": "0BSD","optional": true},@@ -9219,7 +9126,7 @@"version": "6.0.3","resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz","integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==",- "devOptional": true,+ "dev": true,"license": "Apache-2.0","bin": {"tsc": "bin/tsc",@@ -9262,7 +9169,7 @@"version": "6.21.0","resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz","integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",- "devOptional": true,+ "dev": true,"license": "MIT"},"node_modules/universal-user-agent": {@@ -9337,6 +9244,7 @@"version": "8.1.0","resolved": "https://registry.npmjs.org/vite/-/vite-8.1.0.tgz","integrity": "sha512-BuJcQK/56NQTWDGn4ABea3q4SSBdNPWwNZKTkkUpcMPnLoquSYH8llRtSUIgoL1KSCpHt5eghLShn50mH36y7Q==",+ "dev": true,"license": "MIT","dependencies": {"lightningcss": "^1.32.0",@@ -9433,28 +9341,6 @@"vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"}},- "node_modules/vue": {- "version": "3.5.39",- "resolved": "https://registry.npmjs.org/vue/-/vue-3.5.39.tgz",- "integrity": "sha512-xmZCYabFGcirU8r0fTuvl/LICc1OU620rnqepaJDL/a141ZigkG7AyaxQLdqJ02ZRYzWe6YPaDHeQx7MfknQfA==",- "license": "MIT",- "peer": true,- "dependencies": {- "@vue/compiler-dom": "3.5.39",- "@vue/compiler-sfc": "3.5.39",- "@vue/runtime-dom": "3.5.39",- "@vue/server-renderer": "3.5.39",- "@vue/shared": "3.5.39"- },- "peerDependencies": {- "typescript": "*"- },- "peerDependenciesMeta": {- "typescript": {- "optional": true- }- }- },"node_modules/web": {"resolved": "packages/web","link": true@@ -9836,64 +9722,6 @@"node": ">=20"}},- "packages/playwright-ct-core": {- "name": "@playwright/experimental-ct-core",- "version": "1.63.0-next",- "license": "Apache-2.0",- "dependencies": {- "playwright": "1.63.0-next",- "playwright-core": "1.63.0-next",- "vite": "^8.1.0"- },- "engines": {- "node": ">=20"- }- },- "packages/playwright-ct-react": {- "name": "@playwright/experimental-ct-react",- "version": "1.63.0-next",- "license": "Apache-2.0",- "dependencies": {- "@playwright/experimental-ct-core": "1.63.0-next",- "@vitejs/plugin-react": "^6.0.3"- },- "bin": {- "playwright": "cli.js"- },- "engines": {- "node": ">=20"- }- },- "packages/playwright-ct-react17": {- "name": "@playwright/experimental-ct-react17",- "version": "1.63.0-next",- "license": "Apache-2.0",- "dependencies": {- "@playwright/experimental-ct-core": "1.63.0-next",- "@vitejs/plugin-react": "^6.0.3"- },- "bin": {- "playwright": "cli.js"- },- "engines": {- "node": ">=20"- }- },- "packages/playwright-ct-vue": {- "name": "@playwright/experimental-ct-vue",- "version": "1.63.0-next",- "license": "Apache-2.0",- "dependencies": {- "@playwright/experimental-ct-core": "1.63.0-next",- "@vitejs/plugin-vue": "^6.0.7"- },- "bin": {- "playwright": "cli.js"- },- "engines": {- "node": ">=20"- }- },"packages/playwright-firefox": {"version": "1.63.0-next","hasInstallScript": true,diff --git a/package.json b/package.jsonindex 980944675c..90a2210955 100644--- a/package.json+++ b/package.json@@ -28,7 +28,6 @@"test-html-reporter": "playwright test --config=packages/html-reporter","test-web": "playwright test --config=packages/web","ttest": "node ./tests/playwright-test/stable-test-runner/node_modules/@playwright/test/cli test --config=tests/playwright-test/playwright.config.ts",- "ct": "playwright test tests/components/test-all.spec.js --reporter=list","test": "playwright test --config=tests/library/playwright.config.ts","test-mcp": "playwright test --config=tests/mcp/playwright.config.ts","ctest-mcp": "playwright test --config=tests/mcp/playwright.config.ts --project=chrome",diff --git a/packages/playwright-core/src/tools/skills/playwright-component-testing/references/migration.md b/packages/playwright-core/src/tools/skills/playwright-component-testing/references/migration.mdindex 13eb9ec768..d88c85b9be 100644--- a/packages/playwright-core/src/tools/skills/playwright-component-testing/references/migration.md+++ b/packages/playwright-core/src/tools/skills/playwright-component-testing/references/migration.md@@ -22,6 +22,9 @@ form for the test to assert on). Plain data props travel through `mount(storyId,| `ctViteConfig`, `ctPort`, `ctTemplateDir`, `ctCacheDir` | Gone — the gallery runs through the app's own dev server; port lives in `webServer` + `baseURL`; location is `playwright/gallery/` || `defineConfig` from `@playwright/experimental-ct-react` | Plain `defineConfig` from `@playwright/test`, with `baseURL` = gallery URL, `serviceWorkers: 'block'`, `reuseContext: true` (see `SKILL.md`) |+The CT packages were removed in Playwright 1.63 and are no longer published, so migrate while+pinned to Playwright 1.62 and upgrade once the last spec is ported.+## Steps1. Set up the gallery and config per `SKILL.md`. Keep the old CT project running until the last@@ -39,8 +42,8 @@ form for the test to assert on). Plain data props travel through `mount(storyId,4. Port `beforeMount` hooks: app-wide setup into the gallery's `window.mount`; per-test`hooksConfig` branches into props interpreted by a story or decorator.5. When all specs are green, delete the CT project from the config, drop the- `@playwright/experimental-ct-*` dependency, and remove `playwright/index.html`,- `playwright/index.ts*` and `playwright/.cache`.+ `@playwright/experimental-ct-*` dependency, remove `playwright/index.html`,+ `playwright/index.ts*` and `playwright/.cache`, and lift the Playwright version pin.## Gotchasdiff --git a/packages/playwright-ct-core/.npmignore b/packages/playwright-ct-core/.npmignoredeleted file mode 100644index fd3a0b88d5..0000000000--- a/packages/playwright-ct-core/.npmignore+++ /dev/null@@ -1,10 +0,0 @@-**/*--!README.md-!LICENSE-!cli.js-!lib/**-!types/**-!index.d.ts-!index.js-diff --git a/packages/playwright-ct-core/README.md b/packages/playwright-ct-core/README.mddeleted file mode 100644index 23ae82312d..0000000000--- a/packages/playwright-ct-core/README.md+++ /dev/null@@ -1,3 +0,0 @@-> **BEWARE** This package is EXPERIMENTAL and does not respect semver.--Read more at https://playwright.dev/docs/test-componentsdiff --git a/packages/playwright-ct-core/index.d.ts b/packages/playwright-ct-core/index.d.tsdeleted file mode 100644index a7a3320af0..0000000000--- a/packages/playwright-ct-core/index.d.ts+++ /dev/null@@ -1,58 +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 type {- TestType as BaseTestType,- PlaywrightTestArgs,- PlaywrightTestConfig as BasePlaywrightTestConfig,- PlaywrightTestOptions,- PlaywrightWorkerArgs,- PlaywrightWorkerOptions,- BrowserContext,-} from 'playwright/test';-import type { InlineConfig } from 'vite';--export type PlaywrightTestConfig<T = {}, W = {}> = Omit<BasePlaywrightTestConfig<T, W>, 'use'> & {- use?: BasePlaywrightTestConfig<T, W>['use'] & {- ctPort?: number;- ctTemplateDir?: string;- ctCacheDir?: string;- ctViteConfig?: InlineConfig | (() => Promise<InlineConfig>);- };-};--interface RequestHandler {- run(args: { request: Request, requestId?: string, resolutionContext?: { baseUrl?: string } }): Promise<{ response?: Response } | null>;-}--export interface RouterFixture {- route(...args: Parameters<BrowserContext['route']>): Promise<any>;- use(...handlers: RequestHandler[]): Promise<void>;-}--export type TestType<ComponentFixtures> = BaseTestType<- PlaywrightTestArgs & PlaywrightTestOptions & ComponentFixtures & { router: RouterFixture },- PlaywrightWorkerArgs & PlaywrightWorkerOptions->;--export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig;-export function defineConfig<T>(config: PlaywrightTestConfig<T>): PlaywrightTestConfig<T>;-export function defineConfig<T, W>(config: PlaywrightTestConfig<T, W>): PlaywrightTestConfig<T, W>;-export function defineConfig(config: PlaywrightTestConfig, ...configs: PlaywrightTestConfig[]): PlaywrightTestConfig;-export function defineConfig<T>(config: PlaywrightTestConfig<T>, ...configs: PlaywrightTestConfig<T>[]): PlaywrightTestConfig<T>;-export function defineConfig<T, W>(config: PlaywrightTestConfig<T, W>, ...configs: PlaywrightTestConfig<T, W>[]): PlaywrightTestConfig<T, W>;--export { expect, devices, Locator } from 'playwright/test';diff --git a/packages/playwright-ct-core/index.js b/packages/playwright-ct-core/index.jsdeleted file mode 100644index 1a4f185a31..0000000000--- a/packages/playwright-ct-core/index.js+++ /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.- */--const { test: baseTest, expect, devices, defineConfig: originalDefineConfig } = require('playwright/test');-const { fixtures } = require('./lib/mount');-const { createPlugin } = require('./lib/vitePlugin');--const defineConfig = (...configs) => {- const original = originalDefineConfig(...configs);- return {- ...original,- '@playwright/test': {- ...original['@playwright/test'],- plugins: [() => createPlugin()],- babelPlugins: [- [require.resolve('./lib/tsxTransform')]- ],- }- };-};--const test = baseTest.extend(fixtures);--module.exports = { test, expect, devices, defineConfig };diff --git a/packages/playwright-ct-core/package.json b/packages/playwright-ct-core/package.jsondeleted file mode 100644index 4a008df6c8..0000000000--- a/packages/playwright-ct-core/package.json+++ /dev/null@@ -1,33 +0,0 @@-{- "name": "@playwright/experimental-ct-core",- "version": "1.63.0-next",- "description": "Playwright Component Testing Helpers",- "repository": {- "type": "git",- "url": "git+https://github.com/microsoft/playwright.git"- },- "homepage": "https://playwright.dev",- "engines": {- "node": ">=20"- },- "author": {- "name": "Microsoft Corporation"- },- "license": "Apache-2.0",- "exports": {- ".": {- "types": "./index.d.ts",- "default": "./index.js"- },- "./lib/mount": "./lib/mount.js",- "./lib/program": "./lib/program.js",- "./types/component": {- "types": "./types/component.d.ts"- }- },- "dependencies": {- "playwright-core": "1.63.0-next",- "vite": "^8.1.0",- "playwright": "1.63.0-next"- }-}diff --git a/packages/playwright-ct-core/src/DEPS.list b/packages/playwright-ct-core/src/DEPS.listdeleted file mode 100644index 58cf2e435d..0000000000--- a/packages/playwright-ct-core/src/DEPS.list+++ /dev/null@@ -1,7 +0,0 @@-[vitePlugin.ts]-generated/indexSource.ts--[viteDevPlugin.ts]--[mount.ts]-injected/**diff --git a/packages/playwright-ct-core/src/injected/importRegistry.ts b/packages/playwright-ct-core/src/injected/importRegistry.tsdeleted file mode 100644index 1f5c1adf4c..0000000000--- a/packages/playwright-ct-core/src/injected/importRegistry.ts+++ /dev/null@@ -1,55 +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.- */--export type ImportRef = {- __pw_type: 'importRef',- id: string,- property?: string,-};--export function isImportRef(value: any): value is ImportRef {- return typeof value === 'object' && value && value.__pw_type === 'importRef';-}--export class ImportRegistry {- private _registry = new Map<string, () => Promise<any>>();-- initialize(components: Record<string, () => Promise<any>>) {- for (const [name, value] of Object.entries(components))- this._registry.set(name, value);- }-- async resolveImportRef(importRef: ImportRef): Promise<any> {- const importFunction = this._registry.get(importRef.id);- if (!importFunction)- throw new Error(`Unregistered component: ${importRef.id}. Following components are registered: ${[...this._registry.keys()]}`);- let importedObject = await importFunction();- if (!importedObject)- throw new Error(`Could not resolve component: ${importRef.id}.`);- if (importRef.property) {- importedObject = importedObject[importRef.property];- if (!importedObject)- throw new Error(`Could not instantiate component: ${importRef.id}.${importRef.property}.`);- }- return importedObject;- }-}--declare global {- interface Window {- __pwRegistry: ImportRegistry;- }-}diff --git a/packages/playwright-ct-core/src/injected/index.ts b/packages/playwright-ct-core/src/injected/index.tsdeleted file mode 100644index 2238574353..0000000000--- a/packages/playwright-ct-core/src/injected/index.ts+++ /dev/null@@ -1,22 +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 { ImportRegistry } from './importRegistry';-import { transformObject, unwrapObject } from './serializers';--window.__pwRegistry = new ImportRegistry();-window.__pwUnwrapObject = unwrapObject;-window.__pwTransformObject = transformObject;diff --git a/packages/playwright-ct-core/src/injected/serializers.ts b/packages/playwright-ct-core/src/injected/serializers.tsdeleted file mode 100644index 3d9fee5e76..0000000000--- a/packages/playwright-ct-core/src/injected/serializers.ts+++ /dev/null@@ -1,78 +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 { isImportRef } from './importRegistry';--// Validates that the component tree does not reference components defined in-// the test file. Functions in the tree are passed to evaluate() as arguments-// and materialize as callbacks in the page.-export function validateComponent(value: any) {- transformObject(value, () => undefined);-}--export async function unwrapObject(value: any): Promise<any> {- return transformObjectAsync(value, async (v: any) => {- if (isImportRef(v))- return { result: await window.__pwRegistry.resolveImportRef(v) };- });-}--export function transformObject(value: any, mapping: (v: any) => { result: any } | undefined): any {- const result = mapping(value);- if (result)- return result.result;- if (value === null || typeof value !== 'object')- return value;- if (value instanceof Date || value instanceof RegExp || value instanceof URL)- return value;- if (Array.isArray(value)) {- const result = [];- for (const item of value)- result.push(transformObject(item, mapping));- return result;- }- if (value?.__pw_type === 'jsx' && typeof value.type === 'function') {- throw new Error([- `Component "${value.type.name}" cannot be mounted.`,- `Most likely, this component is defined in the test file. Create a test story instead.`,- `For more information, see https://playwright.dev/docs/test-components#test-stories.`,- ].join('\n'));- }- const result2: any = {};- for (const [key, prop] of Object.entries(value))- result2[key] = transformObject(prop, mapping);- return result2;-}--export async function transformObjectAsync(value: any, mapping: (v: any) => Promise<{ result: any } | undefined>): Promise<any> {- const result = await mapping(value);- if (result)- return result.result;- if (value === null || typeof value !== 'object')- return value;- if (value instanceof Date || value instanceof RegExp || value instanceof URL)- return value;- if (Array.isArray(value)) {- const result = [];- for (const item of value)- result.push(await transformObjectAsync(item, mapping));- return result;- }- const result2: any = {};- for (const [key, prop] of Object.entries(value))- result2[key] = await transformObjectAsync(prop, mapping);- return result2;-}diff --git a/packages/playwright-ct-core/src/mount.ts b/packages/playwright-ct-core/src/mount.tsdeleted file mode 100644index 294a83cd33..0000000000--- a/packages/playwright-ct-core/src/mount.ts+++ /dev/null@@ -1,133 +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 { validateComponent } from './injected/serializers';-import { Router } from './router';--import type { config, FullConfigInternal } from 'playwright/lib/common';-import type { RouterFixture } from '../index';-import type { ImportRef } from './injected/importRegistry';-import type { Component, JsxComponent, MountOptions, ObjectComponentOptions } from '../types/component';-import type { Fixtures, Locator, Page, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions } from 'playwright/test';-import type { Page as PageImpl } from 'playwright-core/lib/client/page';--interface MountResult extends Locator {- unmount: () => Promise<void>;- update: (options: ObjectComponentOptions | JsxComponent) => Promise<void>;-}--type TestFixtures = Omit<PlaywrightTestArgs, 'mount'> & PlaywrightTestOptions & {- mount: (component: any, options: any) => Promise<MountResult>;- router: RouterFixture;-};-type WorkerFixtures = PlaywrightWorkerArgs & PlaywrightWorkerOptions;-type BaseTestFixtures = {- _optionContextReuseMode: config.ContextReuseMode-};--export const fixtures: Fixtures<TestFixtures, WorkerFixtures, BaseTestFixtures> = {-- _optionContextReuseMode: 'when-possible',-- serviceWorkers: 'block',-- page: async ({ page }, use, info) => {- if (!((info as any)._configInternal as FullConfigInternal).defineConfigWasUsed)- throw new Error('Component testing requires the use of the defineConfig() in your playwright-ct.config.{ts,js}: https://aka.ms/playwright/ct-define-config');- if (!process.env.PLAYWRIGHT_TEST_BASE_URL)- throw new Error('Component testing could not determine the base URL of your component under test. Ensure you have supplied a template playwright/index.html or have set the PLAYWRIGHT_TEST_BASE_URL environment variable.');- await (page as PageImpl)._wrapApiCall(async () => {- await page.goto(process.env.PLAYWRIGHT_TEST_BASE_URL!);- }, { internal: true });- await use(page);- },-- mount: async ({ page }, use) => {- await use(async (componentRef: JsxComponent | ImportRef, options?: ObjectComponentOptions & MountOptions) => {- const selector = await (page as PageImpl)._wrapApiCall(async () => {- return await innerMount(page, componentRef, options);- }, { internal: true });- const locator = page.locator(selector);- return Object.assign(locator, {- unmount: async () => {- await locator.evaluate(async () => {- const rootElement = document.getElementById('root')!;- await window.playwrightUnmount(rootElement);- });- },- update: async (options: JsxComponent | ObjectComponentOptions) => {- if (isJsxComponent(options))- return await innerUpdate(page, options);- await innerUpdate(page, componentRef, options);- }- });- });- },-- router: async ({ context, baseURL }, use) => {- const router = new Router(context, baseURL);- await use(router);- await router.dispose();- },-};--function isJsxComponent(component: any): component is JsxComponent {- return typeof component === 'object' && component && component.__pw_type === 'jsx';-}--async function innerUpdate(page: Page, componentRef: JsxComponent | ImportRef, options: ObjectComponentOptions = {}): Promise<void> {- const component = createComponent(componentRef, options);- validateComponent(component);-- await page.evaluate(async ({ component }) => {- component = await window.__pwUnwrapObject(component);- const rootElement = document.getElementById('root')!;- return await window.playwrightUpdate(rootElement, component);- }, { component }, { exposeFunctions: true });-}--async function innerMount(page: Page, componentRef: JsxComponent | ImportRef, options: ObjectComponentOptions & MountOptions = {}): Promise<string> {- const component = createComponent(componentRef, options);- validateComponent(component);-- // WebKit does not wait for deferred scripts.- await page.waitForFunction(() => !!window.playwrightMount);-- const selector = await page.evaluate(async ({ component, hooksConfig }) => {- component = await window.__pwUnwrapObject(component);- hooksConfig = await window.__pwUnwrapObject(hooksConfig);- let rootElement = document.getElementById('root');- if (!rootElement) {- rootElement = document.createElement('div');- rootElement.id = 'root';- document.body.appendChild(rootElement);- }- await window.playwrightMount(component, rootElement, hooksConfig);-- return '#root >> internal:control=component';- }, { component, hooksConfig: options.hooksConfig }, { exposeFunctions: true });- return selector;-}--function createComponent(component: JsxComponent | ImportRef, options: ObjectComponentOptions = {}): Component {- if (component.__pw_type === 'jsx')- return component;- return {- __pw_type: 'object-component',- type: component,- ...options,- };-}diff --git a/packages/playwright-ct-core/src/program.ts b/packages/playwright-ct-core/src/program.tsdeleted file mode 100644index 3014578d69..0000000000--- a/packages/playwright-ct-core/src/program.ts+++ /dev/null@@ -1,17 +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.- */--export { program } from 'playwright/lib/program';diff --git a/packages/playwright-ct-core/src/router.ts b/packages/playwright-ct-core/src/router.tsdeleted file mode 100644index b27d5242b2..0000000000--- a/packages/playwright-ct-core/src/router.ts+++ /dev/null@@ -1,189 +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 type * as playwright from 'playwright/test';--interface RequestHandler {- run(args: { request: Request, requestId?: string, resolutionContext?: { baseUrl?: string } }): Promise<{ response?: Response } | null>;-}--type RouteArgs = Parameters<playwright.BrowserContext['route']>;--let lastRequestId = 0;-let fetchOverrideCounter = 0;-const currentlyInterceptingInContexts = new Map<playwright.BrowserContext, number>();-const originalFetch = globalThis.fetch;--async function executeRequestHandlers(request: Request, handlers: RequestHandler[], baseUrl: string | undefined): Promise<Response | undefined> {- const requestId = String(++lastRequestId);- const resolutionContext = { baseUrl };- for (const handler of handlers) {- const result = await handler.run({ request, requestId, resolutionContext });- if (result?.response)- return result.response;- }-}--function isMswRequestPassthrough(headers: Headers): boolean {- if (headers.get('x-msw-intention') === 'bypass')- return true;- // After MSW v2.6.4- // https://github.com/mswjs/msw/commit/2fa98c327acc51189f87789d9155c4ec57be2299- if (headers.get('accept')?.includes('msw/passthrough'))- return true;- return false;-}--async function globalFetch(...args: Parameters<typeof globalThis.fetch>) {- if (args[0] && args[0] instanceof Request) {- const request = args[0];- if (isMswRequestPassthrough(request.headers)) {- const cookieHeaders = await Promise.all([...currentlyInterceptingInContexts.keys()].map(async context => {- const cookies = await context.cookies(request.url);- if (!cookies.length)- return undefined;- return cookies.map(c => `${c.name}=${c.value}`).join('; ');- }));-- if (!cookieHeaders.length)- throw new Error(`Cannot call fetch(bypass()) outside of a request handler`);-- if (cookieHeaders.some(h => h !== cookieHeaders[0]))- throw new Error(`Cannot call fetch(bypass()) while concurrently handling multiple requests from different browser contexts`);-- const headers = new Headers(request.headers);- headers.set('cookie', cookieHeaders[0]!);- {- // pre 2.6.4- headers.delete('x-msw-intention');- // post 2.6.4- const accept = headers.get('accept')?.split(',').filter(h => !h.includes('msw/')).join(',');- if (accept)- headers.set('accept', accept);- else- headers.delete('accept');- }- args[0] = new Request(request.clone(), { headers });- }- }- return originalFetch(...args);-}--export class Router {- private _context: playwright.BrowserContext;- private _requestHandlers: RequestHandler[] = [];- private _requestHandlersRoute: (route: playwright.Route) => Promise<void>;- private _requestHandlersActive = false;- private _routes: RouteArgs[] = [];-- constructor(context: playwright.BrowserContext, baseURL: string | undefined) {- this._context = context;-- this._requestHandlersRoute = async route => {- if (route.request().isNavigationRequest()) {- await route.fallback();- return;- }-- const request = route.request();- const headersArray = await request.headersArray();- const headers = new Headers();- for (const { name, value } of headersArray)- headers.append(name, value);-- const buffer = request.postDataBuffer();- const body = buffer?.byteLength ? new Int8Array(buffer.buffer as ArrayBuffer, buffer.byteOffset, buffer.length) : undefined;-- const newRequest = new Request(request.url(), {- body: body,- headers: headers,- method: request.method(),- referrer: headersArray.find(h => h.name.toLowerCase() === 'referer')?.value,- });-- currentlyInterceptingInContexts.set(context, 1 + (currentlyInterceptingInContexts.get(context) || 0));- const response = await executeRequestHandlers(newRequest, this._requestHandlers, baseURL).finally(() => {- const value = currentlyInterceptingInContexts.get(context)! - 1;- if (value)- currentlyInterceptingInContexts.set(context, value);- else- currentlyInterceptingInContexts.delete(context);- });-- if (!response) {- await route.fallback();- return;- }-- if (response.status === 302 && response.headers.get('x-msw-intention') === 'passthrough') {- await route.continue();- return;- }-- if (response.type === 'error') {- await route.abort();- return;- }-- const responseHeaders: Record<string, string> = {};- for (const [name, value] of response.headers.entries()) {- if (responseHeaders[name])- responseHeaders[name] = responseHeaders[name] + (name.toLowerCase() === 'set-cookie' ? '\n' : ', ') + value;- else- responseHeaders[name] = value;- }- await route.fulfill({- status: response.status,- body: Buffer.from(await response.arrayBuffer()),- headers: responseHeaders,- });- };- }-- async route(...routeArgs: RouteArgs) {- this._routes.push(routeArgs);- return await this._context.route(...routeArgs);- }-- async use(...handlers: RequestHandler[]) {- this._requestHandlers = handlers.concat(this._requestHandlers);- await this._updateRequestHandlersRoute();- }-- async dispose() {- this._requestHandlers = [];- await this._updateRequestHandlersRoute();- for (const route of this._routes)- await this._context.unroute(route[0], route[1]);- }-- private async _updateRequestHandlersRoute() {- if (this._requestHandlers.length && !this._requestHandlersActive) {- await this._context.route('**/*', this._requestHandlersRoute);- if (!fetchOverrideCounter)- globalThis.fetch = globalFetch;- ++fetchOverrideCounter;- this._requestHandlersActive = true;- }- if (!this._requestHandlers.length && this._requestHandlersActive) {- await this._context.unroute('**/*', this._requestHandlersRoute);- this._requestHandlersActive = false;- --fetchOverrideCounter;- if (!fetchOverrideCounter)- globalThis.fetch = originalFetch;- }- }-}diff --git a/packages/playwright-ct-core/src/tsxTransform.ts b/packages/playwright-ct-core/src/tsxTransform.tsdeleted file mode 100644index 6601c19cf1..0000000000--- a/packages/playwright-ct-core/src/tsxTransform.ts+++ /dev/null@@ -1,199 +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 path from 'path';--import * as babel from 'playwright/lib/transform/babelBundle';--const t: typeof babel.T = babel.types;--let jsxComponentNames: Set<string>;-let importInfos: Map<string, ImportInfo>;--type TsxTransformOptions = {- setTransformData: (key: string, value: any) => void;-};--export default babel.declare((api: babel.BabelAPI, options: TsxTransformOptions) => {- api.assertVersion(7);-- const result: babel.PluginObj = {- name: 'playwright-debug-transform',- visitor: {- Program: {- enter(path) {- jsxComponentNames = collectJsxComponentUsages(path.node);- importInfos = new Map();- },- exit(path) {- let firstDeclaration: any;- let lastImportDeclaration: any;- path.get('body').forEach(p => {- if (p.isImportDeclaration())- lastImportDeclaration = p;- else if (!firstDeclaration)- firstDeclaration = p;- });- const insertionPath = lastImportDeclaration || firstDeclaration;- if (!insertionPath)- return;-- for (const [localName, componentImport] of [...importInfos.entries()].reverse()) {- insertionPath.insertAfter(- t.variableDeclaration(- 'const',- [- t.variableDeclarator(- t.identifier(localName),- t.objectExpression([- t.objectProperty(t.identifier('__pw_type'), t.stringLiteral('importRef')),- t.objectProperty(t.identifier('id'), t.stringLiteral(componentImport.id)),- ]),- )- ]- )- );- }- options.setTransformData('playwright-ct-core', [...importInfos.values()]);- }- },-- ImportDeclaration(p) {- const importNode = p.node;- if (!t.isStringLiteral(importNode.source))- return;-- const ext = path.extname(importNode.source.value);-- // Convert all non-JS imports into refs.- if (artifactExtensions.has(ext)) {- for (const specifier of importNode.specifiers) {- if (t.isImportNamespaceSpecifier(specifier))- continue;- const { localName, info } = importInfo(importNode, specifier, this.filename!);- importInfos.set(localName, info);- }- p.skip();- p.remove();- return;- }-- // Convert JS imports that are used as components in JSX expressions into refs.- let importCount = 0;- for (const specifier of importNode.specifiers) {- if (t.isImportNamespaceSpecifier(specifier))- continue;- const { localName, info } = importInfo(importNode, specifier, this.filename!);- if (jsxComponentNames.has(localName)) {- importInfos.set(localName, info);- ++importCount;- }- }-- // All the imports were from JSX => delete.- if (importCount && importCount === importNode.specifiers.length) {- p.skip();- p.remove();- }- },-- MemberExpression(path) {- if (!t.isIdentifier(path.node.object))- return;- if (!importInfos.has(path.node.object.name))- return;- if (!t.isIdentifier(path.node.property))- return;- path.replaceWith(- t.objectExpression([- t.spreadElement(t.identifier(path.node.object.name)),- t.objectProperty(t.identifier('property'), t.stringLiteral(path.node.property.name)),- ])- );- },- }- };- return result;-});--function collectJsxComponentUsages(node: babel.T.Node): Set<string> {- const names = new Set<string>();- babel.traverse(node, {- enter: p => {- // Treat JSX-everything as component usages.- if (t.isJSXElement(p.node)) {- if (t.isJSXIdentifier(p.node.openingElement.name))- names.add(p.node.openingElement.name.name);- if (t.isJSXMemberExpression(p.node.openingElement.name) && t.isJSXIdentifier(p.node.openingElement.name.object) && t.isJSXIdentifier(p.node.openingElement.name.property))- names.add(p.node.openingElement.name.object.name);- }- }- });- return names;-}--export type ImportInfo = {- id: string;- filename: string;- importSource: string;- remoteName: string | undefined;-};--export function importInfo(importNode: babel.T.ImportDeclaration, specifier: babel.T.ImportSpecifier | babel.T.ImportDefaultSpecifier, filename: string): { localName: string, info: ImportInfo } {- const importSource = importNode.source.value;- const idPrefix = path.join(filename, '..', importSource).replace(/[^\w_\d]/g, '_');-- const result: ImportInfo = {- id: idPrefix,- filename,- importSource,- remoteName: undefined,- };-- if (t.isImportDefaultSpecifier(specifier)) {- } else if (t.isIdentifier(specifier.imported)) {- result.remoteName = specifier.imported.name;- } else {- result.remoteName = specifier.imported.value;- }-- if (result.remoteName)- result.id += '_' + result.remoteName;- return { localName: specifier.local.name, info: result };-}--const artifactExtensions = new Set([- // Frameworks- '.vue',-- // Images- '.jpg', '.jpeg',- '.png',- '.gif',- '.svg',- '.bmp',- '.webp',- '.ico',-- // CSS- '.css',-- // Fonts- '.woff', '.woff2',- '.ttf',- '.otf',- '.eot',-]);diff --git a/packages/playwright-ct-core/src/vitePlugin.ts b/packages/playwright-ct-core/src/vitePlugin.tsdeleted file mode 100644index f018d115b4..0000000000--- a/packages/playwright-ct-core/src/vitePlugin.ts+++ /dev/null@@ -1,290 +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 fs from 'fs';-import path from 'path';--import { iso, utils, getPlaywrightVersion } from 'playwright-core/lib/coreBundle';-import { colors, debug } from 'playwright-core/lib/utilsBundle';-import { cc, transform } from 'playwright/lib/common';-import { removeDirAndLogToConsole } from 'playwright/lib/util';--import { source as injectedSource } from './generated/indexSource';-import { createConfig, frameworkConfig, hasJSComponents, populateComponentsFromTests, resolveDirs, transformIndexFile } from './viteUtils';--import type http from 'http';-import type { AddressInfo } from 'net';-import type { FullConfig, Suite } from 'playwright/types/testReporter';-import type { Plugin, ResolveFn, ResolvedConfig, Rollup } from 'vite';-import type { TestRunnerPlugin } from '../../playwright/src/plugins';-import type { ImportInfo } from './tsxTransform';-import type { ComponentRegistry } from './viteUtils';---const log = debug('pw:vite');--let previewHttpServer: http.Server | undefined;-const playwrightVersion = getPlaywrightVersion();--export function createPlugin(): TestRunnerPlugin {- let configDir: string;- let config: FullConfig;- return {- name: 'playwright-vite-plugin',-- setup: async (configObject: FullConfig, configDirectory: string) => {- config = configObject;- configDir = configDirectory;- },-- begin: async (suite: Suite) => {- const result = await buildBundle(config, configDir);- if (!result)- return;-- const { viteConfig } = result;- const { preview } = await import('vite');- const previewServer = await preview(viteConfig);- previewHttpServer = previewServer.httpServer as http.Server;- utils.decorateServer(previewHttpServer);- const isAddressInfo = (x: any): x is AddressInfo => x?.address;- const address = previewServer.httpServer.address();- if (isAddressInfo(address)) {- const protocol = viteConfig.preview.https ? 'https:' : 'http:';- process.env.PLAYWRIGHT_TEST_BASE_URL = `${protocol}//${viteConfig.preview.host}:${address.port}`;- }- },-- end: async () => {- if (previewHttpServer)- await new Promise<void>(f => previewHttpServer!.close(() => f()));- },-- populateDependencies: async () => {- await buildBundle(config, configDir);- },-- clearCache: async () => {- const configDir = config.configFile ? path.dirname(config.configFile) : config.rootDir;- const dirs = await resolveDirs(configDir, config);- if (dirs)- await removeDirAndLogToConsole(dirs.outDir);- },- };-}--type BuildInfo = {- version: string,- viteVersion: string,- registerSourceHash: string,- sources: {- [key: string]: {- timestamp: number;- }- };- components: ImportInfo[];- deps: {- [key: string]: string[];- }-};--export async function buildBundle(config: FullConfig, configDir: string): Promise<{ buildInfo: BuildInfo, viteConfig: Record<string, any> } | null> {- const { registerSourceFile, frameworkPluginFactory } = frameworkConfig(config);- const dirs = await resolveDirs(configDir, config);- if (!dirs) {- // eslint-disable-next-line no-console- console.log(colors.red(`Component testing template file playwright/index.html is missing and there is no existing Vite server. Component tests will fail.\n`));- return null;- }-- const buildInfoFile = path.join(dirs.outDir, 'metainfo.json');-- let buildExists = false;- let buildInfo: BuildInfo;-- const registerSource = injectedSource + '\n' + await fs.promises.readFile(registerSourceFile, 'utf-8');- const registerSourceHash = utils.calculateSha1(registerSource);-- const { version: viteVersion, build, mergeConfig } = await import('vite');-- try {- buildInfo = JSON.parse(await fs.promises.readFile(buildInfoFile, 'utf-8')) as BuildInfo;- iso.assert(buildInfo.version === playwrightVersion);- iso.assert(buildInfo.viteVersion === viteVersion);- iso.assert(buildInfo.registerSourceHash === registerSourceHash);- buildExists = true;- } catch (e) {- buildInfo = {- version: playwrightVersion,- viteVersion,- registerSourceHash,- components: [],- sources: {},- deps: {},- };- }- log('build exists:', buildExists);-- const componentRegistry: ComponentRegistry = new Map();- const componentsByImportingFile = new Map<string, string[]>();- // 1. Populate component registry based on tests' component imports.- await populateComponentsFromTests(componentRegistry, componentsByImportingFile);-- // 2. Check if the set of required components has changed.- const hasNewComponents = await checkNewComponents(buildInfo, componentRegistry);- log('has new components:', hasNewComponents);-- // 3. Check component sources.- const sourcesDirty = !buildExists || hasNewComponents || await checkSources(buildInfo);- log('sourcesDirty:', sourcesDirty);-- // 4. Update component info.- buildInfo.components = [...componentRegistry.values()];-- const jsxInJS = hasJSComponents(buildInfo.components);- const viteConfig = await createConfig(dirs, config, frameworkPluginFactory, jsxInJS);-- if (sourcesDirty) {- // Only add our own plugin when we actually build / transform.- log('build');- const depsCollector = new Map<string, string[]>();- const buildConfig = mergeConfig(viteConfig, {- plugins: [vitePlugin(registerSource, dirs.templateDir, buildInfo, componentRegistry, depsCollector)]- });- await build(buildConfig);- buildInfo.deps = Object.fromEntries(depsCollector.entries());- }-- {- // Update dependencies based on the vite build.- for (const [importingFile, components] of componentsByImportingFile) {- const deps = new Set<string>();- for (const component of components) {- for (const d of buildInfo.deps[component])- deps.add(d);- }- cc.setExternalDependencies(importingFile, [...deps]);- }- }-- if (hasNewComponents || sourcesDirty) {- log('write manifest');- await fs.promises.writeFile(buildInfoFile, JSON.stringify(buildInfo, undefined, 2));- }- return { buildInfo, viteConfig };-}--async function checkSources(buildInfo: BuildInfo): Promise<boolean> {- for (const [source, sourceInfo] of Object.entries(buildInfo.sources)) {- try {- const timestamp = (await fs.promises.stat(source)).mtimeMs;- if (sourceInfo.timestamp !== timestamp) {- log('source has changed:', source);- return true;- }- } catch (e) {- log('check source failed:', e);- return true;- }- }- return false;-}--async function checkNewComponents(buildInfo: BuildInfo, componentRegistry: ComponentRegistry): Promise<boolean> {- const newComponents = [...componentRegistry.keys()];- const oldComponents = new Map(buildInfo.components.map(c => [c.id, c]));-- let hasNewComponents = false;- for (const c of newComponents) {- if (!oldComponents.has(c)) {- hasNewComponents = true;- break;- }- }- for (const c of oldComponents.values()) {- try {- if ((await fs.promises.stat(c.filename)))- componentRegistry.set(c.id, c);- } catch (e) {- if (e.code !== 'ENOENT')- throw e;- log('non existent file, skipping component registry:', c.filename);- }- }-- return hasNewComponents;-}--function vitePlugin(registerSource: string, templateDir: string, buildInfo: BuildInfo, importInfos: Map<string, ImportInfo>, depsCollector: Map<string, string[]>): Plugin {- buildInfo.sources = {};- let moduleResolver: ResolveFn;- return {- name: 'playwright:component-index',-- configResolved(config: ResolvedConfig) {- moduleResolver = config.createResolver();- },-- async transform(this: Rollup.PluginContext, content, id) {- const queryIndex = id.indexOf('?');- const file = queryIndex !== -1 ? id.substring(0, queryIndex) : id;- if (!buildInfo.sources[file]) {- try {- const timestamp = (await fs.promises.stat(file)).mtimeMs;- buildInfo.sources[file] = { timestamp };- } catch {- // Silent if can't read the file.- }- }- return transformIndexFile(id, content, templateDir, registerSource, importInfos);- },-- async writeBundle(this: Rollup.PluginContext) {- for (const importInfo of importInfos.values()) {- const importPath = transform.resolveHook(importInfo.filename, importInfo.importSource);- if (!importPath)- continue;- const deps = new Set<string>();- const id = await moduleResolver(importPath);- if (!id)- continue;- collectViteModuleDependencies(this, id, deps);- depsCollector.set(importPath, [...deps]);- }- },- };-}--function collectViteModuleDependencies(context: Rollup.PluginContext, id: string, deps: Set<string>) {- // Example: "src/Component.tsx?raw" or "src/Component.tsx?import" should resolve to the file path.- const cleanedId = id.split(/[?#]/)[0];- const normalizedId = path.normalize(cleanedId);- if (!path.isAbsolute(normalizedId))- return;- // Vite 8 (rolldown) surfaces node_modules in the module graph that earlier- // versions hid behind dep optimization. Component dependencies should only- // track project sources, so stop at the node_modules boundary.- if (normalizedId.includes(`${path.sep}node_modules${path.sep}`))- return;- if (deps.has(normalizedId))- return;- deps.add(normalizedId);- const module = context.getModuleInfo(id);- for (const importedId of module?.importedIds || [])- collectViteModuleDependencies(context, importedId, deps);- for (const importedId of module?.dynamicallyImportedIds || [])- collectViteModuleDependencies(context, importedId, deps);-}diff --git a/packages/playwright-ct-core/src/viteUtils.ts b/packages/playwright-ct-core/src/viteUtils.tsdeleted file mode 100644index 0cae117b53..0000000000--- a/packages/playwright-ct-core/src/viteUtils.ts+++ /dev/null@@ -1,210 +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 fs from 'fs';-import path from 'path';--import { cc, transform } from 'playwright/lib/common';-import { debug } from 'playwright-core/lib/utilsBundle';--import type { ImportInfo } from './tsxTransform';-import type { PlaywrightTestConfig as BasePlaywrightTestConfig } from 'playwright/types/test';-import type { FullConfig } from 'playwright/types/testReporter';-import type { InlineConfig, Plugin, TransformResult, UserConfig } from 'vite';---const log = debug('pw:vite');--export type CtConfig = BasePlaywrightTestConfig['use'] & {- ctPort?: number;- ctTemplateDir?: string;- ctCacheDir?: string;- ctViteConfig?: InlineConfig | (() => Promise<InlineConfig>);-};--export type ComponentRegistry = Map<string, ImportInfo>;-export type ComponentDirs = {- configDir: string;- outDir: string;- templateDir: string;-};--export async function resolveDirs(configDir: string, config: FullConfig): Promise<ComponentDirs | null> {- const use = config.projects[0].use as CtConfig;- // FIXME: use build plugin to determine html location to resolve this.- // TemplateDir must be relative, otherwise we can't move the final index.html into its target location post-build.- // This regressed in https://github.com/microsoft/playwright/pull/26526- const relativeTemplateDir = use.ctTemplateDir || 'playwright';- const templateDir = await fs.promises.realpath(path.normalize(path.join(configDir, relativeTemplateDir))).catch(() => undefined);- if (!templateDir)- return null;- const outDir = use.ctCacheDir ? path.resolve(configDir, use.ctCacheDir) : path.resolve(templateDir, '.cache');- return {- configDir,- outDir,- templateDir- };-}--export function resolveEndpoint(config: FullConfig) {- const use = config.projects[0].use as CtConfig;- const baseURL = new URL(use.baseURL || 'http://localhost');- return {- https: baseURL.protocol.startsWith('https:') ? {} : undefined,- host: baseURL.hostname,- port: use.ctPort || Number(baseURL.port) || 3100- };-}--export async function createConfig(dirs: ComponentDirs, config: FullConfig, frameworkPluginFactory: (() => Promise<Plugin>) | undefined, supportJsxInJs: boolean) {- // We are going to have 3 config files:- // - the defaults that user config overrides (baseConfig)- // - the user config (userConfig)- // - frameworks overrides (frameworkOverrides);-- const endpoint = resolveEndpoint(config);- const use = config.projects[0].use as CtConfig;-- // Compose base config from the playwright config only.- const baseConfig: InlineConfig = {- root: dirs.templateDir,- configFile: false,- publicDir: path.join(dirs.configDir, 'public'),- define: {- __VUE_PROD_DEVTOOLS__: true,- },- css: {- devSourcemap: true,- },- build: {- outDir: dirs.outDir- },- preview: endpoint,- server: endpoint,- // Vite preview server will otherwise always return the index.html with 200.- appType: 'mpa',- };-- // Vite 5 refuses to support CJS.- const { mergeConfig, transformWithOxc } = await import('vite');-- // Apply user config on top of the base config. This could have changed root and build.outDir.- const userConfig = typeof use.ctViteConfig === 'function' ? await use.ctViteConfig() : (use.ctViteConfig || {});- const baseAndUserConfig = mergeConfig(baseConfig, userConfig);-- const frameworkOverrides: UserConfig = { plugins: [] };-- // React heuristic. If we see a component in a file with .js extension,- // consider it a potential JSX-in-JS scenario and parse JSX in all .js files.- // Vite's default transform (oxc) infers the language from the file extension- // and rejects JSX in .js files, so we lower it ahead of time with an explicit- // `lang: 'jsx'` and the automatic runtime (no `import React` required).- const jsxInJsPlugins: Plugin[] = [];- if (supportJsxInJs) {- log('jsx-in-js detected');- jsxInJsPlugins.push({- name: 'playwright:jsx-in-js',- enforce: 'pre',- async transform(code: string, id: string) {- const file = id.split(/[?#]/)[0];- if (!file.endsWith('.js') || file.includes(`${path.sep}node_modules${path.sep}`))- return null;- const result = await transformWithOxc(code, file, { lang: 'jsx', jsx: { runtime: 'automatic' } } as any);- return { code: result.code, map: result.map as any };- },- });- }-- frameworkOverrides.build = {- target: 'esnext',- minify: false,- rollupOptions: {- treeshake: false,- input: {- index: path.join(dirs.templateDir, 'index.html')- },- },- sourcemap: true,- };-- // We assume that any non-empty plugin list includes `vite-react` or similar.- if (frameworkPluginFactory && !baseAndUserConfig.plugins?.length)- frameworkOverrides.plugins = [...jsxInJsPlugins, await frameworkPluginFactory()];- else- frameworkOverrides.plugins = [...(frameworkOverrides.plugins || []), ...jsxInJsPlugins];-- return mergeConfig(baseAndUserConfig, frameworkOverrides);-}--export async function populateComponentsFromTests(componentRegistry: ComponentRegistry, componentsByImportingFile?: Map<string, string[]>) {- const importInfos: Map<string, ImportInfo[]> = await cc.getUserData('playwright-ct-core');- for (const [file, importList] of importInfos) {- for (const importInfo of importList)- componentRegistry.set(importInfo.id, importInfo);- if (componentsByImportingFile)- componentsByImportingFile.set(file, importList.map(i => transform.resolveHook(i.filename, i.importSource)).filter(Boolean) as string[]);- }-}--export function hasJSComponents(components: ImportInfo[]): boolean {- for (const component of components) {- const importPath = transform.resolveHook(component.filename, component.importSource);- const extname = importPath ? path.extname(importPath) : '';- if (extname === '.js' || (importPath && !extname && fs.existsSync(importPath + '.js')))- return true;- }- return false;-}--const importReactRE = /(^|[\n;}\])])import\s+(\*\s+as\s+)?React(,|\s+)/;-const compiledReactRE = /(const|var)\s+React\s*=/;-const runtimeImportRequire = /import\(['"`]react['"`]\)|require\(['"`]react['"`]\)/i;--export function transformIndexFile(id: string, content: string, templateDir: string, registerSource: string, importInfos: Map<string, ImportInfo>): TransformResult | null {- // Vite React plugin will do this for .jsx files, but not .js files.- // `__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED` check is to avoid modifying React itself (such as react.development.js)- if (id.endsWith('.js') && content.includes('React.createElement') && !content.includes('__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED') && !content.match(importReactRE)- && !content.match(compiledReactRE) && !content.match(runtimeImportRequire)) {- const code = `import React from 'react';\n${content}`;- return { code, map: { mappings: '' } };- }-- const indexTs = path.join(templateDir, 'index.ts');- const indexTsx = path.join(templateDir, 'index.tsx');- const indexJs = path.join(templateDir, 'index.js');- const indexJsx = path.join(templateDir, 'index.jsx');- const idResolved = path.resolve(id);- if (!idResolved.endsWith(indexTs) && !idResolved.endsWith(indexTsx) && !idResolved.endsWith(indexJs) && !idResolved.endsWith(indexJsx))- return null;-- const lines = [content, ''];- lines.push(registerSource);-- for (const value of importInfos.values()) {- const importPath = transform.resolveHook(value.filename, value.importSource) || value.importSource;- lines.push(`const ${value.id} = () => import('${importPath?.replaceAll(path.sep, '/')}').then((mod) => mod.${value.remoteName || 'default'});`);- }-- lines.push(`__pwRegistry.initialize({ ${[...importInfos.keys()].join(',\n ')} });`);- return {- code: lines.join('\n'),- map: { mappings: '' }- };-}--export function frameworkConfig(config: FullConfig): { registerSourceFile: string, frameworkPluginFactory?: () => Promise<Plugin> } {- return (config as any)['@playwright/experimental-ct-core'];-}diff --git a/packages/playwright-ct-core/types/component.d.ts b/packages/playwright-ct-core/types/component.d.tsdeleted file mode 100644index d3dfa9f566..0000000000--- a/packages/playwright-ct-core/types/component.d.ts+++ /dev/null@@ -1,53 +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.- */--export type JsxComponent = {- __pw_type: 'jsx',- type: any,- props: Record<string, any>,-};--export type MountOptions = {- hooksConfig?: any,-};--export type ObjectComponentOptions = {- props?: Record<string, any>;- slots?: Record<string, string | string[]>;-};--export type ObjectComponent = ObjectComponentOptions & {- __pw_type: 'object-component',- type: any,-};--export type Component = JsxComponent | ObjectComponent;--declare global {- interface Window {- playwrightMount(component: Component, rootElement: Element, hooksConfig?: any): Promise<void>;- playwrightUnmount(rootElement: Element): Promise<void>;- playwrightUpdate(rootElement: Element, component: Component): Promise<void>;- __pw_hooks_before_mount?: (<HooksConfig>(- params: { hooksConfig?: HooksConfig; [key: string]: any }- ) => Promise<any>)[];- __pw_hooks_after_mount?: (<HooksConfig>(- params: { hooksConfig?: HooksConfig; [key: string]: any }- ) => Promise<void>)[];- __pwUnwrapObject: (value: any) => Promise<any>;- __pwTransformObject: (value: any, mapping: (v: any) => { result: any } | undefined) => any;- }-}diff --git a/packages/playwright-ct-react/.npmignore b/packages/playwright-ct-react/.npmignoredeleted file mode 100644index 62701eb493..0000000000--- a/packages/playwright-ct-react/.npmignore+++ /dev/null@@ -1,12 +0,0 @@-**/*--!README.md-!LICENSE-!cli.js-!register.d.ts-!register.mjs-!registerSource.mjs-!index.d.ts-!index.js-!hooks.d.ts-!hooks.mjsdiff --git a/packages/playwright-ct-react/README.md b/packages/playwright-ct-react/README.mddeleted file mode 100644index 23ae82312d..0000000000--- a/packages/playwright-ct-react/README.md+++ /dev/null@@ -1,3 +0,0 @@-> **BEWARE** This package is EXPERIMENTAL and does not respect semver.--Read more at https://playwright.dev/docs/test-componentsdiff --git a/packages/playwright-ct-react/cli.js b/packages/playwright-ct-react/cli.jsdeleted file mode 100755index 9cc834ee95..0000000000--- a/packages/playwright-ct-react/cli.js+++ /dev/null@@ -1,20 +0,0 @@-#!/usr/bin/env node-/**- * 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.- */--const { program } = require('@playwright/experimental-ct-core/lib/program');--program.parse(process.argv);diff --git a/packages/playwright-ct-react/hooks.d.ts b/packages/playwright-ct-react/hooks.d.tsdeleted file mode 100644index f05ad1ffdf..0000000000--- a/packages/playwright-ct-react/hooks.d.ts+++ /dev/null@@ -1,24 +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 type React from 'react';--export declare function beforeMount<HooksConfig>(- callback: (params: { hooksConfig?: HooksConfig; App: () => React.JSX.Element }) => Promise<void | React.JSX.Element>-): void;-export declare function afterMount<HooksConfig>(- callback: (params: { hooksConfig?: HooksConfig }) => Promise<void>-): void;diff --git a/packages/playwright-ct-react/hooks.mjs b/packages/playwright-ct-react/hooks.mjsdeleted file mode 100644index b7cea242c4..0000000000--- a/packages/playwright-ct-react/hooks.mjs+++ /dev/null@@ -1,29 +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.- */--const __pw_hooks_before_mount = [];-const __pw_hooks_after_mount = [];--window.__pw_hooks_before_mount = __pw_hooks_before_mount;-window.__pw_hooks_after_mount = __pw_hooks_after_mount;--export const beforeMount = callback => {- __pw_hooks_before_mount.push(callback);-};--export const afterMount = callback => {- __pw_hooks_after_mount.push(callback);-};diff --git a/packages/playwright-ct-react/index.d.ts b/packages/playwright-ct-react/index.d.tsdeleted file mode 100644index 157d6dcca8..0000000000--- a/packages/playwright-ct-react/index.d.ts+++ /dev/null@@ -1,39 +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 type React from 'react';--import type { TestType, Locator } from '@playwright/experimental-ct-core';--export interface MountOptions<HooksConfig> {- hooksConfig?: HooksConfig;-}--export interface MountResult extends Locator {- unmount: () => Promise<void>;- update: (component: React.JSX.Element) => Promise<void>;-}--export interface ComponentFixtures {- mount: <HooksConfig>(- component: React.JSX.Element,- options?: MountOptions<HooksConfig>- ) => Promise<MountResult>;-}--export const test: TestType<ComponentFixtures>;--export { defineConfig, PlaywrightTestConfig, expect, devices } from '@playwright/experimental-ct-core';diff --git a/packages/playwright-ct-react/index.js b/packages/playwright-ct-react/index.jsdeleted file mode 100644index 3308747541..0000000000--- a/packages/playwright-ct-react/index.js+++ /dev/null@@ -1,33 +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.- */--const { test, expect, devices, defineConfig: originalDefineConfig } = require('@playwright/experimental-ct-core');-const path = require('path');--const defineConfig = (config, ...configs) => {- return originalDefineConfig({- ...config,- '@playwright/test': {- packageJSON: require.resolve('./package.json'),- },- '@playwright/experimental-ct-core': {- registerSourceFile: path.join(__dirname, 'registerSource.mjs'),- frameworkPluginFactory: () => import('@vitejs/plugin-react').then(plugin => plugin.default()),- },- }, ...configs);-};--module.exports = { test, expect, devices, defineConfig };diff --git a/packages/playwright-ct-react/package.json b/packages/playwright-ct-react/package.jsondeleted file mode 100644index 32e224b802..0000000000--- a/packages/playwright-ct-react/package.json+++ /dev/null@@ -1,39 +0,0 @@-{- "name": "@playwright/experimental-ct-react",- "version": "1.63.0-next",- "description": "Playwright Component Testing for React",- "repository": {- "type": "git",- "url": "git+https://github.com/microsoft/playwright.git"- },- "homepage": "https://playwright.dev",- "engines": {- "node": ">=20"- },- "author": {- "name": "Microsoft Corporation"- },- "license": "Apache-2.0",- "exports": {- ".": {- "types": "./index.d.ts",- "default": "./index.js"- },- "./register": {- "types": "./register.d.ts",- "default": "./register.mjs"- },- "./hooks": {- "types": "./hooks.d.ts",- "default": "./hooks.mjs"- },- "./package.json": "./package.json"- },- "dependencies": {- "@playwright/experimental-ct-core": "1.63.0-next",- "@vitejs/plugin-react": "^6.0.3"- },- "bin": {- "playwright": "cli.js"- }-}diff --git a/packages/playwright-ct-react/register.d.ts b/packages/playwright-ct-react/register.d.tsdeleted file mode 100644index 1f44530ed6..0000000000--- a/packages/playwright-ct-react/register.d.ts+++ /dev/null@@ -1,17 +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.- */--export default function pwRegister(components: Record<string, any>): void;diff --git a/packages/playwright-ct-react/register.mjs b/packages/playwright-ct-react/register.mjsdeleted file mode 100644index ca6a6a12d9..0000000000--- a/packages/playwright-ct-react/register.mjs+++ /dev/null@@ -1,21 +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 { pwRegister } from './registerSource.mjs';--export default components => {- pwRegister(components);-};diff --git a/packages/playwright-ct-react/registerSource.mjs b/packages/playwright-ct-react/registerSource.mjsdeleted file mode 100644index 4b233a8dec..0000000000--- a/packages/playwright-ct-react/registerSource.mjs+++ /dev/null@@ -1,116 +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.- */--// @ts-check-// This file is injected into the registry as text, no dependencies are allowed.--import __pwReact from 'react';-import { createRoot as __pwCreateRoot } from 'react-dom/client';-/** @typedef {import('../playwright-ct-core/types/component').JsxComponent} JsxComponent */--/** @type {Map<Element, { root: import('react-dom/client').Root, setRenderer: (renderer: any) => void }>} */-const __pwRootRegistry = new Map();--/**- * @param {any} component- * @returns {component is JsxComponent}- */-function isJsxComponent(component) {- return typeof component === 'object' && component && component.__pw_type === 'jsx';-}--/**- * @param {any} type- * @returns {boolean} type is Playwright's mock JSX.Fragment- */-function isJsxFragment(type) {- return typeof type === 'object' && type?.__pw_jsx_fragment;-}--/**- * Turns the Playwright representation of JSX (see jsx-runtime.js) into React.createElement calls.- * @param {any} value- */-function __pwRender(value) {- return window.__pwTransformObject(value, v => {- if (isJsxComponent(v)) {- const component = v;- let type = component.type;- if (isJsxFragment(type))- type = __pwReact.Fragment;- const props = component.props ? __pwRender(component.props) : {};- const key = component.key ? __pwRender(component.key) : undefined;- const { children, ...propsWithoutChildren } = props;- if (key)- propsWithoutChildren.key = key;- const createElementArguments = [propsWithoutChildren];- if (children)- createElementArguments.push(children);- return { result: __pwReact.createElement(type, ...createElementArguments) };- }- });-}--window.playwrightMount = async (component, rootElement, hooksConfig) => {- if (!isJsxComponent(component))- throw new Error('Object mount notation is not supported');- if (__pwRootRegistry.has(rootElement)) {- throw new Error(- 'Attempting to mount a component into an container that already has a React root'- );- }-- const root = __pwCreateRoot(rootElement);- const entry = { root, setRenderer: () => undefined };- __pwRootRegistry.set(rootElement, entry);-- const App = () => {- /** @type {any} */- const [renderer, setRenderer] = __pwReact.useState(() => __pwRender(component));- entry.setRenderer = setRenderer;- return renderer;- };- let AppWrapper = App;- for (const hook of window.__pw_hooks_before_mount || []) {- const wrapper = await hook({ App: AppWrapper, hooksConfig });- if (wrapper)- AppWrapper = () => wrapper;- }-- root.render(__pwReact.createElement(AppWrapper));-- for (const hook of window.__pw_hooks_after_mount || [])- await hook({ hooksConfig });-};--window.playwrightUnmount = async rootElement => {- const entry = __pwRootRegistry.get(rootElement);- if (!entry)- throw new Error('Component was not mounted');-- entry.root.unmount();- __pwRootRegistry.delete(rootElement);-};--window.playwrightUpdate = async (rootElement, component) => {- if (!isJsxComponent(component))- throw new Error('Object mount notation is not supported');-- const entry = __pwRootRegistry.get(rootElement);- if (!entry)- throw new Error('Component was not mounted');- entry.setRenderer(() => __pwRender(component));-};diff --git a/packages/playwright-ct-react17/.npmignore b/packages/playwright-ct-react17/.npmignoredeleted file mode 100644index 62701eb493..0000000000--- a/packages/playwright-ct-react17/.npmignore+++ /dev/null@@ -1,12 +0,0 @@-**/*--!README.md-!LICENSE-!cli.js-!register.d.ts-!register.mjs-!registerSource.mjs-!index.d.ts-!index.js-!hooks.d.ts-!hooks.mjsdiff --git a/packages/playwright-ct-react17/README.md b/packages/playwright-ct-react17/README.mddeleted file mode 100644index 23ae82312d..0000000000--- a/packages/playwright-ct-react17/README.md+++ /dev/null@@ -1,3 +0,0 @@-> **BEWARE** This package is EXPERIMENTAL and does not respect semver.--Read more at https://playwright.dev/docs/test-componentsdiff --git a/packages/playwright-ct-react17/cli.js b/packages/playwright-ct-react17/cli.jsdeleted file mode 100755index 9cc834ee95..0000000000--- a/packages/playwright-ct-react17/cli.js+++ /dev/null@@ -1,20 +0,0 @@-#!/usr/bin/env node-/**- * 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.- */--const { program } = require('@playwright/experimental-ct-core/lib/program');--program.parse(process.argv);diff --git a/packages/playwright-ct-react17/hooks.d.ts b/packages/playwright-ct-react17/hooks.d.tsdeleted file mode 100644index 1093f1a3a3..0000000000--- a/packages/playwright-ct-react17/hooks.d.ts+++ /dev/null@@ -1,22 +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.- */--export declare function beforeMount<HooksConfig>(- callback: (params: { hooksConfig?: HooksConfig; App: () => JSX.Element }) => Promise<void | JSX.Element>-): void;-export declare function afterMount<HooksConfig>(- callback: (params: { hooksConfig?: HooksConfig }) => Promise<void>-): void;diff --git a/packages/playwright-ct-react17/hooks.mjs b/packages/playwright-ct-react17/hooks.mjsdeleted file mode 100644index b7cea242c4..0000000000--- a/packages/playwright-ct-react17/hooks.mjs+++ /dev/null@@ -1,29 +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.- */--const __pw_hooks_before_mount = [];-const __pw_hooks_after_mount = [];--window.__pw_hooks_before_mount = __pw_hooks_before_mount;-window.__pw_hooks_after_mount = __pw_hooks_after_mount;--export const beforeMount = callback => {- __pw_hooks_before_mount.push(callback);-};--export const afterMount = callback => {- __pw_hooks_after_mount.push(callback);-};diff --git a/packages/playwright-ct-react17/index.d.ts b/packages/playwright-ct-react17/index.d.tsdeleted file mode 100644index 558375700b..0000000000--- a/packages/playwright-ct-react17/index.d.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 type { TestType, Locator} from '@playwright/experimental-ct-core';--export interface MountOptions<HooksConfig> {- hooksConfig?: HooksConfig;-}--export interface MountResult extends Locator {- unmount: () => Promise<void>;- update: (component: JSX.Element) => Promise<void>;-}--export interface ComponentFixtures {- mount: <HooksConfig>(- component: JSX.Element,- options?: MountOptions<HooksConfig>- ) => Promise<MountResult>;-}--export const test: TestType<ComponentFixtures>;--export { defineConfig, PlaywrightTestConfig, expect, devices } from '@playwright/experimental-ct-core';diff --git a/packages/playwright-ct-react17/index.js b/packages/playwright-ct-react17/index.jsdeleted file mode 100644index 3308747541..0000000000--- a/packages/playwright-ct-react17/index.js+++ /dev/null@@ -1,33 +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.- */--const { test, expect, devices, defineConfig: originalDefineConfig } = require('@playwright/experimental-ct-core');-const path = require('path');--const defineConfig = (config, ...configs) => {- return originalDefineConfig({- ...config,- '@playwright/test': {- packageJSON: require.resolve('./package.json'),- },- '@playwright/experimental-ct-core': {- registerSourceFile: path.join(__dirname, 'registerSource.mjs'),- frameworkPluginFactory: () => import('@vitejs/plugin-react').then(plugin => plugin.default()),- },- }, ...configs);-};--module.exports = { test, expect, devices, defineConfig };diff --git a/packages/playwright-ct-react17/package.json b/packages/playwright-ct-react17/package.jsondeleted file mode 100644index 9390e961a0..0000000000--- a/packages/playwright-ct-react17/package.json+++ /dev/null@@ -1,39 +0,0 @@-{- "name": "@playwright/experimental-ct-react17",- "version": "1.63.0-next",- "description": "Playwright Component Testing for React",- "repository": {- "type": "git",- "url": "git+https://github.com/microsoft/playwright.git"- },- "homepage": "https://playwright.dev",- "engines": {- "node": ">=20"- },- "author": {- "name": "Microsoft Corporation"- },- "license": "Apache-2.0",- "exports": {- ".": {- "types": "./index.d.ts",- "default": "./index.js"- },- "./register": {- "types": "./register.d.ts",- "default": "./register.mjs"- },- "./hooks": {- "types": "./hooks.d.ts",- "default": "./hooks.mjs"- },- "./package.json": "./package.json"- },- "dependencies": {- "@playwright/experimental-ct-core": "1.63.0-next",- "@vitejs/plugin-react": "^6.0.3"- },- "bin": {- "playwright": "cli.js"- }-}diff --git a/packages/playwright-ct-react17/register.d.ts b/packages/playwright-ct-react17/register.d.tsdeleted file mode 100644index 1f44530ed6..0000000000--- a/packages/playwright-ct-react17/register.d.ts+++ /dev/null@@ -1,17 +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.- */--export default function pwRegister(components: Record<string, any>): void;diff --git a/packages/playwright-ct-react17/register.mjs b/packages/playwright-ct-react17/register.mjsdeleted file mode 100644index ca6a6a12d9..0000000000--- a/packages/playwright-ct-react17/register.mjs+++ /dev/null@@ -1,21 +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 { pwRegister } from './registerSource.mjs';--export default components => {- pwRegister(components);-};diff --git a/packages/playwright-ct-react17/registerSource.mjs b/packages/playwright-ct-react17/registerSource.mjsdeleted file mode 100644index 50a888b92a..0000000000--- a/packages/playwright-ct-react17/registerSource.mjs+++ /dev/null@@ -1,101 +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.- */--// @ts-check-// This file is injected into the registry as text, no dependencies are allowed.--import __pwReact from 'react';-import __pwReactDOM from 'react-dom';-/** @typedef {import('../playwright-ct-core/types/component').JsxComponent} JsxComponent */--/** @type {Map<Element, { setRenderer: (renderer: any) => void }>} */-const __pwRootRegistry = new Map();--/**- * @param {any} component- * @returns {component is JsxComponent}- */-function isJsxComponent(component) {- return typeof component === 'object' && component && component.__pw_type === 'jsx';-}--/**- * @param {any} value- */-function __pwRender(value) {- return window.__pwTransformObject(value, v => {- if (isJsxComponent(v)) {- const component = v;- const props = component.props ? __pwRender(component.props) : {};- const key = component.key ? __pwRender(component.key) : undefined;- const { children, ...propsWithoutChildren } = props;- if (key)- propsWithoutChildren.key = key;- const createElementArguments = [propsWithoutChildren];- if (children)- createElementArguments.push(children);- return { result: __pwReact.createElement(component.type, ...createElementArguments) };- }- });-}--window.playwrightMount = async (component, rootElement, hooksConfig) => {- if (!isJsxComponent(component))- throw new Error('Object mount notation is not supported');- if (__pwRootRegistry.has(rootElement)) {- throw new Error(- 'Attempting to mount a component into an container that already has a React root'- );- }-- const entry = { setRenderer: () => undefined };- __pwRootRegistry.set(rootElement, entry);-- const App = () => {- /** @type {any} */- const [renderer, setRenderer] = __pwReact.useState(() => __pwRender(component));- entry.setRenderer = setRenderer;- return renderer;- };- let AppWrapper = App;- for (const hook of window.__pw_hooks_before_mount || []) {- const wrapper = await hook({ App: AppWrapper, hooksConfig });- if (wrapper)- AppWrapper = () => wrapper;- }-- __pwReactDOM.render(__pwReact.createElement(AppWrapper), rootElement);-- for (const hook of window.__pw_hooks_after_mount || [])- await hook({ hooksConfig });-};--window.playwrightUnmount = async rootElement => {- if (!__pwReactDOM.unmountComponentAtNode(rootElement))- throw new Error('Component was not mounted');-- __pwRootRegistry.delete(rootElement);-};--window.playwrightUpdate = async (rootElement, component) => {- if (!isJsxComponent(component))- throw new Error('Object mount notation is not supported');-- const entry = __pwRootRegistry.get(rootElement);- if (!entry)- throw new Error('Component was not mounted');- entry.setRenderer(() => __pwRender(component));-};diff --git a/packages/playwright-ct-vue/.npmignore b/packages/playwright-ct-vue/.npmignoredeleted file mode 100644index 62701eb493..0000000000--- a/packages/playwright-ct-vue/.npmignore+++ /dev/null@@ -1,12 +0,0 @@-**/*--!README.md-!LICENSE-!cli.js-!register.d.ts-!register.mjs-!registerSource.mjs-!index.d.ts-!index.js-!hooks.d.ts-!hooks.mjsdiff --git a/packages/playwright-ct-vue/README.md b/packages/playwright-ct-vue/README.mddeleted file mode 100644index 23ae82312d..0000000000--- a/packages/playwright-ct-vue/README.md+++ /dev/null@@ -1,3 +0,0 @@-> **BEWARE** This package is EXPERIMENTAL and does not respect semver.--Read more at https://playwright.dev/docs/test-componentsdiff --git a/packages/playwright-ct-vue/cli.js b/packages/playwright-ct-vue/cli.jsdeleted file mode 100755index 9cc834ee95..0000000000--- a/packages/playwright-ct-vue/cli.js+++ /dev/null@@ -1,20 +0,0 @@-#!/usr/bin/env node-/**- * 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.- */--const { program } = require('@playwright/experimental-ct-core/lib/program');--program.parse(process.argv);diff --git a/packages/playwright-ct-vue/hooks.d.ts b/packages/playwright-ct-vue/hooks.d.tsdeleted file mode 100644index 69b91cc2cb..0000000000--- a/packages/playwright-ct-vue/hooks.d.ts+++ /dev/null@@ -1,28 +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 type { App, ComponentPublicInstance } from 'vue';--export declare function beforeMount<HooksConfig>(- callback: (params: { app: App; hooksConfig?: HooksConfig }) => Promise<void>-): void;-export declare function afterMount<HooksConfig>(- callback: (params: {- app: App;- hooksConfig?: HooksConfig;- instance: ComponentPublicInstance;- }) => Promise<void>-): void;diff --git a/packages/playwright-ct-vue/hooks.mjs b/packages/playwright-ct-vue/hooks.mjsdeleted file mode 100644index b7cea242c4..0000000000--- a/packages/playwright-ct-vue/hooks.mjs+++ /dev/null@@ -1,29 +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.- */--const __pw_hooks_before_mount = [];-const __pw_hooks_after_mount = [];--window.__pw_hooks_before_mount = __pw_hooks_before_mount;-window.__pw_hooks_after_mount = __pw_hooks_after_mount;--export const beforeMount = callback => {- __pw_hooks_before_mount.push(callback);-};--export const afterMount = callback => {- __pw_hooks_after_mount.push(callback);-};diff --git a/packages/playwright-ct-vue/index.d.ts b/packages/playwright-ct-vue/index.d.tsdeleted file mode 100644index 64bd6ee436..0000000000--- a/packages/playwright-ct-vue/index.d.ts+++ /dev/null@@ -1,70 +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 type { TestType, Locator } from '@playwright/experimental-ct-core';--type ComponentSlot = string | string[];-type ComponentSlots = Record<string, ComponentSlot> & { default?: ComponentSlot };--type ComponentEvents = Record<string, Function>;--// Copied from: https://github.com/vuejs/language-tools/blob/master/packages/vue-component-type-helpers/index.d.ts#L10-L13-type ComponentProps<T> =- T extends new (...angs: any) => { $props: infer P; } ? NonNullable<P> :- T extends (props: infer P, ...args: any) => any ? P :- {};--export interface MountOptions<HooksConfig, Component> {- props?: ComponentProps<Component>;- slots?: ComponentSlots;- on?: ComponentEvents;- hooksConfig?: HooksConfig;-}--export interface MountOptionsJsx<HooksConfig> {- hooksConfig?: HooksConfig;-}--export interface MountResult<Component> extends Locator {- unmount: () => Promise<void>;- update: (options: {- props?: Partial<ComponentProps<Component>>;- slots?: Partial<ComponentSlots>;- on?: Partial<ComponentEvents>;- }) => Promise<void>;-}--export interface MountResultJsx extends Locator {- unmount: () => Promise<void>;- update: (component: JSX.Element) => Promise<void>;-}--export interface ComponentFixtures {- mount: {- <HooksConfig>(- component: JSX.Element,- options?: MountOptionsJsx<HooksConfig>- ): Promise<MountResultJsx>;- <HooksConfig, Component = unknown>(- component: Component,- options?: MountOptions<HooksConfig, Component>- ): Promise<MountResult<Component>>;- };-}--export const test: TestType<ComponentFixtures>;--export { defineConfig, PlaywrightTestConfig, expect, devices } from '@playwright/experimental-ct-core';diff --git a/packages/playwright-ct-vue/index.js b/packages/playwright-ct-vue/index.jsdeleted file mode 100644index b01b23e412..0000000000--- a/packages/playwright-ct-vue/index.js+++ /dev/null@@ -1,33 +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.- */--const { test, expect, devices, defineConfig: originalDefineConfig } = require('@playwright/experimental-ct-core');-const path = require('path');--const defineConfig = (config, ...configs) => {- return originalDefineConfig({- ...config,- '@playwright/test': {- packageJSON: require.resolve('./package.json'),- },- '@playwright/experimental-ct-core': {- registerSourceFile: path.join(__dirname, 'registerSource.mjs'),- frameworkPluginFactory: () => import('@vitejs/plugin-vue').then(plugin => plugin.default()),- },- }, ...configs);-};--module.exports = { test, expect, devices, defineConfig };diff --git a/packages/playwright-ct-vue/package.json b/packages/playwright-ct-vue/package.jsondeleted file mode 100644index d4c42b49e0..0000000000--- a/packages/playwright-ct-vue/package.json+++ /dev/null@@ -1,39 +0,0 @@-{- "name": "@playwright/experimental-ct-vue",- "version": "1.63.0-next",- "description": "Playwright Component Testing for Vue",- "repository": {- "type": "git",- "url": "git+https://github.com/microsoft/playwright.git"- },- "homepage": "https://playwright.dev",- "engines": {- "node": ">=20"- },- "author": {- "name": "Microsoft Corporation"- },- "license": "Apache-2.0",- "exports": {- ".": {- "types": "./index.d.ts",- "default": "./index.js"- },- "./register": {- "types": "./register.d.ts",- "default": "./register.mjs"- },- "./hooks": {- "types": "./hooks.d.ts",- "default": "./hooks.mjs"- },- "./package.json": "./package.json"- },- "dependencies": {- "@playwright/experimental-ct-core": "1.63.0-next",- "@vitejs/plugin-vue": "^6.0.7"- },- "bin": {- "playwright": "cli.js"- }-}diff --git a/packages/playwright-ct-vue/register.d.ts b/packages/playwright-ct-vue/register.d.tsdeleted file mode 100644index f88e9be59d..0000000000--- a/packages/playwright-ct-vue/register.d.ts+++ /dev/null@@ -1,24 +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.- */--export default function pwRegister(- components: Record<string, any>,- options?: {- createApp: any,- setDevtoolsHook: any,- h: any,- }-): void;diff --git a/packages/playwright-ct-vue/register.mjs b/packages/playwright-ct-vue/register.mjsdeleted file mode 100644index ca6a6a12d9..0000000000--- a/packages/playwright-ct-vue/register.mjs+++ /dev/null@@ -1,21 +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 { pwRegister } from './registerSource.mjs';--export default components => {- pwRegister(components);-};diff --git a/packages/playwright-ct-vue/registerSource.mjs b/packages/playwright-ct-vue/registerSource.mjsdeleted file mode 100644index 33bc74e731..0000000000--- a/packages/playwright-ct-vue/registerSource.mjs+++ /dev/null@@ -1,284 +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.- */-// @ts-check--// This file is injected into the registry as text, no dependencies are allowed.--import { createApp as __pwCreateApp, setDevtoolsHook as __pwSetDevtoolsHook, h as __pwH } from 'vue';-import { compile as __pwCompile } from '@vue/compiler-dom';-import * as __pwVue from 'vue';--/** @typedef {import('../playwright-ct-core/types/component').Component} Component */-/** @typedef {import('../playwright-ct-core/types/component').JsxComponent} JsxComponent */-/** @typedef {import('../playwright-ct-core/types/component').ObjectComponent} ObjectComponent */-/** @typedef {import('vue').Component} FrameworkComponent */--const __pwAllListeners = new Map();--/**- * @param {any} component- * @returns {component is ObjectComponent}- */-function isObjectComponent(component) {- return typeof component === 'object' && component && component.__pw_type === 'object-component';-}--/**- * @param {any} component- * @returns {component is JsxComponent}- */-function isJsxComponent(component) {- return typeof component === 'object' && component && component.__pw_type === 'jsx';-}--/**- * @param {any} child- */-function __pwCreateChild(child) {- if (Array.isArray(child))- return child.map(grandChild => __pwCreateChild(grandChild));- if (isJsxComponent(child) || isObjectComponent(child))- return __pwCreateWrapper(child);- return child;-}--/**- * Copied from: https://github.com/vuejs/test-utils/blob/main/src/utils/compileSlots.ts- * Vue does not provide an easy way to compile template in "slot" mode- * Since we do not want to rely on compiler internals and specify- * transforms manually we create fake component invocation with the slot we- * need and pick slots param from render function later. Fake component will- * never be instantiated but it requires to be a component so compile- * properly generate invocation. Since we do not want to monkey-patch- * `resolveComponent` function we are just using one of built-in components.- *- * @param {string} html- */-function __pwCreateSlot(html) {- let template = html.trim();- const hasWrappingTemplate = template && template.startsWith('<template');-- // allow content without `template` tag, for easier testing- if (!hasWrappingTemplate)- template = `<template #default="params">${template}</template>`;-- const { code } = __pwCompile(`<transition>${template}</transition>`, {- mode: 'function',- prefixIdentifiers: false- });- const createRenderFunction = new Function('Vue', code);- const renderFn = createRenderFunction(__pwVue);- return (ctx = {}) => {- const result = renderFn(ctx);- const slotName = Object.keys(result.children)[0];- return result.children[slotName](ctx);- };-}--/**- * @param {string | string[]} slot- */-function __pwSlotToFunction(slot) {- if (typeof slot === 'string')- return __pwCreateSlot(slot)();-- if (Array.isArray(slot))- return slot.map(slot => __pwCreateSlot(slot)());-- throw Error(`Invalid slot received.`);-}--/**- * @param {JsxComponent} component- * @returns {any[] | undefined}- */-function __pwJsxChildArray(component) {- if (!component.props.children)- return;- if (Array.isArray(component.props.children))- return component.props.children;- return [component.props.children];-}--/**- * @param {Component} component- */-function __pwCreateComponent(component) {- const isVueComponent = typeof component.type !== 'string';-- /**- * @type {(import('vue').VNode | string)[]}- */- const children = [];- /** @type {{[key: string]: any}} */- const slots = {};- const listeners = {};- /** @type {{[key: string]: any}} */- let props = {};-- if (component.__pw_type === 'jsx') {- for (const child of __pwJsxChildArray(component) || []) {- if (isJsxComponent(child) && child.type === 'template') {- const slotProperty = Object.keys(child.props).find(k => k.startsWith('v-slot:'));- const slot = slotProperty ? slotProperty.substring('v-slot:'.length) : 'default';- slots[slot] = __pwJsxChildArray(child)?.map(__pwCreateChild);- } else {- children.push(__pwCreateChild(child));- }- }-- for (const [key, value] of Object.entries(component.props)) {- if (key.startsWith('v-on:')) {- const event = key.substring('v-on:'.length);- if (isVueComponent)- listeners[event] = value;- else- props[`on${event[0].toUpperCase()}${event.substring(1)}`] = value;- } else {- props[key] = value;- }- }- }-- if (component.__pw_type === 'object-component') {- // Vue test util syntax.- for (const [key, value] of Object.entries(component.slots || {})) {- if (key === 'default')- children.push(__pwSlotToFunction(value));- else- slots[key] = __pwSlotToFunction(value);- }- props = component.props || {};- for (const [key, value] of Object.entries(component.on || {}))- listeners[key] = value;- }-- let lastArg;- if (Object.entries(slots).length) {- lastArg = slots;- if (children.length)- slots.default = children;- } else if (children.length) {- lastArg = children;- }-- return { Component: component.type, props, slots: lastArg, listeners };-}--/**- * @param {any} slots- */-function __pwWrapFunctions(slots) {- /** @type {import('vue').ComponentInternalInstance['slots']} */- const slotsWithRenderFunctions = {};- if (!Array.isArray(slots)) {- for (const [key, value] of Object.entries(slots || {}))- slotsWithRenderFunctions[key] = () => [value];- } else if (slots?.length) {- slotsWithRenderFunctions['default'] = () => slots;- }- return slotsWithRenderFunctions;-}--/**- * @param {Component} component- * @returns {import('vue').VNode | string}- */-function __pwCreateWrapper(component) {- const { Component, props, slots, listeners } = __pwCreateComponent(component);- // @ts-ignore- const wrapper = __pwH(Component, { ...props, ...listeners }, slots);- __pwAllListeners.set(wrapper, listeners);- return wrapper;-}--function __pwSetDevTools() {- __pwSetDevtoolsHook({- emit(eventType, ...payload) {- if (eventType !== 'component:emit')- return;-- const [, componentVM, event, eventArgs] = payload;- for (const [wrapper, listeners] of __pwAllListeners) {- if (wrapper.component !== componentVM)- continue;- const listener = listeners[event];- if (!listener)- return;- listener(...eventArgs);- }- },- on() {},- off() {},- once() {},- appRecords: []- }, {});-}--const __pwAppKey = Symbol('appKey');-const __pwWrapperKey = Symbol('wrapperKey');--window.playwrightMount = async (component, rootElement, hooksConfig) => {- const app = __pwCreateApp({- render: () => {- const wrapper = __pwCreateWrapper(component);- rootElement[__pwWrapperKey] = wrapper;- return wrapper;- }- });- __pwSetDevTools();-- for (const hook of window.__pw_hooks_before_mount || [])- await hook({ app, hooksConfig });- const instance = app.mount(rootElement);- rootElement[__pwAppKey] = app;-- for (const hook of window.__pw_hooks_after_mount || [])- await hook({ app, hooksConfig, instance });-};--window.playwrightUnmount = async rootElement => {- /** @type {import('vue').App<Element> | undefined} */- const app = rootElement[__pwAppKey];- if (!app)- throw new Error('Component was not mounted');- app.unmount();- delete rootElement[__pwAppKey];-};--window.playwrightUpdate = async (rootElement, component) => {- /** @type {import('vue').VNode | undefined} */- const wrapper = rootElement[__pwWrapperKey];- if (!wrapper)- throw new Error('Component was not mounted');-- if (!wrapper.component)- throw new Error('Updating a native HTML element is not supported');-- const { slots, listeners, props } = __pwCreateComponent(component);-- wrapper.component.slots = __pwWrapFunctions(slots);- __pwAllListeners.set(wrapper, listeners);-- if (typeof slots !== 'undefined')- wrapper.component.effect.run();-- for (const [key, value] of Object.entries(props))- wrapper.component.props[key] = value;-- if (!Object.keys(props).length)- wrapper.component.update();-};diff --git a/packages/playwright/src/common/configLoader.ts b/packages/playwright/src/common/configLoader.tsindex f9ec654517..5461d4014c 100644--- a/packages/playwright/src/common/configLoader.ts+++ b/packages/playwright/src/common/configLoader.ts@@ -116,10 +116,9 @@ export async function loadConfig(location: ConfigLocation, overrides?: ConfigCLI}// 3. Load transform options from the playwright config.- const babelPlugins = (userConfig as any)['@playwright/test']?.babelPlugins || [];const external = userConfig.build?.external || [];const jsxImportSource = path.dirname(require.resolve('playwright'));- await setTransformConfig({ babelPlugins, external, jsxImportSource });+ await setTransformConfig({ external, jsxImportSource });if (!overrides?.tsconfig)await setSingleTSConfig(fullConfig?.singleTSConfigPath);diff --git a/packages/playwright/src/runner/testRunner.ts b/packages/playwright/src/runner/testRunner.tsindex 9f8b9c37d5..6088d44c7e 100644--- a/packages/playwright/src/runner/testRunner.ts+++ b/packages/playwright/src/runner/testRunner.ts@@ -15,8 +15,6 @@*/import EventEmitter from 'events';-import fs from 'fs';-import path from 'path';import { registry } from 'playwright-core/lib/coreBundle';@@ -267,12 +265,6 @@ export class TestRunner extends EventEmitter<TestRunnerEventMap> {this._ignoredProjectOutputs.add(p.project.outputDir);}- const result = await resolveCtDirs(config);- if (result) {- this._watchedProjectDirs.add(result.templateDir);- this._ignoredProjectOutputs.add(result.outDir);- }-if (this._watchTestDirs)await this._updateWatcher(false);}@@ -428,20 +420,6 @@ function printInternalError(e: Error) {console.error('Internal error:', e);}-// TODO: remove CT dependency.-async function resolveCtDirs(config: FullConfigInternal) {- const use = config.config.projects[0].use as any;- const relativeTemplateDir = use.ctTemplateDir || 'playwright';- const templateDir = await fs.promises.realpath(path.normalize(path.join(config.configDir, relativeTemplateDir))).catch(() => undefined);- if (!templateDir)- return null;- const outDir = use.ctCacheDir ? path.resolve(config.configDir, use.ctCacheDir) : path.resolve(templateDir, '.cache');- return {- outDir,- templateDir- };-}-export async function runAllTestsWithConfig(config: FullConfigInternal, options: TestRunOptions): Promise<FullResultStatus> {setPlaywrightTestProcessEnv();diff --git a/packages/playwright/src/transform/babelBundle.ts b/packages/playwright/src/transform/babelBundle.tsindex 6503009c16..096de75e1a 100644--- a/packages/playwright/src/transform/babelBundle.ts+++ b/packages/playwright/src/transform/babelBundle.ts@@ -30,11 +30,11 @@ export type { NodePath, PluginObj, types as T } from '@babel/core';export type { BabelAPI } from '@babel/helper-plugin-utils';export type BabelPlugin = [string, any?];-export type BabelTransformFunction = (code: string, filename: string, isModule: boolean, pluginsPrefix: BabelPlugin[], pluginsSuffix: BabelPlugin[], jsxImportSource?: string) => BabelFileResult | null;+export type BabelTransformFunction = (code: string, filename: string, isModule: boolean, pluginsSuffix: BabelPlugin[], jsxImportSource?: string) => BabelFileResult | null;const nodeMajorVersion = +process.versions.node.split('.')[0];-function babelTransformOptions(isTypeScript: boolean, isModule: boolean, pluginsPrologue: [string, any?][], pluginsEpilogue: [string, any?][], jsxImportSource?: string): TransformOptions {+function babelTransformOptions(isTypeScript: boolean, isModule: boolean, pluginsEpilogue: [string, any?][], jsxImportSource?: string): TransformOptions {const plugins = [[require('@babel/plugin-syntax-import-attributes'), { deprecatedAssertSyntax: true }],];@@ -131,7 +131,6 @@ function babelTransformOptions(isTypeScript: boolean, isModule: boolean, plugins[require('@babel/preset-typescript'), { onlyRemoveTypeImports: false }],] : [],plugins: [- ...pluginsPrologue.map(([name, options]) => [require(name), options]),...plugins,...pluginsEpilogue.map(([name, options]) => [require(name), options]),],@@ -146,14 +145,14 @@ function isTypeScript(filename: string) {return filename.endsWith('.ts') || filename.endsWith('.tsx') || filename.endsWith('.mts') || filename.endsWith('.cts');}-export function babelTransform(code: string, filename: string, isModule: boolean, pluginsPrologue: [string, any?][], pluginsEpilogue: [string, any?][], jsxImportSource?: string): BabelFileResult | null {+export function babelTransform(code: string, filename: string, isModule: boolean, pluginsEpilogue: [string, any?][], jsxImportSource?: string): BabelFileResult | null {if (isTransforming)return null;// Prevent reentry while requiring plugins lazily.isTransforming = true;try {- const options = babelTransformOptions(isTypeScript(filename), isModule, pluginsPrologue, pluginsEpilogue, jsxImportSource);+ const options = babelTransformOptions(isTypeScript(filename), isModule, pluginsEpilogue, jsxImportSource);return babel.transform(code, { filename, ...options });} finally {isTransforming = false;@@ -161,6 +160,6 @@ export function babelTransform(code: string, filename: string, isModule: boolean}export function babelParse(code: string, filename: string, isModule: boolean): babel.ParseResult {- const options = babelTransformOptions(isTypeScript(filename), isModule, [], []);+ const options = babelTransformOptions(isTypeScript(filename), isModule, []);return babel.parse(code, { filename, ...options })!;}diff --git a/packages/playwright/src/transform/compilationCache.ts b/packages/playwright/src/transform/compilationCache.tsindex 6c71d39f98..dc66827bf8 100644--- a/packages/playwright/src/transform/compilationCache.ts+++ b/packages/playwright/src/transform/compilationCache.ts@@ -27,7 +27,6 @@ import { packageRoot } from '../package';export type MemoryCache = {codePath: string;sourceMapPath: string;- dataPath: string;moduleUrl?: string;};@@ -125,7 +124,7 @@ function readCodeCache(codePath: string): string {type CompilationCacheLookupResult = {serializedCache?: any;cachedCode?: string;- addToCache?: (code: string, map: any | undefined | null, data: Map<string, any>) => { serializedCache?: any };+ addToCache?: (code: string, map: any | undefined | null) => { serializedCache?: any };};export function getFromCompilationCache(filename: string, contentHash: string, moduleUrl?: string): CompilationCacheLookupResult {@@ -147,16 +146,15 @@ export function getFromCompilationCache(filename: string, contentHash: string, mconst cachePath = calculateCachePath(filename, cacheFolderName, hashPrefix);const codePath = cachePath + '.js';const sourceMapPath = cachePath + '.map';- const dataPath = cachePath + '.data';try {const cachedCode = readCodeCache(codePath);- const serializedCache = _innerAddToCompilationCacheAndSerialize(filename, { codePath, sourceMapPath, dataPath, moduleUrl });+ const serializedCache = _innerAddToCompilationCacheAndSerialize(filename, { codePath, sourceMapPath, moduleUrl });return { cachedCode, serializedCache };} catch {}return {- addToCache: (code: string, map: any | undefined | null, data: Map<string, any>) => {+ addToCache: (code: string, map: any | undefined | null) => {if (isWorkerProcess())return {};// Trim cache. This won't help with deleted files, but it will remove storing multiple copies of the same file@@ -164,10 +162,8 @@ export function getFromCompilationCache(filename: string, contentHash: string, mfs.mkdirSync(path.dirname(cachePath), { recursive: true });if (map)fs.writeFileSync(sourceMapPath, JSON.stringify(map), 'utf8');- if (data.size)- fs.writeFileSync(dataPath, JSON.stringify(Object.fromEntries(data.entries()), undefined, 2), 'utf8');writeCodeCache(codePath, code);- const serializedCache = _innerAddToCompilationCacheAndSerialize(filename, { codePath, sourceMapPath, dataPath, moduleUrl });+ const serializedCache = _innerAddToCompilationCacheAndSerialize(filename, { codePath, sourceMapPath, moduleUrl });return { serializedCache };}};@@ -311,17 +307,3 @@ export function belongsToNodeModules(file: string) {return true;return false;}--export async function getUserData(pluginName: string): Promise<Map<string, any>> {- const result = new Map<string, any>();- for (const [fileName, cache] of memoryCache) {- if (!cache.dataPath)- continue;- if (!fs.existsSync(cache.dataPath))- continue;- const data = JSON.parse(await fs.promises.readFile(cache.dataPath, 'utf8'));- if (data[pluginName])- result.set(fileName, data[pluginName]);- }- return result;-}diff --git a/packages/playwright/src/transform/transform.ts b/packages/playwright/src/transform/transform.tsindex c88c228f41..076c3b5940 100644--- a/packages/playwright/src/transform/transform.ts+++ b/packages/playwright/src/transform/transform.ts@@ -44,13 +44,11 @@ type ParsedTsConfigData = {const cachedTSConfigs = new Map<string, ParsedTsConfigData[]>();export type TransformConfig = {- babelPlugins: [string, any?][];external: string[];jsxImportSource?: string;};let _transformConfig: TransformConfig = {- babelPlugins: [],external: [],};@@ -211,20 +209,13 @@ export function shouldTransform(filename: string): boolean {return !cc.belongsToNodeModules(filename);}-let transformData: Map<string, any>;--export function setTransformData(pluginName: string, value: any) {- transformData.set(pluginName, value);-}-export function transformHook(originalCode: string, filename: string, moduleUrl?: string): { code: string, serializedCache?: any } {const hasPreprocessor =process.env.PW_TEST_SOURCE_TRANSFORM &&process.env.PW_TEST_SOURCE_TRANSFORM_SCOPE &&process.env.PW_TEST_SOURCE_TRANSFORM_SCOPE.split(pathSeparator).some(f => filename.startsWith(f));- const pluginsPrologue = _transformConfig.babelPlugins;const pluginsEpilogue = hasPreprocessor ? [[process.env.PW_TEST_SOURCE_TRANSFORM!]] as BabelPlugin[] : [];- const hash = calculateHash(originalCode, filename, !!moduleUrl, pluginsPrologue, pluginsEpilogue);+ const hash = calculateHash(originalCode, filename, !!moduleUrl, pluginsEpilogue);const { cachedCode, addToCache, serializedCache } = cc.getFromCompilationCache(filename, hash, moduleUrl);if (cachedCode !== undefined)return { code: cachedCode, serializedCache };@@ -234,32 +225,20 @@ export function transformHook(originalCode: string, filename: string, moduleUrl?process.env.BROWSERSLIST_IGNORE_OLD_DATA = 'true';const { babelTransform }: { babelTransform: BabelTransformFunction } = require(libPath('transform', 'babelBundle'));- transformData = new Map<string, any>();- // Pass `setTransformData` to plugins via plugin options instead of having- // them import it. The bundled esmLoader inlines its own copy of this file,- // so an import-based approach would close over the wrong `transformData`- // module-level variable. The closure here always references the bundle copy- // currently driving the transform.- const setTransformDataForPlugin = (key: string, value: any) => transformData.set(key, value);- const wrappedPrologue: BabelPlugin[] = pluginsPrologue.map(([name, opts]) => [- name,- { ...(opts || {}), setTransformData: setTransformDataForPlugin },- ]);- const babelResult = babelTransform(originalCode, filename, !!moduleUrl, wrappedPrologue, pluginsEpilogue, _transformConfig.jsxImportSource);+ const babelResult = babelTransform(originalCode, filename, !!moduleUrl, pluginsEpilogue, _transformConfig.jsxImportSource);if (!babelResult?.code)return { code: originalCode, serializedCache };const { code, map } = babelResult;- const added = addToCache!(code, map, transformData);+ const added = addToCache!(code, map);return { code, serializedCache: added.serializedCache };}-function calculateHash(content: string, filePath: string, isModule: boolean, pluginsPrologue: BabelPlugin[], pluginsEpilogue: BabelPlugin[]): string {+function calculateHash(content: string, filePath: string, isModule: boolean, pluginsEpilogue: BabelPlugin[]): string {const hash = crypto.createHash('sha1').update(isModule ? 'esm' : 'no_esm').update(content).update(filePath).update(version)- .update(pluginsPrologue.map(p => p[0]).join(',')).update(pluginsEpilogue.map(p => p[0]).join(',')).digest('hex');return hash;diff --git a/tests/components/.gitignore b/tests/components/.gitignoredeleted file mode 100644index 483a9c42c3..0000000000--- a/tests/components/.gitignore+++ /dev/null@@ -1 +0,0 @@-package-lock.json\ No newline at end of filediff --git a/tests/components/ct-react-vite/.gitignore b/tests/components/ct-react-vite/.gitignoredeleted file mode 100644index a547bf36d8..0000000000--- a/tests/components/ct-react-vite/.gitignore+++ /dev/null@@ -1,24 +0,0 @@-# Logs-logs-*.log-npm-debug.log*-yarn-debug.log*-yarn-error.log*-pnpm-debug.log*-lerna-debug.log*--node_modules-dist-dist-ssr-*.local--# Editor directories and files-.vscode/*-!.vscode/extensions.json-.idea-.DS_Store-*.suo-*.ntvs*-*.njsproj-*.sln-*.sw?diff --git a/tests/components/ct-react-vite/index.html b/tests/components/ct-react-vite/index.htmldeleted file mode 100644index cf3a13303c..0000000000--- a/tests/components/ct-react-vite/index.html+++ /dev/null@@ -1,13 +0,0 @@-<!DOCTYPE html>-<html lang="en">- <head>- <meta charset="UTF-8" />- <link rel="icon" type="image/svg+xml" href="/src/assets/favicon.svg" />- <meta name="viewport" content="width=device-width, initial-scale=1.0" />- <title>Vite App</title>- </head>- <body>- <div id="root"></div>- <script type="module" src="/src/main.tsx"></script>- </body>-</html>diff --git a/tests/components/ct-react-vite/package.json b/tests/components/ct-react-vite/package.jsondeleted file mode 100644index 4706770cff..0000000000--- a/tests/components/ct-react-vite/package.json+++ /dev/null@@ -1,25 +0,0 @@-{- "name": "ct-react-vite",- "private": true,- "version": "0.0.0",- "type": "module",- "scripts": {- "dev": "vite",- "build": "tsc && vite build",- "preview": "vite preview",- "typecheck": "tsc --noEmit"- },- "dependencies": {- "react": "^18.2.0",- "react-dom": "^18.2.0",- "react-router-dom": "^6.6.1"- },- "devDependencies": {- "@types/react": "^18.0.26",- "@types/react-dom": "^18.0.10",- "@vitejs/plugin-react": "^6.0.3",- "msw": "^2.3.0",- "typescript": "^5.2.2",- "vite": "^8.1.0"- }-}diff --git a/tests/components/ct-react-vite/playwright.config.ts b/tests/components/ct-react-vite/playwright.config.tsdeleted file mode 100644index 42db0226d1..0000000000--- a/tests/components/ct-react-vite/playwright.config.ts+++ /dev/null@@ -1,53 +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, devices } from '@playwright/experimental-ct-react';-import path from 'path';-import { fileURLToPath } from 'url';--export default defineConfig({- testDir: 'tests',- forbidOnly: !!process.env.CI,- retries: process.env.CI ? 2 : 0,- reporter: process.env.CI ? 'html' : 'line',- use: {- trace: 'on-first-retry',- ctViteConfig: {- build: {- assetsInlineLimit: 0,- },- resolve: {- alias: {- '@': path.resolve(path.dirname(fileURLToPath(import.meta.url)), './src'),- }- }- }- },- projects: [- {- name: 'chromium',- use: { ...devices['Desktop Chrome'] },- },- {- name: 'firefox',- use: { ...devices['Desktop Firefox'] },- },- {- name: 'webkit',- use: { ...devices['Desktop Safari'] },- },- ],-});diff --git a/tests/components/ct-react-vite/playwright/index.html b/tests/components/ct-react-vite/playwright/index.htmldeleted file mode 100644index f7b4577817..0000000000--- a/tests/components/ct-react-vite/playwright/index.html+++ /dev/null@@ -1,13 +0,0 @@-<!DOCTYPE html>-<html lang="en">- <head>- <meta charset="UTF-8" />- <link rel="icon" type="image/svg+xml" href="/src/assets/favicon.svg" />- <meta name="viewport" content="width=device-width, initial-scale=1.0" />- <title>Vite App</title>- </head>- <body>- <div id="root"></div>- <script type="module" src="./index.tsx"></script>- </body>-</html>diff --git a/tests/components/ct-react-vite/playwright/index.tsx b/tests/components/ct-react-vite/playwright/index.tsxdeleted file mode 100644index fa0563dbcd..0000000000--- a/tests/components/ct-react-vite/playwright/index.tsx+++ /dev/null@@ -1,19 +0,0 @@-import { beforeMount, afterMount } from '@playwright/experimental-ct-react/hooks';-import { BrowserRouter } from 'react-router-dom';-import '../src/assets/index.css';--export type HooksConfig = {- route?: string;- routing?: boolean;-}--beforeMount<HooksConfig>(async ({ hooksConfig, App }) => {- console.log(`Before mount: ${JSON.stringify(hooksConfig)}`);-- if (hooksConfig?.routing)- return <BrowserRouter><App /></BrowserRouter>;-});--afterMount<HooksConfig>(async () => {- console.log(`After mount`);-});diff --git a/tests/components/ct-react-vite/src/App.tsx b/tests/components/ct-react-vite/src/App.tsxdeleted file mode 100644index fd004390f3..0000000000--- a/tests/components/ct-react-vite/src/App.tsx+++ /dev/null@@ -1,21 +0,0 @@-import { Routes, Route, Link } from 'react-router-dom';-import logo from './assets/logo.svg';-import LoginPage from './pages/LoginPage';-import DashboardPage from './pages/DashboardPage';--export default function App({ title }: { title?: string }) {- return <>- <header>- <img src={logo} alt="logo" width={125} height={125} />- {title && <h1>{title}</h1>}- <Link to="/">Login</Link>- <Link to="/dashboard">Dashboard</Link>- </header>- <Routes>- <Route path="/">- <Route index element={<LoginPage />} />- <Route path="dashboard" element={<DashboardPage />} />- </Route>- </Routes>- </>-}diff --git a/tests/components/ct-react-vite/src/assets/favicon.svg b/tests/components/ct-react-vite/src/assets/favicon.svgdeleted file mode 100644index de4aeddc12..0000000000--- a/tests/components/ct-react-vite/src/assets/favicon.svg+++ /dev/null@@ -1,15 +0,0 @@-<svg width="410" height="404" viewBox="0 0 410 404" fill="none" xmlns="http://www.w3.org/2000/svg">-<path d="M399.641 59.5246L215.643 388.545C211.844 395.338 202.084 395.378 198.228 388.618L10.5817 59.5563C6.38087 52.1896 12.6802 43.2665 21.0281 44.7586L205.223 77.6824C206.398 77.8924 207.601 77.8904 208.776 77.6763L389.119 44.8058C397.439 43.2894 403.768 52.1434 399.641 59.5246Z" fill="url(#paint0_linear)"/>-<path d="M292.965 1.5744L156.801 28.2552C154.563 28.6937 152.906 30.5903 152.771 32.8664L144.395 174.33C144.198 177.662 147.258 180.248 150.51 179.498L188.42 170.749C191.967 169.931 195.172 173.055 194.443 176.622L183.18 231.775C182.422 235.487 185.907 238.661 189.532 237.56L212.947 230.446C216.577 229.344 220.065 232.527 219.297 236.242L201.398 322.875C200.278 328.294 207.486 331.249 210.492 326.603L212.5 323.5L323.454 102.072C325.312 98.3645 322.108 94.137 318.036 94.9228L279.014 102.454C275.347 103.161 272.227 99.746 273.262 96.1583L298.731 7.86689C299.767 4.27314 296.636 0.855181 292.965 1.5744Z" fill="url(#paint1_linear)"/>-<defs>-<linearGradient id="paint0_linear" x1="6.00017" y1="32.9999" x2="235" y2="344" gradientUnits="userSpaceOnUse">-<stop stop-color="#41D1FF"/>-<stop offset="1" stop-color="#BD34FE"/>-</linearGradient>-<linearGradient id="paint1_linear" x1="194.651" y1="8.81818" x2="236.076" y2="292.989" gradientUnits="userSpaceOnUse">-<stop stop-color="#FFEA83"/>-<stop offset="0.0833333" stop-color="#FFDD35"/>-<stop offset="1" stop-color="#FFA800"/>-</linearGradient>-</defs>-</svg>diff --git a/tests/components/ct-react-vite/src/assets/iconfont.woff2 b/tests/components/ct-react-vite/src/assets/iconfont.woff2deleted file mode 100644index ed1f4f34a4..0000000000Binary files a/tests/components/ct-react-vite/src/assets/iconfont.woff2 and /dev/null differdiff --git a/tests/components/ct-react-vite/src/assets/index.css b/tests/components/ct-react-vite/src/assets/index.cssdeleted file mode 100644index dd2a6fa726..0000000000--- a/tests/components/ct-react-vite/src/assets/index.css+++ /dev/null@@ -1,29 +0,0 @@-body {- margin: 0;- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',- 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',- sans-serif;- -webkit-font-smoothing: antialiased;- -moz-osx-font-smoothing: grayscale;-}--code {- font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',- monospace;-}--@media (prefers-color-scheme: light) {- :root {- color: #e3e3e3;- background-color: #1b1b1d;- }-}--@font-face {- font-family: 'pwtest-iconfont';- /* See tests/assets/webfont/README.md */- src: url('./iconfont.woff2') format('woff2');- font-weight: normal;- font-style: normal;- font-display: swap;-}diff --git a/tests/components/ct-react-vite/src/assets/logo.svg b/tests/components/ct-react-vite/src/assets/logo.svgdeleted file mode 100644index 6b60c1042f..0000000000--- a/tests/components/ct-react-vite/src/assets/logo.svg+++ /dev/null@@ -1,7 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3">- <g fill="#61DAFB">- <path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/>- <circle cx="420.9" cy="296.5" r="45.7"/>- <path d="M520.5 78.1z"/>- </g>-</svg>diff --git a/tests/components/ct-react-vite/src/components/Button.tsx b/tests/components/ct-react-vite/src/components/Button.tsxdeleted file mode 100644index 8785b878d0..0000000000--- a/tests/components/ct-react-vite/src/components/Button.tsx+++ /dev/null@@ -1,13 +0,0 @@-import { ButtonHTMLAttributes } from "react";--type ButtonProps = {- title: string;- onClick?(props: string): void;- className?: string;-} & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick'>;--export default function Button({ onClick, title, ...attributes }: ButtonProps) {- return <button {...attributes} onClick={() => onClick?.('hello')}>- {title}- </button>-}diff --git a/tests/components/ct-react-vite/src/components/CheckChildrenProp.tsx b/tests/components/ct-react-vite/src/components/CheckChildrenProp.tsxdeleted file mode 100644index 3e8f405a5b..0000000000--- a/tests/components/ct-react-vite/src/components/CheckChildrenProp.tsx+++ /dev/null@@ -1,7 +0,0 @@-import type { PropsWithChildren } from 'react';--type DefaultChildrenProps = PropsWithChildren<{}>;--export default function CheckChildrenProp(props: DefaultChildrenProps) {- return <>{'children' in props ? props.children : 'No Children'}</>-}diff --git a/tests/components/ct-react-vite/src/components/ComponentAsProp.tsx b/tests/components/ct-react-vite/src/components/ComponentAsProp.tsxdeleted file mode 100644index 67b8813207..0000000000--- a/tests/components/ct-react-vite/src/components/ComponentAsProp.tsx+++ /dev/null@@ -1,9 +0,0 @@-import { ReactNode } from "react";--type ComponentAsProp = {- component: ReactNode[] | ReactNode;-};--export function ComponentAsProp({ component }: ComponentAsProp) {- return <div>{component}</div>-}diff --git a/tests/components/ct-react-vite/src/components/Counter.tsx b/tests/components/ct-react-vite/src/components/Counter.tsxdeleted file mode 100644index 18e999de73..0000000000--- a/tests/components/ct-react-vite/src/components/Counter.tsx+++ /dev/null@@ -1,25 +0,0 @@-import { useLayoutEffect, useRef, useState } from "react"-- type CounterProps = {- count?: number;- onClick?(props: string): void;- children?: any;- }-- let _remountCount = 1;-- export default function Counter(props: CounterProps) {- const [remountCount] = useState(_remountCount);- const didMountRef = useRef(false)- useLayoutEffect(() => {- if (!didMountRef.current) {- didMountRef.current = true;- _remountCount++;- }- }, [])- return <button onClick={() => props.onClick?.('hello')}>- <span data-testid="props">{ props.count }</span>- <span data-testid="remount-count">{ remountCount }</span>- { props.children }- </button>- }diff --git a/tests/components/ct-react-vite/src/components/DefaultChildren.tsx b/tests/components/ct-react-vite/src/components/DefaultChildren.tsxdeleted file mode 100644index 691b6a0806..0000000000--- a/tests/components/ct-react-vite/src/components/DefaultChildren.tsx+++ /dev/null@@ -1,15 +0,0 @@-type DefaultChildrenProps = {- children?: any;-}--export default function DefaultChildren(props: DefaultChildrenProps) {- return <div>- <h1>Welcome!</h1>- <main>- {props.children}- </main>- <footer>- Thanks for visiting.- </footer>- </div>-}diff --git a/tests/components/ct-react-vite/src/components/EmptyFragment.tsx b/tests/components/ct-react-vite/src/components/EmptyFragment.tsxdeleted file mode 100644index b424841462..0000000000--- a/tests/components/ct-react-vite/src/components/EmptyFragment.tsx+++ /dev/null@@ -1,4 +0,0 @@-export default function EmptyFragment(props: unknown) {- Object.assign(window, { props });- return <>{[]}</>;-}diff --git a/tests/components/ct-react-vite/src/components/Fetcher.tsx b/tests/components/ct-react-vite/src/components/Fetcher.tsxdeleted file mode 100644index 2f1322d148..0000000000--- a/tests/components/ct-react-vite/src/components/Fetcher.tsx+++ /dev/null@@ -1,32 +0,0 @@-import { useEffect, useState } from "react"--export default function Fetcher() {- const [data, setData] = useState<{ name: string }>({ name: '<none>' });- const [fetched, setFetched] = useState(false);-- useEffect(() => {- const doFetch = async () => {- try {- const response = await fetch('/data.json');- setData(await response.json());- } catch {- setData({ name: '<error>' });- }- setFetched(true);- }-- if (!fetched)- doFetch();- }, [fetched, setFetched, setData]);-- return <div>- <div data-testid='name'>{data.name}</div>- <button onClick={() => {- setFetched(false);- setData({ name: '<none>' });- }}>Reset</button>- <button onClick={() => {- fetch('/post', { method: 'POST', body: 'hello from the page' });- }}>Post it</button>- </div>;-}diff --git a/tests/components/ct-react-vite/src/components/MultiRoot.tsx b/tests/components/ct-react-vite/src/components/MultiRoot.tsxdeleted file mode 100644index f29e397c0f..0000000000--- a/tests/components/ct-react-vite/src/components/MultiRoot.tsx+++ /dev/null@@ -1,6 +0,0 @@-export default function MultiRoot() {- return <>- <div>root 1</div>- <div>root 2</div>- </>-}diff --git a/tests/components/ct-react-vite/src/components/MultipleChildren.tsx b/tests/components/ct-react-vite/src/components/MultipleChildren.tsxdeleted file mode 100644index 63bd0104c6..0000000000--- a/tests/components/ct-react-vite/src/components/MultipleChildren.tsx+++ /dev/null@@ -1,18 +0,0 @@--type MultipleChildrenProps = {- children?: [any, any, any];-}--export default function MultipleChildren(props: MultipleChildrenProps) {- return <div>- <header>- {props.children?.at(0)}- </header>- <main>- {props.children?.at(1)}- </main>- <footer>- {props.children?.at(2)}- </footer>-</div>-}diff --git a/tests/components/ct-react-vite/src/components/TitleWithFont.css b/tests/components/ct-react-vite/src/components/TitleWithFont.cssdeleted file mode 100644index 9fc7e0a7c0..0000000000--- a/tests/components/ct-react-vite/src/components/TitleWithFont.css+++ /dev/null@@ -1,3 +0,0 @@-.title-with-font {- font-family: pwtest-iconfont, sans-serif;-}diff --git a/tests/components/ct-react-vite/src/components/TitleWithFont.tsx b/tests/components/ct-react-vite/src/components/TitleWithFont.tsxdeleted file mode 100644index ad783205c3..0000000000--- a/tests/components/ct-react-vite/src/components/TitleWithFont.tsx+++ /dev/null@@ -1,5 +0,0 @@-import './TitleWithFont.css';--export default function TitleWithFont() {- return <div className='title-with-font'>+-</div>-}diff --git a/tests/components/ct-react-vite/src/main.tsx b/tests/components/ct-react-vite/src/main.tsxdeleted file mode 100644index f3fe4a896d..0000000000--- a/tests/components/ct-react-vite/src/main.tsx+++ /dev/null@@ -1,13 +0,0 @@-import * as React from 'react';-import { createRoot } from 'react-dom/client';-import { BrowserRouter } from 'react-router-dom';-import App from './App';-import './assets/index.css';--createRoot(document.getElementById("root")!).render(- <React.StrictMode>- <BrowserRouter>- <App />- </BrowserRouter>- </React.StrictMode>-);diff --git a/tests/components/ct-react-vite/src/pages/DashboardPage.tsx b/tests/components/ct-react-vite/src/pages/DashboardPage.tsxdeleted file mode 100644index 64307e87f3..0000000000--- a/tests/components/ct-react-vite/src/pages/DashboardPage.tsx+++ /dev/null@@ -1,3 +0,0 @@-export default function DashboardPage() {- return <main>Dashboard</main>-}diff --git a/tests/components/ct-react-vite/src/pages/LoginPage.tsx b/tests/components/ct-react-vite/src/pages/LoginPage.tsxdeleted file mode 100644index 96adc431ed..0000000000--- a/tests/components/ct-react-vite/src/pages/LoginPage.tsx+++ /dev/null@@ -1,3 +0,0 @@-export default function LoginPage() {- return <main>Login</main>-}diff --git a/tests/components/ct-react-vite/src/vite-env.d.ts b/tests/components/ct-react-vite/src/vite-env.d.tsdeleted file mode 100644index 11f02fe2a0..0000000000--- a/tests/components/ct-react-vite/src/vite-env.d.ts+++ /dev/null@@ -1 +0,0 @@-/// <reference types="vite/client" />diff --git a/tests/components/ct-react-vite/tests/callbacks.spec.tsx b/tests/components/ct-react-vite/tests/callbacks.spec.tsxdeleted file mode 100644index d9d15dac16..0000000000--- a/tests/components/ct-react-vite/tests/callbacks.spec.tsx+++ /dev/null@@ -1,28 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-react';-import Button from '@/components/Button';-import DefaultChildren from '@/components/DefaultChildren';--test('execute callback when the button is clicked', async ({ mount }) => {- const messages: string[] = [];- const component = await mount(- <Button- title="Submit"- onClick={(data) => {- messages.push(data);- }}- ></Button>- );- await component.click();- expect(messages).toEqual(['hello']);-});--test('execute callback when a child node is clicked', async ({ mount }) => {- let clickFired = false;- const component = await mount(- <DefaultChildren>- <span onClick={() => (clickFired = true)}>Main Content</span>- </DefaultChildren>- );- await component.getByText('Main Content').click();- expect(clickFired).toBeTruthy();-});diff --git a/tests/components/ct-react-vite/tests/children.spec.tsx b/tests/components/ct-react-vite/tests/children.spec.tsxdeleted file mode 100644index 03da7d2c55..0000000000--- a/tests/components/ct-react-vite/tests/children.spec.tsx+++ /dev/null@@ -1,66 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-react';-import Button from '@/components/Button';-import CheckChildrenProp from '@/components/CheckChildrenProp';-import DefaultChildren from '@/components/DefaultChildren';-import MultipleChildren from '@/components/MultipleChildren';--test('render a default child', async ({ mount }) => {- const component = await mount(- <DefaultChildren>Main Content</DefaultChildren>- );- await expect(component).toContainText('Main Content');-});--test('render a component as child', async ({ mount }) => {- const component = await mount(- <DefaultChildren>- <Button title="Submit" />- </DefaultChildren>- );- await expect(component).toContainText('Submit');-});--test('render multiple children', async ({ mount }) => {- const component = await mount(- <DefaultChildren>- <div data-testid="one">One</div>- <div data-testid="two">Two</div>- </DefaultChildren>- );- await expect(component.getByTestId('one')).toContainText('One');- await expect(component.getByTestId('two')).toContainText('Two');-});--test('render named children', async ({ mount }) => {- const component = await mount(- <MultipleChildren>- <div>Header</div>- <div>Main Content</div>- <div>Footer</div>- </MultipleChildren>- );- await expect(component).toContainText('Header');- await expect(component).toContainText('Main Content');- await expect(component).toContainText('Footer');-});--test('render string as child', async ({ mount }) => {- const component = await mount(<DefaultChildren>{'string'}</DefaultChildren>);- await expect(component).toContainText('string');-});--test('render array as child', async ({ mount }) => {- const component = await mount(<DefaultChildren>{[<h4>{[4]}</h4>,[[<p>[2,3]</p>]]]}</DefaultChildren>);- await expect(component.getByRole('heading', { level: 4 })).toHaveText('4');- await expect(component.getByRole('paragraph')).toHaveText('[2,3]');-});--test('render number as child', async ({ mount }) => {- const component = await mount(<DefaultChildren>{1337}</DefaultChildren>);- await expect(component).toContainText('1337');-});--test('absence of children when children prop is not provided', async ({ mount }) => {- const component = await mount(<CheckChildrenProp />);- await expect(component).toContainText('No Children');-});diff --git a/tests/components/ct-react-vite/tests/react-router.spec.tsx b/tests/components/ct-react-vite/tests/react-router.spec.tsxdeleted file mode 100644index 939154e9d4..0000000000--- a/tests/components/ct-react-vite/tests/react-router.spec.tsx+++ /dev/null@@ -1,26 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-react';-import App from '@/App';-import type { HooksConfig } from '../playwright';--test('navigate to a page by clicking a link', async ({ page, mount }) => {- const component = await mount<HooksConfig>(<App />, {- hooksConfig: { routing: true },- });- await expect(component.getByRole('main')).toHaveText('Login');- await expect(page).toHaveURL('/');- await component.getByRole('link', { name: 'Dashboard' }).click();- await expect(component.getByRole('main')).toHaveText('Dashboard');- await expect(page).toHaveURL('/dashboard');-});--test('update should not reset mount hooks', async ({ page, mount }) => {- const component = await mount<HooksConfig>(<App title='before'/>, {- hooksConfig: { routing: true },- });- await expect(component.getByRole('heading')).toHaveText('before');- await expect(component.getByRole('main')).toHaveText('Login');-- await component.update(<App title='after'/>);- await expect(component.getByRole('heading')).toHaveText('after');- await expect(component.getByRole('main')).toHaveText('Login');-});diff --git a/tests/components/ct-react-vite/tests/render.spec.tsx b/tests/components/ct-react-vite/tests/render.spec.tsxdeleted file mode 100644index b7d0e61b29..0000000000--- a/tests/components/ct-react-vite/tests/render.spec.tsx+++ /dev/null@@ -1,53 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-react';-import Button from '@/components/Button';-import EmptyFragment from '@/components/EmptyFragment';-import { ComponentAsProp } from '@/components/ComponentAsProp';-import DefaultChildren from '@/components/DefaultChildren';--test('render props', async ({ mount }) => {- const component = await mount(<Button title="Submit" />);- await expect(component).toContainText('Submit');-});--test('render component as props', async ({ mount }) => {- const component = await mount(<ComponentAsProp component={<Button title="Submit" />} />);- await expect(component.getByRole('button', { name: 'submit' })).toBeVisible();-});--test('render jsx array as props', async ({ mount }) => {- const component = await mount(<ComponentAsProp component={[<h4>{[4]}</h4>,[[<p>[2,3]</p>]]]} />);- await expect(component.getByRole('heading', { level: 4 })).toHaveText('4');- await expect(component.getByRole('paragraph')).toHaveText('[2,3]');-});--test('render attributes', async ({ mount }) => {- const component = await mount(<Button className="primary" title="Submit" />);- await expect(component).toHaveClass('primary');-});--test('render an empty component', async ({ mount, page }) => {- const component = await mount(<EmptyFragment />);- expect(await page.evaluate(() => 'props' in window && window.props)).toEqual({});- expect(await component.allTextContents()).toEqual(['']);- expect(await component.textContent()).toBe('');- await expect(component).toHaveText('');-});--function MyInlineComponent({ value }: { value: string }) {- return <>Hello {value}</>;-}--test('render inline component with an error', async ({ mount }) => {- await expect(mount(<MyInlineComponent value="Max" />)).rejects.toThrow('Component "MyInlineComponent" cannot be mounted.');-});--test('render inline component with an error if its nested', async ({ mount }) => {- await expect(mount(<DefaultChildren>- <MyInlineComponent value="Max" />- </DefaultChildren>)).rejects.toThrow('Component "MyInlineComponent" cannot be mounted.');-});--test('render Fragment shorthand notation', { annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/32853' } }, async ({ mount }) => {- const component = await mount(<>Learn React</>);- await expect(component).toContainText('Learn React');-});diff --git a/tests/components/ct-react-vite/tests/route.spec.tsx b/tests/components/ct-react-vite/tests/route.spec.tsxdeleted file mode 100644index 4368a4d41e..0000000000--- a/tests/components/ct-react-vite/tests/route.spec.tsx+++ /dev/null@@ -1,182 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-react';-import TitleWithFont from '@/components/TitleWithFont';-import Fetcher from '@/components/Fetcher';-import { http, HttpResponse, passthrough, bypass } from 'msw';-import httpServer from 'http';-import type net from 'net';--test('should load font without routes', async ({ mount, page }) => {- const promise = page.waitForEvent('requestfinished', request => request.url().includes('iconfont'));- await mount(<TitleWithFont />);- const request = await promise;- const response = await request.response();- const body = await response!.body();- expect(body.length).toBe(348);-});--test('should load font with routes', async ({ mount, page }) => {- test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/27294' });- await page.route('**/*.json', r => r.continue());- const promise = page.waitForEvent('requestfinished', request => request.url().includes('iconfont'));- await mount(<TitleWithFont />);- const request = await promise;- const response = await request.response();- const body = await response!.body();- expect(body.length).toBe(348);-});--test.describe('request handlers', () => {- test('should handle requests', async ({ page, mount, router }) => {- let respond: (() => void) = () => {};- const promise = new Promise<void>(f => respond = f);-- let postReceived: ((body: string) => void) = () => {};- const postBody = new Promise<string>(f => postReceived = f);-- await router.use(- http.get('/data.json', async () => {- await promise;- return HttpResponse.json({ name: 'John Doe' });- }),- http.post('/post', async ({ request }) => {- postReceived(await request.text());- return HttpResponse.text('ok');- }),- );-- const component = await mount(<Fetcher />);- await expect(component.getByTestId('name')).toHaveText('<none>');-- respond();- await expect(component.getByTestId('name')).toHaveText('John Doe');-- await component.getByRole('button', { name: 'Post it' }).click();- expect(await postBody).toBe('hello from the page');- });-- test('should add dynamically', async ({ page, mount, router }) => {- await router.route('**/data.json', async route => {- await route.fulfill({ body: JSON.stringify({ name: '<original>' }) });- });-- const component = await mount(<Fetcher />);- await expect(component.getByTestId('name')).toHaveText('<original>');-- await router.use(- http.get('/data.json', async () => {- return HttpResponse.json({ name: 'John Doe' });- }),- );-- await component.getByRole('button', { name: 'Reset' }).click();- await expect(component.getByTestId('name')).toHaveText('John Doe');- });-- test('should passthrough', async ({ page, mount, router }) => {- await router.route('**/data.json', async route => {- await route.fulfill({ body: JSON.stringify({ name: '<original>' }) });- });-- await router.use(- http.get('/data.json', async () => {- return passthrough();- }),- );-- const component = await mount(<Fetcher />);- await expect(component.getByTestId('name')).toHaveText('<error>');- });-- test('should fallback when nothing is returned', async ({ page, mount, router }) => {- await router.route('**/data.json', async route => {- await route.fulfill({ body: JSON.stringify({ name: '<original>' }) });- });-- let called = false;- await router.use(- http.get('/data.json', async () => {- called = true;- }),- );-- const component = await mount(<Fetcher />);- await expect(component.getByTestId('name')).toHaveText('<original>');- expect(called).toBe(true);- });-- test('should bypass(request)', async ({ page, mount, router }) => {- await router.route('**/data.json', async route => {- await route.fulfill({ body: JSON.stringify({ name: `<original>` }) });- });-- await router.use(- http.get('/data.json', async ({ request }) => {- return await fetch(bypass(request));- }),- );-- const component = await mount(<Fetcher />);- await expect(component.getByTestId('name')).toHaveText('<error>');- });-- test('should bypass(url) and get cookies', async ({ page, mount, router, browserName }) => {- let cookie = '';- const server = new httpServer.Server();- server.on('request', (req, res) => {- cookie = req.headers['cookie']!;- res.writeHead(200, { 'Content-Type': 'application/json' }).end(JSON.stringify({ name: '<server>' }));- });- await new Promise<void>(f => server.listen(0, f));- const port = (server.address() as net.AddressInfo).port;-- await router.route('**/data.json', async route => {- await route.fulfill({ body: JSON.stringify({ name: `<original>` }) });- });-- const component = await mount(<Fetcher />);- await expect(component.getByTestId('name')).toHaveText('<original>');-- await page.evaluate(() => document.cookie = 'foo=bar');- await router.use(- http.get('/data.json', async ({ request }) => {- if (browserName !== 'webkit') {- // WebKit does not have cookies while intercepting.- expect(request.headers.get('cookie')).toBe('foo=bar');- }- return await fetch(bypass(`http://localhost:${port}`));- }),- );- await component.getByRole('button', { name: 'Reset' }).click();- await expect(component.getByTestId('name')).toHaveText('<server>');-- expect(cookie).toBe('foo=bar');- await new Promise(f => server.close(f));- });-- test('should ignore navigation requests', async ({ page, mount, router }) => {- await router.route('**/newpage', async route => {- await route.fulfill({ body: `<div>original</div>`, contentType: 'text/html' });- });-- await router.use(- http.get('/newpage', async ({ request }) => {- return new Response(`<div>intercepted</div>`, {- headers: new Headers({ 'Content-Type': 'text/html' }),- });- }),- );-- await mount(<div />);- await page.goto('/newpage');- await expect(page.locator('div')).toHaveText('original');- });-- test('should throw when calling fetch(bypass) outside of a handler', async ({ page, router, baseURL }) => {- await router.use(http.get('/data.json', async () => {}));-- const error = await fetch(bypass(baseURL + '/hello')).catch(e => e);- expect(error.message).toContain(`Cannot call fetch(bypass()) outside of a request handler`);- });--});-diff --git a/tests/components/ct-react-vite/tests/unmount.spec.tsx b/tests/components/ct-react-vite/tests/unmount.spec.tsxdeleted file mode 100644index 4ce2d45889..0000000000--- a/tests/components/ct-react-vite/tests/unmount.spec.tsx+++ /dev/null@@ -1,32 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-react';-import Button from '@/components/Button';-import MultiRoot from '@/components/MultiRoot';--test('unmount', async ({ page, mount }) => {- const component = await mount(<Button title="Submit" />);- await expect(page.locator('#root')).toContainText('Submit');- await component.unmount();- await expect(page.locator('#root')).not.toContainText('Submit');-});--test('unmount a multi root component', async ({ mount, page }) => {- const component = await mount(<MultiRoot />);- await expect(page.locator('#root')).toContainText('root 1');- await expect(page.locator('#root')).toContainText('root 2');- await component.unmount();- await expect(page.locator('#root')).not.toContainText('root 1');- await expect(page.locator('#root')).not.toContainText('root 2');-});--test('unmount twice throws an error', async ({ mount }) => {- const component = await mount(<Button title="Submit" />);- await component.unmount();- await expect(component.unmount()).rejects.toThrowError('Component was not mounted');-});--test('mount then unmount then mount', async ({ mount }) => {- let component = await mount(<Button title="Submit" />);- await component.unmount();- component = await mount(<Button title="Save" />);- await expect(component).toContainText('Save');-});diff --git a/tests/components/ct-react-vite/tests/update.spec.tsx b/tests/components/ct-react-vite/tests/update.spec.tsxdeleted file mode 100644index e492a4e4cb..0000000000--- a/tests/components/ct-react-vite/tests/update.spec.tsx+++ /dev/null@@ -1,91 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-react';-import Counter from '@/components/Counter';-import DefaultChildren from '@/components/DefaultChildren';--test('update props without remounting', async ({ mount }) => {- const component = await mount(<Counter count={9001} />);- await expect(component.getByTestId('props')).toContainText('9001');-- await component.update(<Counter count={1337} />);- await expect(component).not.toContainText('9001');- await expect(component.getByTestId('props')).toContainText('1337');-- await expect(component.getByTestId('remount-count')).toContainText('1');-});--test('update child props without remounting', async ({ mount }) => {- const component = await mount(<DefaultChildren><Counter count={9001} /></DefaultChildren>);- await expect(component.getByTestId('props')).toContainText('9001');-- await component.update(<DefaultChildren><Counter count={1337} /></DefaultChildren>);- await expect(component).not.toContainText('9001');- await expect(component.getByTestId('props')).toContainText('1337');-- await expect(component.getByTestId('remount-count')).toContainText('1');-});--test('update callbacks without remounting', async ({ mount }) => {- const component = await mount(<Counter />);-- const messages: string[] = [];- await component.update(- <Counter- onClick={(message) => {- messages.push(message);- }}- />- );- await component.click();- expect(messages).toEqual(['hello']);-- await expect(component.getByTestId('remount-count')).toContainText('1');-});--test('update child callbacks without remounting', async ({ mount }) => {- const component = await mount(<DefaultChildren><Counter /></DefaultChildren>);-- const messages: string[] = [];- await component.update(- <DefaultChildren>- <Counter- onClick={(message) => {- messages.push(message);- }}- />- </DefaultChildren>- );- await component.getByRole('button').click();- expect(messages).toEqual(['hello']);-- await expect(component.getByTestId('remount-count')).toContainText('1');-});--test('update children without remounting', async ({ mount }) => {- const component = await mount(<Counter>Default Slot</Counter>);- await expect(component).toContainText('Default Slot');-- await component.update(<Counter>Test Slot</Counter>);- await expect(component).not.toContainText('Default Slot');- await expect(component).toContainText('Test Slot');-- await expect(component.getByTestId('remount-count')).toContainText('1');-});--test('update grandchild without remounting', async ({ mount }) => {- const component = await mount(- <DefaultChildren>- <Counter>Default Slot</Counter>- </DefaultChildren>- );- await expect(component.getByRole('button')).toContainText('Default Slot');-- await component.update(- <DefaultChildren>- <Counter>Test Slot</Counter>- </DefaultChildren>- );- await expect(component.getByRole('button')).not.toContainText('Default Slot');- await expect(component.getByRole('button')).toContainText('Test Slot');-- await expect(component.getByTestId('remount-count')).toContainText('1');-});diff --git a/tests/components/ct-react-vite/tsconfig.json b/tests/components/ct-react-vite/tsconfig.jsondeleted file mode 100644index e706497adb..0000000000--- a/tests/components/ct-react-vite/tsconfig.json+++ /dev/null@@ -1,26 +0,0 @@-{- "compilerOptions": {- "target": "ESNext",- "useDefineForClassFields": true,- "lib": ["DOM", "DOM.Iterable", "ESNext"],- "allowJs": false,- "skipLibCheck": true,- "esModuleInterop": false,- "allowSyntheticDefaultImports": true,- "strict": true,- "forceConsistentCasingInFileNames": true,- "module": "ESNext",- "moduleResolution": "Node",- "resolveJsonModule": true,- "isolatedModules": true,- "noEmit": true,- "jsx": "react-jsx",- "baseUrl": ".",- "paths": {- "@/*": ["./src/*"],- "*": ["_"],- }- },- "include": ["src", "tests"],- "references": [{ "path": "./tsconfig.node.json" }]-}diff --git a/tests/components/ct-react-vite/tsconfig.node.json b/tests/components/ct-react-vite/tsconfig.node.jsondeleted file mode 100644index e993792cb1..0000000000--- a/tests/components/ct-react-vite/tsconfig.node.json+++ /dev/null@@ -1,8 +0,0 @@-{- "compilerOptions": {- "composite": true,- "module": "esnext",- "moduleResolution": "node"- },- "include": ["vite.config.ts"]-}diff --git a/tests/components/ct-react-vite/vite.config.ts b/tests/components/ct-react-vite/vite.config.tsdeleted file mode 100644index b1b5f91e5f..0000000000--- a/tests/components/ct-react-vite/vite.config.ts+++ /dev/null@@ -1,7 +0,0 @@-import { defineConfig } from 'vite'-import react from '@vitejs/plugin-react'--// https://vitejs.dev/config/-export default defineConfig({- plugins: [react()]-})diff --git a/tests/components/ct-react17/.gitignore b/tests/components/ct-react17/.gitignoredeleted file mode 100644index 4d29575de8..0000000000--- a/tests/components/ct-react17/.gitignore+++ /dev/null@@ -1,23 +0,0 @@-# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.--# dependencies-/node_modules-/.pnp-.pnp.js--# testing-/coverage--# production-/build--# misc-.DS_Store-.env.local-.env.development.local-.env.test.local-.env.production.local--npm-debug.log*-yarn-debug.log*-yarn-error.log*diff --git a/tests/components/ct-react17/README.md b/tests/components/ct-react17/README.mddeleted file mode 100644index b87cb00449..0000000000--- a/tests/components/ct-react17/README.md+++ /dev/null@@ -1,46 +0,0 @@-# Getting Started with Create React App--This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).--## Available Scripts--In the project directory, you can run:--### `npm start`--Runs the app in the development mode.\-Open [http://localhost:3000](http://localhost:3000) to view it in the browser.--The page will reload if you make edits.\-You will also see any lint errors in the console.--### `npm test`--Launches the test runner in the interactive watch mode.\-See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.--### `npm run build`--Builds the app for production to the `build` folder.\-It correctly bundles React in production mode and optimizes the build for the best performance.--The build is minified and the filenames include the hashes.\-Your app is ready to be deployed!--See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.--### `npm run eject`--**Note: this is a one-way operation. Once you `eject`, you can’t go back!**--If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.--Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.--You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.--## Learn More--You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).--To learn React, check out the [React documentation](https://reactjs.org/).diff --git a/tests/components/ct-react17/package.json b/tests/components/ct-react17/package.jsondeleted file mode 100644index 5a717e1d05..0000000000--- a/tests/components/ct-react17/package.json+++ /dev/null@@ -1,40 +0,0 @@-{- "name": "ct-react",- "version": "0.1.0",- "private": true,- "dependencies": {- "react": "^17.0.1",- "react-dom": "^17.0.1",- "react-router-dom": "^6.6.1"- },- "devDependencies": {- "@types/node": "^16.11.26",- "@types/react": "^17.0.39",- "@types/react-dom": "^17.0.11",- "react-scripts": "5.0.1",- "typescript": "^4.6.2"- },- "scripts": {- "start": "react-scripts start",- "build": "react-scripts build",- "eject": "react-scripts eject",- "typecheck": "echo \"typecheck disabled because of zod v4 being incompatible with ts 4\""- },- "eslintConfig": {- "extends": [- "react-app"- ]- },- "browserslist": {- "production": [- ">0.2%",- "not dead",- "not op_mini all"- ],- "development": [- "last 1 chrome version",- "last 1 firefox version",- "last 1 safari version"- ]- }-}diff --git a/tests/components/ct-react17/playwright.config.ts b/tests/components/ct-react17/playwright.config.tsdeleted file mode 100644index b22ac8ceff..0000000000--- a/tests/components/ct-react17/playwright.config.ts+++ /dev/null@@ -1,49 +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, devices } from '@playwright/experimental-ct-react17';-import { resolve } from 'path';--export default defineConfig({- testDir: 'tests',- forbidOnly: !!process.env.CI,- retries: process.env.CI ? 2 : 0,- reporter: process.env.CI ? 'html' : 'line',- use: {- trace: 'on-first-retry',- ctViteConfig: {- resolve: {- alias: {- '@': resolve(__dirname, './src'),- }- }- }- },- projects: [- {- name: 'chromium',- use: { ...devices['Desktop Chrome'] },- },- {- name: 'firefox',- use: { ...devices['Desktop Firefox'] },- },- {- name: 'webkit',- use: { ...devices['Desktop Safari'] },- },- ],-});diff --git a/tests/components/ct-react17/playwright/index.html b/tests/components/ct-react17/playwright/index.htmldeleted file mode 100644index 080e66f9b1..0000000000--- a/tests/components/ct-react17/playwright/index.html+++ /dev/null@@ -1,13 +0,0 @@-<!DOCTYPE html>-<html lang="en">- <head>- <meta charset="UTF-8" />- <meta http-equiv="X-UA-Compatible" content="IE=edge" />- <meta name="viewport" content="width=device-width,initial-scale=1.0" />- <title>React App</title>- </head>- <body>- <div id="root"></div>- <script type="module" src="./index.tsx"></script>- </body>-</html>diff --git a/tests/components/ct-react17/playwright/index.tsx b/tests/components/ct-react17/playwright/index.tsxdeleted file mode 100644index eb152a3558..0000000000--- a/tests/components/ct-react17/playwright/index.tsx+++ /dev/null@@ -1,19 +0,0 @@-import { beforeMount, afterMount } from '@playwright/experimental-ct-react17/hooks';-import { BrowserRouter } from 'react-router-dom';-import '../src/assets/index.css';--export type HooksConfig = {- route?: string;- routing?: boolean;-}--beforeMount<HooksConfig>(async ({ hooksConfig, App }) => {- console.log(`Before mount: ${JSON.stringify(hooksConfig)}`);-- if (hooksConfig?.routing)- return <BrowserRouter><App /></BrowserRouter>;-});--afterMount<HooksConfig>(async () => {- console.log(`After mount`);-});diff --git a/tests/components/ct-react17/public/favicon.ico b/tests/components/ct-react17/public/favicon.icodeleted file mode 100644index a11777cc47..0000000000Binary files a/tests/components/ct-react17/public/favicon.ico and /dev/null differdiff --git a/tests/components/ct-react17/public/index.html b/tests/components/ct-react17/public/index.htmldeleted file mode 100644index aa069f27cb..0000000000--- a/tests/components/ct-react17/public/index.html+++ /dev/null@@ -1,43 +0,0 @@-<!DOCTYPE html>-<html lang="en">- <head>- <meta charset="utf-8" />- <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />- <meta name="viewport" content="width=device-width, initial-scale=1" />- <meta name="theme-color" content="#000000" />- <meta- name="description"- content="Web site created using create-react-app"- />- <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />- <!--- manifest.json provides metadata used when your web app is installed on a- user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/- -->- <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />- <!--- Notice the use of %PUBLIC_URL% in the tags above.- It will be replaced with the URL of the `public` folder during the build.- Only files inside the `public` folder can be referenced from the HTML.-- Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will- work correctly both with client-side routing and a non-root public URL.- Learn how to configure a non-root public URL by running `npm run build`.- -->- <title>React App</title>- </head>- <body>- <noscript>You need to enable JavaScript to run this app.</noscript>- <div id="root"></div>- <!--- This HTML file is a template.- If you open it directly in the browser, you will see an empty page.-- You can add webfonts, meta tags, or analytics to this file.- The build step will place the bundled scripts into the <body> tag.-- To begin the development, run `npm start` or `yarn start`.- To create a production bundle, use `npm run build` or `yarn build`.- -->- </body>-</html>diff --git a/tests/components/ct-react17/public/logo192.png b/tests/components/ct-react17/public/logo192.pngdeleted file mode 100644index fc44b0a379..0000000000Binary files a/tests/components/ct-react17/public/logo192.png and /dev/null differdiff --git a/tests/components/ct-react17/public/logo512.png b/tests/components/ct-react17/public/logo512.pngdeleted file mode 100644index a4e47a6545..0000000000Binary files a/tests/components/ct-react17/public/logo512.png and /dev/null differdiff --git a/tests/components/ct-react17/public/manifest.json b/tests/components/ct-react17/public/manifest.jsondeleted file mode 100644index 080d6c77ac..0000000000--- a/tests/components/ct-react17/public/manifest.json+++ /dev/null@@ -1,25 +0,0 @@-{- "short_name": "React App",- "name": "Create React App Sample",- "icons": [- {- "src": "favicon.ico",- "sizes": "64x64 32x32 24x24 16x16",- "type": "image/x-icon"- },- {- "src": "logo192.png",- "type": "image/png",- "sizes": "192x192"- },- {- "src": "logo512.png",- "type": "image/png",- "sizes": "512x512"- }- ],- "start_url": ".",- "display": "standalone",- "theme_color": "#000000",- "background_color": "#ffffff"-}diff --git a/tests/components/ct-react17/public/robots.txt b/tests/components/ct-react17/public/robots.txtdeleted file mode 100644index e9e57dc4d4..0000000000--- a/tests/components/ct-react17/public/robots.txt+++ /dev/null@@ -1,3 +0,0 @@-# https://www.robotstxt.org/robotstxt.html-User-agent: *-Disallow:diff --git a/tests/components/ct-react17/src/App.tsx b/tests/components/ct-react17/src/App.tsxdeleted file mode 100644index fd004390f3..0000000000--- a/tests/components/ct-react17/src/App.tsx+++ /dev/null@@ -1,21 +0,0 @@-import { Routes, Route, Link } from 'react-router-dom';-import logo from './assets/logo.svg';-import LoginPage from './pages/LoginPage';-import DashboardPage from './pages/DashboardPage';--export default function App({ title }: { title?: string }) {- return <>- <header>- <img src={logo} alt="logo" width={125} height={125} />- {title && <h1>{title}</h1>}- <Link to="/">Login</Link>- <Link to="/dashboard">Dashboard</Link>- </header>- <Routes>- <Route path="/">- <Route index element={<LoginPage />} />- <Route path="dashboard" element={<DashboardPage />} />- </Route>- </Routes>- </>-}diff --git a/tests/components/ct-react17/src/assets/index.css b/tests/components/ct-react17/src/assets/index.cssdeleted file mode 100644index 97495c44b8..0000000000--- a/tests/components/ct-react17/src/assets/index.css+++ /dev/null@@ -1,20 +0,0 @@-body {- margin: 0;- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',- 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',- sans-serif;- -webkit-font-smoothing: antialiased;- -moz-osx-font-smoothing: grayscale;-}--code {- font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',- monospace;-}--@media (prefers-color-scheme: light) {- :root {- color: #e3e3e3;- background-color: #1b1b1d;- }-}diff --git a/tests/components/ct-react17/src/assets/logo.svg b/tests/components/ct-react17/src/assets/logo.svgdeleted file mode 100644index 9dfc1c058c..0000000000--- a/tests/components/ct-react17/src/assets/logo.svg+++ /dev/null@@ -1 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>\ No newline at end of filediff --git a/tests/components/ct-react17/src/components/Button.tsx b/tests/components/ct-react17/src/components/Button.tsxdeleted file mode 100644index 8785b878d0..0000000000--- a/tests/components/ct-react17/src/components/Button.tsx+++ /dev/null@@ -1,13 +0,0 @@-import { ButtonHTMLAttributes } from "react";--type ButtonProps = {- title: string;- onClick?(props: string): void;- className?: string;-} & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick'>;--export default function Button({ onClick, title, ...attributes }: ButtonProps) {- return <button {...attributes} onClick={() => onClick?.('hello')}>- {title}- </button>-}diff --git a/tests/components/ct-react17/src/components/CheckChildrenProp.tsx b/tests/components/ct-react17/src/components/CheckChildrenProp.tsxdeleted file mode 100644index 3e8f405a5b..0000000000--- a/tests/components/ct-react17/src/components/CheckChildrenProp.tsx+++ /dev/null@@ -1,7 +0,0 @@-import type { PropsWithChildren } from 'react';--type DefaultChildrenProps = PropsWithChildren<{}>;--export default function CheckChildrenProp(props: DefaultChildrenProps) {- return <>{'children' in props ? props.children : 'No Children'}</>-}diff --git a/tests/components/ct-react17/src/components/Counter.tsx b/tests/components/ct-react17/src/components/Counter.tsxdeleted file mode 100644index 18e999de73..0000000000--- a/tests/components/ct-react17/src/components/Counter.tsx+++ /dev/null@@ -1,25 +0,0 @@-import { useLayoutEffect, useRef, useState } from "react"-- type CounterProps = {- count?: number;- onClick?(props: string): void;- children?: any;- }-- let _remountCount = 1;-- export default function Counter(props: CounterProps) {- const [remountCount] = useState(_remountCount);- const didMountRef = useRef(false)- useLayoutEffect(() => {- if (!didMountRef.current) {- didMountRef.current = true;- _remountCount++;- }- }, [])- return <button onClick={() => props.onClick?.('hello')}>- <span data-testid="props">{ props.count }</span>- <span data-testid="remount-count">{ remountCount }</span>- { props.children }- </button>- }diff --git a/tests/components/ct-react17/src/components/DefaultChildren.tsx b/tests/components/ct-react17/src/components/DefaultChildren.tsxdeleted file mode 100644index 691b6a0806..0000000000--- a/tests/components/ct-react17/src/components/DefaultChildren.tsx+++ /dev/null@@ -1,15 +0,0 @@-type DefaultChildrenProps = {- children?: any;-}--export default function DefaultChildren(props: DefaultChildrenProps) {- return <div>- <h1>Welcome!</h1>- <main>- {props.children}- </main>- <footer>- Thanks for visiting.- </footer>- </div>-}diff --git a/tests/components/ct-react17/src/components/DelayedData.tsx b/tests/components/ct-react17/src/components/DelayedData.tsxdeleted file mode 100644index 6cbbe2618c..0000000000--- a/tests/components/ct-react17/src/components/DelayedData.tsx+++ /dev/null@@ -1,16 +0,0 @@-import { useEffect, useState } from 'react';--type DelayedData = {- data: string;-}--export default function DelayedData(props: DelayedData) {- const [status, setStatus] = useState('loading');-- useEffect(() => {- const timeout = setTimeout(() => setStatus(props.data), 500);- return () => clearTimeout(timeout);- }, [props.data])-- return <p>{status}</p>-};diff --git a/tests/components/ct-react17/src/components/EmptyFragment.tsx b/tests/components/ct-react17/src/components/EmptyFragment.tsxdeleted file mode 100644index b424841462..0000000000--- a/tests/components/ct-react17/src/components/EmptyFragment.tsx+++ /dev/null@@ -1,4 +0,0 @@-export default function EmptyFragment(props: unknown) {- Object.assign(window, { props });- return <>{[]}</>;-}diff --git a/tests/components/ct-react17/src/components/Fetch.tsx b/tests/components/ct-react17/src/components/Fetch.tsxdeleted file mode 100644index 52be98ff4e..0000000000--- a/tests/components/ct-react17/src/components/Fetch.tsx+++ /dev/null@@ -1,13 +0,0 @@-import React, { useEffect, useState } from 'react';--type FetchProps = {- url: string;-}--export default function Fetch(props: FetchProps) {- const [data, setData] = useState('no response yet');- useEffect(() => {- fetch(props.url).then(res => res.text()).then(setData);- }, [props.url]);- return <p>{data}</p>;-}diff --git a/tests/components/ct-react17/src/components/MultiRoot.tsx b/tests/components/ct-react17/src/components/MultiRoot.tsxdeleted file mode 100644index f29e397c0f..0000000000--- a/tests/components/ct-react17/src/components/MultiRoot.tsx+++ /dev/null@@ -1,6 +0,0 @@-export default function MultiRoot() {- return <>- <div>root 1</div>- <div>root 2</div>- </>-}diff --git a/tests/components/ct-react17/src/components/MultipleChildren.tsx b/tests/components/ct-react17/src/components/MultipleChildren.tsxdeleted file mode 100644index 283f88a189..0000000000--- a/tests/components/ct-react17/src/components/MultipleChildren.tsx+++ /dev/null@@ -1,17 +0,0 @@-type MultipleChildrenProps = {- children?: [any, any, any];-}--export default function MultipleChildren(props: MultipleChildrenProps) {- return <div>- <header>- {props.children?.at(0)}- </header>- <main>- {props.children?.at(1)}- </main>- <footer>- {props.children?.at(2)}- </footer>-</div>-}diff --git a/tests/components/ct-react17/src/index.js b/tests/components/ct-react17/src/index.jsdeleted file mode 100644index 2ed26f3b4b..0000000000--- a/tests/components/ct-react17/src/index.js+++ /dev/null@@ -1,13 +0,0 @@-import * as React from 'react';-import { createRoot } from 'react-dom/client';-import { BrowserRouter } from 'react-router-dom';-import App from './App';-import './assets/index.css';--createRoot(document.getElementById("root")).render(- <React.StrictMode>- <BrowserRouter>- <App />- </BrowserRouter>- </React.StrictMode>-);diff --git a/tests/components/ct-react17/src/pages/DashboardPage.tsx b/tests/components/ct-react17/src/pages/DashboardPage.tsxdeleted file mode 100644index 64307e87f3..0000000000--- a/tests/components/ct-react17/src/pages/DashboardPage.tsx+++ /dev/null@@ -1,3 +0,0 @@-export default function DashboardPage() {- return <main>Dashboard</main>-}diff --git a/tests/components/ct-react17/src/pages/LoginPage.tsx b/tests/components/ct-react17/src/pages/LoginPage.tsxdeleted file mode 100644index 96adc431ed..0000000000--- a/tests/components/ct-react17/src/pages/LoginPage.tsx+++ /dev/null@@ -1,3 +0,0 @@-export default function LoginPage() {- return <main>Login</main>-}diff --git a/tests/components/ct-react17/src/react-app-env.d.ts b/tests/components/ct-react17/src/react-app-env.d.tsdeleted file mode 100644index 6431bc5fc6..0000000000--- a/tests/components/ct-react17/src/react-app-env.d.ts+++ /dev/null@@ -1 +0,0 @@-/// <reference types="react-scripts" />diff --git a/tests/components/ct-react17/tests/callbacks.spec.tsx b/tests/components/ct-react17/tests/callbacks.spec.tsxdeleted file mode 100644index d3899350bd..0000000000--- a/tests/components/ct-react17/tests/callbacks.spec.tsx+++ /dev/null@@ -1,28 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-react17';-import Button from '@/components/Button';-import DefaultChildren from '@/components/DefaultChildren';--test('execute callback when the button is clicked', async ({ mount }) => {- const messages: string[] = [];- const component = await mount(- <Button- title="Submit"- onClick={(data) => {- messages.push(data);- }}- ></Button>- );- await component.click();- expect(messages).toEqual(['hello']);-});--test('execute callback when a child node is clicked', async ({ mount }) => {- let clickFired = false;- const component = await mount(- <DefaultChildren>- <span onClick={() => (clickFired = true)}>Main Content</span>- </DefaultChildren>- );- await component.getByText('Main Content').click();- expect(clickFired).toBeTruthy();-});diff --git a/tests/components/ct-react17/tests/children.spec.tsx b/tests/components/ct-react17/tests/children.spec.tsxdeleted file mode 100644index 8f55237723..0000000000--- a/tests/components/ct-react17/tests/children.spec.tsx+++ /dev/null@@ -1,66 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-react17';-import Button from '@/components/Button';-import CheckChildrenProp from '@/components/CheckChildrenProp';-import DefaultChildren from '@/components/DefaultChildren';-import MultipleChildren from '@/components/MultipleChildren';--test('render a default child', async ({ mount }) => {- const component = await mount(- <DefaultChildren>Main Content</DefaultChildren>- );- await expect(component).toContainText('Main Content');-});--test('render a component as child', async ({ mount }) => {- const component = await mount(- <DefaultChildren>- <Button title="Submit" />- </DefaultChildren>- );- await expect(component).toContainText('Submit');-});--test('render multiple children', async ({ mount }) => {- const component = await mount(- <DefaultChildren>- <div data-testid="one">One</div>- <div data-testid="two">Two</div>- </DefaultChildren>- );- await expect(component.getByTestId('one')).toContainText('One');- await expect(component.getByTestId('two')).toContainText('Two');-});--test('render named children', async ({ mount }) => {- const component = await mount(- <MultipleChildren>- <div>Header</div>- <div>Main Content</div>- <div>Footer</div>- </MultipleChildren>- );- await expect(component).toContainText('Header');- await expect(component).toContainText('Main Content');- await expect(component).toContainText('Footer');-});--test('render string as child', async ({ mount }) => {- const component = await mount(<DefaultChildren>{'string'}</DefaultChildren>);- await expect(component).toContainText('string');-});--test('render array as child', async ({ mount }) => {- const component = await mount(<DefaultChildren>{[<h4>{[4]}</h4>,[[<p>[2,3]</p>]]]}</DefaultChildren>);- await expect(component.getByRole('heading', { level: 4 })).toHaveText('4');- await expect(component.getByRole('paragraph')).toHaveText('[2,3]');-});--test('render number as child', async ({ mount }) => {- const component = await mount(<DefaultChildren>{1337}</DefaultChildren>);- await expect(component).toContainText('1337');-});--test('absence of children when children prop is not provided', async ({ mount }) => {- const component = await mount(<CheckChildrenProp />);- await expect(component).toContainText('No Children');-});diff --git a/tests/components/ct-react17/tests/react-router.spec.tsx b/tests/components/ct-react17/tests/react-router.spec.tsxdeleted file mode 100644index 73c4a50c7e..0000000000--- a/tests/components/ct-react17/tests/react-router.spec.tsx+++ /dev/null@@ -1,26 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-react17';-import App from '@/App';-import type { HooksConfig } from '../playwright';--test('navigate to a page by clicking a link', async ({ page, mount }) => {- const component = await mount<HooksConfig>(<App />, {- hooksConfig: { routing: true },- });- await expect(component.getByRole('main')).toHaveText('Login');- await expect(page).toHaveURL('/');- await component.getByRole('link', { name: 'Dashboard' }).click();- await expect(component.getByRole('main')).toHaveText('Dashboard');- await expect(page).toHaveURL('/dashboard');-});--test('update should not reset mount hooks', async ({ page, mount }) => {- const component = await mount<HooksConfig>(<App title='before'/>, {- hooksConfig: { routing: true },- });- await expect(component.getByRole('heading')).toHaveText('before');- await expect(component.getByRole('main')).toHaveText('Login');-- await component.update(<App title='after'/>);- await expect(component.getByRole('heading')).toHaveText('after');- await expect(component.getByRole('main')).toHaveText('Login');-});diff --git a/tests/components/ct-react17/tests/render.spec.tsx b/tests/components/ct-react17/tests/render.spec.tsxdeleted file mode 100644index 46e3ea9abf..0000000000--- a/tests/components/ct-react17/tests/render.spec.tsx+++ /dev/null@@ -1,76 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-react17';-import Fetch from '@/components/Fetch';-import DelayedData from '@/components/DelayedData';-import Button from '@/components/Button';-import EmptyFragment from '@/components/EmptyFragment';-const { serverFixtures } = require('../../../../tests/config/serverFixtures');--test('render props', async ({ mount }) => {- const component = await mount(<Button title="Submit" />);- await expect(component).toContainText('Submit');-});--test('render attributes', async ({ mount }) => {- const component = await mount(<Button className="primary" title="Submit" />);- await expect(component).toHaveClass('primary');-});--test('render delayed data', async ({ mount }) => {- const component = await mount(<DelayedData data="complete" />);- await expect(component).toHaveText('complete');-});--test('render an empty component', async ({ mount, page }) => {- const component = await mount(<EmptyFragment />);- expect(await page.evaluate(() => 'props' in window && window.props)).toEqual({});- expect(await component.allTextContents()).toEqual(['']);- expect(await component.textContent()).toBe('');- await expect(component).toHaveText('');-});--const testWithServer = test.extend(serverFixtures);-testWithServer(- 'components routing should go through context',- // @ts-ignore "serverFixtures" are imported from the impl without any types- async ({ mount, context, server }) => {- server.setRoute('/hello', (req: any, res: any) => {- res.write('served via server');- res.end();- });-- let markRouted: (url: string) => void;- const routedViaContext = new Promise((res) => (markRouted = res));- await context.route('**/hello', async (route, request) => {- markRouted(`${request.method()} ${request.url()}`);- await route.fulfill({- body: 'intercepted',- });- });-- const whoServedTheRequest = Promise.race([- server- .waitForRequest('/hello')- .then((req: any) => `served via server: ${req.method} ${req.url}`),- routedViaContext.then((req) => `served via context: ${req}`),- ]);-- const component = await mount(<Fetch url={server.PREFIX + '/hello'} />);- await expect- .soft(whoServedTheRequest)- .resolves.toMatch(/served via context: GET.*\/hello.*/i);- await expect.soft(component).toHaveText('intercepted');- }-);--test('should return 404 if server does not handle the request', async ({ page }) => {- test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/23364' });- const helloPromise = page.waitForResponse('/hello');- const statusCode = await page.evaluate(async () => {- const response = await fetch('/hello');- return response.status;- });- expect(statusCode).toBe(404);- const response = await helloPromise;- expect(response.status()).toBe(404);- expect(response.statusText()).toBe('Not Found');-});diff --git a/tests/components/ct-react17/tests/unmount.spec.tsx b/tests/components/ct-react17/tests/unmount.spec.tsxdeleted file mode 100644index 1f5c0953c9..0000000000--- a/tests/components/ct-react17/tests/unmount.spec.tsx+++ /dev/null@@ -1,32 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-react17';-import Button from '@/components/Button';-import MultiRoot from '@/components/MultiRoot';--test('unmount', async ({ page, mount }) => {- const component = await mount(<Button title="Submit" />);- await expect(page.locator('#root')).toContainText('Submit');- await component.unmount();- await expect(page.locator('#root')).not.toContainText('Submit');-});--test('unmount a multi root component', async ({ page, mount }) => {- const component = await mount(<MultiRoot />);- await expect(page.locator('#root')).toContainText('root 1');- await expect(page.locator('#root')).toContainText('root 2');- await component.unmount();- await expect(page.locator('#root')).not.toContainText('root 1');- await expect(page.locator('#root')).not.toContainText('root 2');-});--test('unmount twice throws an error', async ({ mount }) => {- const component = await mount(<Button title="Submit" />);- await component.unmount();- await expect(component.unmount()).rejects.toThrowError('Component was not mounted');-});--test('mount then unmount then mount', async ({ mount }) => {- let component = await mount(<Button title="Submit" />);- await component.unmount();- component = await mount(<Button title="Save" />);- await expect(component).toContainText('Save');-});diff --git a/tests/components/ct-react17/tests/update.spec.tsx b/tests/components/ct-react17/tests/update.spec.tsxdeleted file mode 100644index 50967dc50e..0000000000--- a/tests/components/ct-react17/tests/update.spec.tsx+++ /dev/null@@ -1,91 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-react17';-import Counter from '@/components/Counter';-import DefaultChildren from '@/components/DefaultChildren';--test('update props without remounting', async ({ mount }) => {- const component = await mount(<Counter count={9001} />);- await expect(component.getByTestId('props')).toContainText('9001');-- await component.update(<Counter count={1337} />);- await expect(component).not.toContainText('9001');- await expect(component.getByTestId('props')).toContainText('1337');-- await expect(component.getByTestId('remount-count')).toContainText('1');-});--test('update child props without remounting', async ({ mount }) => {- const component = await mount(<DefaultChildren><Counter count={9001} /></DefaultChildren>);- await expect(component.getByTestId('props')).toContainText('9001');-- await component.update(<DefaultChildren><Counter count={1337} /></DefaultChildren>);- await expect(component).not.toContainText('9001');- await expect(component.getByTestId('props')).toContainText('1337');-- await expect(component.getByTestId('remount-count')).toContainText('1');-});--test('update callbacks without remounting', async ({ mount }) => {- const component = await mount(<Counter />);-- const messages: string[] = [];- await component.update(- <Counter- onClick={(message) => {- messages.push(message);- }}- />- );- await component.click();- expect(messages).toEqual(['hello']);-- await expect(component.getByTestId('remount-count')).toContainText('1');-});--test('update child callbacks without remounting', async ({ mount }) => {- const component = await mount(<DefaultChildren><Counter /></DefaultChildren>);-- const messages: string[] = [];- await component.update(- <DefaultChildren>- <Counter- onClick={(message) => {- messages.push(message);- }}- />- </DefaultChildren>- );- await component.getByRole('button').click();- expect(messages).toEqual(['hello']);-- await expect(component.getByTestId('remount-count')).toContainText('1');-});--test('update children without remounting', async ({ mount }) => {- const component = await mount(<Counter>Default Slot</Counter>);- await expect(component).toContainText('Default Slot');-- await component.update(<Counter>Test Slot</Counter>);- await expect(component).not.toContainText('Default Slot');- await expect(component).toContainText('Test Slot');-- await expect(component.getByTestId('remount-count')).toContainText('1');-});--test('update grandchild without remounting', async ({ mount }) => {- const component = await mount(- <DefaultChildren>- <Counter>Default Slot</Counter>- </DefaultChildren>- );- await expect(component.getByRole('button')).toContainText('Default Slot');-- await component.update(- <DefaultChildren>- <Counter>Test Slot</Counter>- </DefaultChildren>- );- await expect(component.getByRole('button')).not.toContainText('Default Slot');- await expect(component.getByRole('button')).toContainText('Test Slot');-- await expect(component.getByTestId('remount-count')).toContainText('1');-});diff --git a/tests/components/ct-react17/tsconfig.json b/tests/components/ct-react17/tsconfig.jsondeleted file mode 100644index 48864aeb82..0000000000--- a/tests/components/ct-react17/tsconfig.json+++ /dev/null@@ -1,32 +0,0 @@-{- "compilerOptions": {- "target": "ES2015",- "lib": [- "dom",- "dom.iterable",- "esnext"- ],- "allowJs": true,- "skipLibCheck": true,- "esModuleInterop": true,- "allowSyntheticDefaultImports": true,- "strict": true,- "forceConsistentCasingInFileNames": true,- "noFallthroughCasesInSwitch": true,- "module": "esnext",- "moduleResolution": "node",- "resolveJsonModule": true,- "isolatedModules": true,- "noEmit": true,- "jsx": "react-jsx",- "baseUrl": ".",- "paths": {- "@/*": ["./src/*"],- "*": ["_"],- }- },- "include": [- "src",- "tests"- ]-}diff --git a/tests/components/ct-vue-cli/.eslintignore b/tests/components/ct-vue-cli/.eslintignoredeleted file mode 100644index 01b7e33fd4..0000000000--- a/tests/components/ct-vue-cli/.eslintignore+++ /dev/null@@ -1 +0,0 @@-**/*\ No newline at end of filediff --git a/tests/components/ct-vue-cli/.gitignore b/tests/components/ct-vue-cli/.gitignoredeleted file mode 100644index 7e2a946d8e..0000000000--- a/tests/components/ct-vue-cli/.gitignore+++ /dev/null@@ -1,23 +0,0 @@-.DS_Store-node_modules-/dist-*.tsbuildinfo--# local env files-.env.local-.env.*.local--# Log files-npm-debug.log*-yarn-debug.log*-yarn-error.log*-pnpm-debug.log*--# Editor directories and files-.idea-.vscode-*.suo-*.ntvs*-*.njsproj-*.sln-*.sw?diff --git a/tests/components/ct-vue-cli/README.md b/tests/components/ct-vue-cli/README.mddeleted file mode 100644index ca3cc56e37..0000000000--- a/tests/components/ct-vue-cli/README.md+++ /dev/null@@ -1,24 +0,0 @@-# ct-vue-cli--## Project setup-```-npm install-```--### Compiles and hot-reloads for development-```-npm run serve-```--### Compiles and minifies for production-```-npm run build-```--### Lints and fixes files-```-npm run lint-```--### Customize configuration-See [Configuration Reference](https://cli.vuejs.org/config/).diff --git a/tests/components/ct-vue-cli/babel.config.js b/tests/components/ct-vue-cli/babel.config.jsdeleted file mode 100644index e9558405fd..0000000000--- a/tests/components/ct-vue-cli/babel.config.js+++ /dev/null@@ -1,5 +0,0 @@-module.exports = {- presets: [- '@vue/cli-plugin-babel/preset'- ]-}diff --git a/tests/components/ct-vue-cli/package.json b/tests/components/ct-vue-cli/package.jsondeleted file mode 100644index 1c3653d027..0000000000--- a/tests/components/ct-vue-cli/package.json+++ /dev/null@@ -1,47 +0,0 @@-{- "name": "ct-vue-cli",- "version": "0.1.0",- "private": true,- "scripts": {- "serve": "vue-cli-service serve",- "build": "vue-cli-service build",- "lint": "vue-cli-service lint",- "typecheck": "tsc --noEmit --project tsconfig.test.json"- },- "dependencies": {- "core-js": "^3.8.3",- "vue": "^3.2.36",- "vue-router": "^4.5.0"- },- "devDependencies": {- "@babel/core": "^7.23.2",- "@babel/eslint-parser": "^7.22.15",- "@vue/cli-plugin-babel": "~5.0.0",- "@vue/cli-plugin-eslint": "~5.0.0",- "@vue/cli-plugin-router": "~5.0.0",- "@vue/cli-service": "~5.0.0",- "@vue/tsconfig": "^0.7.0",- "eslint": "^7.32.0",- "eslint-plugin-vue": "^8.0.3"- },- "eslintConfig": {- "root": true,- "env": {- "node": true- },- "extends": [- "plugin:vue/vue3-essential",- "eslint:recommended"- ],- "parserOptions": {- "parser": "@babel/eslint-parser"- },- "rules": {}- },- "browserslist": [- "> 1%",- "last 2 versions",- "not dead",- "not ie 11"- ]-}diff --git a/tests/components/ct-vue-cli/playwright.config.ts b/tests/components/ct-vue-cli/playwright.config.tsdeleted file mode 100644index c95f2ff338..0000000000--- a/tests/components/ct-vue-cli/playwright.config.ts+++ /dev/null@@ -1,49 +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, devices } from '@playwright/experimental-ct-vue';-import { resolve } from 'path';--export default defineConfig({- testDir: 'tests',- forbidOnly: !!process.env.CI,- retries: process.env.CI ? 2 : 0,- reporter: process.env.CI ? 'html' : 'line',- use: {- trace: 'on-first-retry',- ctViteConfig: {- resolve: {- alias: {- '@': resolve(__dirname, './src'),- }- }- }- },- projects: [- {- name: 'chromium',- use: { ...devices['Desktop Chrome'] },- },- {- name: 'firefox',- use: { ...devices['Desktop Firefox'] },- },- {- name: 'webkit',- use: { ...devices['Desktop Safari'] },- },- ],-});diff --git a/tests/components/ct-vue-cli/playwright/index.html b/tests/components/ct-vue-cli/playwright/index.htmldeleted file mode 100644index 943d4d14db..0000000000--- a/tests/components/ct-vue-cli/playwright/index.html+++ /dev/null@@ -1,12 +0,0 @@-<!DOCTYPE html>-<html lang="">- <head>- <meta charset="utf-8">- <meta http-equiv="X-UA-Compatible" content="IE=edge">- <meta name="viewport" content="width=device-width,initial-scale=1.0">- </head>- <body>- <div id="root"></div>- <script type="module" src="./index.ts"></script>- </body>-</html>diff --git a/tests/components/ct-vue-cli/playwright/index.ts b/tests/components/ct-vue-cli/playwright/index.tsdeleted file mode 100644index 8940db58b8..0000000000--- a/tests/components/ct-vue-cli/playwright/index.ts+++ /dev/null@@ -1,20 +0,0 @@-import { beforeMount, afterMount } from '@playwright/experimental-ct-vue/hooks';-import { router } from '../src/router';-import Button from '../src/components/Button.vue';-import '../src/assets/index.css';--export type HooksConfig = {- route?: string;- routing?: boolean;-}--beforeMount<HooksConfig>(async ({ app, hooksConfig }) => {- if (hooksConfig?.routing)- app.use(router as any);- app.component('Button', Button);- console.log(`Before mount: ${JSON.stringify(hooksConfig)}, app: ${!!app}`);-});--afterMount<HooksConfig>(async ({ instance }) => {- console.log(`After mount el: ${instance.$el.constructor.name}`);-});diff --git a/tests/components/ct-vue-cli/public/favicon.ico b/tests/components/ct-vue-cli/public/favicon.icodeleted file mode 100644index df36fcfb72..0000000000Binary files a/tests/components/ct-vue-cli/public/favicon.ico and /dev/null differdiff --git a/tests/components/ct-vue-cli/public/index.html b/tests/components/ct-vue-cli/public/index.htmldeleted file mode 100644index 3e5a139621..0000000000--- a/tests/components/ct-vue-cli/public/index.html+++ /dev/null@@ -1,17 +0,0 @@-<!DOCTYPE html>-<html lang="">- <head>- <meta charset="utf-8">- <meta http-equiv="X-UA-Compatible" content="IE=edge">- <meta name="viewport" content="width=device-width,initial-scale=1.0">- <link rel="icon" href="<%= BASE_URL %>favicon.ico">- <title><%= htmlWebpackPlugin.options.title %></title>- </head>- <body>- <noscript>- <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>- </noscript>- <div id="app"></div>- <!-- built files will be auto injected -->- </body>-</html>diff --git a/tests/components/ct-vue-cli/src/App.vue b/tests/components/ct-vue-cli/src/App.vuedeleted file mode 100644index d648a97c34..0000000000--- a/tests/components/ct-vue-cli/src/App.vue+++ /dev/null@@ -1,8 +0,0 @@-<template>- <header>- <img alt="Vue logo" class="logo" src="./assets/logo.png" width="125" height="125" />- <router-link to="/">Login</router-link>- <router-link to="/dashboard">Dashboard</router-link>- </header>- <router-view />-</template>diff --git a/tests/components/ct-vue-cli/src/assets/index.css b/tests/components/ct-vue-cli/src/assets/index.cssdeleted file mode 100644index 97495c44b8..0000000000--- a/tests/components/ct-vue-cli/src/assets/index.css+++ /dev/null@@ -1,20 +0,0 @@-body {- margin: 0;- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',- 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',- sans-serif;- -webkit-font-smoothing: antialiased;- -moz-osx-font-smoothing: grayscale;-}--code {- font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',- monospace;-}--@media (prefers-color-scheme: light) {- :root {- color: #e3e3e3;- background-color: #1b1b1d;- }-}diff --git a/tests/components/ct-vue-cli/src/assets/logo.png b/tests/components/ct-vue-cli/src/assets/logo.pngdeleted file mode 100644index f3d2503fc2..0000000000Binary files a/tests/components/ct-vue-cli/src/assets/logo.png and /dev/null differdiff --git a/tests/components/ct-vue-cli/src/components/Button.vue b/tests/components/ct-vue-cli/src/components/Button.vuedeleted file mode 100644index 236f26c335..0000000000--- a/tests/components/ct-vue-cli/src/components/Button.vue+++ /dev/null@@ -1,14 +0,0 @@-<script lang="ts" setup>- import { useAttrs } from 'vue';- defineProps<{ title: string }>();- const attrs = useAttrs();-</script>--<template>- <button- @click="$emit('submit', 'hello')"- @dblclick="() => attrs.dbclick('fallthroughEvent')"- >- {{ title }}- </button>-</template>diff --git a/tests/components/ct-vue-cli/src/components/Component.vue b/tests/components/ct-vue-cli/src/components/Component.vuedeleted file mode 100644index 133c8e2670..0000000000--- a/tests/components/ct-vue-cli/src/components/Component.vue+++ /dev/null@@ -1,3 +0,0 @@-<template>- <div>test</div>-</template>diff --git a/tests/components/ct-vue-cli/src/components/Counter.vue b/tests/components/ct-vue-cli/src/components/Counter.vuedeleted file mode 100644index 47bc1c17cc..0000000000--- a/tests/components/ct-vue-cli/src/components/Counter.vue+++ /dev/null@@ -1,23 +0,0 @@-<template>- <button @click="$emit('submit', 'hello')">- <span data-testid="props">{{ count }}</span>- <span data-testid="remount-count">{{ remountCount }}</span>- <slot name="main" />- <slot />- </button>-</template>--<script lang="ts">-let remountCount = 0-</script>--<script lang="ts" setup>-defineProps({- count: {- type: Number,- required: true- }-})-remountCount++-</script>-diff --git a/tests/components/ct-vue-cli/src/components/DefaultSlot.vue b/tests/components/ct-vue-cli/src/components/DefaultSlot.vuedeleted file mode 100644index 287b84beaf..0000000000--- a/tests/components/ct-vue-cli/src/components/DefaultSlot.vue+++ /dev/null@@ -1,11 +0,0 @@-<template>- <div>- <h1>Welcome!</h1>- <main>- <slot />- </main>- <footer>- Thanks for visiting.- </footer>- </div>-</template>diff --git a/tests/components/ct-vue-cli/src/components/EmptyTemplate.vue b/tests/components/ct-vue-cli/src/components/EmptyTemplate.vuedeleted file mode 100644index 9b4c59695e..0000000000--- a/tests/components/ct-vue-cli/src/components/EmptyTemplate.vue+++ /dev/null@@ -1,8 +0,0 @@-<script lang="ts" setup>- import { useSlots } from 'vue';- const slots = useSlots();- Object.assign(window, { slots });-</script>-<template>-</template>-diff --git a/tests/components/ct-vue-cli/src/components/MultiRoot.vue b/tests/components/ct-vue-cli/src/components/MultiRoot.vuedeleted file mode 100644index d1c348d750..0000000000--- a/tests/components/ct-vue-cli/src/components/MultiRoot.vue+++ /dev/null@@ -1,4 +0,0 @@-<template>- <div>root 1</div>- <div>root 2</div>-</template>\ No newline at end of filediff --git a/tests/components/ct-vue-cli/src/components/NamedSlots.vue b/tests/components/ct-vue-cli/src/components/NamedSlots.vuedeleted file mode 100644index 582608df32..0000000000--- a/tests/components/ct-vue-cli/src/components/NamedSlots.vue+++ /dev/null@@ -1,13 +0,0 @@-<template>- <div>- <header>- <slot name="header" />- </header>- <main>- <slot name="main" />- </main>- <footer>- <slot name="footer" />- </footer>- </div>-</template>diff --git a/tests/components/ct-vue-cli/src/main.js b/tests/components/ct-vue-cli/src/main.jsdeleted file mode 100644index aac97dde17..0000000000--- a/tests/components/ct-vue-cli/src/main.js+++ /dev/null@@ -1,6 +0,0 @@-import { createApp } from 'vue';-import { router } from './router';-import App from './App.vue';-import './assets/index.css';--createApp(App).use(router).mount('#app');diff --git a/tests/components/ct-vue-cli/src/pages/DashboardPage.vue b/tests/components/ct-vue-cli/src/pages/DashboardPage.vuedeleted file mode 100644index 0dcf8cc990..0000000000--- a/tests/components/ct-vue-cli/src/pages/DashboardPage.vue+++ /dev/null@@ -1,3 +0,0 @@-<template>- <main>Dashboard</main>-</template>diff --git a/tests/components/ct-vue-cli/src/pages/LoginPage.vue b/tests/components/ct-vue-cli/src/pages/LoginPage.vuedeleted file mode 100644index aaa18be8ab..0000000000--- a/tests/components/ct-vue-cli/src/pages/LoginPage.vue+++ /dev/null@@ -1,3 +0,0 @@-<template>- <main>Login</main>-</template>diff --git a/tests/components/ct-vue-cli/src/router/index.js b/tests/components/ct-vue-cli/src/router/index.jsdeleted file mode 100644index 783898a3dc..0000000000--- a/tests/components/ct-vue-cli/src/router/index.js+++ /dev/null@@ -1,11 +0,0 @@-import DashboardPage from '../pages/DashboardPage.vue';-import LoginPage from '../pages/LoginPage.vue';-import { createRouter, createWebHistory } from 'vue-router';--export const router = createRouter({- history: createWebHistory('/'),- routes: [- { path: '/', component: LoginPage },- { path: '/dashboard', component: DashboardPage },- ],-})diff --git a/tests/components/ct-vue-cli/src/vue.d.ts b/tests/components/ct-vue-cli/src/vue.d.tsdeleted file mode 100644index d4d073050e..0000000000--- a/tests/components/ct-vue-cli/src/vue.d.ts+++ /dev/null@@ -1,4 +0,0 @@-declare module '*.vue' {- const value: any;- export default value;-}diff --git a/tests/components/ct-vue-cli/tests/events/events.spec.ts b/tests/components/ct-vue-cli/tests/events/events.spec.tsdeleted file mode 100644index 698e887e39..0000000000--- a/tests/components/ct-vue-cli/tests/events/events.spec.ts+++ /dev/null@@ -1,30 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import Button from '@/components/Button.vue';--test('emit an submit event when the button is clicked', async ({ mount }) => {- const messages: string[] = [];- const component = await mount(Button, {- props: {- title: 'Submit',- },- on: {- submit: (data: string) => messages.push(data),- },- });- await component.click();- expect(messages).toEqual(['hello']);-});--test('emit a fallthrough event when the button is double clicked', async ({ mount }) => {- const messages: string[] = [];- const component = await mount(Button, {- props: {- title: 'Submit',- },- on: {- dbclick: (message: string) => messages.push(message),- },- });- await component.dblclick();- expect(messages).toEqual(['fallthroughEvent']);-});diff --git a/tests/components/ct-vue-cli/tests/events/events.spec.tsx b/tests/components/ct-vue-cli/tests/events/events.spec.tsxdeleted file mode 100644index 3fddb9fb44..0000000000--- a/tests/components/ct-vue-cli/tests/events/events.spec.tsx+++ /dev/null@@ -1,42 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import Button from '@/components/Button.vue';-import DefaultSlot from '@/components/DefaultSlot.vue';--test('emit an submit event when the button is clicked', async ({ mount }) => {- const messages: string[] = [];- const component = await mount(- <Button- title="Submit"- v-on:submit={(data: string) => {- messages.push(data);- }}- />- );- await component.click();- expect(messages).toEqual(['hello']);-});--test('emit a fallthrough event when the button is double clicked', async ({ mount }) => {- const messages: string[] = [];- const component = await mount(- <Button- title="Submit"- v-on:dbclick={(message: string) => {- messages.push(message)- }}- />- );- await component.dblclick();- expect(messages).toEqual(['fallthroughEvent']);-});--test('emit a event when a slot is clicked', async ({ mount }) => {- let clickFired = false;- const component = await mount(- <DefaultSlot>- <span v-on:click={() => (clickFired = true)}>Main Content</span>- </DefaultSlot>- );- await component.getByText('Main Content').click();- expect(clickFired).toBeTruthy();-});diff --git a/tests/components/ct-vue-cli/tests/render/render.spec.ts b/tests/components/ct-vue-cli/tests/render/render.spec.tsdeleted file mode 100644index a76a68d660..0000000000--- a/tests/components/ct-vue-cli/tests/render/render.spec.ts+++ /dev/null@@ -1,25 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import Button from '@/components/Button.vue';-import Component from '@/components/Component.vue';-import EmptyTemplate from '@/components/EmptyTemplate.vue';--test('render props', async ({ mount }) => {- const component = await mount(Button, {- props: {- title: 'Submit',- },- });- await expect(component).toContainText('Submit');-});--test('render a component without options', async ({ mount }) => {- const component = await mount(Component);- await expect(component).toContainText('test');-});--test('get textContent of the empty template', async ({ mount }) => {- const component = await mount(EmptyTemplate);- expect(await component.allTextContents()).toEqual(['']);- expect(await component.textContent()).toBe('');- await expect(component).toHaveText('');-});diff --git a/tests/components/ct-vue-cli/tests/render/render.spec.tsx b/tests/components/ct-vue-cli/tests/render/render.spec.tsxdeleted file mode 100644index c051422fdd..0000000000--- a/tests/components/ct-vue-cli/tests/render/render.spec.tsx+++ /dev/null@@ -1,16 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import Button from '@/components/Button.vue';-import EmptyTemplate from '@/components/EmptyTemplate.vue';--test('render props', async ({ mount }) => {- const component = await mount(<Button title="Submit" />);- await expect(component).toContainText('Submit');-});--test('render an empty component', async ({ page, mount }) => {- const component = await mount(<EmptyTemplate />);- expect(await page.evaluate(() => 'slots' in window && window.slots)).toEqual({});- expect(await component.allTextContents()).toEqual(['']);- expect(await component.textContent()).toBe('');- await expect(component).toHaveText('');-});diff --git a/tests/components/ct-vue-cli/tests/slots/slots.spec.ts b/tests/components/ct-vue-cli/tests/slots/slots.spec.tsdeleted file mode 100644index 2af38036b5..0000000000--- a/tests/components/ct-vue-cli/tests/slots/slots.spec.ts+++ /dev/null@@ -1,47 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import DefaultSlot from '@/components/DefaultSlot.vue';-import NamedSlots from '@/components/NamedSlots.vue';--test('render a default slot', async ({ mount }) => {- const component = await mount(DefaultSlot, {- slots: {- default: '<strong>Main Content</strong>',- },- });- await expect(component.getByRole('strong')).toContainText('Main Content');-});--test('render a component as slot', async ({ mount }) => {- const component = await mount(DefaultSlot, {- slots: {- default: '<Button title="Submit" />', // component is registered globally in /playwright/index.ts- },- });- await expect(component).toContainText('Submit');-});--test('render a component with multiple slots', async ({ mount }) => {- const component = await mount(DefaultSlot, {- slots: {- default: [- '<div data-testid="one">One</div>',- '<div data-testid="two">Two</div>',- ],- },- });- await expect(component.getByTestId('one')).toContainText('One');- await expect(component.getByTestId('two')).toContainText('Two');-});--test('render a component with a named slot', async ({ mount }) => {- const component = await mount(NamedSlots, {- slots: {- header: 'Header',- main: 'Main Content',- footer: 'Footer',- },- });- await expect(component).toContainText('Header');- await expect(component).toContainText('Main Content');- await expect(component).toContainText('Footer');-});diff --git a/tests/components/ct-vue-cli/tests/slots/slots.spec.tsx b/tests/components/ct-vue-cli/tests/slots/slots.spec.tsxdeleted file mode 100644index 64da25ed0b..0000000000--- a/tests/components/ct-vue-cli/tests/slots/slots.spec.tsx+++ /dev/null@@ -1,52 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import Button from '@/components/Button.vue';-import DefaultSlot from '@/components/DefaultSlot.vue';-import NamedSlots from '@/components/NamedSlots.vue';--test('render a default slot', async ({ mount }) => {- const component = await mount(- <DefaultSlot>- <strong>Main Content</strong>- </DefaultSlot>- );- await expect(component.getByRole('strong')).toContainText('Main Content');-});--test('render a component as slot', async ({ mount }) => {- const component = await mount(- <DefaultSlot>- <Button title="Submit" />- </DefaultSlot>- );- await expect(component).toContainText('Submit');-});--test('render a component with multiple slots', async ({ mount }) => {- const component = await mount(- <DefaultSlot>- <div data-testid="one">One</div>- <div data-testid="two">Two</div>- </DefaultSlot>- );- await expect(component.getByTestId('one')).toContainText('One');- await expect(component.getByTestId('two')).toContainText('Two');-});--test('render a component with a named slot', async ({ mount }) => {- const component = await mount(- <NamedSlots>- <template v-slot:header>Header</template>- <template v-slot:main>Main Content</template>- <template v-slot:footer>Footer</template>- </NamedSlots>- );- await expect(component).toContainText('Header');- await expect(component).toContainText('Main Content');- await expect(component).toContainText('Footer');-});--test('render array as child', async ({ mount }) => {- const component = await mount(<DefaultSlot>{[<h4>{[4]}</h4>,[[<p>[2,3]</p>]]]}</DefaultSlot>);- await expect(component.getByRole('heading', { level: 4 })).toHaveText('4');- await expect(component.getByRole('paragraph')).toHaveText('[2,3]');-});diff --git a/tests/components/ct-vue-cli/tests/unmount/unmount.spec.ts b/tests/components/ct-vue-cli/tests/unmount/unmount.spec.tsdeleted file mode 100644index 81e4686173..0000000000--- a/tests/components/ct-vue-cli/tests/unmount/unmount.spec.ts+++ /dev/null@@ -1,34 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import Button from '@/components/Button.vue';-import MultiRoot from '@/components/MultiRoot.vue';--test('unmount', async ({ page, mount }) => {- const component = await mount(Button, {- props: {- title: 'Submit',- },- });- await expect(page.locator('#root')).toContainText('Submit');- await component.unmount();- await expect(page.locator('#root')).not.toContainText('Submit');-});--test('unmount a multi root component', async ({ mount, page }) => {- const component = await mount(MultiRoot);- await expect(page.locator('#root')).toContainText('root 1');- await expect(page.locator('#root')).toContainText('root 2');- await component.unmount();- await expect(page.locator('#root')).not.toContainText('root 1');- await expect(page.locator('#root')).not.toContainText('root 2');-});--test('unmount twice throws an error', async ({ mount }) => {- const component = await mount(Button, {- props: {- title: 'Submit',- },- });- await component.unmount();- await expect(component.unmount()).rejects.toThrowError('Component was not mounted');-});-diff --git a/tests/components/ct-vue-cli/tests/unmount/unmount.spec.tsx b/tests/components/ct-vue-cli/tests/unmount/unmount.spec.tsxdeleted file mode 100644index 614fd784c9..0000000000--- a/tests/components/ct-vue-cli/tests/unmount/unmount.spec.tsx+++ /dev/null@@ -1,25 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import Button from '@/components/Button.vue';-import MultiRoot from '@/components/MultiRoot.vue';--test('unmount', async ({ page, mount }) => {- const component = await mount(<Button title="Submit" />);- await expect(page.locator('#root')).toContainText('Submit');- await component.unmount();- await expect(page.locator('#root')).not.toContainText('Submit');-});--test('unmount a multi root component', async ({ mount, page }) => {- const component = await mount(<MultiRoot />);- await expect(page.locator('#root')).toContainText('root 1');- await expect(page.locator('#root')).toContainText('root 2');- await component.unmount();- await expect(page.locator('#root')).not.toContainText('root 1');- await expect(page.locator('#root')).not.toContainText('root 2');-});--test('unmount twice throws an error', async ({ mount }) => {- const component = await mount(<Button title="Submit" />);- await component.unmount();- await expect(component.unmount()).rejects.toThrowError('Component was not mounted');-});diff --git a/tests/components/ct-vue-cli/tests/update/update.spec.ts b/tests/components/ct-vue-cli/tests/update/update.spec.tsdeleted file mode 100644index 114a1274c0..0000000000--- a/tests/components/ct-vue-cli/tests/update/update.spec.ts+++ /dev/null@@ -1,47 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import Counter from '@/components/Counter.vue';--test('update props without remounting', async ({ mount }) => {- const component = await mount(Counter, {- props: { count: 9001 },- });- await expect(component.getByTestId('props')).toContainText('9001');-- await component.update({- props: { count: 1337 },- });- await expect(component).not.toContainText('9001');- await expect(component.getByTestId('props')).toContainText('1337');-- await expect(component.getByTestId('remount-count')).toContainText('1');-});--test('update event listeners without remounting', async ({ mount }) => {- const component = await mount(Counter);-- const messages: string[] = [];- await component.update({- on: {- submit: (count: string) => messages.push(count),- },- });- await component.click();- expect(messages).toEqual(['hello']);-- await expect(component.getByTestId('remount-count')).toContainText('1');-});--test('update slots without remounting', async ({ mount }) => {- const component = await mount(Counter, {- slots: { default: 'Default Slot' },- });- await expect(component).toContainText('Default Slot');-- await component.update({- slots: { main: 'Test Slot' },- });- await expect(component).not.toContainText('Default Slot');- await expect(component).toContainText('Test Slot');-- await expect(component.getByTestId('remount-count')).toContainText('1');-});diff --git a/tests/components/ct-vue-cli/tests/update/update.spec.tsx b/tests/components/ct-vue-cli/tests/update/update.spec.tsxdeleted file mode 100644index d622c5f431..0000000000--- a/tests/components/ct-vue-cli/tests/update/update.spec.tsx+++ /dev/null@@ -1,53 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import Counter from '@/components/Counter.vue';--test('update props without remounting', async ({ mount }) => {- const component = await mount(<Counter count={9001} />);- await expect(component.getByTestId('props')).toContainText('9001');-- await component.update(<Counter count={1337} />);- await expect(component).not.toContainText('9001');- await expect(component.getByTestId('props')).toContainText('1337');-- await expect(component.getByTestId('remount-count')).toContainText('1');-});--test('update event listeners without remounting', async ({ mount }) => {- const component = await mount(<Counter />);-- const messages: string[] = [];- await component.update(- <Counter- v-on:submit={(count: string) => {- messages.push(count);- }}- />- );- await component.click();- expect(messages).toEqual(['hello']);-- await expect(component.getByTestId('remount-count')).toContainText('1');-});--test('update slots without remounting', async ({ mount }) => {- const component = await mount(<Counter>Default Slot</Counter>);- await expect(component).toContainText('Default Slot');-- await component.update(- <Counter>- <template v-slot:main>Test Slot</template>- </Counter>- );- await expect(component).not.toContainText('Default Slot');- await expect(component).toContainText('Test Slot');-- await expect(component.getByTestId('remount-count')).toContainText('1');-});--test('throw error when updating a native html element', async ({ mount }) => {- const component = await mount(<div id="1337"></div>);-- await expect(async () => {- await component.update(<div id="9001"></div>);- }).rejects.toThrowError('Updating a native HTML element is not supported');-});diff --git a/tests/components/ct-vue-cli/tests/vue-router/vue-router.spec.ts b/tests/components/ct-vue-cli/tests/vue-router/vue-router.spec.tsdeleted file mode 100644index c268b2fbfb..0000000000--- a/tests/components/ct-vue-cli/tests/vue-router/vue-router.spec.ts+++ /dev/null@@ -1,14 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import App from '@/App.vue';-import type { HooksConfig } from '../../playwright';--test('navigate to a page by clicking a link', async ({ page, mount }) => {- const component = await mount<HooksConfig>(App, {- hooksConfig: { routing: true },- });- await expect(component.getByRole('main')).toHaveText('Login');- await expect(page).toHaveURL('/');- await component.getByRole('link', { name: 'Dashboard' }).click();- await expect(component.getByRole('main')).toHaveText('Dashboard');- await expect(page).toHaveURL('/dashboard');-});diff --git a/tests/components/ct-vue-cli/tests/vue-router/vue-router.spec.tsx b/tests/components/ct-vue-cli/tests/vue-router/vue-router.spec.tsxdeleted file mode 100644index d5f02daf60..0000000000--- a/tests/components/ct-vue-cli/tests/vue-router/vue-router.spec.tsx+++ /dev/null@@ -1,14 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import App from '@/App.vue';-import type { HooksConfig } from '../../playwright';--test('navigate to a page by clicking a link', async ({ page, mount }) => {- const component = await mount<HooksConfig>(<App />, {- hooksConfig: { routing: true },- });- await expect(component.getByRole('main')).toHaveText('Login');- await expect(page).toHaveURL('/');- await component.getByRole('link', { name: 'Dashboard' }).click();- await expect(component.getByRole('main')).toHaveText('Dashboard');- await expect(page).toHaveURL('/dashboard');-});diff --git a/tests/components/ct-vue-cli/tsconfig.app.json b/tests/components/ct-vue-cli/tsconfig.app.jsondeleted file mode 100644index 4d8e68abb8..0000000000--- a/tests/components/ct-vue-cli/tsconfig.app.json+++ /dev/null@@ -1,13 +0,0 @@-{- "extends": "@vue/tsconfig/tsconfig.dom.json",- "include": ["src/**/*", "src/**/*.vue"],- "exclude": ["src/**/*.spec.*/*"],- "compilerOptions": {- "composite": true,- "baseUrl": ".",- "paths": {- "@/*": ["./src/*"],- "*": ["_"],- }- }-}diff --git a/tests/components/ct-vue-cli/tsconfig.config.json b/tests/components/ct-vue-cli/tsconfig.config.jsondeleted file mode 100644index 4c52107add..0000000000--- a/tests/components/ct-vue-cli/tsconfig.config.json+++ /dev/null@@ -1,8 +0,0 @@-{- "extends": "@vue/tsconfig/tsconfig.dom.json",- "include": ["playwright.config.*"],- "compilerOptions": {- "composite": true,- "types": ["node"]- }-}diff --git a/tests/components/ct-vue-cli/tsconfig.json b/tests/components/ct-vue-cli/tsconfig.jsondeleted file mode 100644index 536e033e83..0000000000--- a/tests/components/ct-vue-cli/tsconfig.json+++ /dev/null@@ -1,14 +0,0 @@-{- "files": [],- "references": [- {- "path": "./tsconfig.config.json"- },- {- "path": "./tsconfig.app.json"- },- {- "path": "./tsconfig.test.json"- }- ]-}diff --git a/tests/components/ct-vue-cli/tsconfig.test.json b/tests/components/ct-vue-cli/tsconfig.test.jsondeleted file mode 100644index 910c087fca..0000000000--- a/tests/components/ct-vue-cli/tsconfig.test.json+++ /dev/null@@ -1,13 +0,0 @@-{- "extends": "./tsconfig.app.json",- "include": ["playwright", "src/**/*", "tests/**/*"],- "compilerOptions": {- "allowJs": true,- "composite": true,- "lib": [],- "jsx": "react-jsx",- "types": ["node"],- "noUncheckedSideEffectImports": false,- "ignoreDeprecations": "6.0"- }-}diff --git a/tests/components/ct-vue-cli/vue.config.js b/tests/components/ct-vue-cli/vue.config.jsdeleted file mode 100644index 523a634b5c..0000000000--- a/tests/components/ct-vue-cli/vue.config.js+++ /dev/null@@ -1,4 +0,0 @@-const { defineConfig } = require('@vue/cli-service')-module.exports = defineConfig({- transpileDependencies: true,-})diff --git a/tests/components/ct-vue-cli/vue.d.ts b/tests/components/ct-vue-cli/vue.d.tsdeleted file mode 100644index d4d073050e..0000000000--- a/tests/components/ct-vue-cli/vue.d.ts+++ /dev/null@@ -1,4 +0,0 @@-declare module '*.vue' {- const value: any;- export default value;-}diff --git a/tests/components/ct-vue-vite/.eslintignore b/tests/components/ct-vue-vite/.eslintignoredeleted file mode 100644index 01b7e33fd4..0000000000--- a/tests/components/ct-vue-vite/.eslintignore+++ /dev/null@@ -1 +0,0 @@-**/*\ No newline at end of filediff --git a/tests/components/ct-vue-vite/.gitignore b/tests/components/ct-vue-vite/.gitignoredeleted file mode 100644index 0f4b1c5632..0000000000--- a/tests/components/ct-vue-vite/.gitignore+++ /dev/null@@ -1,26 +0,0 @@-# Logs-logs-*.log-npm-debug.log*-yarn-debug.log*-yarn-error.log*-pnpm-debug.log*-lerna-debug.log*-*.tsbuildinfo--node_modules-.DS_Store-dist-dist-ssr-coverage-*.local--# Editor directories and files-.vscode/*-!.vscode/extensions.json-.idea-*.suo-*.ntvs*-*.njsproj-*.sln-*.sw?diff --git a/tests/components/ct-vue-vite/README.md b/tests/components/ct-vue-vite/README.mddeleted file mode 100644index a06da4e0ab..0000000000--- a/tests/components/ct-vue-vite/README.md+++ /dev/null@@ -1,29 +0,0 @@-# ct1--This template should help get you started developing with Vue 3 in Vite.--## Recommended IDE Setup--[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.vscode-typescript-vue-plugin).--## Customize configuration--See [Vite Configuration Reference](https://vitejs.dev/config/).--## Project Setup--```sh-npm install-```--### Compile and Hot-Reload for Development--```sh-npm run dev-```--### Compile and Minify for Production--```sh-npm run build-```diff --git a/tests/components/ct-vue-vite/env.d.ts b/tests/components/ct-vue-vite/env.d.tsdeleted file mode 100644index 11f02fe2a0..0000000000--- a/tests/components/ct-vue-vite/env.d.ts+++ /dev/null@@ -1 +0,0 @@-/// <reference types="vite/client" />diff --git a/tests/components/ct-vue-vite/index.html b/tests/components/ct-vue-vite/index.htmldeleted file mode 100644index 030a6ff51b..0000000000--- a/tests/components/ct-vue-vite/index.html+++ /dev/null@@ -1,13 +0,0 @@-<!DOCTYPE html>-<html lang="en">- <head>- <meta charset="UTF-8" />- <link rel="icon" href="/favicon.ico" />- <meta name="viewport" content="width=device-width, initial-scale=1.0" />- <title>Vite App</title>- </head>- <body>- <div id="app"></div>- <script type="module" src="/src/main.js"></script>- </body>-</html>diff --git a/tests/components/ct-vue-vite/package.json b/tests/components/ct-vue-vite/package.jsondeleted file mode 100644index f0fd5466fb..0000000000--- a/tests/components/ct-vue-vite/package.json+++ /dev/null@@ -1,22 +0,0 @@-{- "name": "ct-vue-vite",- "version": "0.0.0",- "type": "module",- "scripts": {- "dev": "vite",- "build": "vite build",- "preview": "vite preview --port 5050",- "typecheck": "vue-tsc --noEmit"- },- "dependencies": {- "vue": "^3.4.0",- "vue-router": "^4.1.5"- },- "devDependencies": {- "@vitejs/plugin-vue": "^6.0.7",- "@vue/tsconfig": "^0.5.1",- "typescript": "5.6.2",- "vite": "^8.1.0",- "vue-tsc": "^2.0.21"- }-}diff --git a/tests/components/ct-vue-vite/playwright.config.ts b/tests/components/ct-vue-vite/playwright.config.tsdeleted file mode 100644index 18067fda8d..0000000000--- a/tests/components/ct-vue-vite/playwright.config.ts+++ /dev/null@@ -1,50 +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, devices } from '@playwright/experimental-ct-vue';-import path from 'path';-import { fileURLToPath } from 'url';--export default defineConfig({- testDir: 'tests',- forbidOnly: !!process.env.CI,- retries: process.env.CI ? 2 : 0,- reporter: process.env.CI ? 'html' : 'line',- use: {- trace: 'on-first-retry',- ctViteConfig: {- resolve: {- alias: {- '@': path.resolve(path.dirname(fileURLToPath(import.meta.url)), './src'),- }- }- }- },- projects: [- {- name: 'chromium',- use: { ...devices['Desktop Chrome'] },- },- {- name: 'firefox',- use: { ...devices['Desktop Firefox'] },- },- {- name: 'webkit',- use: { ...devices['Desktop Safari'] },- },- ],-});diff --git a/tests/components/ct-vue-vite/playwright/index.html b/tests/components/ct-vue-vite/playwright/index.htmldeleted file mode 100644index 7b2273ee63..0000000000--- a/tests/components/ct-vue-vite/playwright/index.html+++ /dev/null@@ -1,13 +0,0 @@-<!DOCTYPE html>-<html lang="en">- <head>- <meta charset="UTF-8" />- <link rel="icon" href="/favicon.ico" />- <meta name="viewport" content="width=device-width, initial-scale=1.0" />- <title>Vite App</title>- </head>- <body>- <div id="root"></div>- <script type="module" src="./index.ts"></script>- </body>-</html>diff --git a/tests/components/ct-vue-vite/playwright/index.ts b/tests/components/ct-vue-vite/playwright/index.tsdeleted file mode 100644index f23ab5a90a..0000000000--- a/tests/components/ct-vue-vite/playwright/index.ts+++ /dev/null@@ -1,23 +0,0 @@-import { beforeMount, afterMount } from '@playwright/experimental-ct-vue/hooks';-import { router } from '../src/router';-import Button from '../src/components/Button.vue';-import '../src/assets/index.css';--export type HooksConfig = {- routing?: boolean;- components?: Record<string, any>;-}--beforeMount<HooksConfig>(async ({ app, hooksConfig }) => {- if (hooksConfig?.routing)- app.use(router as any); // TODO: remove any and fix the various installed conflicting Vue versions-- for (const [name, component] of Object.entries(hooksConfig?.components || {}))- app.component(name, component);-- console.log(`Before mount: ${JSON.stringify(hooksConfig)}, app: ${!!app}`);-});--afterMount<HooksConfig>(async ({ instance }) => {- console.log(`After mount el: ${instance.$el.constructor.name}`);-});diff --git a/tests/components/ct-vue-vite/public/favicon.ico b/tests/components/ct-vue-vite/public/favicon.icodeleted file mode 100644index df36fcfb72..0000000000Binary files a/tests/components/ct-vue-vite/public/favicon.ico and /dev/null differdiff --git a/tests/components/ct-vue-vite/src/App.vue b/tests/components/ct-vue-vite/src/App.vuedeleted file mode 100644index 8eced563f8..0000000000--- a/tests/components/ct-vue-vite/src/App.vue+++ /dev/null@@ -1,8 +0,0 @@-<template>- <header>- <img alt="Vue logo" class="logo" src="./assets/logo.svg" width="125" height="125" />- <router-link to="/">Login</router-link>- <router-link to="/dashboard">Dashboard</router-link>- </header>- <router-view />-</template>diff --git a/tests/components/ct-vue-vite/src/assets/index.css b/tests/components/ct-vue-vite/src/assets/index.cssdeleted file mode 100644index 97495c44b8..0000000000--- a/tests/components/ct-vue-vite/src/assets/index.css+++ /dev/null@@ -1,20 +0,0 @@-body {- margin: 0;- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',- 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',- sans-serif;- -webkit-font-smoothing: antialiased;- -moz-osx-font-smoothing: grayscale;-}--code {- font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',- monospace;-}--@media (prefers-color-scheme: light) {- :root {- color: #e3e3e3;- background-color: #1b1b1d;- }-}diff --git a/tests/components/ct-vue-vite/src/assets/logo.svg b/tests/components/ct-vue-vite/src/assets/logo.svgdeleted file mode 100644index bc826fed80..0000000000--- a/tests/components/ct-vue-vite/src/assets/logo.svg+++ /dev/null@@ -1 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 261.76 226.69" xmlns:v="https://vecta.io/nano"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/></svg>\ No newline at end of filediff --git a/tests/components/ct-vue-vite/src/components/Button.vue b/tests/components/ct-vue-vite/src/components/Button.vuedeleted file mode 100644index 05ab1ef736..0000000000--- a/tests/components/ct-vue-vite/src/components/Button.vue+++ /dev/null@@ -1,14 +0,0 @@-<script lang="ts" setup>- import { useAttrs } from 'vue';- defineProps<{ title: string }>();- const attrs: Record<string, any> = useAttrs();-</script>--<template>- <button- @click="$emit('submit', 'hello')"- @dblclick="() => attrs.dbclick('fallthroughEvent')"- >- {{ title }}- </button>-</template>diff --git a/tests/components/ct-vue-vite/src/components/Component.vue b/tests/components/ct-vue-vite/src/components/Component.vuedeleted file mode 100644index 133c8e2670..0000000000--- a/tests/components/ct-vue-vite/src/components/Component.vue+++ /dev/null@@ -1,3 +0,0 @@-<template>- <div>test</div>-</template>diff --git a/tests/components/ct-vue-vite/src/components/Counter.vue b/tests/components/ct-vue-vite/src/components/Counter.vuedeleted file mode 100644index f6b2c3e0ac..0000000000--- a/tests/components/ct-vue-vite/src/components/Counter.vue+++ /dev/null@@ -1,19 +0,0 @@-<template>- <button @click="$emit('submit', 'hello')">- <span data-testid="props">{{ count }}</span>- <span data-testid="remount-count">{{ remountCount }}</span>- <slot name="main" />- <slot />- </button>-</template>--<script lang="ts">-let remountCount = 0-</script>--<script lang="ts" setup>-defineProps<{ count?: number }>()--remountCount++-</script>-diff --git a/tests/components/ct-vue-vite/src/components/DefaultSlot.vue b/tests/components/ct-vue-vite/src/components/DefaultSlot.vuedeleted file mode 100644index 287b84beaf..0000000000--- a/tests/components/ct-vue-vite/src/components/DefaultSlot.vue+++ /dev/null@@ -1,11 +0,0 @@-<template>- <div>- <h1>Welcome!</h1>- <main>- <slot />- </main>- <footer>- Thanks for visiting.- </footer>- </div>-</template>diff --git a/tests/components/ct-vue-vite/src/components/EmptyTemplate.vue b/tests/components/ct-vue-vite/src/components/EmptyTemplate.vuedeleted file mode 100644index 0c47e38098..0000000000--- a/tests/components/ct-vue-vite/src/components/EmptyTemplate.vue+++ /dev/null@@ -1,7 +0,0 @@-<script lang="ts" setup>- import { useSlots } from 'vue';- const slots = useSlots();- Object.assign(window, { slots });-</script>-<template>-</template>diff --git a/tests/components/ct-vue-vite/src/components/MultiRoot.vue b/tests/components/ct-vue-vite/src/components/MultiRoot.vuedeleted file mode 100644index d1c348d750..0000000000--- a/tests/components/ct-vue-vite/src/components/MultiRoot.vue+++ /dev/null@@ -1,4 +0,0 @@-<template>- <div>root 1</div>- <div>root 2</div>-</template>\ No newline at end of filediff --git a/tests/components/ct-vue-vite/src/components/NamedSlots.vue b/tests/components/ct-vue-vite/src/components/NamedSlots.vuedeleted file mode 100644index 582608df32..0000000000--- a/tests/components/ct-vue-vite/src/components/NamedSlots.vue+++ /dev/null@@ -1,13 +0,0 @@-<template>- <div>- <header>- <slot name="header" />- </header>- <main>- <slot name="main" />- </main>- <footer>- <slot name="footer" />- </footer>- </div>-</template>diff --git a/tests/components/ct-vue-vite/src/components/SlotDefaultValue.vue b/tests/components/ct-vue-vite/src/components/SlotDefaultValue.vuedeleted file mode 100644index c5944a3f8a..0000000000--- a/tests/components/ct-vue-vite/src/components/SlotDefaultValue.vue+++ /dev/null@@ -1,3 +0,0 @@-<template>- <slot>default value</slot>-</template>diff --git a/tests/components/ct-vue-vite/src/main.js b/tests/components/ct-vue-vite/src/main.jsdeleted file mode 100644index dff530a737..0000000000--- a/tests/components/ct-vue-vite/src/main.js+++ /dev/null@@ -1,6 +0,0 @@-import { createApp } from 'vue';-import App from './App.vue';-import './assets/index.css';-import { router } from './router';--createApp(App).use(router).mount('#app');diff --git a/tests/components/ct-vue-vite/src/pages/DashboardPage.vue b/tests/components/ct-vue-vite/src/pages/DashboardPage.vuedeleted file mode 100644index 0dcf8cc990..0000000000--- a/tests/components/ct-vue-vite/src/pages/DashboardPage.vue+++ /dev/null@@ -1,3 +0,0 @@-<template>- <main>Dashboard</main>-</template>diff --git a/tests/components/ct-vue-vite/src/pages/LoginPage.vue b/tests/components/ct-vue-vite/src/pages/LoginPage.vuedeleted file mode 100644index aaa18be8ab..0000000000--- a/tests/components/ct-vue-vite/src/pages/LoginPage.vue+++ /dev/null@@ -1,3 +0,0 @@-<template>- <main>Login</main>-</template>diff --git a/tests/components/ct-vue-vite/src/router/index.ts b/tests/components/ct-vue-vite/src/router/index.tsdeleted file mode 100644index e4e5a9e37f..0000000000--- a/tests/components/ct-vue-vite/src/router/index.ts+++ /dev/null@@ -1,11 +0,0 @@-import DashboardPage from '../pages/DashboardPage.vue';-import LoginPage from '../pages/LoginPage.vue';-import { createRouter, createWebHistory } from 'vue-router';--export const router = createRouter({- history: createWebHistory(import.meta.env.BASE_URL),- routes: [- { path: '/', component: LoginPage },- { path: '/dashboard', component: DashboardPage },- ],-})diff --git a/tests/components/ct-vue-vite/tests/events/events.spec.js b/tests/components/ct-vue-vite/tests/events/events.spec.jsdeleted file mode 100644index 37fafa3a3a..0000000000--- a/tests/components/ct-vue-vite/tests/events/events.spec.js+++ /dev/null@@ -1,30 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import Button from '@/components/Button.vue';--test('emit a submit event when the button is clicked', async ({ mount }) => {- const messages = [];- const component = await mount(Button, {- props: {- title: 'Submit',- },- on: {- submit: (message) => messages.push(message),- },- });- await component.click();- expect(messages).toEqual(['hello']);-});--test('emit a fallthrough event when the button is double clicked', async ({ mount }) => {- const messages = [];- const component = await mount(Button, {- props: {- title: 'Submit',- },- on: {- dbclick: (message) => messages.push(message),- },- });- await component.dblclick();- expect(messages).toEqual(['fallthroughEvent']);-});diff --git a/tests/components/ct-vue-vite/tests/events/events.spec.ts b/tests/components/ct-vue-vite/tests/events/events.spec.tsdeleted file mode 100644index 4cb3149219..0000000000--- a/tests/components/ct-vue-vite/tests/events/events.spec.ts+++ /dev/null@@ -1,30 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import Button from '@/components/Button.vue';--test('emit a submit event when the button is clicked', async ({ mount }) => {- const messages: string[] = [];- const component = await mount(Button, {- props: {- title: 'Submit',- },- on: {- submit: (message: string) => messages.push(message),- },- });- await component.click();- expect(messages).toEqual(['hello']);-});--test('emit a fallthrough event when the button is double clicked', async ({ mount }) => {- const messages: string[] = [];- const component = await mount(Button, {- props: {- title: 'Submit',- },- on: {- dbclick: (message: string) => messages.push(message),- },- });- await component.dblclick();- expect(messages).toEqual(['fallthroughEvent']);-});diff --git a/tests/components/ct-vue-vite/tests/events/events.spec.tsx b/tests/components/ct-vue-vite/tests/events/events.spec.tsxdeleted file mode 100644index 37cf906c37..0000000000--- a/tests/components/ct-vue-vite/tests/events/events.spec.tsx+++ /dev/null@@ -1,42 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import Button from '@/components/Button.vue';-import DefaultSlot from '@/components/DefaultSlot.vue';--test('emit a submit event when the button is clicked', async ({ mount }) => {- const messages: string[] = [];- const component = await mount(- <Button- title="Submit"- v-on:submit={(message: string) => {- messages.push(message);- }}- />- );- await component.click();- expect(messages).toEqual(['hello']);-});--test('emit a fallthrough event when the button is double clicked', async ({ mount }) => {- const messages: string[] = [];- const component = await mount(- <Button- title="Submit"- v-on:dbclick={(message: string) => {- messages.push(message)- }}- />- );- await component.dblclick();- expect(messages).toEqual(['fallthroughEvent']);-});--test('emit a event when a slot is clicked', async ({ mount }) => {- let clickFired = false;- const component = await mount(- <DefaultSlot>- <span v-on:click={() => (clickFired = true)}>Main Content</span>- </DefaultSlot>- );- await component.getByText('Main Content').click();- expect(clickFired).toBeTruthy();-});diff --git a/tests/components/ct-vue-vite/tests/render/render.spec.js b/tests/components/ct-vue-vite/tests/render/render.spec.jsdeleted file mode 100644index f0af3a2cdf..0000000000--- a/tests/components/ct-vue-vite/tests/render/render.spec.js+++ /dev/null@@ -1,25 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import Button from '@/components/Button.vue';-import EmptyTemplate from '@/components/EmptyTemplate.vue';-import Component from '@/components/Component.vue';--test('render props', async ({ mount }) => {- const component = await mount(Button, {- props: {- title: 'Submit',- },- });- await expect(component).toContainText('Submit');-});--test('get textContent of the empty template', async ({ mount }) => {- const component = await mount(EmptyTemplate);- expect(await component.allTextContents()).toEqual(['']);- expect(await component.textContent()).toBe('');- await expect(component).toHaveText('');-});--test('render a component without options', async ({ mount }) => {- const component = await mount(Component);- await expect(component).toContainText('test');-});diff --git a/tests/components/ct-vue-vite/tests/render/render.spec.ts b/tests/components/ct-vue-vite/tests/render/render.spec.tsdeleted file mode 100644index f0af3a2cdf..0000000000--- a/tests/components/ct-vue-vite/tests/render/render.spec.ts+++ /dev/null@@ -1,25 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import Button from '@/components/Button.vue';-import EmptyTemplate from '@/components/EmptyTemplate.vue';-import Component from '@/components/Component.vue';--test('render props', async ({ mount }) => {- const component = await mount(Button, {- props: {- title: 'Submit',- },- });- await expect(component).toContainText('Submit');-});--test('get textContent of the empty template', async ({ mount }) => {- const component = await mount(EmptyTemplate);- expect(await component.allTextContents()).toEqual(['']);- expect(await component.textContent()).toBe('');- await expect(component).toHaveText('');-});--test('render a component without options', async ({ mount }) => {- const component = await mount(Component);- await expect(component).toContainText('test');-});diff --git a/tests/components/ct-vue-vite/tests/render/render.spec.tsx b/tests/components/ct-vue-vite/tests/render/render.spec.tsxdeleted file mode 100644index e4cf96ec8f..0000000000--- a/tests/components/ct-vue-vite/tests/render/render.spec.tsx+++ /dev/null@@ -1,21 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import Button from '@/components/Button.vue';-import EmptyTemplate from '@/components/EmptyTemplate.vue';--test('render props', async ({ mount }) => {- const component = await mount(<Button title='Submit' />);- await expect(component).toContainText('Submit');-});--test('render attributes', async ({ mount }) => {- const component = await mount(<Button class='primary' title='Submit' />);- await expect(component).toHaveClass('primary');-});--test('render an empty component', async ({ page, mount }) => {- const component = await mount(<EmptyTemplate />);- expect(await page.evaluate(() => 'slots' in window && window.slots)).toEqual({});- expect(await component.allTextContents()).toEqual(['']);- expect(await component.textContent()).toBe('');- await expect(component).toHaveText('');-});diff --git a/tests/components/ct-vue-vite/tests/slots/slots.spec.js b/tests/components/ct-vue-vite/tests/slots/slots.spec.jsdeleted file mode 100644index 7d36d9733b..0000000000--- a/tests/components/ct-vue-vite/tests/slots/slots.spec.js+++ /dev/null@@ -1,62 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import DefaultSlot from '@/components/DefaultSlot.vue';-import NamedSlots from '@/components/NamedSlots.vue';-import Button from '@/components/Button.vue';-import SlotDefaultValue from "@/components/SlotDefaultValue.vue";--test('render a default slot', async ({ mount }) => {- const component = await mount(DefaultSlot, {- slots: {- default: '<strong>Main Content</strong>',- },- });- await expect(component.getByRole('strong')).toContainText('Main Content');-});--test('render a component as slot', async ({ mount }) => {- const component = await mount(DefaultSlot, {- slots: {- default: '<Button title="Submit" />', // component is registered globally in /playwright/index.ts- },- hooksConfig: {- components: { Button }- }- });- await expect(component).toContainText('Submit');-});--test('render a component with multiple slots', async ({ mount }) => {- const component = await mount(DefaultSlot, {- slots: {- default: [- '<div data-testid="one">One</div>',- '<div data-testid="two">Two</div>',- ],- },- });- await expect(component.getByTestId('one')).toContainText('One');- await expect(component.getByTestId('two')).toContainText('Two');-});--test('render a component with a named slot', async ({ mount }) => {- const component = await mount(NamedSlots, {- slots: {- header: 'Header',- main: 'Main Content',- footer: 'Footer',- },- });- await expect(component).toContainText('Header');- await expect(component).toContainText('Main Content');- await expect(component).toContainText('Footer');-});--test('updating default slot should work', { annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/32809' } }, async ({ mount }) => {- const slots = { default: 'foo' };-- const component = await mount(SlotDefaultValue, { slots });- await expect(component).toHaveText('foo');-- await component.update({ slots });- await expect(component).toHaveText('foo');-});diff --git a/tests/components/ct-vue-vite/tests/slots/slots.spec.ts b/tests/components/ct-vue-vite/tests/slots/slots.spec.tsdeleted file mode 100644index 7d36d9733b..0000000000--- a/tests/components/ct-vue-vite/tests/slots/slots.spec.ts+++ /dev/null@@ -1,62 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import DefaultSlot from '@/components/DefaultSlot.vue';-import NamedSlots from '@/components/NamedSlots.vue';-import Button from '@/components/Button.vue';-import SlotDefaultValue from "@/components/SlotDefaultValue.vue";--test('render a default slot', async ({ mount }) => {- const component = await mount(DefaultSlot, {- slots: {- default: '<strong>Main Content</strong>',- },- });- await expect(component.getByRole('strong')).toContainText('Main Content');-});--test('render a component as slot', async ({ mount }) => {- const component = await mount(DefaultSlot, {- slots: {- default: '<Button title="Submit" />', // component is registered globally in /playwright/index.ts- },- hooksConfig: {- components: { Button }- }- });- await expect(component).toContainText('Submit');-});--test('render a component with multiple slots', async ({ mount }) => {- const component = await mount(DefaultSlot, {- slots: {- default: [- '<div data-testid="one">One</div>',- '<div data-testid="two">Two</div>',- ],- },- });- await expect(component.getByTestId('one')).toContainText('One');- await expect(component.getByTestId('two')).toContainText('Two');-});--test('render a component with a named slot', async ({ mount }) => {- const component = await mount(NamedSlots, {- slots: {- header: 'Header',- main: 'Main Content',- footer: 'Footer',- },- });- await expect(component).toContainText('Header');- await expect(component).toContainText('Main Content');- await expect(component).toContainText('Footer');-});--test('updating default slot should work', { annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/32809' } }, async ({ mount }) => {- const slots = { default: 'foo' };-- const component = await mount(SlotDefaultValue, { slots });- await expect(component).toHaveText('foo');-- await component.update({ slots });- await expect(component).toHaveText('foo');-});diff --git a/tests/components/ct-vue-vite/tests/slots/slots.spec.tsx b/tests/components/ct-vue-vite/tests/slots/slots.spec.tsxdeleted file mode 100644index 64da25ed0b..0000000000--- a/tests/components/ct-vue-vite/tests/slots/slots.spec.tsx+++ /dev/null@@ -1,52 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import Button from '@/components/Button.vue';-import DefaultSlot from '@/components/DefaultSlot.vue';-import NamedSlots from '@/components/NamedSlots.vue';--test('render a default slot', async ({ mount }) => {- const component = await mount(- <DefaultSlot>- <strong>Main Content</strong>- </DefaultSlot>- );- await expect(component.getByRole('strong')).toContainText('Main Content');-});--test('render a component as slot', async ({ mount }) => {- const component = await mount(- <DefaultSlot>- <Button title="Submit" />- </DefaultSlot>- );- await expect(component).toContainText('Submit');-});--test('render a component with multiple slots', async ({ mount }) => {- const component = await mount(- <DefaultSlot>- <div data-testid="one">One</div>- <div data-testid="two">Two</div>- </DefaultSlot>- );- await expect(component.getByTestId('one')).toContainText('One');- await expect(component.getByTestId('two')).toContainText('Two');-});--test('render a component with a named slot', async ({ mount }) => {- const component = await mount(- <NamedSlots>- <template v-slot:header>Header</template>- <template v-slot:main>Main Content</template>- <template v-slot:footer>Footer</template>- </NamedSlots>- );- await expect(component).toContainText('Header');- await expect(component).toContainText('Main Content');- await expect(component).toContainText('Footer');-});--test('render array as child', async ({ mount }) => {- const component = await mount(<DefaultSlot>{[<h4>{[4]}</h4>,[[<p>[2,3]</p>]]]}</DefaultSlot>);- await expect(component.getByRole('heading', { level: 4 })).toHaveText('4');- await expect(component.getByRole('paragraph')).toHaveText('[2,3]');-});diff --git a/tests/components/ct-vue-vite/tests/unmount/unmount.spec.js b/tests/components/ct-vue-vite/tests/unmount/unmount.spec.jsdeleted file mode 100644index d527b9d7ce..0000000000--- a/tests/components/ct-vue-vite/tests/unmount/unmount.spec.js+++ /dev/null@@ -1,28 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import MultiRoot from '@/components/MultiRoot.vue';-import Button from '@/components/Button.vue';--test('unmount a multi root component', async ({ mount, page }) => {- const component = await mount(MultiRoot);- await expect(page.locator('#root')).toContainText('root 1');- await expect(page.locator('#root')).toContainText('root 2');- await component.unmount();- await expect(page.locator('#root')).not.toContainText('root 1');- await expect(page.locator('#root')).not.toContainText('root 2');-});--test('mount then unmount then mount', async ({ mount }) => {- let component = await mount(Button, {- props: {- title: 'Submit',- },- });- await component.unmount();- component = await mount(Button, {- props: {- title: 'Save',- },- });- await expect(component).toContainText('Save');-});-diff --git a/tests/components/ct-vue-vite/tests/unmount/unmount.spec.ts b/tests/components/ct-vue-vite/tests/unmount/unmount.spec.tsdeleted file mode 100644index 322460f7aa..0000000000--- a/tests/components/ct-vue-vite/tests/unmount/unmount.spec.ts+++ /dev/null@@ -1,48 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import Button from '@/components/Button.vue';-import MultiRoot from '@/components/MultiRoot.vue';--test('unmount', async ({ page, mount }) => {- const component = await mount(Button, {- props: {- title: 'Submit',- },- });- await expect(page.locator('#root')).toContainText('Submit');- await component.unmount();- await expect(page.locator('#root')).not.toContainText('Submit');-});--test('unmount a multi root component', async ({ mount, page }) => {- const component = await mount(MultiRoot);- await expect(page.locator('#root')).toContainText('root 1');- await expect(page.locator('#root')).toContainText('root 2');- await component.unmount();- await expect(page.locator('#root')).not.toContainText('root 1');- await expect(page.locator('#root')).not.toContainText('root 2');-});--test('unmount twice throws an error', async ({ mount }) => {- const component = await mount(Button, {- props: {- title: 'Submit',- },- });- await component.unmount();- await expect(component.unmount()).rejects.toThrowError('Component was not mounted');-});--test('mount then unmount then mount', async ({ mount }) => {- let component = await mount(Button, {- props: {- title: 'Submit',- },- });- await component.unmount();- component = await mount(Button, {- props: {- title: 'Save',- },- });- await expect(component).toContainText('Save');-});diff --git a/tests/components/ct-vue-vite/tests/unmount/unmount.spec.tsx b/tests/components/ct-vue-vite/tests/unmount/unmount.spec.tsxdeleted file mode 100644index cf0704e674..0000000000--- a/tests/components/ct-vue-vite/tests/unmount/unmount.spec.tsx+++ /dev/null@@ -1,25 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import MultiRoot from '@/components/MultiRoot.vue';-import Button from '@/components/Button.vue';--test('unmount a multi root component', async ({ mount, page }) => {- const component = await mount(<MultiRoot />);- await expect(page.locator('#root')).toContainText('root 1');- await expect(page.locator('#root')).toContainText('root 2');- await component.unmount();- await expect(page.locator('#root')).not.toContainText('root 1');- await expect(page.locator('#root')).not.toContainText('root 2');-});--test('unmount twice throws an error', async ({ mount }) => {- const component = await mount(<Button title="Submit" />);- await component.unmount();- await expect(component.unmount()).rejects.toThrowError('Component was not mounted');-});--test('mount then unmount then mount', async ({ mount }) => {- let component = await mount(<Button title="Submit" />);- await component.unmount();- component = await mount(<Button title="Save" />);- await expect(component).toContainText('Save');-});diff --git a/tests/components/ct-vue-vite/tests/update/update.spec.js b/tests/components/ct-vue-vite/tests/update/update.spec.jsdeleted file mode 100644index f0adb13114..0000000000--- a/tests/components/ct-vue-vite/tests/update/update.spec.js+++ /dev/null@@ -1,47 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import Counter from '@/components/Counter.vue';--test('update props without remounting', async ({ mount }) => {- const component = await mount(Counter, {- props: { count: 9001 },- });- await expect(component.getByTestId('props')).toContainText('9001');-- await component.update({- props: { count: 1337 },- });- await expect(component).not.toContainText('9001');- await expect(component.getByTestId('props')).toContainText('1337');-- await expect(component.getByTestId('remount-count')).toContainText('1');-});--test('update event listeners without remounting', async ({ mount }) => {- const component = await mount(Counter);-- const messages = [];- await component.update({- on: {- submit: (count) => messages.push(count),- },- });- await component.click();- expect(messages).toEqual(['hello']);-- await expect(component.getByTestId('remount-count')).toContainText('1');-});--test('update slots without remounting', async ({ mount }) => {- const component = await mount(Counter, {- slots: { default: 'Default Slot' },- });- await expect(component).toContainText('Default Slot');-- await component.update({- slots: { main: 'Test Slot' },- });- await expect(component).not.toContainText('Default Slot');- await expect(component).toContainText('Test Slot');-- await expect(component.getByTestId('remount-count')).toContainText('1');-});diff --git a/tests/components/ct-vue-vite/tests/update/update.spec.ts b/tests/components/ct-vue-vite/tests/update/update.spec.tsdeleted file mode 100644index 114a1274c0..0000000000--- a/tests/components/ct-vue-vite/tests/update/update.spec.ts+++ /dev/null@@ -1,47 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import Counter from '@/components/Counter.vue';--test('update props without remounting', async ({ mount }) => {- const component = await mount(Counter, {- props: { count: 9001 },- });- await expect(component.getByTestId('props')).toContainText('9001');-- await component.update({- props: { count: 1337 },- });- await expect(component).not.toContainText('9001');- await expect(component.getByTestId('props')).toContainText('1337');-- await expect(component.getByTestId('remount-count')).toContainText('1');-});--test('update event listeners without remounting', async ({ mount }) => {- const component = await mount(Counter);-- const messages: string[] = [];- await component.update({- on: {- submit: (count: string) => messages.push(count),- },- });- await component.click();- expect(messages).toEqual(['hello']);-- await expect(component.getByTestId('remount-count')).toContainText('1');-});--test('update slots without remounting', async ({ mount }) => {- const component = await mount(Counter, {- slots: { default: 'Default Slot' },- });- await expect(component).toContainText('Default Slot');-- await component.update({- slots: { main: 'Test Slot' },- });- await expect(component).not.toContainText('Default Slot');- await expect(component).toContainText('Test Slot');-- await expect(component.getByTestId('remount-count')).toContainText('1');-});diff --git a/tests/components/ct-vue-vite/tests/update/update.spec.tsx b/tests/components/ct-vue-vite/tests/update/update.spec.tsxdeleted file mode 100644index d622c5f431..0000000000--- a/tests/components/ct-vue-vite/tests/update/update.spec.tsx+++ /dev/null@@ -1,53 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import Counter from '@/components/Counter.vue';--test('update props without remounting', async ({ mount }) => {- const component = await mount(<Counter count={9001} />);- await expect(component.getByTestId('props')).toContainText('9001');-- await component.update(<Counter count={1337} />);- await expect(component).not.toContainText('9001');- await expect(component.getByTestId('props')).toContainText('1337');-- await expect(component.getByTestId('remount-count')).toContainText('1');-});--test('update event listeners without remounting', async ({ mount }) => {- const component = await mount(<Counter />);-- const messages: string[] = [];- await component.update(- <Counter- v-on:submit={(count: string) => {- messages.push(count);- }}- />- );- await component.click();- expect(messages).toEqual(['hello']);-- await expect(component.getByTestId('remount-count')).toContainText('1');-});--test('update slots without remounting', async ({ mount }) => {- const component = await mount(<Counter>Default Slot</Counter>);- await expect(component).toContainText('Default Slot');-- await component.update(- <Counter>- <template v-slot:main>Test Slot</template>- </Counter>- );- await expect(component).not.toContainText('Default Slot');- await expect(component).toContainText('Test Slot');-- await expect(component.getByTestId('remount-count')).toContainText('1');-});--test('throw error when updating a native html element', async ({ mount }) => {- const component = await mount(<div id="1337"></div>);-- await expect(async () => {- await component.update(<div id="9001"></div>);- }).rejects.toThrowError('Updating a native HTML element is not supported');-});diff --git a/tests/components/ct-vue-vite/tests/vue-router/vue-router.spec.js b/tests/components/ct-vue-vite/tests/vue-router/vue-router.spec.jsdeleted file mode 100644index 0caa91f544..0000000000--- a/tests/components/ct-vue-vite/tests/vue-router/vue-router.spec.js+++ /dev/null@@ -1,13 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import App from '@/App.vue';--test('navigate to a page by clicking a link', async ({ page, mount }) => {- const component = await mount(App, {- hooksConfig: { routing: true },- });- await expect(component.getByRole('main')).toHaveText('Login');- await expect(page).toHaveURL('/');- await component.getByRole('link', { name: 'Dashboard' }).click();- await expect(component.getByRole('main')).toHaveText('Dashboard');- await expect(page).toHaveURL('/dashboard');-});diff --git a/tests/components/ct-vue-vite/tests/vue-router/vue-router.spec.ts b/tests/components/ct-vue-vite/tests/vue-router/vue-router.spec.tsdeleted file mode 100644index 000715b368..0000000000--- a/tests/components/ct-vue-vite/tests/vue-router/vue-router.spec.ts+++ /dev/null@@ -1,14 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import type { HooksConfig } from '../../playwright';-import App from '@/App.vue';--test('navigate to a page by clicking a link', async ({ page, mount }) => {- const component = await mount<HooksConfig>(App, {- hooksConfig: { routing: true },- });- await expect(component.getByRole('main')).toHaveText('Login');- await expect(page).toHaveURL('/');- await component.getByRole('link', { name: 'Dashboard' }).click();- await expect(component.getByRole('main')).toHaveText('Dashboard');- await expect(page).toHaveURL('/dashboard');-});diff --git a/tests/components/ct-vue-vite/tests/vue-router/vue-router.spec.tsx b/tests/components/ct-vue-vite/tests/vue-router/vue-router.spec.tsxdeleted file mode 100644index 48d7f6065b..0000000000--- a/tests/components/ct-vue-vite/tests/vue-router/vue-router.spec.tsx+++ /dev/null@@ -1,14 +0,0 @@-import { test, expect } from '@playwright/experimental-ct-vue';-import type { HooksConfig } from '../../playwright';-import App from '@/App.vue';--test('navigate to a page by clicking a link', async ({ page, mount }) => {- const component = await mount<HooksConfig>(<App />, {- hooksConfig: { routing: true },- });- await expect(component.getByRole('main')).toHaveText('Login');- await expect(page).toHaveURL('/');- await component.getByRole('link', { name: 'Dashboard' }).click();- await expect(component.getByRole('main')).toHaveText('Dashboard');- await expect(page).toHaveURL('/dashboard');-});diff --git a/tests/components/ct-vue-vite/tsconfig.json b/tests/components/ct-vue-vite/tsconfig.jsondeleted file mode 100644index b74b79834f..0000000000--- a/tests/components/ct-vue-vite/tsconfig.json+++ /dev/null@@ -1,12 +0,0 @@-{- "extends": "@vue/tsconfig/tsconfig.dom.json",- "include": ["env.d.ts", "src/**/*", "src/**/*.vue", "tests/**/*", "playwright"],- "compilerOptions": {- "baseUrl": ".",- "paths": {- "@/*": ["./src/*"],- "*": ["_"],- },- "ignoreDeprecations": "5.0"- }-}diff --git a/tests/components/ct-vue-vite/vite.config.js b/tests/components/ct-vue-vite/vite.config.jsdeleted file mode 100644index d7386edeb3..0000000000--- a/tests/components/ct-vue-vite/vite.config.js+++ /dev/null@@ -1,14 +0,0 @@-import { fileURLToPath, URL } from 'url'--import { defineConfig } from 'vite'-import vue from '@vitejs/plugin-vue'--// https://vitejs.dev/config/-export default defineConfig({- plugins: [vue()],- resolve: {- alias: {- '@': fileURLToPath(new URL('./src', import.meta.url))- }- },-})diff --git a/tests/components/test-all.spec.js b/tests/components/test-all.spec.jsdeleted file mode 100644index a23d0f44c6..0000000000--- a/tests/components/test-all.spec.js+++ /dev/null@@ -1,71 +0,0 @@-const { test, expect } = require('@playwright/test');--const { spawn, execSync } = require('child_process');-const fs = require('fs');-const path = require('path');--let activeChild = undefined;-const isWindows = process.platform === 'win32';--for (const dir of fs.readdirSync(__dirname)) {- const folder = path.join(__dirname, dir);- if (!fs.statSync(folder).isDirectory())- continue;- test.describe.serial(path.basename(folder), () => {- test.setTimeout(7 * 60 * 1000 /* 7 minutes */);- test('install', async () => {- await run('npm', ['i'], folder);- });-- test('typecheck', async () => {- await run('npm', ['run', 'typecheck'], folder);- });-- for (const project of ['chromium', 'firefox', 'webkit']) {- test(project, async () => {- await run('npx', ['playwright', 'test', '--project=' + project, '--reporter=list'], folder);- });- }- });-}--test.afterEach(async () => {- // Make sure to kill server even if timeout occurs- onExit();-});--async function run(command, args, folder) {- const child = spawn(command, args, {- cwd: folder,- stdio: 'pipe',- env: process.env,- shell: true,- // On non-windows platforms, `detached: true` makes child process a leader of a new- // process group, making it possible to kill child process tree with `.kill(-pid)` command.- // @see https://nodejs.org/api/child_process.html#child_process_options_detached- detached: !isWindows,- });- activeChild = child;- child.stdout.on('data', data => process.stdout.write(data));- child.stderr.on('data', data => process.stdout.write(data));- process.on('exit', onExit);- const code = await new Promise(f => child.on('close', f));- expect(code).toEqual(0);-}--function onExit() {- if (activeChild) {- try {- if (activeChild.exitCode !== null || activeChild.signalCode !== null)- return;-- if (isWindows) {- execSync(`taskkill /pid ${activeChild.pid} /T /F`, { stdio: 'ignore' });- } else {- process.kill(-activeChild.pid, 'SIGKILL');- }- } finally {- activeChild = undefined;- }- }-}diff --git a/tests/installation/globalSetup.ts b/tests/installation/globalSetup.tsindex 9e295ee328..e65f99f96e 100644--- a/tests/installation/globalSetup.ts+++ b/tests/installation/globalSetup.ts@@ -55,8 +55,6 @@ async function globalSetup() {build('playwright-browser-chromium', '@playwright/browser-chromium'),build('playwright-browser-firefox', '@playwright/browser-firefox'),build('playwright-browser-webkit', '@playwright/browser-webkit'),- build('playwright-ct-react', '@playwright/experimental-ct-react'),- build('playwright-ct-core', '@playwright/experimental-ct-core'),]);const buildPlaywrightTestPlugin = async () => {diff --git a/tests/installation/playwright-component-testing.spec.ts b/tests/installation/playwright-component-testing.spec.tsdeleted file mode 100755index 74f674a415..0000000000--- a/tests/installation/playwright-component-testing.spec.ts+++ /dev/null@@ -1,75 +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 { test } from './npmTest';-import path from 'path';--test.slow();--test('pnpm: @playwright/experimental-ct-react should work', async ({ exec, tmpWorkspace, writeFiles }) => {- await exec('pnpm add @playwright/experimental-ct-react react react-dom');- await exec('pnpm exec playwright install');- await writeFiles({- 'playwright.config.ts': `- import { defineConfig } from '@playwright/experimental-ct-react';- export default defineConfig({});- `,- 'playwright/index.html': `<script type="module" src="./index.js"></script>`,- 'playwright/index.js': ``,- 'Button.tsx': `- export function Button({ onClick }) {- return <button onClick={onClick}>Submit</button>;- }- `,- 'example.spec.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './Button';-- test('sample test', async ({ page, mount }) => {- let clicked = false;- const component = await mount(- <Button title='Submit' onClick={() => { clicked = true }}></Button>- );- await expect(component).toContainText('Submit');- await component.click();- expect(clicked).toBeTruthy();- });- `,- });- await exec('pnpm exec playwright test -c . --browser=chromium --reporter=list,json example.spec.tsx', { env: { PLAYWRIGHT_JSON_OUTPUT_NAME: 'report.json' } });- await exec('node read-json-report.js', path.join(tmpWorkspace, 'report.json'), '--validate-chromium-project-only');-});--test('pnpm: JSX inside a @playwright/test should work', async ({ exec, tmpWorkspace, writeFiles }) => {- await exec('pnpm add @playwright/test');- await exec('pnpm exec playwright install');- await writeFiles({- 'Button.tsx': `- export function Button({ onClick }) {- return <button onClick={onClick}>Submit</button>;- }- `,- 'example.spec.ts': `- import { test, expect } from '@playwright/test';- import { Button } from './Button';-- test('sample test', async ({ page }) => {- expect(Button).toEqual(expect.any(Function));- });- `,- });- await exec(`node node_modules/@playwright/test/cli.js test --browser=chromium --reporter=list,json example.spec.ts`, { env: { PLAYWRIGHT_JSON_OUTPUT_NAME: 'report.json' } });- await exec('node read-json-report.js', path.join(tmpWorkspace, 'report.json'), '--validate-chromium-project-only');-});diff --git a/tests/installation/playwright-test-package-managers.spec.ts b/tests/installation/playwright-test-package-managers.spec.tsindex e3e50379f1..4c776bc327 100755--- a/tests/installation/playwright-test-package-managers.spec.ts+++ b/tests/installation/playwright-test-package-managers.spec.ts@@ -51,13 +51,6 @@ test('npm: @playwright/test should install playwright-core bin', async ({ exec,expect(result).toContain('Version 1.');});-test('npm: uninstalling ct removes playwright bin', async ({ exec, tmpWorkspace }) => {- await exec('npm i @playwright/test');- await exec('npm i @playwright/experimental-ct-react');- await exec('npm uninstall @playwright/experimental-ct-react');- await exec('npx playwright test', { expectToExitWithError: true, message: 'command not found' });-});-test('yarn: @playwright/test should work', async ({ exec, tmpWorkspace }) => {await exec('yarn add @playwright/test');await exec('yarn playwright install');diff --git a/tests/playwright-test/config.spec.ts b/tests/playwright-test/config.spec.tsindex 9c4acda6e4..58e69363e2 100644--- a/tests/playwright-test/config.spec.ts+++ b/tests/playwright-test/config.spec.ts@@ -740,44 +740,6 @@ test('should merge projects in the config', async ({ runInlineTest }) => {expect(result.exitCode).toBe(0);});-test('should merge ct configs', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': `- import { defineConfig, expect } from '@playwright/experimental-ct-react';- const baseConfig = defineConfig({- timeout: 10,- use: {- foo: 1,- },- });- const derivedConfig = defineConfig(baseConfig, {- grep: 'hi',- use: {- bar: 2,- },- });-- // Make sure ct-specific properties are preserved- // and config properties are merged.- expect(derivedConfig).toEqual(expect.objectContaining({- use: { foo: 1, bar: 2 },- grep: 'hi',- '@playwright/test': expect.objectContaining({- babelPlugins: [[expect.stringContaining('tsxTransform.js')]]- }),- '@playwright/experimental-ct-core': expect.objectContaining({- registerSourceFile: expect.stringContaining('registerSource'),- }),- }));- `,- 'a.test.ts': `- import { test } from '@playwright/experimental-ct-react';- test('pass', async ({}) => {});- `- });- expect(result.exitCode).toBe(0);-});-test('should throw on invalid config.tsconfig option', async ({ runInlineTest }) => {const result = await runInlineTest({'playwright.config.ts': `diff --git a/tests/playwright-test/esm.spec.ts b/tests/playwright-test/esm.spec.tsindex 0e1deb9585..5f4022b466 100644--- a/tests/playwright-test/esm.spec.ts+++ b/tests/playwright-test/esm.spec.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { test, expect, playwrightCtConfigText } from './playwright-test-fixtures';+import { test, expect } from './playwright-test-fixtures';test('should load nested as esm when package.json has type module', async ({ runInlineTest }) => {const result = await runInlineTest({@@ -542,29 +542,6 @@ test('should resolve no-extension import to .jsx file in ESM mode', async ({ runexpect(result.exitCode).toBe(0);});-test('should resolve .js import to .tsx file in ESM mode for components', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'package.json': `{ "type": "module" }`,- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,-- 'src/button.tsx': `- export const Button = () => <button>Button</button>;- `,-- 'src/test.spec.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button.js';- test('pass', async ({ mount }) => {- await mount(<Button></Button>);- });- `,- }, { workers: 1 });- expect(result.passed).toBe(1);- expect(result.exitCode).toBe(0);-});-test('should load cjs config and test in non-ESM mode', async ({ runInlineTest }) => {const result = await runInlineTest({'package.json': `{ "type": "module" }`,diff --git a/tests/playwright-test/loader.spec.ts b/tests/playwright-test/loader.spec.tsindex 75e7d85267..cca5bbf037 100644--- a/tests/playwright-test/loader.spec.ts+++ b/tests/playwright-test/loader.spec.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { test, expect, playwrightCtConfigText } from './playwright-test-fixtures';+import { test, expect } from './playwright-test-fixtures';import fs from 'fs';import path from 'path';import url from 'url';@@ -756,28 +756,6 @@ test('should resolve .js import to .tsx file in non-ESM mode', async ({ runInlinexpect(result.exitCode).toBe(0);});-test('should resolve .js import to .tsx file in non-ESM mode for components', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,-- 'src/button.tsx': `- export const Button = () => <button>Button</button>;- `,-- 'src/test.spec.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button.js';- test('pass', async ({ mount }) => {- await mount(<Button></Button>);- });- `,- }, { workers: 1 });- expect(result.passed).toBe(1);- expect(result.exitCode).toBe(0);-});-test('should import export assignment from ts', async ({ runInlineTest }) => {const result = await runInlineTest({'a.test.ts': `diff --git a/tests/playwright-test/only-changed.spec.ts b/tests/playwright-test/only-changed.spec.tsindex 13bb434670..7bc7fc645c 100644--- a/tests/playwright-test/only-changed.spec.ts+++ b/tests/playwright-test/only-changed.spec.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { test, expect, playwrightCtConfigText } from './playwright-test-fixtures';+import { test, expect } from './playwright-test-fixtures';test.slow();@@ -166,91 +166,6 @@ test('should throw nice error message if git doesnt work', async ({ runInlineTesexpect(result.output, 'contains git command output').toContain('unknown revision or path not in the working tree');});-test('should support component tests', async ({ runInlineTest, git, writeFiles }) => {- await writeFiles({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': `- `,- 'src/contents.ts': `- export const content = "Button";- `,- 'src/button.tsx': `- import {content} from './contents';- export const Button = () => <button>{content}</button>;- `,- 'src/helper.ts': `- export { Button } from "./button";- `,- 'src/button.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './helper';-- test('pass', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button', { timeout: 1000 });- });- `,- 'src/button2.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './helper';-- test('pass', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button', { timeout: 1000 });- });- `,- 'src/button3.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';-- test('pass', async ({ mount }) => {- const component = await mount(<p>Hello World</p>);- await expect(component).toHaveText('Hello World');- });- `,- });-- git(`add .`);- git(`commit -m "init"`);-- const result = await runInlineTest({}, { 'only-changed': true });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(0);- expect(result.failed).toBe(0);-- const result2 = await runInlineTest({- 'src/button2.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './helper';-- test('pass', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Different Button', { timeout: 1000 });- });- `- }, { 'only-changed': true });-- expect(result2.exitCode).toBe(1);- expect(result2.failed).toBe(1);- expect(result2.passed).toBe(0);- expect(result2.output).toContain('button2.test.tsx');- expect(result2.output).not.toContain('button.test.tsx');- expect(result2.output).not.toContain('button3.test.tsx');-- git(`commit -am "update button2 test"`);-- const result3 = await runInlineTest({- 'src/contents.ts': `- export const content = 'Changed Content';- `- }, { 'only-changed': true });-- expect(result3.exitCode).toBe(1);- expect(result3.failed).toBe(2);- expect(result3.passed).toBe(0);-});-test.describe('should work the same if being called in subdirectory', () => {test('tracked file', async ({ runInlineTest, git, writeFiles }) => {await writeFiles({diff --git a/tests/playwright-test/playwright-test-fixtures.ts b/tests/playwright-test/playwright-test-fixtures.tsindex 28ef919e29..93ab2ecd79 100644--- a/tests/playwright-test/playwright-test-fixtures.ts+++ b/tests/playwright-test/playwright-test-fixtures.ts@@ -464,16 +464,6 @@ export function parseTestRunnerOutput(output: string) {};}-export const playwrightCtConfigText = `-import { defineConfig } from '@playwright/experimental-ct-react';-export default defineConfig({- use: {- ctPort: ${3200 + (+process.env.TEST_PARALLEL_INDEX)}- },- projects: [{name: 'default'}],-});-`;-export async function removeFolders(dirs: string[]): Promise<Error[]> {return await Promise.all(dirs.map((dir: string) =>fs.promises.rm(dir, { recursive: true, force: true, maxRetries: 10 }).catch(e => e)diff --git a/tests/playwright-test/playwright.ct-build.spec.ts b/tests/playwright-test/playwright.ct-build.spec.tsdeleted file mode 100644index 0b2229b54f..0000000000--- a/tests/playwright-test/playwright.ct-build.spec.ts+++ /dev/null@@ -1,797 +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 fs from 'fs';-import path from 'path';-import { expect, playwrightCtConfigText, test } from './playwright-test-fixtures';--test.describe.configure({ mode: 'parallel' });--test('should work with the empty component list', async ({ runInlineTest }, testInfo) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.js"></script>`,- 'playwright/index.js': ``,-- 'a.test.ts': `- import { test, expect } from '@playwright/experimental-ct-react';- test('pass', async ({ mount }) => {});- `,- }, { workers: 1 });- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);- const output = result.output;- expect(output).toContain('transforming...');- expect(output.replace(/\\+/g, '/')).toContain('.cache/index.html');-- const metainfo = JSON.parse(fs.readFileSync(testInfo.outputPath('playwright/.cache/metainfo.json'), 'utf-8'));- expect(metainfo.version).toEqual(require('playwright-core/package.json').version);- expect(metainfo.viteVersion).toEqual(require('vite/package.json').version);- expect(Object.entries(metainfo.deps)).toHaveLength(0);- expect(Object.entries(metainfo.sources)).toHaveLength(14);-});--test('should extract component list', async ({ runInlineTest }, testInfo) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,-- 'src/button.tsx': `- export const Button = () => <button>Button</button>;- `,-- 'src/components.tsx': `- export const Component1 = () => <div>Component 1</div>;- export const Component2 = () => <div>Component 2</div>;- `,-- 'src/defaultExport.tsx': `- export default () => <div>Default export</div>;- `,-- 'src/clashingNames1.tsx': `- export const ClashingName = () => <div>Clashing name 1</div>;- `,-- 'src/clashingNames2.tsx': `- export const ClashingName = () => <div>Clashing name 2</div>;- `,-- 'src/one-import.spec.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button';- test('pass', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button');- });- `,-- 'src/named-imports.spec.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Component1, Component2 } from './components';-- test('pass 1', async ({ mount }) => {- const component = await mount(<Component1></Component1>);- await expect(component).toHaveText('Component 1');- });-- test('pass 2', async ({ mount }) => {- const component = await mount(<Component2></Component2>);- await expect(component).toHaveText('Component 2');- });- `,-- 'src/default-import.spec.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import DefaultComponent from './defaultExport';-- test('named', async ({ mount }) => {- const component = await mount(<DefaultComponent></DefaultComponent>);- await expect(component).toHaveText('Default export');- });- `,-- 'src/clashing-imports.spec.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';-- import DefaultComponent from './defaultExport.tsx';- import { ClashingName as CN1 } from './clashingNames1';- import { ClashingName as CN2 } from './clashingNames2';-- test('named', async ({ mount }) => {- const component = await mount(<CN1></CN1>);- await expect(component).toHaveText('Clashing name 1');- });-- test('pass 2', async ({ mount }) => {- const component = await mount(<CN2></CN2>);- await expect(component).toHaveText('Clashing name 2');- });- `,- 'src/relative-import-different-folders/one/index.tsx': `- export default () => <button>Button</button>;- `,- 'src/relative-import-different-folders/one/one.spec.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import Button from '.';- test('pass', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button');- });- `,- 'src/relative-import-different-folders/two/index.tsx': `- export default () => <button>Button</button>;- `,- 'src/relative-import-different-folders/two/two.spec.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import Button from '.';- test('pass', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button');- });- `,- }, { workers: 1 });- expect(result.exitCode).toBe(0);-- const metainfo = JSON.parse(fs.readFileSync(testInfo.outputPath('playwright/.cache/metainfo.json'), 'utf-8'));- metainfo.components.sort((a, b) => {- return (a.importSource + '/' + a.importedName).localeCompare(b.importSource + '/' + b.importedName);- });-- expect(metainfo.components).toEqual([{- id: expect.stringContaining('button_Button'),- remoteName: 'Button',- importSource: expect.stringContaining('./button'),- filename: expect.stringContaining('one-import.spec.tsx'),- }, {- id: expect.stringContaining('clashingNames1_ClashingName'),- remoteName: 'ClashingName',- importSource: expect.stringContaining('./clashingNames1'),- filename: expect.stringContaining('clashing-imports.spec.tsx'),- }, {- id: expect.stringContaining('clashingNames2_ClashingName'),- remoteName: 'ClashingName',- importSource: expect.stringContaining('./clashingNames2'),- filename: expect.stringContaining('clashing-imports.spec.tsx'),- }, {- id: expect.stringContaining('components_Component1'),- remoteName: 'Component1',- importSource: expect.stringContaining('./components'),- filename: expect.stringContaining('named-imports.spec.tsx'),- }, {- id: expect.stringContaining('components_Component2'),- remoteName: 'Component2',- importSource: expect.stringContaining('./components'),- filename: expect.stringContaining('named-imports.spec.tsx'),- }, {- id: expect.stringContaining('defaultExport'),- importSource: expect.stringContaining('./defaultExport'),- filename: expect.stringContaining('default-import.spec.tsx'),- }, {- id: expect.stringContaining('_one'),- importSource: expect.stringContaining('.'),- filename: expect.stringContaining(`one${path.sep}one.spec.tsx`),- }, {- id: expect.stringContaining('_two'),- importSource: expect.stringContaining('.'),- filename: expect.stringContaining(`two${path.sep}two.spec.tsx`),- }]);-- for (const [, value] of Object.entries(metainfo.deps))- (value as string[]).sort();-- expect(Object.entries(metainfo.deps)).toEqual([- [expect.stringContaining('clashingNames1.tsx'), [- expect.stringContaining('clashingNames1.tsx'),- ]],- [expect.stringContaining('clashingNames2.tsx'), [- expect.stringContaining('clashingNames2.tsx'),- ]],- [expect.stringContaining('defaultExport.tsx'), [- expect.stringContaining('defaultExport.tsx'),- ]],- [expect.stringContaining('components.tsx'), [- expect.stringContaining('components.tsx'),- ]],- [expect.stringContaining('button.tsx'), [- expect.stringContaining('button.tsx'),- ]],- [expect.stringContaining(`one${path.sep}index.tsx`), [- expect.stringContaining(`one${path.sep}index.tsx`),- ]],- [expect.stringContaining(`two${path.sep}index.tsx`), [- expect.stringContaining(`two${path.sep}index.tsx`),- ]],- ]);-});--test('should cache build', async ({ runInlineTest }, testInfo) => {- test.slow();-- await test.step('original test', async () => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,-- 'src/button.tsx': `- export const Button = () => <button>Button</button>;- `,-- 'src/button.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button.tsx';-- test('pass', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);- const output = result.output;- expect(output, 'should rebuild bundle').toContain('modules transformed');- });-- await test.step('re-run same test', async () => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- }, { workers: 1 });- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);- const output = result.output;- expect(output, 'should not rebuild bundle').not.toContain('modules transformed');- });-- await test.step('modify test', async () => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'src/button.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button.tsx';-- test('pass updated', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button 2', { timeout: 200 });- });- `,- }, { workers: 1 });- expect(result.exitCode).toBe(1);- expect(result.passed).toBe(0);- const output = result.output;- expect(output, 'should not rebuild bundle').not.toContain('modules transformed');- });-- await test.step('modify source', async () => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'src/button.tsx': `- export const Button = () => <button>Button 2</button>;- `,- }, { workers: 1 });- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);- const output = result.output;- expect(output, 'should rebuild bundle').toContain('modules transformed');- });-});--test('should grow cache', async ({ runInlineTest }, testInfo) => {- test.slow();-- await test.step('original test', async () => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,- 'src/button1.tsx': `- export const Button1 = () => <button>Button 1</button>;- `,- 'src/button2.tsx': `- export const Button2 = () => <button>Button 2</button>;- `,- 'src/button1.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button1 } from './button1.tsx';- test('pass', async ({ mount }) => {- const component = await mount(<Button1></Button1>);- await expect(component).toHaveText('Button 1');- });- `,- 'src/button2.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button2 } from './button2.tsx';- test('pass', async ({ mount }) => {- const component = await mount(<Button2></Button2>);- await expect(component).toHaveText('Button 2');- });- `,- }, { workers: 1 }, undefined, { additionalArgs: ['button1'] });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);- const output = result.output;- expect(output).toContain('modules transformed');- });-- await test.step('run second test', async () => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- }, { workers: 1 }, undefined, { additionalArgs: ['button2'] });- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);- const output = result.output;- expect(output).toContain('modules transformed');- });-- await test.step('run first test again', async () => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- }, { workers: 1 }, undefined, { additionalArgs: ['button2'] });- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);- const output = result.output;- expect(output).not.toContain('modules transformed');- });-});--test('should not crash when cached component test file is deleted', async ({ runInlineTest }, testInfo) => {-- await test.step('run first test to build the cache', async () => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,- 'src/button.tsx': `- export const Button = () => <button>Button</button>;- `,- 'src/button.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button.tsx';- test('pass', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button');- });- `,- 'src/button2.tsx': `- export const Button2 = () => <button>Button 2</button>;- `,- 'src/button2.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button2 } from './button2.tsx';- test('pass', async ({ mount }) => {- const component = await mount(<Button2></Button2>);- await expect(component).toHaveText('Button 2');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(2);-- });-- await test.step('remove the second test and component and run the tests again', async () => {-- fs.unlinkSync(testInfo.outputPath('src/button2.tsx'));- fs.unlinkSync(testInfo.outputPath('src/button2.test.tsx'));-- const result2 = await runInlineTest({}, { workers: 1 });-- expect(result2.exitCode).toBe(0);- expect(result2.passed).toBe(1);- });--});--test('should not use global config for preview', async ({ runInlineTest }) => {- const result1 = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.js"></script>`,- 'playwright/index.js': ``,- 'vite.config.js': `- export default {- plugins: [{- configurePreviewServer: () => {- throw new Error('Original preview throws');- }- }]- };- `,- 'a.test.ts': `- import { test, expect } from '@playwright/experimental-ct-react';- test('pass', async ({ mount }) => {});- `,- }, { workers: 1 });- expect(result1.exitCode).toBe(0);- expect(result1.passed).toBe(1);-- const result2 = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- }, { workers: 1 });- expect(result2.exitCode).toBe(0);- expect(result2.passed).toBe(1);-});--test('should work with https enabled', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright/index.html': `<script type="module" src="./index.js"></script>`,- 'playwright/index.js': ``,- 'playwright.config.js': `- import { defineConfig } from '@playwright/experimental-ct-react';- import basicSsl from '@vitejs/plugin-basic-ssl';- export default defineConfig({- use: {- ignoreHTTPSErrors: true,- ctViteConfig: {- plugins: [basicSsl()],- preview: {- https: true- }- }- },- });- `,- 'http.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';-- test('pass', async ({ page }) => {- await expect(page).toHaveURL(/https:.*/);- });- `,- }, { workers: 1 });- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('list compilation cache should not clash with the run one', async ({ runInlineTest }) => {- const listResult = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,- 'src/button.tsx': `- export const Button = () => <button>Button</button>;- `,- 'src/button.spec.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button';- test('pass', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button');- });- `,- }, { workers: 1 }, {}, { additionalArgs: ['--list'] });- expect(listResult.exitCode).toBe(0);- expect(listResult.passed).toBe(0);-- const runResult = await runInlineTest({}, { workers: 1 });- expect(runResult.exitCode).toBe(0);- expect(runResult.passed).toBe(1);-});--test('should retain deps when test changes', async ({ runInlineTest }, testInfo) => {- test.slow();-- await test.step('original test', async () => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,- 'src/button.tsx': `- export const Button = () => <button>Button</button>;- `,- 'src/button.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button.tsx';- test('pass', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);- const output = result.output;- expect(output).toContain('modules transformed');- });-- await test.step('modify test and run it again', async () => {- const result = await runInlineTest({- 'src/button.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button.tsx';- test('pass', async ({ mount }) => {- const component1 = await mount(<Button></Button>);- await expect(component1).toHaveText('Button');- });- `,- }, { workers: 1 });- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);- const output = result.output;- expect(output).not.toContain('modules transformed');- });-- const metainfo = JSON.parse(fs.readFileSync(testInfo.outputPath('playwright/.cache/metainfo.json'), 'utf-8'));-- expect(metainfo.components).toEqual([{- id: expect.stringContaining('button_tsx_Button'),- remoteName: 'Button',- importSource: expect.stringContaining('button.tsx'),- filename: expect.stringContaining('button.test.tsx'),- }]);-- for (const [, value] of Object.entries(metainfo.deps))- (value as string[]).sort();-- expect(Object.entries(metainfo.deps)).toEqual([- [- expect.stringContaining('button.tsx'),- [- expect.stringContaining('button.tsx'),- ],- ]- ]);-});--test('should render component via re-export', async ({ runInlineTest }, testInfo) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,- 'src/button.tsx': `- export const Button = () => <button>Button</button>;- `,- 'src/buttonHelper.ts': `- import { Button } from './button.tsx';- export { Button };- `,- 'src/button.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './buttonHelper';- test('pass', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should import json', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,- 'src/some.json': `{ "some": "value" }`,- 'src/button.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import json from './some.json';- test('pass', async ({}) => {- expect(json.some).toBe('value');- });- `,- }, { workers: 1 });- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should render component exported via fixture', async ({ runInlineTest }, testInfo) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,- 'src/button.tsx': `- export const Button = () => <button>Button</button>;- `,- 'src/buttonFixture.tsx': `- import { Button } from './button';- import { test as baseTest } from '@playwright/experimental-ct-react';- export { expect } from '@playwright/experimental-ct-react';- export const test = baseTest.extend({- button: async ({ mount }, use) => {- await use(await mount(<Button></Button>));- }- });- `,- 'src/button.test.tsx': `- import { test, expect } from './buttonFixture';- test('pass', async ({ button }) => {- await expect(button).toHaveText('Button');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should pass imported images from test to component', async ({ runInlineTest }, testInfo) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,- 'src/image.png': Buffer.from('iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAQAAAD9CzEMAAACMElEQVRYw+1XT0tCQRD/9Qci0Cw7mp1C6BMYnt5niMhPEEFCh07evNk54XnuGkhFehA/QxHkqYMEFWXpscMTipri7fqeu+vbfY+EoBkQ3Zn5zTo7MzsL/NNfoClkUUQNN3jCJ/ETfavRSpYkkSmFQzz8wMr4gaSp8OBJ2HCU4Iwd0kqGgd9GPxCccZ+0jWgWVW1wxlWy0qR51I3hv7lOllq7b4SC/+aGzr+QBadjEKgAykvzJGXwr/Lj4JfRk5hUSLKIa00HPUJRki0xeMWSWxVXmi5sddXKymqTyxdwquXAUVV3WREeLx3gTcNFWQY/jXtB8QIzgt4qTvAR4OCe0ATKCmrnmFMEM0Pp2BvrIisaFUdUjgKKZgYWSjjDLR5J+x13lATHuHSti6JBzQP+gq2QHXjfRaiJojbPgYqbmGFow0VpiyIW0/VIF9QKLzeBWA2MHmwCu8QJQV++Ps/joHQQH4HpuO0uobUeVztgIcr4Vnf4we9orWfUIWKHbEVyYKkPmaVpIVKICuo0ZYXWjHTITXWhsVYxkIDpUoKsla1i2Oz2QjvYG9fshu36GbFQ8DGyHNOuvRdOKZSDUtCFM7wyHeSM4XN8e7bOpd9F2gg+TRYal753bGkbuEjzMg0YW/yDV1czUDm+e43Byz86OnRwsYDMKXlmkYbeAOwffrtU/nGpXpwkXfPhVza+D9AiMAtrtOMYfVr0q8Wr1nh8n8ADZCJPqAk8AifyjP2n36cvkA6/Wln9MokAAAAASUVORK5CYII=', 'base64'),- 'src/image.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import imageSrc from './image.png';- test('pass', async ({ mount }) => {- const component = await mount(<img src={imageSrc}></img>);- await expect(component).toHaveJSProperty('naturalWidth', 48);- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should pass dates, regex, urls and bigints', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,- 'src/button.tsx': `- export const Button = ({ props }: any) => {- const { date, url, bigint, regex } = props;- const types = [- date instanceof Date,- url instanceof URL,- typeof bigint === 'bigint',- regex instanceof RegExp,- ];- return <div>{types.join(' ')}</div>;- };- `,- 'src/component.spec.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button';-- test('renders props with builtin types', async ({ mount, page }) => {- const component = await mount(<Button props={{- date: new Date(),- url: new URL('https://example.com'),- bigint: BigInt(42),- regex: /foo/,- }} />);- await expect(component).toHaveText('true true true true');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should pass undefined value as param', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,- 'src/component.tsx': `- export const Component = ({ value }: { value?: number }) => {- return <div>{typeof value}</div>;- };- `,- 'src/component.spec.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Component } from './component';-- test('renders props with undefined type', async ({ mount, page }) => {- const component = await mount(<Component value={undefined} />);- await expect(component).toHaveText('undefined');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should resolve components imported from node_modules', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'package.json': `{ "name": "test-project" }`,- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.js"></script>`,- 'playwright/index.js': ``,-- 'node_modules/@mui/material/index.js': `- const TextField = () => 'input';- module.exports = { TextField };- `,- 'node_modules/@mui/material/package.json': JSON.stringify({- name: '@mui/material',- main: './index.js',- }),-- 'src/component.spec.tsx': `- import { test } from '@playwright/experimental-ct-react';- import { TextField } from '@mui/material';-- test("passes", async ({ mount }) => {- await mount(<TextField />);- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should remove ? or # from deps in metainfo.json', async ({ runInlineTest }, testInfo) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.js"></script>`,- 'playwright/index.js': ``,- 'button.tsx': `- export const Button = () => <button>Button</button>;- `,- 'button2.tsx': `- export const Button2 = () => <button>Button2</button>;- `,- 'button3.tsx': `- export const Button3 = () => <button>Button3</button>;- `,- 'button.story.tsx': `- import { Button as Button1 } from './button';- import { Button } from './button';- import { Button as ButtonA } from './button?a';- import { Button as ButtonB } from './button#b';- import { Button2 } from './button2?c';- import { Button3 } from './button3#d';-- export const ButtonStory = () => (- <div>- <Button />- <Button2 />- <ButtonA />- <Button3 />- <ButtonB />- </div>- )- `,- 'a.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { ButtonStory } from './button.story.tsx';-- test('Button', async ({ mount }) => {- const component = await mount(<ButtonStory />);- await expect(component).toHaveText('ButtonButton2ButtonButton3Button');- });- `,- }, { workers: 1 });- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);- const metainfo = JSON.parse(fs.readFileSync(testInfo.outputPath('playwright/.cache/metainfo.json'), 'utf-8'));-- for (const [, value] of Object.entries(metainfo.deps))- (value as string[]).sort();-- expect(Object.entries(metainfo.deps)).toEqual([- [expect.stringContaining('button.story.tsx'), [- expect.stringContaining('button.story.tsx'),- expect.stringContaining('button.tsx'),- expect.stringContaining('button2.tsx'),- expect.stringContaining('button3.tsx'),- ]],- ]);-});diff --git a/tests/playwright-test/playwright.ct-react.spec.ts b/tests/playwright-test/playwright.ct-react.spec.tsdeleted file mode 100644index dec391284b..0000000000--- a/tests/playwright-test/playwright.ct-react.spec.ts+++ /dev/null@@ -1,655 +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 { test, expect, playwrightCtConfigText } from './playwright-test-fixtures';--test('should work with TSX', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': `- `,- 'src/button.tsx': `- export const Button = () => <button>Button</button>;- `,- 'src/button.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button';-- test('pass', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should work with JSX', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.js"></script>`,- 'playwright/index.js': `- `,-- 'src/button.jsx': `- export const Button = () => <button>Button</button>;- `,-- 'src/button.test.jsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button';-- test('pass', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should work with JSX in JS', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.js"></script>`,- 'playwright/index.js': `- `,-- 'src/button.js': `- export const Button = () => <button>Button</button>;- `,-- 'src/button.test.jsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button';-- test('pass', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should work with JSX in JS and in JSX', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.js"></script>`,- 'playwright/index.js': `- `,-- 'src/button.js': `- export const Button = () => <button>Button</button>;- `,-- 'src/list.jsx': `- export const List = () => <ul><li>List</li></ul>;- `,-- 'src/button.test.jsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button';- import { List } from './list';-- test('pass button', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button');- });-- test('pass list', async ({ mount }) => {- const component = await mount(<List></List>);- await expect(component).toHaveText('List');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(2);-});---test('should work with stray TSX import', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': `- `,-- 'src/button.tsx': `- export const Button = () => <button>Button</button>;- `,-- 'src/list.tsx': `- export const List = () => <ul><li>List</li></ul>;- `,-- 'src/button.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button';- import { List } from './list';-- test('pass button', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should work with stray JSX import', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.js"></script>`,- 'playwright/index.js': `- `,-- 'src/button.jsx': `- export const Button = () => <button>Button</button>;- `,-- 'src/list.jsx': `- export const List = () => <ul><li>List</li></ul>;- `,-- 'src/button.test.jsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button';- import { List } from './list';-- test('pass button', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should work with stray JS import', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.js"></script>`,- 'playwright/index.js': `- `,-- 'src/button.js': `- export const Button = () => <button>Button</button>;- `,-- 'src/list.js': `- export const List = () => <ul><li>List</li></ul>;- `,-- 'src/button.test.jsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button';- import { List } from './list';-- test('pass button', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should work with JSX in variable', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.js"></script>`,- 'playwright/index.js': `- `,-- 'src/button.jsx': `- export const Button = () => <button>Button</button>;- `,-- 'src/button.test.jsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button';-- const button = <Button></Button>;-- test('pass button', async ({ mount }) => {- const component = await mount(button);- await expect(component).toHaveText('Button');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should pass "key" attribute from JSX in variable', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.js"></script>`,- 'playwright/index.js': `- `,-- 'src/container.jsx': `- import { useState } from 'react';- export function Container({ children }) {- const [index, setIndex] = useState(0);- return (- <div onClick={() => setIndex((index + 1) % children.length)}>- {children[index]}- </div>- );- }- `,-- 'src/button.jsx': `- import { useState } from 'react';- export function Button({ value }) {- const [state, setState] = useState(value);- return <button onClick={() => setState(state + 1)}>{state}</button>;- }- `,-- 'src/index.test.jsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button';- import { Container } from './container';-- test('key should tear down and recreate component', async ({ mount }) => {- const component = await mount(- <Container>- <Button key='a' value={1} />- <Button key='b' value={10} />- </Container>- );- const button = component.getByRole('button');- await expect(button).toHaveText("1");- await button.click();- await expect(button).toHaveText("10");- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should return root locator for fragments', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.js"></script>`,- 'playwright/index.js': ``,-- 'src/button.jsx': `- export const Button = () => <><h1>Header</h1><button>Button</button></>;- `,-- 'src/button.test.jsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button';-- test('pass button', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toContainText('Header');- await expect(component).toContainText('Button');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should respect default property values', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,- 'src/label.tsx': `- export const Label = ({ checked }) => <div>type:{typeof checked} value:{String(checked)}</div>;- `,-- 'src/label.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Label } from './label';-- test('boolean shorthand', async ({ mount }) => {- const component = await mount(<Label checked></Label>);- await expect(component).toHaveText('type:boolean value:true');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should bundle public folder', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': `- `,- 'public/logo.svg': `- <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">- <circle cx="50" cy="50" r="50"/>- </svg>`,- 'src/image.tsx': `- export const Image = () => <img src='/logo.svg' className="App-logo" alt="logo" />;- `,- 'src/image.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Image } from './image';-- test('pass', async ({ mount, page }) => {- const urls = [];- const [response] = await Promise.all([- page.waitForResponse('**/*.svg'),- mount(<Image></Image>)- ]);- const data = await response.body();- await expect(data.toString()).toContain('</svg>');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should work with property expressions in JSX', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': `- `,- 'src/button1.tsx': `- const Button = () => <button>Button 1</button>;- export const components1 = { Button };- `,- 'src/button2.tsx': `- const Button = () => <button>Button 2</button>;- export default { Button };- `,- 'src/button.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { components1 } from './button1';- import components2 from './button2';-- test('pass 1', async ({ mount }) => {- const component = await mount(<components1.Button />);- await expect(component).toHaveText('Button 1');- });-- test('pass 2', async ({ mount }) => {- const component = await mount(<components2.Button />);- await expect(component).toHaveText('Button 2');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(2);-});--test('should handle the baseUrl config', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': `- import { defineConfig } from '@playwright/experimental-ct-react';- export default defineConfig({ use: { baseURL: 'http://127.0.0.1:8080' } });- `,- 'playwright/index.html': `<script type="module" src="./index.js"></script>`,- 'playwright/index.js': ``,-- 'src/component.jsx': `- export const Component = () => <></>;- `,-- 'src/component.test.jsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Component } from './component';-- test('pass component', async ({ page, mount }) => {- const component = await mount(<Component />);- await expect(page).toHaveURL('http://127.0.0.1:8080/');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should handle the vite host config', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': `- import { defineConfig } from '@playwright/experimental-ct-react';- export default defineConfig({ use: { ctViteConfig: { preview: { host: '127.0.0.1' } } } });- `,- 'playwright/index.html': `<script type="module" src="./index.js"></script>`,- 'playwright/index.js': ``,-- 'src/component.jsx': `- export const Component = () => <></>;- `,-- 'src/component.test.jsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Component } from './component';-- test('pass component', async ({ page, mount }) => {- const component = await mount(<Component />);- const host = await page.evaluate(() => window.location.hostname);- await expect(host).toBe('127.0.0.1');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should prioritize the vite host config over the baseUrl config', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': `- import { defineConfig } from '@playwright/experimental-ct-react';- export default defineConfig({- use: {- baseURL: 'http://localhost:8080',- ctViteConfig: { preview: { host: '127.0.0.1' } }- },- });- `,- 'playwright/index.html': `<script type="module" src="./index.js"></script>`,- 'playwright/index.js': ``,-- 'src/component.jsx': `- export const Component = () => <></>;- `,-- 'src/component.test.jsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Component } from './component';-- test('pass component', async ({ page, mount }) => {- const component = await mount(<Component />);- await expect(page).toHaveURL('http://127.0.0.1:8080/');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should normalize children', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,- 'src/component.tsx': `- import React from 'react';- export const OneChild: React.FC<React.PropsWithChildren<{}>> = ({ children }) => {- React.Children.only(children);- return <>{children}</>;- };- export const OtherComponent: React.FC = () => <p>othercomponent</p>;- `,-- 'src/component.spec.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { OneChild, OtherComponent } from './component';-- test("can pass an HTML element to OneChild", async ({ mount }) => {- const component = await mount(<OneChild><p>child</p></OneChild>);- await expect(component).toHaveText("child");- });-- test("can pass another component to OneChild", async ({ mount }) => {- const component = await mount(<OneChild><OtherComponent /></OneChild>);- await expect(component).toHaveText("othercomponent");- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(2);-});--test('should allow props children', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,- 'src/component.spec.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';-- test("renders children from props object", async ({ mount, page }) => {- const props = { children: 'test' };- await mount(<button {...props} />);- await expect(page.getByText('test')).toBeVisible();- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should allow import from shared file', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,- 'src/component.tsx': `- export const Component = (props: { content: string }) => {- return <div>{props.content}</div>- };- `,- 'src/component.shared.tsx': `- export const componentMock = { content: 'This is a content.' };- `,- 'src/component.render.tsx': `- import {Component} from './component';- import {componentMock} from './component.shared';- export const ComponentTest = () => {- return <Component content={componentMock.content} />;- };- `,- 'src/component.spec.tsx': `- import { expect, test } from '@playwright/experimental-ct-react';- import { ComponentTest } from './component.render';- import { componentMock } from './component.shared';- test('component renders', async ({ mount }) => {- const component = await mount(<ComponentTest />);- await expect(component).toContainText(componentMock.content)- })`- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should not add React import to minified .js file that already imports React after closing brace', {- annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/38906' }-}, async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.js"></script>`,- 'playwright/index.js': ``,-- 'src/minified-component.js': `function foo(){return 1}import React from 'react';export const MinifiedComponent = () => React.createElement('div', null, 'Minified');`,-- 'src/button.jsx': `- import { MinifiedComponent } from './minified-component';- export const Button = () => <MinifiedComponent />;- `,-- 'src/button.test.jsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button';-- test('pass', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Minified');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(0);- expect(result.passed).toBe(1);-});--test('should throw test error when template index.html is not provided', async ({ runInlineTest }) => {- const result = await runInlineTest({- 'playwright.config.ts': `- import { defineConfig } from '@playwright/experimental-ct-react';- export default defineConfig({});- `,- 'src/component.jsx': `- export const Component = () => <></>;- `,-- 'src/component.test.jsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Component } from './component';-- test('pass component', async ({ page, mount }) => {- const component = await mount(<Component />);- await expect(page).toHaveURL('http://127.0.0.1:8080/');- });- `,- }, { workers: 1 });-- expect(result.exitCode).toBe(1);- expect(result.passed).toBe(0);- expect(result.output).toContain('Component testing template file playwright/index.html is missing and there is no existing Vite server. Component tests will fail.');- expect(result.results[0].error.message).toBe('Error: Component testing could not determine the base URL of your component under test. Ensure you have supplied a template playwright/index.html or have set the PLAYWRIGHT_TEST_BASE_URL environment variable.');-});diff --git a/tests/playwright-test/test-server.spec.ts b/tests/playwright-test/test-server.spec.tsindex e5cc1c31b2..5cc9544da8 100644--- a/tests/playwright-test/test-server.spec.ts+++ b/tests/playwright-test/test-server.spec.ts@@ -18,7 +18,6 @@import { test as baseTest, expect } from './ui-mode-fixtures';import { TestServerConnection } from '../../packages/playwright/lib/isomorphic';-import { playwrightCtConfigText } from './playwright-test-fixtures';import ws from 'ws';import type { TestChildProcess } from '../config/commonFixtures';@@ -80,20 +79,16 @@ const test = baseTest.extend<{ startTestServer: (options?: { env?: NodeJS.Proces}});-const ctFiles = {- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,- 'src/button.tsx': `- export const Button = () => <button>Button</button>;+const filesWithDependency = {+ 'src/button.ts': `+ export const label = 'Button';`,- 'src/button.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button';+ 'src/button.test.ts': `+ import { test, expect } from '@playwright/test';+ import { label } from './button';- test('pass', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button', { timeout: 1 });+ test('pass', async () => {+ expect(label).toBe('Button');});`,};@@ -199,21 +194,21 @@ test('find related test files errors', async ({ startTestServer, writeFiles }) =});test('find related test files', async ({ startTestServer, writeFiles }) => {- await writeFiles(ctFiles);+ await writeFiles(filesWithDependency);const testServerConnection = await startTestServer();await testServerConnection.initialize({ interceptStdio: true });expect((await testServerConnection.runGlobalSetup({})).status).toBe('passed');- const buttonTsx = test.info().outputPath('src/button.tsx');- const buttonTestTsx = test.info().outputPath('src/button.test.tsx');- const result = await testServerConnection.findRelatedTestFiles({ files: [buttonTsx] });- expect(result).toEqual({ testFiles: [buttonTestTsx] });+ const buttonTs = test.info().outputPath('src/button.ts');+ const buttonTestTs = test.info().outputPath('src/button.test.ts');+ const result = await testServerConnection.findRelatedTestFiles({ files: [buttonTs] });+ expect(result).toEqual({ testFiles: [buttonTestTs] });expect((await testServerConnection.runGlobalTeardown({})).status).toBe('passed');});test('clear cache', async ({ startTestServer, writeFiles }) => {- await writeFiles(ctFiles);+ await writeFiles(filesWithDependency);const testServerConnection = await startTestServer();await testServerConnection.initialize({ interceptStdio: true });expect((await testServerConnection.runGlobalSetup({})).status).toBe('passed');diff --git a/tests/playwright-test/types.spec.ts b/tests/playwright-test/types.spec.tsindex e9fea813f0..aa62063f25 100644--- a/tests/playwright-test/types.spec.ts+++ b/tests/playwright-test/types.spec.ts@@ -357,16 +357,6 @@ test('should check types of fixtures', async ({ runTSC }) => {timeout: 2,});`,- 'playwright-define-merge-ct.config.ts': `- import { defineConfig } from '@playwright/experimental-ct-vue';- const config0 = defineConfig({- timeout: 1,- // @ts-expect-error- grep: 23,- }, {- timeout: 2,- });- `,});expect(result.exitCode).toBe(0);});diff --git a/tests/playwright-test/ui-mode-test-ct.spec.ts b/tests/playwright-test/ui-mode-test-ct.spec.tsdeleted file mode 100644index 48683580a7..0000000000--- a/tests/playwright-test/ui-mode-test-ct.spec.ts+++ /dev/null@@ -1,387 +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 { test, expect, retries, dumpTestTree } from './ui-mode-fixtures';--test.describe.configure({ mode: 'parallel', retries });--const basicTestTree = {- 'playwright.config.ts': `- import { defineConfig } from '@playwright/experimental-ct-react';- export default defineConfig({- use: {- ctPort: ${3200 + (+process.env.TEST_PARALLEL_INDEX)}- }- });- `,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,- 'src/button.tsx': `- export const Button = () => <button>Button</button>;- `,- 'src/button.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button';-- test('pass', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button', { timeout: 1 });- });- `,-};--test('should run component tests', async ({ runUITest }) => {- const { page } = await runUITest(basicTestTree);- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ◯ button.test.tsx- ◯ pass- `);- await page.getByTitle('Run all').click();- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ✅ button.test.tsx- ✅ pass- `);-});--test('should run component tests after editing test', async ({ runUITest, writeFiles }) => {- const { page } = await runUITest(basicTestTree);- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ◯ button.test.tsx- ◯ pass- `);- await page.getByTitle('Run all').click();- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ✅ button.test.tsx- ✅ pass- `);-- await writeFiles({- 'src/button.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button';-- test('fail', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button2', { timeout: 1 });- });- `- });- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ◯ button.test.tsx- ◯ fail- `);- await page.getByTitle('Run all').click();- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ❌ button.test.tsx- ❌ fail <=- `);-});--test('should run component tests after editing component', async ({ runUITest, writeFiles }) => {- const { page } = await runUITest(basicTestTree);- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ◯ button.test.tsx- ◯ pass- `);- await page.getByTitle('Run all').click();- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ✅ button.test.tsx- ✅ pass- `);-- await writeFiles({- 'src/button.tsx': `- export const Button = () => <button>Button2</button>;- `- });- await page.getByTitle('Run all').click();- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ❌ button.test.tsx- ❌ pass <=- `);-});--test('should run component tests after editing test and component', async ({ runUITest, writeFiles }) => {- const { page } = await runUITest(basicTestTree);- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ◯ button.test.tsx- ◯ pass- `);- await page.getByTitle('Run all').click();- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ✅ button.test.tsx- ✅ pass- `);-- await writeFiles({- 'src/button.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button';-- test('pass 2', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button2', { timeout: 1 });- });- `,- 'src/button.tsx': `- export const Button = () => <button>Button2</button>;- `- });- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ◯ button.test.tsx- ◯ pass 2- `);-- await page.getByTitle('Run all').click();- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ✅ button.test.tsx- ✅ pass 2- `);-});--test('should watch test', async ({ runUITest, writeFiles }) => {- const { page } = await runUITest(basicTestTree);- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ◯ button.test.tsx- ◯ pass- `);-- await page.getByTitle('Watch all').click();- await page.getByTitle('Run all').click();-- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ✅ button.test.tsx- ✅ pass- `);-- await writeFiles({- 'src/button.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button';-- test('pass', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button2', { timeout: 1 });- });- `- });-- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ❌ button.test.tsx- ❌ pass <=- `);-});--test('should watch component', async ({ runUITest, writeFiles }) => {- const { page } = await runUITest(basicTestTree);- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ◯ button.test.tsx- ◯ pass- `);-- await page.getByTitle('Watch all').click();- await page.getByTitle('Run all').click();-- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ✅ button.test.tsx- ✅ pass- `);-- await writeFiles({- 'src/button.tsx': `- export const Button = () => <button>Button2</button>;- `- });-- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ❌ button.test.tsx- ❌ pass <=- `);-});--test('should watch component via util', async ({ runUITest, writeFiles }) => {- const { page } = await runUITest({- ...basicTestTree,- 'src/button.tsx': undefined,- 'src/button.ts': `- import { Button } from './buttonComponent';- export { Button };- `,- 'src/buttonComponent.tsx': `- export const Button = () => <button>Button</button>;- `,- });- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ◯ button.test.tsx- ◯ pass- `);-- await page.getByTitle('Watch all').click();- await page.getByTitle('Run all').click();-- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ✅ button.test.tsx- ✅ pass- `);-- await writeFiles({- 'src/buttonComponent.tsx': `- export const Button = () => <button>Button2</button>;- `- });-- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ❌ button.test.tsx- ❌ pass <=- `);-});--test('should watch component when editing util', async ({ runUITest, writeFiles }) => {- const { page } = await runUITest({- ...basicTestTree,- 'src/button.tsx': undefined,- 'src/button.ts': `- import { Button } from './buttonComponent';- export { Button };- `,- 'src/buttonComponent.tsx': `- export const Button = () => <button>Button</button>;- `,- 'src/buttonComponent2.tsx': `- export const Button = () => <button>Button2</button>;- `,- });- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ◯ button.test.tsx- ◯ pass- `);-- await page.getByTitle('Watch all').click();- await page.getByTitle('Run all').click();-- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ✅ button.test.tsx- ✅ pass- `);-- await writeFiles({- 'src/button.ts': `- import { Button } from './buttonComponent2';- export { Button };- `,- });-- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ❌ button.test.tsx- ❌ pass <=- `);-});--test('should watch component when editing inline css', async ({ runUITest, writeFiles }) => {- const { page } = await runUITest({- ...basicTestTree,- 'src/button.tsx': undefined,- 'src/button.ts': `- import { Button } from './buttonComponent';- export { Button };- `,- 'src/buttonComponent.tsx': `- import cssText from './style.css?inline';- export const Button = () => <button>{cssText.trim()}</button>;- `,- 'src/style.css': `- .button{color:red}- `,- 'src/button.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button';-- test('pass', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('.button{color:red}', { timeout: 1 });- });- `,- });- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ◯ button.test.tsx- ◯ pass- `);-- await page.getByTitle('Watch all').click();- await page.getByTitle('Run all').click();-- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ✅ button.test.tsx- ✅ pass- `);-- await writeFiles({- 'src/style.css': `- .button{color:blue}- `,- });-- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ❌ button.test.tsx- ❌ pass <=- `);-});--test('should watch component when editing story import chain', async ({ runUITest, writeFiles }) => {- const { page } = await runUITest({- ...basicTestTree,- 'src/button.tsx': undefined,- 'src/button.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { StoryButton } from './button.story';-- test('pass', async ({ mount }) => {- const component = await mount(<StoryButton></StoryButton>);- await expect(component).toHaveText('Button', { timeout: 1 });- });- `,- 'src/button.story.tsx': `- import { Button } from './buttonComponent';- export const StoryButton = () => <Button></Button>;- `,- 'src/buttonComponent.tsx': `- export const Button = () => <button>Button</button>;- `,- });- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ◯ button.test.tsx- ◯ pass- `);-- await page.getByTitle('Watch all').click();- await page.getByTitle('Run all').click();-- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ✅ button.test.tsx- ✅ pass- `);-- await writeFiles({- 'src/buttonComponent.tsx': `- export const Button = () => <button>Button2</button>;- `,- });-- await expect.poll(dumpTestTree(page)).toBe(`- ▼ ❌ button.test.tsx- ❌ pass <=- `);-});diff --git a/tests/playwright-test/update-aria-snapshot.spec.ts b/tests/playwright-test/update-aria-snapshot.spec.tsindex ae11bfcaf3..bf9289a56d 100644--- a/tests/playwright-test/update-aria-snapshot.spec.ts+++ b/tests/playwright-test/update-aria-snapshot.spec.ts@@ -15,7 +15,7 @@*/import * as fs from 'fs';-import { test, expect, playwrightCtConfigText, stripAnsi } from './playwright-test-fixtures';+import { test, expect, stripAnsi } from './playwright-test-fixtures';import { execSync } from 'child_process';test.describe.configure({ mode: 'parallel' });@@ -299,21 +299,12 @@ test('should generate baseline with special characters', async ({ runInlineTesttest('should update missing snapshots in tsx', async ({ runInlineTest }, testInfo) => {const result = await runInlineTest({'.git/marker': '',- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,-- 'src/button.tsx': `- export const Button = () => <button>Button</button>;- `,-'src/button.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button.tsx';+ import { test, expect } from '@playwright/test';- test('pass', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toMatchAriaSnapshot(\`\`);+ test('pass', async ({ page }) => {+ await page.setContent(\`<button>Button</button>\`);+ await expect(page.locator('body')).toMatchAriaSnapshot(\`\`);});`,});@@ -324,12 +315,12 @@ test('should update missing snapshots in tsx', async ({ runInlineTest }, testInfexpect(trimPatch(data)).toBe(`diff --git a/src/button.test.tsx b/src/button.test.tsx--- a/src/button.test.tsx+++ b/src/button.test.tsx-@@ -4,6 +4,8 @@+@@ -3,6 +3,8 @@- test('pass', async ({ mount }) => {- const component = await mount(<Button></Button>);-- await expect(component).toMatchAriaSnapshot(\`\`);-+ await expect(component).toMatchAriaSnapshot(\`+ test('pass', async ({ page }) => {+ await page.setContent(\`<button>Button</button>\`);+- await expect(page.locator('body')).toMatchAriaSnapshot(\`\`);++ await expect(page.locator('body')).toMatchAriaSnapshot(\`+ - button \"Button\"+ \`);});@@ -345,31 +336,21 @@ test('should update missing snapshots in tsx', async ({ runInlineTest }, testInftest('should update multiple files', async ({ runInlineTest }, testInfo) => {const result = await runInlineTest({'.git/marker': '',- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,-- 'src/button.tsx': `- export const Button = () => <button>Button</button>;- `,-- 'src/button-1.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button.tsx';+ 'src/button-1.test.ts': `+ import { test, expect } from '@playwright/test';- test('pass 1', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toMatchAriaSnapshot(\`\`);+ test('pass 1', async ({ page }) => {+ await page.setContent(\`<button>Button</button>\`);+ await expect(page.locator('body')).toMatchAriaSnapshot(\`\`);});`,- 'src/button-2.test.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button.tsx';+ 'src/button-2.test.ts': `+ import { test, expect } from '@playwright/test';- test('pass 2', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toMatchAriaSnapshot(\`\`);+ test('pass 2', async ({ page }) => {+ await page.setContent(\`<button>Button</button>\`);+ await expect(page.locator('body')).toMatchAriaSnapshot(\`\`);});`,});@@ -378,38 +359,38 @@ test('should update multiple files', async ({ runInlineTest }, testInfo) => {expect(stripAnsi(result.output).replace(/\\/g, '/')).toContain(`New baselines created for:- src/button-1.test.tsx- src/button-2.test.tsx+ src/button-1.test.ts+ src/button-2.test.tsgit apply test-results/rebaselines.patch`);const patchPath = testInfo.outputPath('test-results/rebaselines.patch');const data = fs.readFileSync(patchPath, 'utf-8');- expect(trimPatch(data)).toBe(`diff --git a/src/button-1.test.tsx b/src/button-1.test.tsx---- a/src/button-1.test.tsx-+++ b/src/button-1.test.tsx-@@ -4,6 +4,8 @@-- test('pass 1', async ({ mount }) => {- const component = await mount(<Button></Button>);-- await expect(component).toMatchAriaSnapshot(\`\`);-+ await expect(component).toMatchAriaSnapshot(\`+ expect(trimPatch(data)).toBe(`diff --git a/src/button-1.test.ts b/src/button-1.test.ts+--- a/src/button-1.test.ts++++ b/src/button-1.test.ts+@@ -3,6 +3,8 @@++ test('pass 1', async ({ page }) => {+ await page.setContent(\`<button>Button</button>\`);+- await expect(page.locator('body')).toMatchAriaSnapshot(\`\`);++ await expect(page.locator('body')).toMatchAriaSnapshot(\`+ - button \"Button\"+ \`);});\\ No newline at end of file-diff --git a/src/button-2.test.tsx b/src/button-2.test.tsx---- a/src/button-2.test.tsx-+++ b/src/button-2.test.tsx-@@ -4,6 +4,8 @@+diff --git a/src/button-2.test.ts b/src/button-2.test.ts+--- a/src/button-2.test.ts++++ b/src/button-2.test.ts+@@ -3,6 +3,8 @@- test('pass 2', async ({ mount }) => {- const component = await mount(<Button></Button>);-- await expect(component).toMatchAriaSnapshot(\`\`);-+ await expect(component).toMatchAriaSnapshot(\`+ test('pass 2', async ({ page }) => {+ await page.setContent(\`<button>Button</button>\`);+- await expect(page.locator('body')).toMatchAriaSnapshot(\`\`);++ await expect(page.locator('body')).toMatchAriaSnapshot(\`+ - button \"Button\"+ \`);});diff --git a/tests/playwright-test/watch.spec.ts b/tests/playwright-test/watch.spec.tsindex e32239534b..02c6e0bbb9 100644--- a/tests/playwright-test/watch.spec.ts+++ b/tests/playwright-test/watch.spec.ts@@ -14,9 +14,8 @@* limitations under the License.*/-import path from 'path';import timers from 'timers/promises';-import { test, expect, playwrightCtConfigText } from './playwright-test-fixtures';+import { test, expect } from './playwright-test-fixtures';test.describe.configure({ mode: 'parallel' });@@ -687,129 +686,6 @@ test('should not watch unfiltered files', async ({ runWatchTest, writeFiles }) =await testProcess.waitForOutput('Waiting for file changes.');});-test('should run CT on changed deps', async ({ runWatchTest, writeFiles }) => {- const testProcess = await runWatchTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,- 'src/button.tsx': `- export const Button = () => <button>Button</button>;- `,- 'src/button.spec.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button';- test('pass', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button', { timeout: 1000 });- });- `,- 'src/link.spec.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- test('pass', async ({ mount }) => {- const component = await mount(<a>hello</a>);- await expect(component).toHaveText('hello');- });- `,- }, undefined, { PWTEST_RECOVERY_DISABLED: '1' });- await testProcess.waitForOutput('Waiting for file changes.');- await writeFiles({- 'src/button.tsx': `- export const Button = () => <button>Button 2</button>;- `,- });-- await testProcess.waitForOutput(`src${path.sep}button.spec.tsx:4:11 › pass`);- expect(testProcess.output).not.toContain(`src${path.sep}link.spec.tsx`);- await testProcess.waitForOutput(`Error: expect(locator).toHaveText(expected) failed`);- await testProcess.waitForOutput('Timeout: 1000ms');- await testProcess.waitForOutput('Waiting for file changes.');-});--test('should run CT on indirect deps change', async ({ runWatchTest, writeFiles }) => {- const testProcess = await runWatchTest({- 'playwright.config.ts': playwrightCtConfigText,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,- 'src/button.css': `- button { color: red; }- `,- 'src/button.tsx': `- import './button.css';- export const Button = () => <button>Button</button>;- `,- 'src/helper.tsx': `- import { Button } from "./button";- export const buttonInstance = <Button></Button>- `,- 'src/button.spec.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { buttonInstance } from './helper';- test('pass', async ({ mount }) => {- const component = await mount(buttonInstance);- await expect(component).toHaveText('Button', { timeout: 1000 });- });- `,- 'src/link.spec.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- test('pass', async ({ mount }) => {- const component = await mount(<a>hello</a>);- await expect(component).toHaveText('hello');- });- `,- });- await testProcess.waitForOutput('Waiting for file changes.');- await writeFiles({- 'src/button.css': `- button { color: blue; }- `,- });-- await testProcess.waitForOutput(`src${path.sep}button.spec.tsx:4:11 › pass`);- expect(testProcess.output).not.toContain(`src${path.sep}link.spec.tsx`);- await testProcess.waitForOutput('Waiting for file changes.');-});--test('should run CT on indirect deps change ESM mode', async ({ runWatchTest, writeFiles }) => {- const testProcess = await runWatchTest({- 'playwright.config.ts': playwrightCtConfigText,- 'package.json': `{ "type": "module" }`,- 'playwright/index.html': `<script type="module" src="./index.ts"></script>`,- 'playwright/index.ts': ``,- 'src/button.css': `- button { color: red; }- `,- 'src/button.tsx': `- import './button.css';- export const Button = () => <button>Button</button>;- `,- 'src/button.spec.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- import { Button } from './button.jsx';- test('pass', async ({ mount }) => {- const component = await mount(<Button></Button>);- await expect(component).toHaveText('Button', { timeout: 1000 });- });- `,- 'src/link.spec.tsx': `- import { test, expect } from '@playwright/experimental-ct-react';- test('pass', async ({ mount }) => {- const component = await mount(<a>hello</a>);- await expect(component).toHaveText('hello');- });- `,- });- await testProcess.waitForOutput('Waiting for file changes.');- await writeFiles({- 'src/button.css': `- button { color: blue; }- `,- });-- await testProcess.waitForOutput(`src${path.sep}button.spec.tsx:4:7 › pass`);- expect(testProcess.output).not.toContain(`src${path.sep}link.spec.tsx`);- await testProcess.waitForOutput('Waiting for file changes.');-});-test('should run global teardown before exiting', async ({ runWatchTest }) => {const testProcess = await runWatchTest({'playwright.config.ts': `diff --git a/utils/build/build.js b/utils/build/build.jsindex 4669883234..9a68a7725f 100644--- a/utils/build/build.js+++ b/utils/build/build.js@@ -959,7 +959,6 @@ onChanges.push({inputs: ['packages/injected/src/**','packages/playwright-core/src/third_party/**',- 'packages/playwright-ct-core/src/injected/**','packages/isomorphic/**','utils/generate_injected_builtins.js','utils/generate_injected.js',diff --git a/utils/check_deps.js b/utils/check_deps.jsindex f6dbf96c12..aeac9fe6ac 100644--- a/utils/check_deps.js+++ b/utils/check_deps.js@@ -39,7 +39,6 @@ const depsCache = {};async function checkDeps() {await innerCheckDeps(path.join(packagesDir, 'html-reporter'));- await innerCheckDeps(path.join(packagesDir, 'playwright-ct-core'));await innerCheckDeps(path.join(packagesDir, 'protocol'));await innerCheckDeps(path.join(packagesDir, 'recorder'));await innerCheckDeps(path.join(packagesDir, 'trace-viewer'));diff --git a/utils/doclint/linting-code-snippets/cli.js b/utils/doclint/linting-code-snippets/cli.jsindex 884ef61a0f..38b11fa761 100644--- a/utils/doclint/linting-code-snippets/cli.js+++ b/utils/doclint/linting-code-snippets/cli.js@@ -134,8 +134,6 @@ class JSLintingService extends LintingService {_knownBadSnippets = ['mount(','render(',- 'vue-router',- 'experimental-ct',];async _init() {diff --git a/utils/generate_injected.js b/utils/generate_injected.jsindex f62221f0d0..4162e312d2 100644--- a/utils/generate_injected.js+++ b/utils/generate_injected.js@@ -23,81 +23,64 @@ const ROOT = path.join(__dirname, '..');const esbuild = require('esbuild');/**- * @type {[string, string, string, boolean][]}+ * @type {[string, string, string][]}*/const injectedScripts = [[path.join(ROOT, 'packages', 'injected', 'src', 'utilityScript.ts'),path.join(ROOT, 'packages', 'injected', 'lib'),path.join(ROOT, 'packages', 'playwright-core', 'src', 'generated'),- true,],[path.join(ROOT, 'packages', 'injected', 'src', 'injectedScript.ts'),path.join(ROOT, 'packages', 'injected', 'lib'),path.join(ROOT, 'packages', 'playwright-core', 'src', 'generated'),- true,],[path.join(ROOT, 'packages', 'injected', 'src', 'recorder', 'pollingRecorder.ts'),path.join(ROOT, 'packages', 'injected', 'lib'),path.join(ROOT, 'packages', 'playwright-core', 'src', 'generated'),- true,],[path.join(ROOT, 'packages', 'injected', 'src', 'clock.ts'),path.join(ROOT, 'packages', 'injected', 'lib'),path.join(ROOT, 'packages', 'playwright-core', 'src', 'generated'),- true,],[path.join(ROOT, 'packages', 'injected', 'src', 'storageScript.ts'),path.join(ROOT, 'packages', 'injected', 'lib'),path.join(ROOT, 'packages', 'playwright-core', 'src', 'generated'),- true,],[path.join(ROOT, 'packages', 'injected', 'src', 'bindingsController.ts'),path.join(ROOT, 'packages', 'injected', 'lib'),path.join(ROOT, 'packages', 'playwright-core', 'src', 'generated'),- true,],[path.join(ROOT, 'packages', 'injected', 'src', 'webSocketMock.ts'),path.join(ROOT, 'packages', 'injected', 'lib'),path.join(ROOT, 'packages', 'playwright-core', 'src', 'generated'),- true,],[path.join(ROOT, 'packages', 'injected', 'src', 'webAuthn.ts'),path.join(ROOT, 'packages', 'injected', 'lib'),path.join(ROOT, 'packages', 'playwright-core', 'src', 'generated'),- true,],[path.join(ROOT, 'packages', 'injected', 'src', 'bidiInsertText.ts'),path.join(ROOT, 'packages', 'injected', 'lib'),path.join(ROOT, 'packages', 'playwright-core', 'src', 'generated'),- true,],[path.join(ROOT, 'packages', 'injected', 'src', 'webview', 'webViewInput.ts'),path.join(ROOT, 'packages', 'injected', 'lib'),path.join(ROOT, 'packages', 'playwright-core', 'src', 'generated'),- true,],[path.join(ROOT, 'packages', 'injected', 'src', 'webview', 'webViewDialog.ts'),path.join(ROOT, 'packages', 'injected', 'lib'),path.join(ROOT, 'packages', 'playwright-core', 'src', 'generated'),- true,],- [- path.join(ROOT, 'packages', 'playwright-ct-core', 'src', 'injected', 'index.ts'),- path.join(ROOT, 'packages', 'playwright-ct-core', 'lib', 'injected', 'packed'),- path.join(ROOT, 'packages', 'playwright-ct-core', 'src', 'generated'),- false,- ]];const modulePrefix = `@@ -150,7 +133,7 @@ const inlineCSSPlugin = {};(async () => {- for (const [injected, outdir, generatedFolder, hasExports] of injectedScripts) {+ for (const [injected, outdir, generatedFolder] of injectedScripts) {await fs.promises.mkdir(generatedFolder, { recursive: true });const buildOutput = await esbuild.build({entryPoints: [injected],@@ -165,9 +148,7 @@ const inlineCSSPlugin = {console.log(message.text);const baseName = path.basename(injected);const outFileJs = path.join(outdir, baseName.replace('.ts', '.js'));- let content = await fs.promises.readFile(outFileJs, 'utf-8');- if (hasExports)- content = await replaceEsbuildHeader(content, outFileJs);+ const content = await replaceEsbuildHeader(await fs.promises.readFile(outFileJs, 'utf-8'), outFileJs);const newContent = `export const source = ${JSON.stringify(content)};`;await fs.promises.writeFile(path.join(generatedFolder, baseName.replace('.ts', 'Source.ts')), newContent);}diff --git a/utils/workspace.js b/utils/workspace.jsindex 2f98fc2f3e..bc25a191d0 100755--- a/utils/workspace.js+++ b/utils/workspace.js@@ -194,26 +194,6 @@ const workspace = new Workspace(ROOT_PATH, [path: path.join(ROOT_PATH, 'packages', 'playwright-browser-chromium'),files: LICENCE_FILES,}),- new PWPackage({- name: '@playwright/experimental-ct-core',- path: path.join(ROOT_PATH, 'packages', 'playwright-ct-core'),- files: ['LICENSE'],- }),- new PWPackage({- name: '@playwright/experimental-ct-react',- path: path.join(ROOT_PATH, 'packages', 'playwright-ct-react'),- files: ['LICENSE'],- }),- new PWPackage({- name: '@playwright/experimental-ct-react17',- path: path.join(ROOT_PATH, 'packages', 'playwright-ct-react17'),- files: ['LICENSE'],- }),- new PWPackage({- name: '@playwright/experimental-ct-vue',- path: path.join(ROOT_PATH, 'packages', 'playwright-ct-vue'),- files: ['LICENSE'],- }),]);if (require.main === module) {