@virtocommerce/test-automation-framework 0.0.0-stage → 0.1.0-alpha.1
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/.biome/formatter.json +11 -0
- package/.biome/imports.json +52 -0
- package/.biome/preset.json +4 -0
- package/.biome/rules.json +45 -0
- package/.claude/agents/qa-automation-expert.md +119 -0
- package/.claude/agents/qa-coverage.md +96 -0
- package/.claude/agents/qa-explorer.md +112 -0
- package/.claude/agents/qa-healer.md +88 -0
- package/.claude/agents/qa-judge.md +102 -0
- package/.claude/agents/qa-planner.md +104 -0
- package/.claude/agents/qa-reviewer.md +121 -0
- package/.claude/checks/browser-secrets.mts +107 -0
- package/.claude/checks/contract.mts +469 -0
- package/.claude/checks/expectation-guard.mts +665 -0
- package/.claude/checks/explore-extractors.mts +4 -0
- package/.claude/checks/judge-verdict.mts +165 -0
- package/.claude/checks/project-facts.mts +491 -0
- package/.claude/checks/prove-fails.mts +770 -0
- package/.claude/checks/rank-gaps.mts +177 -0
- package/.claude/checks/readonly-shell.mts +740 -0
- package/.claude/checks/reconcile-run.mts +270 -0
- package/.claude/checks/scan-prompts.mts +351 -0
- package/.claude/checks/stand.mts +45 -0
- package/.claude/checks/test-duration.mts +134 -0
- package/.claude/checks/test-shape.mts +224 -0
- package/.claude/checks/ticket-card.mts +195 -0
- package/.claude/commands/qa-coverage.md +13 -0
- package/.claude/commands/qa-explore.md +17 -0
- package/.claude/commands/qa-heal.md +44 -0
- package/.claude/commands/qa-implement.md +60 -0
- package/.claude/commands/qa-plan.md +55 -0
- package/.claude/commands/qa-review.md +90 -0
- package/.claude/commands/qa.md +156 -0
- package/.claude/hooks/readonly-shell.mts +65 -0
- package/.claude/settings.json +15 -0
- package/.claude/skills/coverage-analysis/SKILL.md +107 -0
- package/.claude/skills/create-graphql-layer/SKILL.md +159 -0
- package/.claude/skills/create-ui-layer/SKILL.md +189 -0
- package/.claude/skills/explore-api/SKILL.md +74 -0
- package/.claude/skills/explore-frontend/SKILL.md +85 -0
- package/.claude/skills/framework-rules/SKILL.md +189 -0
- package/.claude/skills/heal-tests/SKILL.md +197 -0
- package/.claude/skills/heal-tests/guard-recipe.md +53 -0
- package/.claude/skills/judge-criteria/SKILL.md +40 -0
- package/.claude/skills/judge-criteria/coverage.md +9 -0
- package/.claude/skills/judge-criteria/expert.md +23 -0
- package/.claude/skills/judge-criteria/explorer.md +9 -0
- package/.claude/skills/judge-criteria/healer.md +13 -0
- package/.claude/skills/judge-criteria/planner.md +12 -0
- package/.claude/skills/plan-implementation/SKILL.md +82 -0
- package/.claude/skills/plan-implementation/contract-template.md +72 -0
- package/.claude/skills/plan-test-strategy/SKILL.md +100 -0
- package/.claude/skills/project-facts/SKILL.md +130 -0
- package/.claude/skills/read-change/SKILL.md +64 -0
- package/.claude/skills/read-ticket/SKILL.md +63 -0
- package/.claude/skills/read-ticket/providers.md +58 -0
- package/.claude/skills/review-pr/SKILL.md +152 -0
- package/.claude/skills/review-test-code/SKILL.md +208 -0
- package/.claude/skills/write-e2e-test/SKILL.md +175 -0
- package/.claude/skills/write-graphql-test/SKILL.md +158 -0
- package/.claude/skills/write-rest-api-test/SKILL.md +182 -0
- package/.claude/skills/write-security-test/SKILL.md +253 -0
- package/.qa/project.example.json +71 -0
- package/CHANGELOG.md +1 -0
- package/LICENSE +12 -0
- package/README.md +53 -2
- package/bin/install-qa-agents.mjs +94 -0
- package/dist/auth/credentials.d.ts +10 -0
- package/dist/auth/credentials.js +2 -0
- package/dist/auth/credentials.js.map +1 -0
- package/dist/auth/frontend-browser-sessions.d.ts +71 -0
- package/dist/auth/frontend-browser-sessions.js +130 -0
- package/dist/auth/frontend-browser-sessions.js.map +1 -0
- package/dist/auth/index.d.ts +9 -0
- package/dist/auth/index.js +5 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/platform-browser-sessions.d.ts +47 -0
- package/dist/auth/platform-browser-sessions.js +92 -0
- package/dist/auth/platform-browser-sessions.js.map +1 -0
- package/dist/auth/sign-in-lock.d.ts +14 -0
- package/dist/auth/sign-in-lock.js +70 -0
- package/dist/auth/sign-in-lock.js.map +1 -0
- package/dist/auth/storage-state.d.ts +3 -0
- package/dist/auth/storage-state.js +2 -0
- package/dist/auth/storage-state.js.map +1 -0
- package/dist/auth/token-client.d.ts +82 -0
- package/dist/auth/token-client.js +111 -0
- package/dist/auth/token-client.js.map +1 -0
- package/dist/auth/token-manager.d.ts +67 -0
- package/dist/auth/token-manager.js +138 -0
- package/dist/auth/token-manager.js.map +1 -0
- package/dist/core/default-reporters.d.ts +31 -0
- package/dist/core/default-reporters.js +36 -0
- package/dist/core/default-reporters.js.map +1 -0
- package/dist/core/default-use.d.ts +28 -0
- package/dist/core/default-use.js +25 -0
- package/dist/core/default-use.js.map +1 -0
- package/dist/core/env.d.ts +24 -0
- package/dist/core/env.js +33 -0
- package/dist/core/env.js.map +1 -0
- package/dist/core/error-message.d.ts +10 -0
- package/dist/core/error-message.js +13 -0
- package/dist/core/error-message.js.map +1 -0
- package/dist/core/index.d.ts +16 -0
- package/dist/core/index.js +11 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/is-ci.d.ts +14 -0
- package/dist/core/is-ci.js +18 -0
- package/dist/core/is-ci.js.map +1 -0
- package/dist/core/parse-env.d.ts +13 -0
- package/dist/core/parse-env.js +21 -0
- package/dist/core/parse-env.js.map +1 -0
- package/dist/core/projects.d.ts +24 -0
- package/dist/core/projects.js +33 -0
- package/dist/core/projects.js.map +1 -0
- package/dist/core/run-options.d.ts +31 -0
- package/dist/core/run-options.js +43 -0
- package/dist/core/run-options.js.map +1 -0
- package/dist/core/secret.d.ts +105 -0
- package/dist/core/secret.js +167 -0
- package/dist/core/secret.js.map +1 -0
- package/dist/core/string-schemas.d.ts +39 -0
- package/dist/core/string-schemas.js +56 -0
- package/dist/core/string-schemas.js.map +1 -0
- package/dist/core/url-path.d.ts +7 -0
- package/dist/core/url-path.js +2 -0
- package/dist/core/url-path.js.map +1 -0
- package/dist/dataset/collection.d.ts +44 -0
- package/dist/dataset/collection.js +76 -0
- package/dist/dataset/collection.js.map +1 -0
- package/dist/dataset/index.d.ts +11 -0
- package/dist/dataset/index.js +6 -0
- package/dist/dataset/index.js.map +1 -0
- package/dist/dataset/load-dataset.d.ts +39 -0
- package/dist/dataset/load-dataset.js +62 -0
- package/dist/dataset/load-dataset.js.map +1 -0
- package/dist/dataset/manifest.d.ts +77 -0
- package/dist/dataset/manifest.js +10 -0
- package/dist/dataset/manifest.js.map +1 -0
- package/dist/dataset/placeholders.d.ts +66 -0
- package/dist/dataset/placeholders.js +87 -0
- package/dist/dataset/placeholders.js.map +1 -0
- package/dist/dataset/seed-collection.d.ts +53 -0
- package/dist/dataset/seed-collection.js +115 -0
- package/dist/dataset/seed-collection.js.map +1 -0
- package/dist/dataset/seed-dataset.d.ts +70 -0
- package/dist/dataset/seed-dataset.js +138 -0
- package/dist/dataset/seed-dataset.js.map +1 -0
- package/dist/dataset/seed-events.d.ts +81 -0
- package/dist/dataset/seed-events.js +2 -0
- package/dist/dataset/seed-events.js.map +1 -0
- package/dist/dataset/seed-requests.d.ts +102 -0
- package/dist/dataset/seed-requests.js +160 -0
- package/dist/dataset/seed-requests.js.map +1 -0
- package/dist/dataset/seed-scope.d.ts +39 -0
- package/dist/dataset/seed-scope.js +67 -0
- package/dist/dataset/seed-scope.js.map +1 -0
- package/dist/fixtures/default-fixtures.d.ts +93 -0
- package/dist/fixtures/default-fixtures.js +105 -0
- package/dist/fixtures/default-fixtures.js.map +1 -0
- package/dist/fixtures/index.d.ts +2 -0
- package/dist/fixtures/index.js +2 -0
- package/dist/fixtures/index.js.map +1 -0
- package/dist/graphql/graphql-client.d.ts +78 -0
- package/dist/graphql/graphql-client.js +83 -0
- package/dist/graphql/graphql-client.js.map +1 -0
- package/dist/graphql/graphql-codegen.d.ts +56 -0
- package/dist/graphql/graphql-codegen.js +42 -0
- package/dist/graphql/graphql-codegen.js.map +1 -0
- package/dist/graphql/graphql-error.d.ts +54 -0
- package/dist/graphql/graphql-error.js +74 -0
- package/dist/graphql/graphql-error.js.map +1 -0
- package/dist/graphql/index.d.ts +6 -0
- package/dist/graphql/index.js +4 -0
- package/dist/graphql/index.js.map +1 -0
- package/dist/http/authentication.d.ts +16 -0
- package/dist/http/authentication.js +2 -0
- package/dist/http/authentication.js.map +1 -0
- package/dist/http/http-client.d.ts +110 -0
- package/dist/http/http-client.js +237 -0
- package/dist/http/http-client.js.map +1 -0
- package/dist/http/http-error.d.ts +26 -0
- package/dist/http/http-error.js +34 -0
- package/dist/http/http-error.js.map +1 -0
- package/dist/http/http-method.d.ts +2 -0
- package/dist/http/http-method.js +2 -0
- package/dist/http/http-method.js.map +1 -0
- package/dist/http/http-response.d.ts +137 -0
- package/dist/http/http-response.js +166 -0
- package/dist/http/http-response.js.map +1 -0
- package/dist/http/index.d.ts +7 -0
- package/dist/http/index.js +4 -0
- package/dist/http/index.js.map +1 -0
- package/dist/http/request-options.d.ts +62 -0
- package/dist/http/request-options.js +2 -0
- package/dist/http/request-options.js.map +1 -0
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +2 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/modules/installed-modules.d.ts +86 -0
- package/dist/modules/installed-modules.js +135 -0
- package/dist/modules/installed-modules.js.map +1 -0
- package/docs/README.md +43 -0
- package/docs/concepts/areas.md +38 -0
- package/docs/concepts/auth.md +92 -0
- package/docs/concepts/config.md +102 -0
- package/docs/concepts/dataset.md +183 -0
- package/docs/concepts/environment.md +54 -0
- package/docs/concepts/fixtures.md +109 -0
- package/docs/concepts/graphql.md +76 -0
- package/docs/concepts/http.md +88 -0
- package/docs/concepts/modules.md +63 -0
- package/docs/concepts/secrets.md +50 -0
- package/docs/contributing/architecture.md +67 -0
- package/docs/contributing/conventions.md +39 -0
- package/docs/contributing/documentation.md +37 -0
- package/docs/contributing/releasing.md +76 -0
- package/docs/examples/auth.ts +20 -0
- package/docs/examples/config.ts +36 -0
- package/docs/examples/dataset.ts +70 -0
- package/docs/examples/environment.ts +8 -0
- package/docs/examples/fixtures.ts +41 -0
- package/docs/examples/getting-started.ts +22 -0
- package/docs/examples/graphql-codegen.ts +9 -0
- package/docs/examples/graphql.ts +32 -0
- package/docs/examples/http.ts +18 -0
- package/docs/examples/modules.ts +19 -0
- package/docs/examples/secrets.ts +11 -0
- package/docs/examples/tsconfig.json +10 -0
- package/docs/getting-started.md +106 -0
- package/docs/guides/generating-types.md +75 -0
- package/docs/guides/qa-agents.md +66 -0
- package/package.json +156 -4
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review-pr
|
|
3
|
+
description: "Review a pull request — analyze diffs, commit quality, CI result, test coverage and convention compliance across all changed files, and provide structured feedback"
|
|
4
|
+
argument-hint: "<pr-number-or-url>"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Pull Request Review
|
|
8
|
+
|
|
9
|
+
Analyze the full scope of the PR and give structured, actionable feedback. The skill `framework-rules` is the source
|
|
10
|
+
of the framework's rules and the repository's `CLAUDE.md` of its style; a framework rule beats a style rule.
|
|
11
|
+
|
|
12
|
+
## Review Process
|
|
13
|
+
|
|
14
|
+
### Step 1: Gather PR Context
|
|
15
|
+
|
|
16
|
+
The `qa-reviewer` shell is read-only and cannot run `gh`: the dispatcher fetches the commands below and passes
|
|
17
|
+
the diff and the metadata, and the reviewer works from those and from `git diff|log|show`.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
gh pr view <number> --json title,body,baseRefName,headRefName,files,additions,deletions,commits
|
|
21
|
+
gh pr diff <number>
|
|
22
|
+
gh pr checks <number>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Step 2: Understand the Scope
|
|
26
|
+
|
|
27
|
+
- What the PR does (title, description, linked ticket).
|
|
28
|
+
- Which parts changed: the framework (`src/` areas `core`, `http`, `auth`, `graphql`, `modules`, `dataset`,
|
|
29
|
+
`fixtures`; `tests/unit/`; `docs/`; `.changeset/`), the suite (`virtocommerce/`: `tests`, `fixtures`, `arrange`,
|
|
30
|
+
`builders`, `support`, `dataset`, `pages`, `graphql`, `rest`), config, CI.
|
|
31
|
+
- Which projects are affected: `restapi`, `graphql`, `e2e-frontend`, `e2e-backend`, `isolated`, `seed`, and the unit tests of
|
|
32
|
+
the framework (`unit`) and of the suite.
|
|
33
|
+
|
|
34
|
+
### Step 3: Review Each Changed File
|
|
35
|
+
|
|
36
|
+
**Specs (`virtocommerce/tests/**/*.spec.ts`):** apply the `/review-test-code` checklist.
|
|
37
|
+
|
|
38
|
+
**REST calls:**
|
|
39
|
+
- Paths and methods match the platform's API; response types come from `@rest/generated/platform.ts`, never
|
|
40
|
+
hand-written shapes.
|
|
41
|
+
- `expectOk()` before `json<T>()`; `optionalJson<T>({ allow404 })` only where "not found" is an answer.
|
|
42
|
+
- `virtocommerce/rest/generated/` regenerated with `npm run codegen:vc`, never edited by hand.
|
|
43
|
+
|
|
44
|
+
**GraphQL documents (`virtocommerce/graphql/**/*.graphql`):**
|
|
45
|
+
- Generated files regenerated in the same PR (`npm run codegen:vc`); no hand edits in
|
|
46
|
+
`virtocommerce/graphql/generated/`.
|
|
47
|
+
- Fragments reused instead of repeated field lists; optional modules' fields kept out of shared fragments.
|
|
48
|
+
|
|
49
|
+
**Page objects (`virtocommerce/pages/**`):**
|
|
50
|
+
- One class per file, named and placed as `virtocommerce/pages/README.md` says.
|
|
51
|
+
- `readonly` locators built in the constructor, `data-test-id` first, actions that wait for what they trigger.
|
|
52
|
+
- Frontend settings handled inside the page object; no test assertions, no API calls.
|
|
53
|
+
|
|
54
|
+
**Suite data (`virtocommerce/arrange/`, `builders/`, `support/`, `dataset/`):**
|
|
55
|
+
- Builders are pure `newX()` functions with unique values.
|
|
56
|
+
- `arrange` methods sit in the right domain and register the removal of what they create; `...Later` methods only
|
|
57
|
+
register removal.
|
|
58
|
+
- `dataset/data` or `dataset/manifest.ts` changes: which specs read the changed records? Is the seed still safe to
|
|
59
|
+
repeat? Does `npm run test:vc:unit` still pass?
|
|
60
|
+
|
|
61
|
+
**Fixtures (`virtocommerce/fixtures/`, `src/fixtures/`):**
|
|
62
|
+
- Right scope (worker vs test); worker fixtures have no per-test side effects.
|
|
63
|
+
- Minimal dependencies: every destructured fixture is built for each test that uses it.
|
|
64
|
+
- Options stay `user`, `shopperAs` and `modules`; renamed or removed fixtures updated in every spec, README, the
|
|
65
|
+
docs and CLAUDE.md.
|
|
66
|
+
|
|
67
|
+
**Framework source (`src/**`):**
|
|
68
|
+
- Layer rules of `.biome/layers.json`; nothing specific to one solution or store.
|
|
69
|
+
- Documentation comments on exported members; the concept page in `docs/concepts/` and the examples in
|
|
70
|
+
`docs/examples/` follow the change; a changeset in `.changeset/` for what consumers get.
|
|
71
|
+
- Unit tests in `tests/unit/` for every public behaviour.
|
|
72
|
+
|
|
73
|
+
**Config and CI (`virtocommerce/playwright.config.ts`, `virtocommerce/env.ts`, `src/core/env.ts`,
|
|
74
|
+
`.github/workflows/`, `virtocommerce/backend-packages.json`, `virtocommerce/modules.ts`):**
|
|
75
|
+
- New variables in the env schema and documented where the suite's environment is described.
|
|
76
|
+
- Projects, test directories and worker settings match the npm scripts and the workflows.
|
|
77
|
+
|
|
78
|
+
### Step 4: Cross-File Analysis
|
|
79
|
+
|
|
80
|
+
- **Consistency:** new specs follow their neighbours.
|
|
81
|
+
- **Callers:** changed signatures in the framework or in the suite's shared code are updated everywhere, the
|
|
82
|
+
documentation examples included.
|
|
83
|
+
- **Duplication:** new methods do not duplicate existing ones.
|
|
84
|
+
- **Coverage:** the PR tests what it adds; a bug fix has a test that fails without it; framework changes have
|
|
85
|
+
unit tests in `tests/unit/`.
|
|
86
|
+
- **Docs:** README, `docs/` and CLAUDE.md updated when conventions, options or scripts change.
|
|
87
|
+
|
|
88
|
+
### Step 5: Review Commit Quality
|
|
89
|
+
|
|
90
|
+
- Messages explain why, not only what.
|
|
91
|
+
- Each commit is one logical change.
|
|
92
|
+
|
|
93
|
+
### Step 6: Check CI
|
|
94
|
+
|
|
95
|
+
- Did `ci.yml` pass (typecheck, Biome, unit tests, docs check, changeset status)?
|
|
96
|
+
- Did `auto-tests.yml` (the shared `playwright-tests.yml`) pass for every database and search engine in its matrix?
|
|
97
|
+
- Are failures caused by the PR, or by a platform defect a test already names in an `issue` annotation?
|
|
98
|
+
|
|
99
|
+
## Output Format
|
|
100
|
+
|
|
101
|
+
```markdown
|
|
102
|
+
## PR Review: #<number> — <title>
|
|
103
|
+
|
|
104
|
+
### Summary
|
|
105
|
+
<2-3 sentence overview and quality assessment>
|
|
106
|
+
|
|
107
|
+
### Scope
|
|
108
|
+
- **Files changed:** <count>
|
|
109
|
+
- **Parts:** <framework src / unit tests / docs / changesets / suite tests / suite fixtures, arrange, builders,
|
|
110
|
+
support, dataset, pages / config / CI>
|
|
111
|
+
- **Projects affected:** <rest / graphql / frontend / backend / isolated / seed / unit>
|
|
112
|
+
|
|
113
|
+
### Critical Issues
|
|
114
|
+
- **[file:line]** <issue> — **Fix:** <specific fix>
|
|
115
|
+
|
|
116
|
+
### Warnings
|
|
117
|
+
- **[file:line]** <issue> — **Suggestion:** <improvement>
|
|
118
|
+
|
|
119
|
+
### Suggestions
|
|
120
|
+
- <idea>
|
|
121
|
+
|
|
122
|
+
### Coverage Assessment
|
|
123
|
+
- **New code tested:** Yes / No / Partially
|
|
124
|
+
- **Missing coverage:** <scenarios>
|
|
125
|
+
|
|
126
|
+
### Commit Quality
|
|
127
|
+
- <assessment>
|
|
128
|
+
|
|
129
|
+
### CI Status
|
|
130
|
+
- <passing / failing — details>
|
|
131
|
+
|
|
132
|
+
### Verdict
|
|
133
|
+
**APPROVE** | **REQUEST_CHANGES** | **NEEDS_DISCUSSION**
|
|
134
|
+
|
|
135
|
+
<brief rationale>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Common PR Patterns
|
|
139
|
+
|
|
140
|
+
**New coverage:** expect the happy path, error cases, identity differences and data removed after the test. Watch
|
|
141
|
+
for assertions on shared lists, dataset users whose state changes, and setup written in the spec instead of
|
|
142
|
+
`arrange`.
|
|
143
|
+
|
|
144
|
+
**Bug fix:** expect a test that fails without the fix. When a platform defect is fixed, the `issue` annotation of the
|
|
145
|
+
tests that caught it goes.
|
|
146
|
+
|
|
147
|
+
**Refactoring:** expect no behavior change;
|
|
148
|
+
`npx --no playwright test --config=virtocommerce --list --reporter=list` count unchanged unless intended. Watch for
|
|
149
|
+
removed tests without replacement and callers left behind.
|
|
150
|
+
|
|
151
|
+
**Infrastructure:** expect fixture, framework or `arrange` changes with all callers updated. Watch for fixtures that
|
|
152
|
+
now build more for every test, and changed removal order.
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review-test-code
|
|
3
|
+
description: "Review spec files and test infrastructure (page objects, builders, arrange, fixtures, support) for convention compliance, isolation, correctness, coverage gaps and best practices — produces actionable feedback; holds the reviewer's definition-of-done check of a contract's run"
|
|
4
|
+
argument-hint: "<file-path-or-pattern>"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Test Code Review
|
|
8
|
+
|
|
9
|
+
Read the skill `framework-rules` first, then check every item below against it (the framework's rules) and against the
|
|
10
|
+
repository's own style (its `CLAUDE.md`, linter configuration and neighbouring files). A framework rule beats a style
|
|
11
|
+
rule. Report only real issues, with line numbers.
|
|
12
|
+
|
|
13
|
+
## Review Process
|
|
14
|
+
|
|
15
|
+
### Step 1: Read the Files
|
|
16
|
+
|
|
17
|
+
Read each target file completely, plus what it depends on:
|
|
18
|
+
- the fixtures it destructures and the options it sets (`user`, `shopperAs`, `modules`);
|
|
19
|
+
- the `arrange` methods, builders and support functions it calls;
|
|
20
|
+
- the page objects it uses;
|
|
21
|
+
- the GraphQL documents behind its `…Document` imports and the generated REST types it names;
|
|
22
|
+
- the `MODULES` entries it gates on.
|
|
23
|
+
|
|
24
|
+
### Step 2: Structure (every spec)
|
|
25
|
+
|
|
26
|
+
- [ ] `test`, `expect` from `@fixtures`; nothing from `@playwright/test` (except unit tests).
|
|
27
|
+
- [ ] One `test.describe("<topic> (<who>)")` per identity; who acts is set only with `test.use` (`user`,
|
|
28
|
+
`shopperAs`, `modules`), with no wrapper around it.
|
|
29
|
+
- [ ] Every phase is a `test.step("arrange: …" | "act: …" | "assert: …")` (`"act and assert: …"` for one call
|
|
30
|
+
whose answer is the assertion); `expect` sits in `assert:` steps, or in an `arrange:` step that checks a
|
|
31
|
+
precondition. No hand-written `cleanup:` steps.
|
|
32
|
+
- [ ] Setup in the test body through `arrange`; a `beforeEach` only for what every test of the describe shares.
|
|
33
|
+
- [ ] Titles say what happens in plain words; one behaviour per test.
|
|
34
|
+
- [ ] No conditionals or `as` casts; repeated cases are one table-driven test (rows may hold small lambdas). A read
|
|
35
|
+
several tests of the file repeat is a `function` declaration at the end of the spec; one several specs need
|
|
36
|
+
belongs in `support/`, setup several specs need in `arrange`.
|
|
37
|
+
- [ ] No raw selectors; constants at module level in `UPPER_SNAKE_CASE`; dataset ids as constants, other seeded
|
|
38
|
+
values read through `dataset`.
|
|
39
|
+
- [ ] Placed by platform module (users and accounts in `security`); platform-wide changes in `tests/isolated/` with
|
|
40
|
+
`{ tag: DESTRUCTIVE_TAG }` on the describe.
|
|
41
|
+
|
|
42
|
+
### Step 3: Isolation and Cleanup
|
|
43
|
+
|
|
44
|
+
- [ ] Data the test changes is created with `arrange`; read-only data comes from `dataset`.
|
|
45
|
+
- [ ] A test that changes a customer's own state uses a customer created for the test (`shopperAs: "customer"` or
|
|
46
|
+
`arrange.customers.customer()`), never a dataset user.
|
|
47
|
+
- [ ] What the code under test creates is registered with a `…Later` method: before the act when a builder gave the
|
|
48
|
+
id, right after the act when the platform assigns it, always before the first assertion.
|
|
49
|
+
- [ ] No teardown code in the spec (`afterEach`, `try`/`finally`); missing removal is a new `arrange` method.
|
|
50
|
+
- [ ] Assertions target the test's own records (`toContain(id)`, `toMatchObject`), never a whole shared list.
|
|
51
|
+
- [ ] Deletions are proven by id (`optionalJson` returns `undefined`), not by a search.
|
|
52
|
+
- [ ] Store settings through `arrange.platform.storeSetting`; global settings only in `tests/isolated/`.
|
|
53
|
+
- [ ] A `leaves data` annotation explains every record the test cannot remove.
|
|
54
|
+
|
|
55
|
+
### Step 4: Waits and Data
|
|
56
|
+
|
|
57
|
+
- [ ] Index-backed reads wait in `arrange` or with `expect.poll(…, { timeout: INDEX_LAG_TIMEOUT_MS })`.
|
|
58
|
+
- [ ] No `waitForTimeout`, `networkidle`, sleeps or `expect(await locator.isVisible())`.
|
|
59
|
+
- [ ] Missing data fails loudly: `requireFields` / `requireDefined` / `lineItemOf`, no `?? ""`, `?? []`, `?? 0`.
|
|
60
|
+
- [ ] Expected errors are explicit: REST `expect(response.status).toBe(<status>)` with the reason from
|
|
61
|
+
`response.text` or `errorJson`; GraphQL `rejects.toThrow("[CODE]")` or `executeRaw` with its `errors`.
|
|
62
|
+
- [ ] Platform defects: the test asserts the correct behaviour. A confirmed defect that fails every time is a known
|
|
63
|
+
issue: `PLATFORM_DEFECT_TAG`, an `issue` annotation with the ticket URL when one exists, and
|
|
64
|
+
`test.fail(true, "<ticket>: <defect>")`. No `test.fixme`, `test.skip`, retries or workarounds, no `test.fail`
|
|
65
|
+
for anything else, and no expectation edited to match the build.
|
|
66
|
+
- [ ] Optional modules gated with `test.use({ modules: { … } })` on the describe; nothing adapted to an older
|
|
67
|
+
(stable) platform, a `minVersion` raised instead.
|
|
68
|
+
|
|
69
|
+
### Step 5: Project-Specific Checks
|
|
70
|
+
|
|
71
|
+
**REST:** direct calls on `api` (`get`/`post`/`put`/`delete`), success bodies through `expectOk().json<T>()` typed
|
|
72
|
+
with `@rest/generated/platform.ts`; paths as module-level constants; `api` signed in with `test.use({ user })`.
|
|
73
|
+
|
|
74
|
+
**GraphQL:** typed documents from `@graphql/generated/graphql.ts`; variables spread from `shopper.storeContext`;
|
|
75
|
+
`execute` for success, `executeRaw` only to read errors or partial data; nullable results unwrapped with
|
|
76
|
+
`requireFields` / `lineItemOf`; carts and lists from `arrange.carts`.
|
|
77
|
+
|
|
78
|
+
**E2E:** page objects from the `frontend` / `pageBuilder` / `pageDesigner` fixtures; data arranged through `arrange`
|
|
79
|
+
as `shopper`; no branch or skip on `QUANTITY_CONTROL`, `RANGE_FILTER_TYPE`, `CHECKOUT_MODE` (the page object hides
|
|
80
|
+
them); waits on the response an action triggers (`whenGraphql` / `whenResponse`) when the next step depends on it; new
|
|
81
|
+
tabs followed through the page object; UI sign-in only when sign-in is under test; no `page.goto` unless the URL is
|
|
82
|
+
under test.
|
|
83
|
+
|
|
84
|
+
### Step 6: Infrastructure Files
|
|
85
|
+
|
|
86
|
+
- [ ] Page objects: one class per file in kebab case under the right `pages/` directory; `readonly` locators built in
|
|
87
|
+
the constructor, `data-test-id` first, `.vc-*` classes only in `ui-kit/` and `vc-shell/`, settings hidden
|
|
88
|
+
behind methods, no test assertions, no API calls, imports only Playwright and other page objects.
|
|
89
|
+
- [ ] Builders: pure `newX()` functions with unique values (`uniqueId`), and a client-side `id` where the platform
|
|
90
|
+
keeps it.
|
|
91
|
+
- [ ] `arrange` methods: on the right domain, declared in its interface with a JSDoc that says what is created and
|
|
92
|
+
removed, registering removal with `later` before anything else can fail, waiting for index lag where the data is
|
|
93
|
+
searched; removals tolerate a record already gone; new result types exported from `arrange/index.ts`.
|
|
94
|
+
- [ ] Fixtures: right scope (worker or test); minimal dependencies; options only through `{ option: true }`.
|
|
95
|
+
- [ ] Support: small shared reads and waits; arrange waits with `pollUntil`, not loops with sleeps.
|
|
96
|
+
- [ ] REST calls typed with the generated types; generated files (`graphql/generated/`, `rest/generated/`) not edited
|
|
97
|
+
by hand.
|
|
98
|
+
- [ ] Layers respected (`.biome/layers.json`; the framework never imports suite code, the suite imports the framework
|
|
99
|
+
by package name); nothing duplicates an existing method.
|
|
100
|
+
- [ ] Framework code (`src/`): a unit test for each public behaviour; a public API change updates its concept page,
|
|
101
|
+
the examples in `docs/examples/` and adds a changeset in `.changeset/`.
|
|
102
|
+
|
|
103
|
+
### Step 7: Code Quality
|
|
104
|
+
|
|
105
|
+
- [ ] The facts' `commands.typecheck` and `commands.lint` pass. The dispatcher runs them; the reviewer's shell is
|
|
106
|
+
read-only, so the reviewer reports them as not checked.
|
|
107
|
+
- [ ] No `any`, no `!`, no floating promises, no unused imports.
|
|
108
|
+
- [ ] Named and exported functions are `function` declarations; arrows only for inline callbacks.
|
|
109
|
+
- [ ] Class state in `readonly #private` fields.
|
|
110
|
+
- [ ] No code comments; JSDoc short and only for what the signature cannot say.
|
|
111
|
+
- [ ] No credentials or URLs in code; secrets as `Secret`, revealed only at the call.
|
|
112
|
+
- [ ] Wording: frontend (not storefront), platform, platform admin, directory (not folder).
|
|
113
|
+
|
|
114
|
+
### Step 8: Coverage
|
|
115
|
+
|
|
116
|
+
- [ ] Happy path, and error cases (invalid input, unauthorized identity, missing record).
|
|
117
|
+
- [ ] Identities where behaviour differs.
|
|
118
|
+
- [ ] The test fails when the feature is broken (no vacuous assertions).
|
|
119
|
+
|
|
120
|
+
## Definition of Done
|
|
121
|
+
|
|
122
|
+
Used by `qa-reviewer` with a contract. Do not take the author's word for the run. The author left Playwright's
|
|
123
|
+
JSON report per project under `.qa/runs/<contract-name>/` (names: `project-facts`, "Hand-off Paths"). For each
|
|
124
|
+
Playwright project in the contract's case rows, with `<specs>` the changed spec files (repo-relative) and
|
|
125
|
+
`--config=<suiteDir>` from the facts (left out when `suiteDir` is `.`):
|
|
126
|
+
|
|
127
|
+
1. Make your own list of what should have run, as the stable series the author had to run
|
|
128
|
+
(`quality.stableSeries` from the facts), so that every missing repetition fails the reconciliation:
|
|
129
|
+
|
|
130
|
+
```shell
|
|
131
|
+
PLAYWRIGHT_JSON_OUTPUT_FILE=.qa/runs/<contract-name>/review-list.<project>.json npx --no playwright test --config=<suiteDir> --no-deps --list --reporter=json --project=<project> --repeat-each=<quality.stableSeries> <specs>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
2. Reconcile it with the author's report:
|
|
135
|
+
|
|
136
|
+
```shell
|
|
137
|
+
node .claude/checks/reconcile-run.mts .qa/runs/<contract-name>/review-list.<project>.json .qa/runs/<contract-name>/report.<project>.json
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Exit 1 means not done; copy each failure (test, project, why) into Critical, missing repetitions
|
|
141
|
+
included. A missing report file, a stand that was not reachable and no record, or a report you cannot read is
|
|
142
|
+
also not done.
|
|
143
|
+
3. Do not read the author's own `list.<project>.json` as the truth: it is theirs.
|
|
144
|
+
4. Your read-only shell cannot run typecheck and lint. Say in the Summary that they were not checked and name
|
|
145
|
+
`commands.typecheck` and `commands.lint` from the facts for the dispatcher to run; a diff that is clearly
|
|
146
|
+
type-unsafe (`any`, `!`, floating promises) is a finding on its own.
|
|
147
|
+
|
|
148
|
+
5. Shape and duration of every new or changed test, with `<specs>` the changed spec files and `<project>` each
|
|
149
|
+
project of the run:
|
|
150
|
+
|
|
151
|
+
```shell
|
|
152
|
+
node .claude/checks/test-shape.mts <specs>
|
|
153
|
+
node .claude/checks/test-duration.mts .qa/runs/<contract-name>/report.<project>.json <project> [<previous report>]
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Give a previous report only when the brief names one. Each line either prints is a finding (a shape finding names
|
|
157
|
+
`file:line`, a duration finding `file › describe › title`: find that test by its title in the spec; exit 1). It is
|
|
158
|
+
**Critical** only for a test the diff adds or changes: its spec is new, or a diff hunk adds or changes a line from
|
|
159
|
+
the test's first line to the end of the test call. A finding in another test of a touched file goes under
|
|
160
|
+
Suggestions as "already there" and never blocks. The limits are the facts' `quality`, never
|
|
161
|
+
your own. A project without a budget is judged only on the slowdown ratio.
|
|
162
|
+
|
|
163
|
+
APPROVE only when reconciliation exits 0 for every project and there is no Critical finding.
|
|
164
|
+
|
|
165
|
+
## Severity Levels
|
|
166
|
+
|
|
167
|
+
**Critical (must fix):** leaked data or removal registered after an assertion; teardown code in a spec; vacuous
|
|
168
|
+
assertions or none; shared-state races (a dataset user's cart, global settings outside `isolated`); fixed waits;
|
|
169
|
+
credentials in code; `test.fixme`, a retry or an edited expectation for a platform defect, or a `test.fail` that is not a known-issue
|
|
170
|
+
mark.
|
|
171
|
+
|
|
172
|
+
**Warning (should fix):** conditionals or casts in specs; raw selectors in specs; fallbacks hiding missing data; a
|
|
173
|
+
missing `issue` annotation where the contract names a ticket; deletion proven by search; layer violations;
|
|
174
|
+
duplicated methods; a test adapted to an older platform.
|
|
175
|
+
|
|
176
|
+
**Suggestion:** splitting a large test; a table for repeated cases; missing negative or identity coverage.
|
|
177
|
+
|
|
178
|
+
## Output Format
|
|
179
|
+
|
|
180
|
+
```markdown
|
|
181
|
+
## Review: <file path>
|
|
182
|
+
|
|
183
|
+
### Summary
|
|
184
|
+
<1-2 sentences: what is good, what needs work>
|
|
185
|
+
|
|
186
|
+
### Critical Issues
|
|
187
|
+
- **[line N]** <issue> — **Fix:** <specific fix>
|
|
188
|
+
|
|
189
|
+
### Warnings
|
|
190
|
+
- **[line N]** <issue> — **Suggestion:** <specific improvement>
|
|
191
|
+
|
|
192
|
+
### Suggestions
|
|
193
|
+
- <idea with rationale>
|
|
194
|
+
|
|
195
|
+
### Coverage Gaps
|
|
196
|
+
- <missing scenario>
|
|
197
|
+
|
|
198
|
+
### Verdict
|
|
199
|
+
APPROVE | REQUEST_CHANGES | NEEDS_DISCUSSION
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
When reviewing several files, write one section per file, then an overall summary.
|
|
203
|
+
|
|
204
|
+
## Example from this repository
|
|
205
|
+
|
|
206
|
+
- `suiteDir` is `virtocommerce`; the layer configuration is `.biome/layers.json`; the tables are in `CLAUDE.md`
|
|
207
|
+
"Layers".
|
|
208
|
+
- Page object rules: `virtocommerce/pages/README.md`.
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: write-e2e-test
|
|
3
|
+
description: "Write e2e specs for the frontend and for an admin UI app — page objects from the frontend, pageBuilder and pageDesigner fixtures, the shopper fixture and shopperAs option, data arranged through the API, web-first assertions"
|
|
4
|
+
argument-hint: "<area> <test-scenario>"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## E2E Spec Writing
|
|
8
|
+
|
|
9
|
+
Specs live where the suite's Playwright configuration (`<suiteDir>/playwright.config.ts`) puts the browser projects
|
|
10
|
+
(keys of `commands.test` in the project facts that run a browser): one directory per project, one subdirectory per
|
|
11
|
+
area. A project that shares state between tests runs with one worker; read its configuration instead of assuming.
|
|
12
|
+
|
|
13
|
+
A UI test checks the UI. Data rules (search semantics, prices, validation) are checked once through the API.
|
|
14
|
+
|
|
15
|
+
Read first: skill `framework-rules`, then `project-facts` (`node .claude/checks/project-facts.mts`), then
|
|
16
|
+
`virtocommerce/pages/README.md`. Copy the shape of a neighbouring spec of the same project.
|
|
17
|
+
|
|
18
|
+
## Step 1: Browser State Before the Test
|
|
19
|
+
|
|
20
|
+
The browser starts signed in: on the frontend as `shopper`, in the admin UI as `user` (or `ADMINISTRATOR` when `user`
|
|
21
|
+
is not set). Data the browser shows is arranged through the API as the same identity.
|
|
22
|
+
|
|
23
|
+
| Need | Use |
|
|
24
|
+
|---|---|
|
|
25
|
+
| Anonymous visitor | nothing (the default `shopperAs: "anonymous"`) |
|
|
26
|
+
| A fresh signed-in customer | `test.use({ shopperAs: "customer" })`; `customerOf(shopper)` (`@arrange`) gives its organization and contact ids |
|
|
27
|
+
| A dataset customer, read-only | `test.use({ shopperAs: ROLE_ACCOUNT })`, the credentials of `roles["<role>"]` from the suite's dataset users |
|
|
28
|
+
| A cart | `arrange.carts.cart(shopper, items)` or `checkoutReadyCart(shopper, items)`: the default cart, the one the frontend shows |
|
|
29
|
+
| Lists, addresses | `arrange.carts.shoppingList(shopper, items)`, `arrange.customers.memberAddress(shopper, memberId, draft)` |
|
|
30
|
+
| Admin UI content | the `arrange` domain that owns it, such as `arrange.content.page()` |
|
|
31
|
+
|
|
32
|
+
Sign in through the UI only when sign-in itself is under test. The shopper's default cart is removed after every
|
|
33
|
+
frontend test.
|
|
34
|
+
|
|
35
|
+
## Step 2: Write the Spec
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { expect, test } from "@fixtures";
|
|
39
|
+
import { GetCartDocument } from "@graphql/generated/graphql.ts";
|
|
40
|
+
|
|
41
|
+
const SKU = "smartphone-samsung-galaxy-a57-5g";
|
|
42
|
+
const QUANTITY = 3;
|
|
43
|
+
const NEW_QUANTITY = 4;
|
|
44
|
+
|
|
45
|
+
test.describe("cart (customer of their own)", () => {
|
|
46
|
+
test.use({ shopperAs: "customer" });
|
|
47
|
+
|
|
48
|
+
test("change the quantity of a line item", async ({ frontend, shopper, arrange }) => {
|
|
49
|
+
await test.step(`arrange: the cart holds ${SKU} ×${QUANTITY}`, () =>
|
|
50
|
+
arrange.carts.cart(shopper, [{ productId: `product-${SKU}`, quantity: QUANTITY }]));
|
|
51
|
+
const cart = frontend.cart();
|
|
52
|
+
const { quantity } = cart.lineItem(SKU);
|
|
53
|
+
|
|
54
|
+
await test.step("arrange: open the cart", async () => {
|
|
55
|
+
await cart.navigate();
|
|
56
|
+
await expect(quantity.input).toHaveValue(String(QUANTITY));
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
await test.step(`act: set the quantity to ${NEW_QUANTITY}`, () => quantity.setQuantity(NEW_QUANTITY));
|
|
60
|
+
|
|
61
|
+
await test.step(`assert: the badge and the stored cart hold ${NEW_QUANTITY}`, async () => {
|
|
62
|
+
await expect(cart.cartQuantityLabel).toHaveText(String(NEW_QUANTITY));
|
|
63
|
+
await expect
|
|
64
|
+
.poll(async () => {
|
|
65
|
+
const { cart: stored } = await shopper.graphql.execute(GetCartDocument, shopper.storeContext);
|
|
66
|
+
return stored?.items.map((item) => item.quantity);
|
|
67
|
+
})
|
|
68
|
+
.toEqual([NEW_QUANTITY]);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
- `test.describe("<topic> (<who>)")`: `(<a role from roles>)`, `(anonymous)`, `(customer of their own)`, or for an
|
|
75
|
+
admin UI test `(platform admin)`, the identity the admin UI signs in as.
|
|
76
|
+
- `frontend` builds page objects for the configured frontend (`frontend.cart()`, `frontend.checkout()`, …; modals
|
|
77
|
+
such as `frontend.pickupLocationsModal` are fields). The page objects hide the frontend's own settings (quantity
|
|
78
|
+
control, checkout mode, range filter type): specs never read those settings and never skip on them. Find the action
|
|
79
|
+
in the page object; when it is missing, add it with `/create-ui-layer`.
|
|
80
|
+
- To wait for what a click sends, use `whenGraphql` (or `whenResponse` for REST) from `@pages/shared/responses.ts`:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
await whenGraphql(page, "ClearCart", () => cart.clearCartModal.confirmButton.click());
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
- Shared setup for every test of a describe: a `test.beforeEach` with `arrange:` steps. Setup one test needs stays in
|
|
87
|
+
its body; setup several tests repeat may be a `function` declaration at the end of the spec that takes the fixtures
|
|
88
|
+
it needs (`openPickupLocations` in `checkout-delivery.spec.ts`).
|
|
89
|
+
|
|
90
|
+
## Step 3: Admin UI Tests
|
|
91
|
+
|
|
92
|
+
A browser test of an admin app uses that app's fixture and page objects (`pageBuilder`, `pageDesigner`), the identity
|
|
93
|
+
the admin UI signs in as, and `arrange` for the data the page shows. A precondition with no UI step goes through
|
|
94
|
+
`arrange` (add a method when it has none). What the admin UI creates in the test is removed after it, registered
|
|
95
|
+
before the act (`arrange.content.deletePagesLater(name)`). Gate the app's module on the describe:
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
import { expect, test } from "@fixtures";
|
|
99
|
+
import { MODULES } from "@modules";
|
|
100
|
+
import { Column, Route } from "@pages/backend/page-builder/routes.ts";
|
|
101
|
+
|
|
102
|
+
test.describe("status transitions (platform admin)", () => {
|
|
103
|
+
test.use({ modules: { pageBuilder: MODULES.pageBuilder } });
|
|
104
|
+
|
|
105
|
+
test("publishing a draft moves it to the active list", async ({ pageBuilder, arrange }) => {
|
|
106
|
+
const draft = await test.step("arrange: a draft page", () => arrange.content.page());
|
|
107
|
+
|
|
108
|
+
await test.step(`act: publish ${draft.name}`, async () => {
|
|
109
|
+
await (await pageBuilder.openPage(draft.name, Route.draft)).publish();
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
await test.step("assert: the page moved from the draft list to the active list", async () => {
|
|
113
|
+
expect(await pageBuilder.isListed(Route.draft, draft.name)).toBe(false);
|
|
114
|
+
expect(await pageBuilder.isListed(Route.active, draft.name)).toBe(true);
|
|
115
|
+
await expect(pageBuilder.listBlade.pageRow(draft.name).cell(Column.status)).toHaveText("Published");
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Assertions
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
await expect(locator).toBeVisible();
|
|
125
|
+
await expect(locator).toHaveText("…");
|
|
126
|
+
await expect(locator).toHaveValue("3");
|
|
127
|
+
await expect(locator).toHaveCount(2);
|
|
128
|
+
await expect.poll(() => cart.totalAmount()).toBeLessThan(before);
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Things to Keep in Mind
|
|
132
|
+
|
|
133
|
+
- Product links can open a new tab: follow them through the page object (an action that returns the page to build
|
|
134
|
+
on, such as `ProductCard.openConfigurations()`), never by clicking and asserting on the original `page`.
|
|
135
|
+
- Browser storage is fixed when the page opens: a lock or password change must happen before a UI sign-in.
|
|
136
|
+
- The frontend signs in with an e-mail address (`SignInPage.signIn(email, password)`).
|
|
137
|
+
|
|
138
|
+
## Rules
|
|
139
|
+
|
|
140
|
+
1. `test`, `expect` from `@fixtures`; page objects from the fixtures, their types and constants from `@pages/...`.
|
|
141
|
+
2. Every phase is a `test.step("arrange: …" | "act: …" | "assert: …")`.
|
|
142
|
+
3. No conditionals, `as` casts or raw selectors in the spec. A missing locator or action goes into
|
|
143
|
+
`virtocommerce/pages/` (`/create-ui-layer`).
|
|
144
|
+
4. Open pages with `navigate()` / `open(...)` / `start()`; no `page.goto` unless the URL itself is under test.
|
|
145
|
+
5. Web-first assertions; no `waitForTimeout`, no `networkidle`, no `expect(await locator.isVisible())`.
|
|
146
|
+
6. Data from `dataset`, changes through `arrange`, as the identity the browser is.
|
|
147
|
+
7. Platform defects: a confirmed defect is a known issue (`framework-rules`, Platform Defects); a new one stays failing.
|
|
148
|
+
8. Style (comments, naming, wording) comes from the repository's `CLAUDE.md`.
|
|
149
|
+
|
|
150
|
+
## Verify
|
|
151
|
+
|
|
152
|
+
Run `commands.typecheck`, `commands.lint` and `commands.test["<browser project>"]` from the project facts on the
|
|
153
|
+
changed spec, with the run record the expert agent describes. Add `--headed --workers=1` to watch a run.
|
|
154
|
+
|
|
155
|
+
## Example from this repository
|
|
156
|
+
|
|
157
|
+
- Projects: `e2e-frontend` (`virtocommerce/tests/e2e/frontend/<area>/<topic>.spec.ts`; areas account, cart, catalog,
|
|
158
|
+
checkout, lists, site; `E2E_WORKERS` workers) and `e2e-backend` (`virtocommerce/tests/e2e/backend/page-builder/`; one
|
|
159
|
+
worker, the page list is shared, the admin UI signed in as `ADMINISTRATOR`).
|
|
160
|
+
- Reference specs: `virtocommerce/tests/e2e/frontend/cart/cart.spec.ts`,
|
|
161
|
+
`virtocommerce/tests/e2e/frontend/checkout/checkout-delivery.spec.ts` (`beforeEach`, module gating, a pickup
|
|
162
|
+
location waited for in `arrange`), `virtocommerce/tests/e2e/backend/page-builder/page-status.spec.ts`,
|
|
163
|
+
`virtocommerce/tests/e2e/backend/page-builder/designer-sections.spec.ts` (`pageDesigner.open(pageId, language)`).
|
|
164
|
+
- A seeded product: `product-smartphone-samsung-galaxy-a57-5g`, SKU `smartphone-samsung-galaxy-a57-5g`.
|
|
165
|
+
- Frontend settings the page objects hide: `QUANTITY_CONTROL`, `RANGE_FILTER_TYPE`, `CHECKOUT_MODE`; `setQuantity`
|
|
166
|
+
works for either quantity control and `frontend.checkout()` walks the single-page or multi-step checkout.
|
|
167
|
+
- Page builder pages: `arrange.content.page()`, `publishedPage()`, `archivedPage()`; pages the admin UI creates in the
|
|
168
|
+
test: `arrange.content.deletePagesLater(name)` before the act.
|
|
169
|
+
- Commands: `npm run typecheck && npm run check`, then (`VERIFY_SSL=false` in front for a self-signed local
|
|
170
|
+
frontend):
|
|
171
|
+
|
|
172
|
+
```shell
|
|
173
|
+
npx --no playwright test --config=virtocommerce --no-deps virtocommerce/tests/e2e/frontend/<area>/<topic>.spec.ts --project=e2e-frontend
|
|
174
|
+
npx --no playwright test --config=virtocommerce --no-deps virtocommerce/tests/e2e/backend/page-builder/<topic>.spec.ts --project=e2e-backend
|
|
175
|
+
```
|