playwright-webserver

playwright-webserver is a cursor rule for Cursor from YuDefine/nuxt-supabase-starter. It costs 0 tokens per session (3,008 once invoked), scanned A, original, MIT.

A rule for configuring Playwright, a browser-testing tool, so its end-to-end tests can start a web server reliably in continuous integration (CI), where local environment files and tunnels may not exist.

In plain words
What is it for?
It is for setting Playwright's test server command, choosing a production-like preview server in CI, and keeping the test URL and server port aligned.
Why use it?
It removes opaque startup failures caused by development-only scripts, missing credentials, or mismatched ports. It also separates local server reuse from clean CI startup.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/yudefine/nuxt-supabase-starter/playwright-webserver
Clone the repo
git clone --depth 1 https://github.com/YuDefine/nuxt-supabase-starter

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for playwright-webserver

README.md
[![agentmods](https://agentmods.dev/badge/rules/yudefine/nuxt-supabase-starter/playwright-webserver.svg)](https://agentmods.dev/rules/yudefine/nuxt-supabase-starter/playwright-webserver)
Your own site
<a href="https://agentmods.dev/rules/yudefine/nuxt-supabase-starter/playwright-webserver"><img src="https://agentmods.dev/badge/rules/yudefine/nuxt-supabase-starter/playwright-webserver.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 3,008 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.03008
Opus 5 $0.00000 $0.01504
Sonnet 5 $0.00000 $0.00602
Haiku 4.5 $0.00000 $0.00301

Measured 2d ago against content hash 3c99af183ff1, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

playwright-webserver scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

template/.cursor/rules/playwright-webserver.mdc · 199 lines

How it starts

The opening of the file, as written. The whole thing — 199 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Playwright webServer 必 CI-safe

核心命題:E2E 的 webServer 啟動 command 會在 CI 乾淨環境跑 —— actions/checkout 的 repo 沒有 .env、沒有 tunnel creds、port 配置可能跟本地不同。webServer 的 CI 路徑 MUST 能在這個環境起來,不可依賴任何本地 dev-only 條件。違反時 Playwright 只會回不透明 的 Process from config.webServer was not able to start. Exit code: 1webServer 子程序 的 stderr 被 Playwright 吞掉),現場無 stack,極難判讀。

真相層:本檔規範 playwright*.config.tswebServer / use.nuxt 啟動契約。dev 環境本身的 tunnel / port convention 是 [[dev-tunnel-convention]] / [[dev-port-allocation]] 的事;test 內容反模式(mock 濫用、boundary)是 [[testing-anti-patterns]] 的事。三者不重疊。

對應 pitfall:pitfall-playwright-webserver-pnpm-dev-tunnel-ci-exit1~/offline/clade/docs/pitfalls/2026-06-11-playwright-webserver-pnpm-dev-tunnel-ci-exit1.md)。

MUST

  1. webServer 的 CI 路徑走 production-ish server:用 @nuxt/test-utilsuse.nuxt.dev: false(CI 自動 build + 起 server)或手動 webServer.command 在 CI 分支跑 nuxt previewNEVER 在 CI 路徑碰 dev tunnel / 多程序 dev script。
  2. reuseExistingServer: !process.env.CI(手動 webServer 時)。CI 一律全新啟動,本地才 重用已開的 server。
  3. port 對齊webServer.url / baseURL 的 port 必須跟 server 實際聽的 port 一致 (手動 command 顯式帶 --port <N>)。Nuxt preview 預設聽 3000,consumer 多半不是 3000 → 不顯式帶 port 會 connect 不到 → timeout。port 來源見 [[dev-port-allocation]]。

NEVER

  • webServer.command: 'pnpm dev'(或任何 dev script),當該 command 沒有 process.env.CI ? 分支把 CI 導向非-dev 啟動方式時。尤其 dev script 經 concurrently -k 包了 tunnel / migration / 多個子程序:CI 缺 .env / creds → 子程序 process.exit(1)concurrently -k(kill-others-on-fail)連坐打掉整組 → webServer exit 1,約 2 秒內快速失敗,stderr 被吞,無從判讀。
  • reuseExistingServer: true(無條件重用)。CI 沒有「既有 server」可重用,且本地殘留的 舊 server 會讓 E2E 跑在過時 build 上。
  • ❌ 把 E2E 紅燈當「之後再看」——workflow_run 觸發 + 非 required check 的 E2E job 紅燈 長期被忽略 = false confidence(以為有 E2E gate,實際從未綠過)。webServer 起不來的 紅燈要當天 root-cause。

Read the full file on GitHub · 199 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 199 lines · 0 tokens per session scan A 3c99af183ff1

Subscribe to this mod's changes

playwright-webserver is a cursor rule published in the GitHub repository YuDefine/nuxt-supabase-starter (45 stars, last pushed today), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,008 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.