e2e-case-lifecycle
GitHub用于管理 ZCode 桌面端 E2E 用例的生命周期,涵盖规划、维护、回放及 CI 准入。包括覆盖率规划、手动审查用例捕获与证据记录,以及通过 Docker 和 CI 流程促进测试用例的正式化。
Trigger Scenarios
Install
npx skills add zai-org/ZCode --skill e2e-case-lifecycle -g -y
SKILL.md
Frontmatter
{
"name": "e2e-case-lifecycle",
"description": "Plan, maintain, replay, and promote ZCode desktop E2E cases and their fixtures, coverage matrices, and CI admission evidence.",
"disable-model-invocation": true
}
E2E Case Lifecycle
Use this skill for the z-code E2E lifecycle: manual-review automation, capture/replay evidence, formal fixture promotion, Docker admission, and CI. It is intentionally domain-neutral: use it for conversation flows, SSH, provider settings, UI workflows, filesystem behavior, remote runtimes, auth/config, and similar product surfaces. Work from the z-code repo root.
Required Reading
Before writing or moving an E2E spec, read the relevant sections of the domain's case catalog, coverage matrix, and workflow docs. For conversation-session work, the default sources are:
docs/conversation-session-case-catalog.mddocs/testing/conversation-session-e2e-coverage-matrix.mddocs/testing/conversation-session-e2e-development-workflow.md
If the request involves SSH, provider settings, auth/config, fork, goal, fault, model switch, or remote/replayable semantics, also read the matching matrix/spec document under docs/testing/ or the nearest feature docs.
Coverage Planning
For open-ended feature changes or "what should we cover?" requests, use
feature-boundary-planner first. Return here only after accepted cases
exist in the catalog/matrix.
When asked what to test:
- Extract state dimensions from the feature spec, catalog, and matrix.
- Enumerate combinations, then prune invalid or duplicate cases with the user.
- Write accepted/undefined/pruned decisions into catalog or matrix docs before code.
- Only generate E2E code for accepted semantics. If product behavior is undefined, stop at a question or doc update.
Do not claim coverage from a path that merely passes through a state; each covered case needs setup, action, and assertion.
Manual Review Case
For a new candidate case:
- Put the spec under the domain's
manual-review/pending/directory. For conversation-session this ispackages/desktop/test/e2e/conversation-session/manual-review/pending/. - Use stable
E2E_*markers in user prompts and provider matchers. - Prefer existing helpers in
packages/desktop/test/e2e/helpers/. - Use
buildReadonlyToolPrompt(...)for high/medium priority completed-history setup unless timing makes tool history counterproductive. - Run manual/capture with:
ZCODE_E2E_MANUAL_REVIEW=1 pnpm --filter @zcode/desktop test:e2e -- --spec './test/e2e/conversation-session/manual-review/pending/<case>.test.ts'
Manual/capture artifacts are review evidence, not the final test contract.
When a feedback reproduction run needs a video artifact, record the Electron
window from inside the app instead of using OS screen recording. Import
startElectronWindowRecording and ELECTRON_WINDOW_RECORDING_CAPTURE_MODE from
../../../helpers/electron-window-recorder.js in conversation
manual-review/pending/ specs, start recording before the user-visible path,
stop it in finally, and write video_capture_mode: ELECTRON_WINDOW_RECORDING_CAPTURE_MODE to the feedback manifest. Do not use
macOS Screen Recording, screencapture, QuickTime, or screenshot-only videos as
the normal evidence path.
Promotion
After the user confirms human review, run the promotion dry run first:
pnpm --filter @zcode/desktop e2e:promote -- --spec ./test/e2e/conversation-session/manual-review/pending/<case>.test.ts --reviewed
Then apply:
pnpm --filter @zcode/desktop e2e:promote -- --spec ./test/e2e/conversation-session/manual-review/pending/<case>.test.ts --reviewed --apply
The tool moves the spec, fixes common helper imports, creates fixture/manifest scaffolds, and updates the coverage matrix path. It does not decide request semantics.
On --apply, promotion treats those writes as one filesystem transaction and runs
pnpm audit:conversation-session-coverage against the tentative formal state. It
keeps the promotion only when the audit passes; audit failure or execution error
restores the pending spec, fixtures, manifest, and coverage matrix, then exits
nonzero. Therefore complete and validate the canonical fixture contract while the
spec is still pending instead of relying on post-promotion scaffolds.
Fixture Contract
Use case-local data by default:
packages/desktop/test/e2e/fixtures/upstream/common.jsonfor truly shared helper responses.packages/desktop/test/e2e/fixtures/upstream/<domain>/<case>.jsonfor case-specific provider responses.packages/desktop/test/e2e/fixtures/cases/<domain>/<case>.jsonfor manifest metadata.packages/desktop/test/e2e/fixtures/fs/<domain>/<case>/for file-system fixtures.
Classify each request as main, common, ignore, or synthetic. Developers review uncertain classifications; tools handle mechanical checks. Do not add new case-specific responses to provider-basic.json.
For timing:
fast-text: ordinary functional assertions.controlled-stream: stop, queue, interrupted, or running-window assertions.recorded-stream: performance or stream cadence assertions.fault-stream: socket, truncation, rate-limit, or error injection.
Every synthetic request needs a syntheticReason in fixture metadata and manifest requests.
Verification
After filling fixtures:
For a pending case, validate the current spec against its canonical formal-target fixture metadata before promotion:
pnpm --filter @zcode/desktop e2e:fixture:check -- --spec ./test/e2e/conversation-session/manual-review/pending/<case>.test.ts
The spec field in both the case manifest and case-local provider fixture remains
./test/e2e/conversation-session/<case>.test.ts while the current spec is pending. It is the canonical formal target,
not the current physical path. Pending replay remains explicit: pass E2E_PROVIDER_REPLAY_FIXTURE_PATH so a normal
manual-review run still captures the live provider path.
After promotion:
pnpm --filter @zcode/desktop e2e:fixture:check -- --spec ./test/e2e/conversation-session/<case>.test.ts
Prove the case does not depend on legacy shared fixtures:
E2E_PROVIDER_REPLAY_FIXTURE_PATH=packages/desktop/test/e2e/fixtures/upstream/common.json,packages/desktop/test/e2e/fixtures/upstream/conversation-session/<case>.json \
pnpm --filter @zcode/desktop exec wdio run wdio.conf.ts --spec './test/e2e/conversation-session/<case>.test.ts'
Then run default replay:
pnpm --filter @zcode/desktop exec wdio run wdio.conf.ts --spec './test/e2e/conversation-session/<case>.test.ts'
Before adding the case to the Docker suite, prove the formal case in isolated replay:
E2E_SPEC=./test/e2e/conversation-session/<case>.test.ts pnpm run test:e2e:container
After that passes, admit it to the Docker conversation preset:
pnpm --filter @zcode/desktop e2e:docker:admit -- --spec ./test/e2e/conversation-session/<case>.test.ts --verified --artifact packages/desktop/.e2e-artifacts/<run-id> --apply
pnpm run test:e2e:container:conversation
Docker runs are suite-oriented after admission. Use one isolated single-spec
Docker run only as the admission proof or for failure localization. Once a case
is admitted, batch stable compatible specs through the matching preset such as
pnpm run test:e2e:container:conversation; this reuses the image, container
startup, WDIO entrypoint, desktop app build, and agent server build. Split a case
into a separate preset or container only when it needs real capture, fault
injection, performance/timing-sensitive replay, global-state pollution, or
special network/file-system setup.
For E2E code changes, run the following required code checks once for the final change. Documentation-only edits use the documentation checks in AGENTS.md:
pnpm --filter @zcode/desktop typecheck:e2e
pnpm typecheck
pnpm lint
After the applicable lifecycle checks and code checks pass, finish; repeat or expand only after new edits, failures, or unresolved risks. Keep human review and promotion/admission requirements above intact. If a required environment or check is blocked, finish the executable parts and report the remaining evidence; use the root AGENTS.md completion rules and do not automatically commit incomplete verification. Report existing warnings separately from new failures.
Version History
- aac4755 Current 2026-10-18 16:06


