Skip to content

Commit 6b28d60

Browse files
committed
Switch E2E fixture hosting to Vite preview
1 parent 88338ae commit 6b28d60

4 files changed

Lines changed: 9 additions & 74 deletions

File tree

.cursor/skills/e2e-playwright-extension/SKILL.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ Aligned with [WXT’s Playwright E2E example](https://github.com/wxt-dev/example
1212
- Tests in [e2e/tests/](e2e/tests/) — main suite [e2e/tests/extension.spec.ts](e2e/tests/extension.spec.ts) with describe blocks: **Popup**, **Content injection**, **Per-domain activation**
1313
- Shared fixture in [e2e/fixtures.ts](e2e/fixtures.ts)
1414
- Page helpers in [e2e/pages/](e2e/pages/) (e.g. [e2e/pages/popup.ts](e2e/pages/popup.ts))
15-
- Fixture page served locally via Playwright `webServer`:
16-
- `e2e/serve-fixtures.mjs`
17-
- `e2e/constants.ts` (`STABLE_TEST_PAGE_URL` + derived host keying)
18-
- `playwright.config.ts` (points `webServer.url` at `inspector-playground.html`)
15+
- Fixture page served via Playwright `webServer` + Vite preview:
16+
- `playwright.config.ts` uses `pnpm exec vite preview --host localhost --port 51234 --strictPort`
17+
- `use.baseURL` is `http://localhost:51234`
18+
- Tests navigate with relative paths like `/inspector-playground.html`
1919

2020
## Fixture
2121

@@ -38,6 +38,6 @@ Navigate to `chrome-extension://${extensionId}/popup.html`. Use helpers like `op
3838

3939
## Note
4040

41-
`playwright-webextext` is in devDependencies for potential future use; current tests use the custom fixture in `fixtures.ts`.
41+
`playwright-webextext` is in devDependencies for potential future use; current tests use the custom extension fixture in `fixtures.ts`.
4242

4343
When a test needs deterministic inspector target setup (distances/side panel), prefer triggering the inspector via a synthetic `mouseover` on a known element (see `toolbar-distances.spec.ts`) rather than relying on hit-testing/hover in the presence of the overlay.

e2e/pages/web.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export async function enableDomainInStorage(context: BrowserContext, domain: str
3333
}
3434

3535
export async function enableStableDomainInStorage(context: BrowserContext) {
36-
const domain = "127.0.0.1:51234";
36+
const domain = "localhost:51234";
3737
await enableDomainInStorage(context, domain);
3838
}
3939

e2e/serve-fixtures.mjs

Lines changed: 0 additions & 65 deletions
This file was deleted.

playwright.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default defineConfig({
2727
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
2828
use: {
2929
/* Base URL to use in actions like `await page.goto('/')`. */
30-
baseURL: "http://127.0.0.1:51234",
30+
baseURL: "http://localhost:51234",
3131

3232
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
3333
trace: "on-first-retry",
@@ -63,8 +63,8 @@ export default defineConfig({
6363
],
6464
timeout: process.env.CI ? 30_000 : 5_000,
6565
webServer: {
66-
command: "node e2e/serve-fixtures.mjs 51234",
67-
url: "http://127.0.0.1:51234/inspector-playground.html",
66+
command: "pnpm exec vite preview --host localhost --port 51234 --strictPort",
67+
url: "http://localhost:51234/inspector-playground.html",
6868
reuseExistingServer: true,
6969
timeout: 60_000,
7070
},

0 commit comments

Comments
 (0)