@athenaflow/plugin-e2e-test-builder 2.0.9 → 2.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/dist/{2.0.8 → 2.0.10}/.agents/plugins/marketplace.json +1 -1
- package/dist/{2.0.9 → 2.0.10}/claude/plugin/.claude-plugin/plugin.json +1 -1
- package/dist/{2.0.9 → 2.0.10}/claude/plugin/package.json +8 -2
- package/dist/{2.0.9 → 2.0.10}/claude/plugin/skills/add-e2e-tests/SKILL.md +18 -65
- package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/add-e2e-tests/agents/openai.yaml +1 -1
- package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/add-e2e-tests/references/error-recovery.md +3 -3
- package/dist/{2.0.8/codex → 2.0.10/claude}/plugin/skills/add-e2e-tests/references/scaffolding.md +1 -1
- package/dist/{2.0.9 → 2.0.10}/claude/plugin/skills/fix-flaky-tests/SKILL.md +1 -1
- package/dist/{2.0.8/codex → 2.0.10/claude}/plugin/skills/fix-flaky-tests/references/fix-patterns.md +3 -2
- package/dist/{2.0.9 → 2.0.10}/claude/plugin/skills/generate-test-cases/SKILL.md +8 -2
- package/dist/{2.0.9 → 2.0.10}/claude/plugin/skills/plan-test-coverage/SKILL.md +7 -6
- package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/review-test-cases/SKILL.md +3 -4
- package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/write-test-code/SKILL.md +4 -3
- package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/write-test-code/references/api-setup-teardown.md +1 -1
- package/dist/{2.0.9 → 2.0.10}/codex/plugin/.codex-plugin/plugin.json +1 -1
- package/dist/{2.0.9 → 2.0.10}/codex/plugin/package.json +8 -2
- package/dist/{2.0.9 → 2.0.10}/codex/plugin/skills/add-e2e-tests/SKILL.md +18 -65
- package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/add-e2e-tests/agents/openai.yaml +1 -1
- package/dist/{2.0.9/claude → 2.0.10/codex}/plugin/skills/add-e2e-tests/references/error-recovery.md +3 -3
- package/dist/{2.0.9/claude → 2.0.10/codex}/plugin/skills/add-e2e-tests/references/scaffolding.md +1 -1
- package/dist/{2.0.8/claude → 2.0.10/codex}/plugin/skills/fix-flaky-tests/SKILL.md +1 -1
- package/dist/{2.0.9/claude → 2.0.10/codex}/plugin/skills/fix-flaky-tests/references/fix-patterns.md +3 -2
- package/dist/{2.0.9 → 2.0.10}/codex/plugin/skills/generate-test-cases/SKILL.md +8 -2
- package/dist/{2.0.9 → 2.0.10}/codex/plugin/skills/plan-test-coverage/SKILL.md +7 -6
- package/dist/{2.0.9/claude → 2.0.10/codex}/plugin/skills/review-test-cases/SKILL.md +3 -4
- package/dist/{2.0.9/claude → 2.0.10/codex}/plugin/skills/write-test-code/SKILL.md +4 -3
- package/dist/{2.0.9/claude → 2.0.10/codex}/plugin/skills/write-test-code/references/api-setup-teardown.md +1 -1
- package/dist/{2.0.9 → 2.0.10}/release.json +1 -1
- package/package.json +7 -1
- package/skills/add-e2e-tests/SKILL.md +18 -65
- package/skills/add-e2e-tests/agents/openai.yaml +1 -1
- package/skills/add-e2e-tests/references/error-recovery.md +3 -3
- package/skills/add-e2e-tests/references/scaffolding.md +1 -1
- package/skills/fix-flaky-tests/SKILL.md +1 -1
- package/skills/fix-flaky-tests/references/fix-patterns.md +3 -2
- package/skills/generate-test-cases/SKILL.md +8 -2
- package/skills/plan-test-coverage/SKILL.md +7 -6
- package/skills/review-test-cases/SKILL.md +3 -4
- package/skills/write-test-code/SKILL.md +4 -3
- package/skills/write-test-code/references/api-setup-teardown.md +1 -1
- package/dist/2.0.8/claude/plugin/.claude-plugin/plugin.json +0 -20
- package/dist/2.0.8/claude/plugin/package.json +0 -9
- package/dist/2.0.8/claude/plugin/skills/add-e2e-tests/SKILL.md +0 -217
- package/dist/2.0.8/claude/plugin/skills/add-e2e-tests/agents/claude.yaml +0 -1
- package/dist/2.0.8/claude/plugin/skills/add-e2e-tests/references/scaffolding.md +0 -12
- package/dist/2.0.8/claude/plugin/skills/add-e2e-tests/references/tracker-template.md +0 -53
- package/dist/2.0.8/claude/plugin/skills/fix-flaky-tests/references/fix-patterns.md +0 -91
- package/dist/2.0.8/claude/plugin/skills/generate-test-cases/SKILL.md +0 -184
- package/dist/2.0.8/claude/plugin/skills/plan-test-coverage/SKILL.md +0 -116
- package/dist/2.0.8/codex/plugin/.codex-plugin/plugin.json +0 -15
- package/dist/2.0.8/codex/plugin/package.json +0 -9
- package/dist/2.0.8/codex/plugin/skills/add-e2e-tests/SKILL.md +0 -217
- package/dist/2.0.8/codex/plugin/skills/add-e2e-tests/agents/claude.yaml +0 -1
- package/dist/2.0.8/codex/plugin/skills/add-e2e-tests/references/error-recovery.md +0 -43
- package/dist/2.0.8/codex/plugin/skills/add-e2e-tests/references/tracker-template.md +0 -53
- package/dist/2.0.8/codex/plugin/skills/fix-flaky-tests/SKILL.md +0 -160
- package/dist/2.0.8/codex/plugin/skills/generate-test-cases/SKILL.md +0 -184
- package/dist/2.0.8/codex/plugin/skills/plan-test-coverage/SKILL.md +0 -116
- package/dist/2.0.8/codex/plugin/skills/review-test-cases/SKILL.md +0 -147
- package/dist/2.0.8/codex/plugin/skills/write-test-code/SKILL.md +0 -227
- package/dist/2.0.8/codex/plugin/skills/write-test-code/references/api-setup-teardown.md +0 -83
- package/dist/2.0.8/release.json +0 -18
- package/dist/2.0.9/.agents/plugins/marketplace.json +0 -14
- package/dist/2.0.9/claude/plugin/skills/add-e2e-tests/agents/openai.yaml +0 -10
- package/dist/2.0.9/claude/plugin/skills/add-e2e-tests/references/authentication.md +0 -8
- package/dist/2.0.9/claude/plugin/skills/add-e2e-tests/references/tracker-template.md +0 -53
- package/dist/2.0.9/claude/plugin/skills/analyze-test-codebase/SKILL.md +0 -142
- package/dist/2.0.9/claude/plugin/skills/analyze-test-codebase/agents/claude.yaml +0 -3
- package/dist/2.0.9/claude/plugin/skills/analyze-test-codebase/agents/openai.yaml +0 -4
- package/dist/2.0.9/claude/plugin/skills/fix-flaky-tests/agents/claude.yaml +0 -3
- package/dist/2.0.9/claude/plugin/skills/fix-flaky-tests/agents/openai.yaml +0 -10
- package/dist/2.0.9/claude/plugin/skills/generate-test-cases/agents/claude.yaml +0 -3
- package/dist/2.0.9/claude/plugin/skills/generate-test-cases/agents/openai.yaml +0 -10
- package/dist/2.0.9/claude/plugin/skills/generate-test-cases/references/scenario-categories.md +0 -36
- package/dist/2.0.9/claude/plugin/skills/plan-test-coverage/agents/claude.yaml +0 -3
- package/dist/2.0.9/claude/plugin/skills/plan-test-coverage/agents/openai.yaml +0 -10
- package/dist/2.0.9/claude/plugin/skills/review-test-cases/agents/claude.yaml +0 -3
- package/dist/2.0.9/claude/plugin/skills/review-test-cases/agents/openai.yaml +0 -10
- package/dist/2.0.9/claude/plugin/skills/review-test-code/SKILL.md +0 -189
- package/dist/2.0.9/claude/plugin/skills/review-test-code/agents/claude.yaml +0 -3
- package/dist/2.0.9/claude/plugin/skills/review-test-code/agents/openai.yaml +0 -10
- package/dist/2.0.9/claude/plugin/skills/write-test-code/agents/claude.yaml +0 -3
- package/dist/2.0.9/claude/plugin/skills/write-test-code/agents/openai.yaml +0 -10
- package/dist/2.0.9/claude/plugin/skills/write-test-code/references/anti-patterns.md +0 -88
- package/dist/2.0.9/claude/plugin/skills/write-test-code/references/auth-patterns.md +0 -63
- package/dist/2.0.9/claude/plugin/skills/write-test-code/references/mapping-tables.md +0 -56
- package/dist/2.0.9/claude/plugin/skills/write-test-code/references/network-interception.md +0 -56
- package/dist/2.0.9/codex/plugin/skills/add-e2e-tests/agents/openai.yaml +0 -10
- package/dist/2.0.9/codex/plugin/skills/add-e2e-tests/references/authentication.md +0 -8
- package/dist/2.0.9/codex/plugin/skills/add-e2e-tests/references/error-recovery.md +0 -43
- package/dist/2.0.9/codex/plugin/skills/add-e2e-tests/references/scaffolding.md +0 -12
- package/dist/2.0.9/codex/plugin/skills/add-e2e-tests/references/tracker-template.md +0 -53
- package/dist/2.0.9/codex/plugin/skills/analyze-test-codebase/SKILL.md +0 -142
- package/dist/2.0.9/codex/plugin/skills/analyze-test-codebase/agents/claude.yaml +0 -3
- package/dist/2.0.9/codex/plugin/skills/analyze-test-codebase/agents/openai.yaml +0 -4
- package/dist/2.0.9/codex/plugin/skills/fix-flaky-tests/SKILL.md +0 -160
- package/dist/2.0.9/codex/plugin/skills/fix-flaky-tests/agents/claude.yaml +0 -3
- package/dist/2.0.9/codex/plugin/skills/fix-flaky-tests/agents/openai.yaml +0 -10
- package/dist/2.0.9/codex/plugin/skills/fix-flaky-tests/references/fix-patterns.md +0 -91
- package/dist/2.0.9/codex/plugin/skills/generate-test-cases/agents/claude.yaml +0 -3
- package/dist/2.0.9/codex/plugin/skills/generate-test-cases/agents/openai.yaml +0 -10
- package/dist/2.0.9/codex/plugin/skills/generate-test-cases/references/scenario-categories.md +0 -36
- package/dist/2.0.9/codex/plugin/skills/plan-test-coverage/agents/claude.yaml +0 -3
- package/dist/2.0.9/codex/plugin/skills/plan-test-coverage/agents/openai.yaml +0 -10
- package/dist/2.0.9/codex/plugin/skills/review-test-cases/SKILL.md +0 -147
- package/dist/2.0.9/codex/plugin/skills/review-test-cases/agents/claude.yaml +0 -3
- package/dist/2.0.9/codex/plugin/skills/review-test-cases/agents/openai.yaml +0 -10
- package/dist/2.0.9/codex/plugin/skills/review-test-code/SKILL.md +0 -189
- package/dist/2.0.9/codex/plugin/skills/review-test-code/agents/claude.yaml +0 -3
- package/dist/2.0.9/codex/plugin/skills/review-test-code/agents/openai.yaml +0 -10
- package/dist/2.0.9/codex/plugin/skills/write-test-code/SKILL.md +0 -227
- package/dist/2.0.9/codex/plugin/skills/write-test-code/agents/claude.yaml +0 -3
- package/dist/2.0.9/codex/plugin/skills/write-test-code/agents/openai.yaml +0 -10
- package/dist/2.0.9/codex/plugin/skills/write-test-code/references/anti-patterns.md +0 -88
- package/dist/2.0.9/codex/plugin/skills/write-test-code/references/api-setup-teardown.md +0 -83
- package/dist/2.0.9/codex/plugin/skills/write-test-code/references/auth-patterns.md +0 -63
- package/dist/2.0.9/codex/plugin/skills/write-test-code/references/mapping-tables.md +0 -56
- package/dist/2.0.9/codex/plugin/skills/write-test-code/references/network-interception.md +0 -56
- package/skills/add-e2e-tests/references/tracker-template.md +0 -53
- /package/dist/{2.0.9 → 2.0.10}/claude/plugin/skills/add-e2e-tests/agents/claude.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/add-e2e-tests/references/authentication.md +0 -0
- /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/analyze-test-codebase/SKILL.md +0 -0
- /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/analyze-test-codebase/agents/claude.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/analyze-test-codebase/agents/openai.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/fix-flaky-tests/agents/claude.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/fix-flaky-tests/agents/openai.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/generate-test-cases/agents/claude.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/generate-test-cases/agents/openai.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/generate-test-cases/references/scenario-categories.md +0 -0
- /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/plan-test-coverage/agents/claude.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/plan-test-coverage/agents/openai.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/review-test-cases/agents/claude.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/review-test-cases/agents/openai.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/review-test-code/SKILL.md +0 -0
- /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/review-test-code/agents/claude.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/review-test-code/agents/openai.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/write-test-code/agents/claude.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/write-test-code/agents/openai.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/write-test-code/references/anti-patterns.md +0 -0
- /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/write-test-code/references/auth-patterns.md +0 -0
- /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/write-test-code/references/mapping-tables.md +0 -0
- /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/write-test-code/references/network-interception.md +0 -0
- /package/dist/{2.0.9 → 2.0.10}/codex/plugin/skills/add-e2e-tests/agents/claude.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/add-e2e-tests/references/authentication.md +0 -0
- /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/analyze-test-codebase/SKILL.md +0 -0
- /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/analyze-test-codebase/agents/claude.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/analyze-test-codebase/agents/openai.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/fix-flaky-tests/agents/claude.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/fix-flaky-tests/agents/openai.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/generate-test-cases/agents/claude.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/generate-test-cases/agents/openai.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/generate-test-cases/references/scenario-categories.md +0 -0
- /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/plan-test-coverage/agents/claude.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/plan-test-coverage/agents/openai.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/review-test-cases/agents/claude.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/review-test-cases/agents/openai.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/review-test-code/SKILL.md +0 -0
- /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/review-test-code/agents/claude.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/review-test-code/agents/openai.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/write-test-code/agents/claude.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/write-test-code/agents/openai.yaml +0 -0
- /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/write-test-code/references/anti-patterns.md +0 -0
- /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/write-test-code/references/auth-patterns.md +0 -0
- /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/write-test-code/references/mapping-tables.md +0 -0
- /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/write-test-code/references/network-interception.md +0 -0
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
interface:
|
|
2
|
-
display_name: "Implement Playwright Tests"
|
|
3
|
-
short_description: "Implement or refactor executable Playwright tests from a scenario or spec"
|
|
4
|
-
default_prompt: "Write or update Playwright E2E tests for this scenario or TC-ID spec."
|
|
5
|
-
|
|
6
|
-
dependencies:
|
|
7
|
-
tools:
|
|
8
|
-
- type: "mcp"
|
|
9
|
-
value: "agent-web-interface"
|
|
10
|
-
description: "Browser automation MCP used when selectors or live behavior need verification"
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
# Anti-Patterns: Detailed Explanations and Fix Strategies
|
|
2
|
-
|
|
3
|
-
## 1. Raw CSS selectors
|
|
4
|
-
Use semantic locators (`getByRole`, `getByLabel`, `getByTestId`) instead of CSS selectors. CSS selectors are brittle and break when markup changes.
|
|
5
|
-
|
|
6
|
-
**Why:** A class rename, component refactor, or CSS-in-JS migration breaks every CSS-based selector overnight. Semantic locators survive these changes because they target accessible roles and labels, not implementation details.
|
|
7
|
-
|
|
8
|
-
**Fix:** Replace `page.locator('.submit-btn')` with `page.getByRole('button', { name: /submit/i })`. Follow the locator strategy hierarchy in the main skill.
|
|
9
|
-
|
|
10
|
-
## 2. `waitForTimeout()`
|
|
11
|
-
Use proper assertions and event-driven waits. `waitForTimeout()` adds arbitrary delays that slow tests and mask timing issues.
|
|
12
|
-
|
|
13
|
-
**Why:** A 2-second sleep that works locally may be too short in CI (slower machines) or too long everywhere (wasting time). It also hides the real question: "what am I actually waiting for?"
|
|
14
|
-
|
|
15
|
-
**Fix:** Replace with `waitForResponse` for API-dependent UI, `expect(el).toBeVisible()` for element appearance, or `expect(spinner).toBeHidden()` for loading states.
|
|
16
|
-
|
|
17
|
-
## 3. Fragile `.nth()` / `.first()`
|
|
18
|
-
Scope locators to a container instead of relying on position. If unavoidable, add a comment explaining why.
|
|
19
|
-
|
|
20
|
-
**Why:** Element order can change when the page adds a banner, reorders a list, or renders asynchronously. `.first()` silently picks the wrong element, causing false passes or mysterious failures.
|
|
21
|
-
|
|
22
|
-
**Fix:** Use `.filter({ hasText: 'Specific Item' })` or scope to a container: `page.locator('[data-testid="cart"]').getByRole('button')`.
|
|
23
|
-
|
|
24
|
-
## 4. Exact long text matches
|
|
25
|
-
Use regex with key words instead of matching entire strings. Marketing copy and UI text change frequently.
|
|
26
|
-
|
|
27
|
-
**Why:** A copywriter changes "Sign up for free today!" to "Create your free account" and every test matching the full string breaks, even though the feature works fine.
|
|
28
|
-
|
|
29
|
-
**Fix:** Use `page.getByText(/sign up/i)` or `page.getByRole('button', { name: /free/i })` — match the stable semantic keywords.
|
|
30
|
-
|
|
31
|
-
## 5. Unscoped locators
|
|
32
|
-
Scope locators to `main`, `nav`, `dialog`, or other containers when possible. Global locators match unintended elements.
|
|
33
|
-
|
|
34
|
-
**Why:** A page-wide `getByRole('button', { name: /submit/i })` may match a submit button in the header, footer, or a hidden modal — not just the one in your form. This causes the wrong click or ambiguous locator errors.
|
|
35
|
-
|
|
36
|
-
**Fix:** Scope first: `page.locator('main').getByRole('button', { name: /submit/i })` or `page.locator('[role="dialog"]').getByRole('button')`.
|
|
37
|
-
|
|
38
|
-
## 6. Login via UI in every test
|
|
39
|
-
Use `storageState` or API-based auth setup. UI login in every test wastes time and creates coupling to the login flow.
|
|
40
|
-
|
|
41
|
-
**Why:** If every test clicks through the login form, a single login page change breaks the entire suite. It also adds 3-10 seconds per test — multiplied across hundreds of tests, this becomes significant CI time.
|
|
42
|
-
|
|
43
|
-
**Fix:** Log in once in `globalSetup`, save `storageState` to a JSON file, and reuse it. See `references/auth-patterns.md` for the four auth strategies.
|
|
44
|
-
|
|
45
|
-
## 7. UI clicks to set up test data
|
|
46
|
-
Use API requests for data seeding. UI setup is 10-50x slower and more fragile than API calls.
|
|
47
|
-
|
|
48
|
-
**Why:** Creating a product via the admin UI takes 15+ seconds and 10+ actions. An API call takes 200ms and one line. UI setup also couples your test to two features instead of one — if the admin form breaks, your unrelated cart test fails too.
|
|
49
|
-
|
|
50
|
-
**Fix:** Use the `request` fixture: `await request.post('/api/products', { data: { ... } })`. See `references/api-setup-teardown.md`.
|
|
51
|
-
|
|
52
|
-
## 8. No error path tests
|
|
53
|
-
Every feature needs at least one failure scenario test. Cover server errors (500), network timeouts, and empty states.
|
|
54
|
-
|
|
55
|
-
**Why:** Happy-path-only suites give false confidence. The app may crash on a 500, show a blank screen on empty data, or hang on a timeout — none of which are caught without explicit error path tests.
|
|
56
|
-
|
|
57
|
-
**Fix:** Use `page.route()` to mock failures. At minimum: one 500 response, one timeout (`route.abort('timedout')`), one empty state (`route.fulfill({ json: { items: [] } })`). See `references/network-interception.md`.
|
|
58
|
-
|
|
59
|
-
## 9. Hardcoded test data
|
|
60
|
-
NEVER embed real entity IDs (`'ACC-SUB-2026-00025'`), real user names (`'Anas Client 73'`), real monetary amounts, or environment-specific strings in test code. Instead:
|
|
61
|
-
- Create data via API in `beforeEach` and capture the returned ID
|
|
62
|
-
- Use `Date.now()` or `crypto.randomUUID()` suffixes for uniqueness
|
|
63
|
-
- Read values from `process.env` or a test data module
|
|
64
|
-
- For read-only assertions on existing data, use pattern matchers (`expect(text).toMatch(/ACC-SUB-\d{4}-\d{5}/)`) instead of exact values
|
|
65
|
-
|
|
66
|
-
If you find yourself typing a specific ID or name into test code, STOP — that is a hardcoded value.
|
|
67
|
-
|
|
68
|
-
## 10. Tests depending on execution order
|
|
69
|
-
Each test must be independently runnable. Never rely on state left by a previous test.
|
|
70
|
-
|
|
71
|
-
## 11. `expect(await el.isVisible()).toBe(true)`
|
|
72
|
-
Use `await expect(el).toBeVisible()` instead. The Playwright assertion auto-retries, while the manual pattern checks once and fails on timing.
|
|
73
|
-
|
|
74
|
-
## 12. `{ force: true }` on clicks/checks
|
|
75
|
-
Hides real interaction problems (overlapping elements, not scrolled into view, disabled state). Diagnose the root cause instead: use `scrollIntoViewIfNeeded()`, wait for overlay to disappear, or wait for element to be enabled. Only acceptable when interacting with a custom widget that Playwright cannot natively trigger (document why in a comment).
|
|
76
|
-
|
|
77
|
-
## 13. `waitForLoadState('networkidle')` as default strategy
|
|
78
|
-
`networkidle` waits for 500ms of no network activity, which breaks on long-polling, WebSockets, analytics beacons, or chat widgets. Use it ONLY for initial full-page loads where no streaming/polling exists. For post-action waits, use `waitForResponse` targeting the specific API call, or assert directly on the resulting UI state (Playwright auto-retries).
|
|
79
|
-
|
|
80
|
-
## 14. CSS utility class selectors (Tailwind, Bootstrap, etc.)
|
|
81
|
-
`button.rounded-l-lg`, `.flex.items-center`, `.bg-primary` are styling concerns that change during refactors. Treat ALL utility framework classes as volatile — never use them as selectors. If no semantic locator works, request a `data-testid` from the dev team.
|
|
82
|
-
|
|
83
|
-
## 15. Asserting exact server-computed values
|
|
84
|
-
`expect(revenue).toHaveText('12450')` will break when data changes. For dashboard counters, totals, and aggregates:
|
|
85
|
-
- Assert the element exists and contains a number (`toMatch(/\$[\d,]+/)`)
|
|
86
|
-
- Assert non-zero or within a range
|
|
87
|
-
- Assert format correctness (`/^\d{1,3}(,\d{3})*$/`)
|
|
88
|
-
- If exact value matters, seed the data via API first so you control the expected value
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# Authentication Setup Patterns
|
|
2
|
-
|
|
3
|
-
Choose the right auth strategy based on the project's needs.
|
|
4
|
-
|
|
5
|
-
## Strategy 1: storageState (Recommended for most projects)
|
|
6
|
-
|
|
7
|
-
Log in once in global setup, save cookies/localStorage to a JSON file, and reuse across all tests:
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
// global-setup.ts
|
|
11
|
-
import { chromium, FullConfig } from '@playwright/test';
|
|
12
|
-
|
|
13
|
-
async function globalSetup(config: FullConfig) {
|
|
14
|
-
const browser = await chromium.launch();
|
|
15
|
-
const page = await browser.newPage();
|
|
16
|
-
await page.goto('/login');
|
|
17
|
-
await page.getByLabel(/email/i).fill(process.env.TEST_USER_EMAIL!);
|
|
18
|
-
await page.getByLabel(/password/i).fill(process.env.TEST_USER_PASSWORD!);
|
|
19
|
-
await page.getByRole('button', { name: /sign in/i }).click();
|
|
20
|
-
await page.waitForURL('/dashboard');
|
|
21
|
-
await page.context().storageState({ path: 'tests/.auth/user.json' });
|
|
22
|
-
await browser.close();
|
|
23
|
-
}
|
|
24
|
-
export default globalSetup;
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Reference in config: `use: { storageState: 'tests/.auth/user.json' }`
|
|
28
|
-
|
|
29
|
-
## Strategy 2: Worker-scoped fixture (for parallel workers needing separate accounts)
|
|
30
|
-
|
|
31
|
-
```typescript
|
|
32
|
-
export const test = base.extend<{}, { workerStorageState: string }>({
|
|
33
|
-
storageState: ({ workerStorageState }, use) => use(workerStorageState),
|
|
34
|
-
workerStorageState: [async ({ browser }, use, testInfo) => {
|
|
35
|
-
const page = await browser.newPage({ storageState: undefined });
|
|
36
|
-
// Login with worker-specific account...
|
|
37
|
-
const path = `tests/.auth/worker-${testInfo.parallelIndex}.json`;
|
|
38
|
-
await page.context().storageState({ path });
|
|
39
|
-
await use(path);
|
|
40
|
-
await page.close();
|
|
41
|
-
}, { scope: 'worker' }],
|
|
42
|
-
});
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Strategy 3: Multi-role testing (admin + user in same test)
|
|
46
|
-
|
|
47
|
-
```typescript
|
|
48
|
-
test('TC-ADMIN-001: Admin sees user profile', async ({ browser }) => {
|
|
49
|
-
const adminContext = await browser.newContext({ storageState: 'tests/.auth/admin.json' });
|
|
50
|
-
const userContext = await browser.newContext({ storageState: 'tests/.auth/user.json' });
|
|
51
|
-
const adminPage = await adminContext.newPage();
|
|
52
|
-
const userPage = await userContext.newPage();
|
|
53
|
-
// Interact with both pages...
|
|
54
|
-
await adminContext.close();
|
|
55
|
-
await userContext.close();
|
|
56
|
-
});
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Strategy 4: Per-test login
|
|
60
|
-
|
|
61
|
-
Only when testing login itself or permission-specific scenarios.
|
|
62
|
-
|
|
63
|
-
Never hardcode tokens. Use environment variables or `.env.test`.
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# Mapping Tables
|
|
2
|
-
|
|
3
|
-
Standard translations for converting journey specs and exploration results to Playwright API calls.
|
|
4
|
-
|
|
5
|
-
## Scope-to-Locator
|
|
6
|
-
|
|
7
|
-
| Journey Scope | Playwright Scoping |
|
|
8
|
-
|---------------|-------------------|
|
|
9
|
-
| `page` | No scoping needed |
|
|
10
|
-
| `header` | `page.locator('header')` |
|
|
11
|
-
| `main` | `page.locator('main')` |
|
|
12
|
-
| `nav` | `page.locator('nav')` |
|
|
13
|
-
| `dialog` | `page.locator('[role="dialog"]')` |
|
|
14
|
-
|
|
15
|
-
## Action-to-Playwright
|
|
16
|
-
|
|
17
|
-
| Journey Action | Playwright Code |
|
|
18
|
-
|----------------|-----------------|
|
|
19
|
-
| `goto` | `await page.goto(url)` |
|
|
20
|
-
| `click` | `await locator.click()` |
|
|
21
|
-
| `fill` | `await locator.fill(value)` |
|
|
22
|
-
| `select` | `await locator.selectOption(value)` |
|
|
23
|
-
| `assert` | `await expect(locator).toBeVisible()` |
|
|
24
|
-
|
|
25
|
-
## Assertion Mapping
|
|
26
|
-
|
|
27
|
-
| Observed Effect | Playwright Assertion |
|
|
28
|
-
|----------------|---------------------|
|
|
29
|
-
| `url changed to /cart` | `await expect(page).toHaveURL(/cart/)` |
|
|
30
|
-
| `text 'Added' visible` | `await expect(page.getByText(/added/i)).toBeVisible()` |
|
|
31
|
-
| `radio 256GB checked` | `await expect(locator).toBeChecked()` |
|
|
32
|
-
| `button now enabled` | `await expect(locator).toBeEnabled()` |
|
|
33
|
-
|
|
34
|
-
## Target Kind to Locator
|
|
35
|
-
|
|
36
|
-
| Target Kind | Value Pattern | Playwright Locator |
|
|
37
|
-
|-------------|--------------|-------------------|
|
|
38
|
-
| `role` | `button name~Add to Bag` | `getByRole('button', { name: /add to bag/i })` |
|
|
39
|
-
| `role` | `radio name~256GB` | `getByRole('radio', { name: /256gb/i })` |
|
|
40
|
-
| `label` | `Email address` | `getByLabel(/email address/i)` |
|
|
41
|
-
| `testid` | `checkout-button` | `getByTestId('checkout-button')` |
|
|
42
|
-
|
|
43
|
-
## Low Confidence Handling (<0.7)
|
|
44
|
-
|
|
45
|
-
When journey step confidence is low:
|
|
46
|
-
1. Add extra assertions to verify state
|
|
47
|
-
2. Include fallback locators as comments
|
|
48
|
-
3. Consider retry logic for flaky interactions
|
|
49
|
-
|
|
50
|
-
```typescript
|
|
51
|
-
// Primary locator
|
|
52
|
-
const storageRadio = page.getByRole('radio', { name: /256gb/i });
|
|
53
|
-
// Fallback: page.getByLabel(/256gb/i)
|
|
54
|
-
await storageRadio.click();
|
|
55
|
-
await expect(storageRadio).toBeChecked({ timeout: 5000 });
|
|
56
|
-
```
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# Network Interception and Error Path Testing
|
|
2
|
-
|
|
3
|
-
## Network Interception
|
|
4
|
-
|
|
5
|
-
Use `page.route()` to intercept and mock network requests for deterministic error testing.
|
|
6
|
-
|
|
7
|
-
**Mock server errors:**
|
|
8
|
-
```typescript
|
|
9
|
-
await page.route('**/api/checkout', route =>
|
|
10
|
-
route.fulfill({ status: 500, body: JSON.stringify({ error: 'Payment declined' }) })
|
|
11
|
-
);
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
**Patch real responses (modify, don't replace):**
|
|
15
|
-
```typescript
|
|
16
|
-
await page.route('**/api/products', async route => {
|
|
17
|
-
const response = await route.fetch();
|
|
18
|
-
const json = await response.json();
|
|
19
|
-
json.results = json.results.slice(0, 1); // reduce to 1 item
|
|
20
|
-
await route.fulfill({ response, json });
|
|
21
|
-
});
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
**Assert backend was called:**
|
|
25
|
-
```typescript
|
|
26
|
-
const [response] = await Promise.all([
|
|
27
|
-
page.waitForResponse(resp =>
|
|
28
|
-
resp.url().includes('/api/order') && resp.status() === 201
|
|
29
|
-
),
|
|
30
|
-
page.getByRole('button', { name: /place order/i }).click(),
|
|
31
|
-
]);
|
|
32
|
-
expect(response.status()).toBe(201);
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
**Block heavy resources to speed up tests:**
|
|
36
|
-
```typescript
|
|
37
|
-
await page.route('**/*.{png,jpg,jpeg,gif,svg}', route => route.abort());
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Error Path Testing
|
|
41
|
-
|
|
42
|
-
Every feature needs error path tests. Use network interception (see above) to simulate failures. At minimum, every feature test suite should cover:
|
|
43
|
-
|
|
44
|
-
- **Server error** — `route.fulfill({ status: 500, ... })` — verify error UI appears
|
|
45
|
-
- **Network timeout** — `route.abort('timedout')` — verify retry option or error message
|
|
46
|
-
- **Empty state** — `route.fulfill({ status: 200, json: { items: [] } })` — verify empty state UI
|
|
47
|
-
|
|
48
|
-
```typescript
|
|
49
|
-
test('TC-DASHBOARD-005: Shows empty state when no data', async ({ page }) => {
|
|
50
|
-
await page.route('**/api/items', route =>
|
|
51
|
-
route.fulfill({ status: 200, json: { items: [] } })
|
|
52
|
-
);
|
|
53
|
-
await page.goto('/dashboard');
|
|
54
|
-
await expect(page.getByText(/no items/i)).toBeVisible();
|
|
55
|
-
});
|
|
56
|
-
```
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
interface:
|
|
2
|
-
display_name: "Run Full E2E Workflow"
|
|
3
|
-
short_description: "Orchestrate browser-led E2E work from exploration to verified tests"
|
|
4
|
-
default_prompt: "Run the full E2E workflow for this feature: maintain a concise progress tracker, explore the live product first, then plan, spec, review, implement, and verify the Playwright tests."
|
|
5
|
-
|
|
6
|
-
dependencies:
|
|
7
|
-
tools:
|
|
8
|
-
- type: "mcp"
|
|
9
|
-
value: "agent-web-interface"
|
|
10
|
-
description: "Browser automation MCP used to explore the site and verify flows"
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Authentication Handling for E2E Tests
|
|
2
|
-
|
|
3
|
-
If the target feature requires login or any form of authentication:
|
|
4
|
-
|
|
5
|
-
1. **Check existing infrastructure** — look for existing test fixtures, environment variables, or auth setup files that already handle authentication. Load the `analyze-test-codebase` skill to find auth patterns.
|
|
6
|
-
2. **Ask the user if no auth setup exists** — request credentials or an auth strategy (stored auth state, API tokens, test accounts). Do not proceed with tests that require login until auth is resolved.
|
|
7
|
-
3. **Never hardcode credentials** — use environment variables, Playwright's `storageState`, or the project's existing auth fixture pattern.
|
|
8
|
-
4. **Handle mid-session auth discovery** — if you discover auth is needed mid-session (e.g., a page redirects to login), ask the user immediately and add auth setup as a prerequisite task.
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# Error Recovery for Infrastructure Failures
|
|
2
|
-
|
|
3
|
-
When infrastructure failures occur during E2E test building, follow the general pattern: diagnose, attempt one known fix, if still stuck record in tracker and ask the user.
|
|
4
|
-
|
|
5
|
-
## Browser MCP unavailable
|
|
6
|
-
|
|
7
|
-
The browser MCP server (`agent-web-interface`) must be running for site exploration.
|
|
8
|
-
|
|
9
|
-
1. Verify the MCP server is configured in the project (check `.mcp.json` or plugin config).
|
|
10
|
-
2. Ask the user to confirm the MCP server is running or to restart it.
|
|
11
|
-
3. If unreachable after user intervention, mark the session as blocked: `<!-- E2E_BLOCKED: browser MCP server unreachable -->`.
|
|
12
|
-
|
|
13
|
-
## Boilerplate clone fails
|
|
14
|
-
|
|
15
|
-
When `git clone git@github.com:lespaceman/playwright-typescript-e2e-boilerplate.git` fails:
|
|
16
|
-
|
|
17
|
-
1. Check if SSH keys are configured — the error will usually indicate `Permission denied (publickey)`.
|
|
18
|
-
2. Fall back to HTTPS: `git clone https://github.com/lespaceman/playwright-typescript-e2e-boilerplate.git`.
|
|
19
|
-
3. If both fail, ask the user to verify network access and GitHub authentication.
|
|
20
|
-
|
|
21
|
-
## npm install fails
|
|
22
|
-
|
|
23
|
-
1. Check the Node.js version — Playwright requires Node 18+. Run `node --version`.
|
|
24
|
-
2. Clear the npm cache: `npm cache clean --force`.
|
|
25
|
-
3. Check for lockfile conflicts — if both `package-lock.json` and `yarn.lock` exist, ask the user which package manager to use.
|
|
26
|
-
4. If dependency resolution fails, try `npm install --legacy-peer-deps` as a fallback.
|
|
27
|
-
|
|
28
|
-
## Playwright browser install fails
|
|
29
|
-
|
|
30
|
-
When `npx playwright install --with-deps chromium` fails:
|
|
31
|
-
|
|
32
|
-
1. Try installing just chromium without system deps: `npx playwright install chromium`.
|
|
33
|
-
2. Check permissions — on Linux, system dependency installation may require sudo.
|
|
34
|
-
3. If behind a corporate proxy, ask the user for proxy configuration.
|
|
35
|
-
4. As a last resort, ask the user to run the install command manually and confirm when done.
|
|
36
|
-
|
|
37
|
-
## General pattern
|
|
38
|
-
|
|
39
|
-
For any infrastructure failure not listed above:
|
|
40
|
-
|
|
41
|
-
1. **Diagnose** — read the error message carefully, check logs, identify the root cause.
|
|
42
|
-
2. **Attempt one known fix** — apply the most likely solution based on the error.
|
|
43
|
-
3. **If still stuck** — record the full error output and diagnostic steps taken in the tracker, then ask the user for help. Do not loop through multiple speculative fixes.
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# Scaffolding Playwright from Boilerplate
|
|
2
|
-
|
|
3
|
-
If Playwright is not set up in the target project, follow this procedure:
|
|
4
|
-
|
|
5
|
-
1. Clone `git@github.com:lespaceman/playwright-typescript-e2e-boilerplate.git` into a temporary directory.
|
|
6
|
-
2. Copy config, fixtures, pages, and utils into the project. Do not overwrite existing files.
|
|
7
|
-
3. Update `baseURL` to the target URL and remove example tests.
|
|
8
|
-
- **Test execution strategy:** If the project needs role-based or category-based test filtering, configure it via Playwright `--grep` tags or file naming conventions (`*.admin.spec.ts`), NOT via `testIgnore` regex patterns. A `testIgnore` regex becomes a maintenance trap — every new test file requires updating the regex. If the boilerplate includes a `testIgnore` regex, replace it with tag-based filtering.
|
|
9
|
-
4. Merge devDependencies into `package.json`.
|
|
10
|
-
5. Run `npm install && npx playwright install --with-deps chromium`.
|
|
11
|
-
6. Clean up the temp clone.
|
|
12
|
-
7. Log all scaffolding steps in the tracker.
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# Tracker Template: e2e-tracker.md
|
|
2
|
-
|
|
3
|
-
Use this as a starting template when creating the tracker file. Adapt sections as needed.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
```markdown
|
|
8
|
-
# E2E Test Tracker
|
|
9
|
-
|
|
10
|
-
## Goal
|
|
11
|
-
|
|
12
|
-
- **URL:** https://myapp.com/checkout
|
|
13
|
-
- **Feature:** Checkout flow with cart, shipping, and payment
|
|
14
|
-
- **Slug:** checkout
|
|
15
|
-
|
|
16
|
-
## Progress
|
|
17
|
-
|
|
18
|
-
### Session 1 — 2026-04-01
|
|
19
|
-
|
|
20
|
-
- Analyzed codebase: Playwright 1.42, TypeScript, existing auth fixture in `tests/fixtures/auth.ts`
|
|
21
|
-
- Browsed checkout flow: 4-step wizard (cart review, shipping, payment, confirmation)
|
|
22
|
-
- Discovered 3 form validation states per step
|
|
23
|
-
- Generated test spec: `test-cases/checkout.md` with TC-CHECKOUT-001 through TC-CHECKOUT-012
|
|
24
|
-
- Review gate passed with warnings (TC-CHECKOUT-008 needs clarification on coupon edge case)
|
|
25
|
-
|
|
26
|
-
### Session 2 — 2026-04-02
|
|
27
|
-
|
|
28
|
-
- Wrote `tests/checkout.spec.ts` covering TC-CHECKOUT-001 through TC-CHECKOUT-012
|
|
29
|
-
- Code review gate passed
|
|
30
|
-
- Ran tests: 10/12 passing, 2 failing (TC-CHECKOUT-006: selector stale, TC-CHECKOUT-011: timeout)
|
|
31
|
-
- Fixed TC-CHECKOUT-006: updated selector from `.price` to `[data-testid="cart-total"]`
|
|
32
|
-
- Fixed TC-CHECKOUT-011: added `waitForResponse` before assertion
|
|
33
|
-
|
|
34
|
-
## Remaining
|
|
35
|
-
|
|
36
|
-
- Re-run full suite to confirm fixes
|
|
37
|
-
- Verify TC-ID coverage: all 12 specs should map to test code
|
|
38
|
-
|
|
39
|
-
## Next Steps
|
|
40
|
-
|
|
41
|
-
- Run `npx playwright test tests/checkout.spec.ts --reporter=list` and record output
|
|
42
|
-
- If all green, mark complete
|
|
43
|
-
- If failures remain, diagnose with `fix-flaky-tests` skill
|
|
44
|
-
|
|
45
|
-
<!-- E2E_COMPLETE -->
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
**Terminal markers** (write as the last line of the tracker when appropriate):
|
|
51
|
-
|
|
52
|
-
- `<!-- E2E_COMPLETE -->` — all tests pass, all TC-IDs covered, work is done
|
|
53
|
-
- `<!-- E2E_BLOCKED: reason -->` — unrecoverable blocker prevents further progress (e.g., `<!-- E2E_BLOCKED: login requires 2FA token we cannot automate -->`)
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: analyze-test-codebase
|
|
3
|
-
description: >
|
|
4
|
-
Scans and reports on an existing Playwright test codebase. This skill should be used to inspect
|
|
5
|
-
the current Playwright setup before writing, reviewing, or fixing tests, and should be loaded
|
|
6
|
-
early when working in a new project to understand existing patterns. Covers: Playwright config,
|
|
7
|
-
page objects, fixtures, helpers, auth/globalSetup patterns, test conventions, and directory
|
|
8
|
-
structure. Triggers: "understand", "check", "show me", "inspect", or "analyze"
|
|
9
|
-
the current test setup, config, infrastructure, patterns, or conventions. In the full add-tests
|
|
10
|
-
workflow, this skill serves as an early read-only analysis sub-step before planning detailed
|
|
11
|
-
coverage or writing code. This skill examines existing files and outputs a structured report.
|
|
12
|
-
It does NOT write or fix tests, install Playwright, or explore live websites — for live site
|
|
13
|
-
exploration, use agent-web-interface-guide instead.
|
|
14
|
-
allowed-tools: Read Glob Grep Bash
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
# Analyze Test Codebase
|
|
18
|
-
|
|
19
|
-
Scan and analyze an existing Playwright test codebase to understand its conventions, configuration, and patterns before writing new tests.
|
|
20
|
-
|
|
21
|
-
## Workflow
|
|
22
|
-
|
|
23
|
-
1. **Locate Playwright configuration** — search for `playwright.config.ts`, `playwright.config.js`, or `playwright.config.mjs` in the project root and common subdirectories.
|
|
24
|
-
|
|
25
|
-
2. **Extract configuration details**:
|
|
26
|
-
- `baseURL` — the target application URL
|
|
27
|
-
- `testDir` — where tests live
|
|
28
|
-
- `projects` — browser/device configurations
|
|
29
|
-
- `use` — default options (viewport, headless, trace, screenshot)
|
|
30
|
-
- `webServer` — if Playwright starts the app
|
|
31
|
-
- `globalSetup` / `globalTeardown` — auth or data seeding scripts
|
|
32
|
-
- `reporter` — configured reporters
|
|
33
|
-
|
|
34
|
-
3. **Scan test directory structure**:
|
|
35
|
-
```
|
|
36
|
-
Glob for **/*.spec.ts, **/*.test.ts, **/*.spec.js, **/*.test.js
|
|
37
|
-
```
|
|
38
|
-
- Count total test files
|
|
39
|
-
- Identify naming conventions (`.spec.ts` vs `.test.ts`)
|
|
40
|
-
- Map directory organization (by feature? by page? flat?)
|
|
41
|
-
|
|
42
|
-
4. **Detect patterns in existing tests** — read 2-3 representative test files and identify:
|
|
43
|
-
- **Locator strategy**: `getByRole`, `getByTestId`, CSS selectors, XPath
|
|
44
|
-
- **Wait strategy**: auto-waits, explicit `waitFor*`, any `waitForTimeout` (flag these)
|
|
45
|
-
- **Test structure**: AAA pattern, describe/test nesting, use of `test.step`
|
|
46
|
-
- **Data management**: fixtures, test data files, factory functions
|
|
47
|
-
- **Page Objects**: POM pattern usage, fixture-based injection
|
|
48
|
-
- **Auth handling**: `storageState`, global setup, per-test login
|
|
49
|
-
- **Custom fixtures**: extended `test` with custom fixtures
|
|
50
|
-
- **Helper utilities**: shared functions, custom assertions
|
|
51
|
-
- **Network mocking**: `page.route()` usage, HAR recording (`routeFromHAR`), API interceptors
|
|
52
|
-
- **Visual regression**: `toHaveScreenshot()`, `toMatchSnapshot()`, snapshot directories
|
|
53
|
-
- **Accessibility testing**: `@axe-core/playwright` usage, custom a11y assertions
|
|
54
|
-
- **Cross-browser config**: multiple projects in playwright.config (chromium, firefox, webkit)
|
|
55
|
-
- **Retry configuration**: `retries` count, trace settings (`on-first-retry`)
|
|
56
|
-
- **Parallelism**: `fullyParallel`, `workers` count, test isolation strategy
|
|
57
|
-
|
|
58
|
-
5. **Check for supporting infrastructure**:
|
|
59
|
-
- `fixtures/` or `helpers/` directories
|
|
60
|
-
- `pages/` or `pom/` (Page Object Model)
|
|
61
|
-
- `.env` or `.env.test` files (test-specific environment configuration)
|
|
62
|
-
- CI configuration (`.github/workflows/`, `Jenkinsfile`, etc.)
|
|
63
|
-
- `package.json` scripts for running tests
|
|
64
|
-
- `*.har` files or HAR directories (recorded API responses for mocking)
|
|
65
|
-
- Snapshot directories (`__snapshots__`, `screenshots/`) for visual regression baselines
|
|
66
|
-
- Docker or `docker-compose` for test environment setup
|
|
67
|
-
- Global setup/teardown scripts — what they do (auth, seeding, cleanup)
|
|
68
|
-
|
|
69
|
-
6. **Generate report** — output a structured summary:
|
|
70
|
-
|
|
71
|
-
```markdown
|
|
72
|
-
## Test Codebase Analysis
|
|
73
|
-
|
|
74
|
-
### Framework
|
|
75
|
-
- **Playwright** version X.Y.Z
|
|
76
|
-
- Config: `playwright.config.ts`
|
|
77
|
-
- Test directory: `tests/`
|
|
78
|
-
|
|
79
|
-
### Conventions
|
|
80
|
-
- File naming: `*.spec.ts`
|
|
81
|
-
- Locator preference: getByRole > getByTestId
|
|
82
|
-
- Structure: describe blocks by feature
|
|
83
|
-
- Page Objects: Yes, in `tests/pages/`
|
|
84
|
-
- Custom fixtures: Yes, in `tests/fixtures/`
|
|
85
|
-
|
|
86
|
-
### Auth
|
|
87
|
-
- Method: storageState via global setup
|
|
88
|
-
- Auth file: `tests/.auth/user.json`
|
|
89
|
-
|
|
90
|
-
### Existing Coverage
|
|
91
|
-
- Total test files: N
|
|
92
|
-
- Feature areas covered: [list]
|
|
93
|
-
- Test count: ~N tests
|
|
94
|
-
|
|
95
|
-
### Network Mocking
|
|
96
|
-
- Method: page.route() / HAR / none
|
|
97
|
-
- Patterns: [list any existing mocking patterns]
|
|
98
|
-
|
|
99
|
-
### Visual Testing
|
|
100
|
-
- Enabled: Yes/No
|
|
101
|
-
- Tool: toHaveScreenshot() / third-party / none
|
|
102
|
-
- Baseline directory: [path if exists]
|
|
103
|
-
|
|
104
|
-
### Accessibility Testing
|
|
105
|
-
- Enabled: Yes/No
|
|
106
|
-
- Tool: @axe-core/playwright / custom assertions / none
|
|
107
|
-
|
|
108
|
-
### Cross-Browser & CI
|
|
109
|
-
- Browser projects: [list from config]
|
|
110
|
-
- Retries: N (CI) / N (local)
|
|
111
|
-
- Workers: N / fullyParallel: Yes/No
|
|
112
|
-
- CI platform: GitHub Actions / Jenkins / none detected
|
|
113
|
-
- Trace: [setting from config]
|
|
114
|
-
|
|
115
|
-
### Recommendations for New Tests
|
|
116
|
-
- Follow existing `*.spec.ts` naming
|
|
117
|
-
- Use page objects from `tests/pages/`
|
|
118
|
-
- Import test data from `tests/fixtures/testData.ts`
|
|
119
|
-
- Use `baseURL` for navigation (relative paths)
|
|
120
|
-
- Auth: reuse existing storageState setup
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
## Out of Scope
|
|
124
|
-
|
|
125
|
-
This skill only reads and reports on the codebase. For related tasks, use the appropriate skill:
|
|
126
|
-
|
|
127
|
-
| Task | Skill |
|
|
128
|
-
|------|-------|
|
|
129
|
-
| Browsing a live site, interacting with UI elements | `agent-web-interface-guide` |
|
|
130
|
-
| Deciding what to test, coverage gaps, priorities | `plan-test-coverage` |
|
|
131
|
-
| Writing or modifying executable test code | `write-test-code` |
|
|
132
|
-
| Diagnosing flaky or failing tests | `fix-flaky-tests` |
|
|
133
|
-
|
|
134
|
-
## Example Usage
|
|
135
|
-
|
|
136
|
-
```
|
|
137
|
-
Claude Code: /analyze-test-codebase
|
|
138
|
-
Codex: $analyze-test-codebase
|
|
139
|
-
|
|
140
|
-
Claude Code: /analyze-test-codebase ./my-app
|
|
141
|
-
Codex: $analyze-test-codebase ./my-app
|
|
142
|
-
```
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
interface:
|
|
2
|
-
display_name: "Analyze Existing Test Setup"
|
|
3
|
-
short_description: "Inspect Playwright conventions before planning or writing tests"
|
|
4
|
-
default_prompt: "Analyze this Playwright codebase and summarize the current setup as an early workflow step before planning detailed coverage or writing test code."
|