- Verify Node.js 20.12+ (
node -v) and npm (npm -v). - Follow the install steps in Getting Started.
If you see Standalone install policy: project-local installs are not supported:
- Remove
ui-testfromdependencies/devDependenciesinpackage.json. - Run
npm uninstall ui-test. - Use the supported one-off command from
README.md:npx -y github:ddv1982/ui-test setup --browsers chromium - Re-run
ui-test setup.
npx playwright install chromiumOn Linux, run:
npx playwright install-deps chromiumIf play e2e/example.yaml cannot reach the app:
- Verify the example app is running at
http://127.0.0.1:5173. - If you start the app manually, run
ui-test play --no-start.
Auto-start only applies when you run a user-created e2e/example.yaml. For other tests, start your app manually and use --no-start.
By default, play saves failure artifacts (failure-report.json, trace.zip, failure.png).
When one or more tests fail in a run, it also saves run-report.json.
If artifacts are missing:
- Ensure
artifactsDiris writable. - Override output path for the run:
ui-test play --artifacts-dir ./tmp/ui-test-artifacts- If needed, disable capture for the run:
ui-test play --no-save-failure-artifactsOpen a saved trace:
npx playwright show-trace .ui-test-artifacts/runs/<runId>/tests/<testSlug>/trace.zipIf replay or improve needs an existing signed-in session, pass a Playwright storage state JSON file explicitly:
ui-test play e2e/account.yaml --load-storage .auth/state.json
ui-test improve e2e/account.yaml --apply --load-storage .auth/state.jsonIf the session still is not present:
- Verify the file path is correct and readable.
- Regenerate the storage state JSON if it is stale.
- Re-run with the same
--load-storage <path>value on bothplayandimprove.
- Ensure you actually click/type/interact before closing the recording session.
- Re-run recording and verify the browser window is used.
- Check for fallback diagnostics in CLI output.
If auto-improve fails after recording, the recording is still saved. The CLI prints a warning with a manual command to retry.
Common causes:
- Chromium not installed — run
npx playwright install chromium. - The recorded test references a URL that is no longer reachable.
Fix the underlying issue, then run the improve step manually:
ui-test improve <file> --applyThis writes <file>.improved.yaml by default; use --in-place to overwrite the input file.
Dynamic news pages can behave differently between headed and headless runs when overlays or fast-changing headlines are present.
Current stability-first behavior:
playregisters targeted Playwright locator handlers (page.addLocatorHandler) for consent and known non-cookie modal roots, and removes handlers after the run.playattempts targeted pre-step dismissal for cookie consent and known non-cookie blocking modals (for example breaking-push style dialogs).- If a click fails with overlay interception,
playperforms one guarded retry after targeted overlay dismissal. record/normalization in reliable mode dropsexact: truefor dynamic headline-like locator text.improveattempts Playwright runtime selector regeneration for dynamic-flagged/brittle targets, but only adopts candidates with unique runtime match.improveskips deterministic post-clickassertVisiblefallback assertions for navigation-like dynamic link clicks and favors URL/title/snapshot-native candidates when available.
Useful diagnostics to confirm behavior:
overlay_dismissed_non_cookiedeterministic_assertion_skipped_navigation_like_clickselector_repair_adopted_on_tie_for_dynamic_targetselector_repair_generated_via_playwright_runtimeselector_repair_playwright_runtime_unavailableselector_repair_playwright_runtime_non_uniqueselector_repair_playwright_runtime_conversion_failedselector_repair_playwright_runtime_disabledselector_repair_playwright_runtime_private_fallback_disabledselector_repair_playwright_runtime_private_fallback_used
If your test still flakes:
- Re-run with traces enabled (default artifact capture) and inspect the failing step:
npx playwright show-trace .ui-test-artifacts/runs/<runId>/tests/<testSlug>/trace.zip
- Re-run improve in apply mode:
ui-test improve <file> --apply
- Prefer stable semantic targets (roles/test ids/nav labels) over long, exact headline text.
- If needed, disable runtime regeneration temporarily to isolate behavior:
UI_TEST_DISABLE_PLAYWRIGHT_RUNTIME_REGEN=1 ui-test improve <file> --apply
Runtime regeneration diagnostic meanings:
selector_repair_playwright_runtime_unavailable: runtime resolver or uniqueness check could not run in this environment.selector_repair_playwright_runtime_non_unique: runtime match count was not unique, so no repair was generated.selector_repair_playwright_runtime_disabled: runtime regeneration was explicitly disabled by env var.
If you see runtime validation errors:
- Install Chromium (
npx playwright install chromium). - Re-run with
ui-test setupif needed.
- Use
--applyor accept the interactive prompt — with--no-apply, improve writes a report only. - Use
--assertions candidates(notnone) — withnone, assertion generation is skipped. - Check the report's
applyStatusfor skip reasons (see Improve Workflow). - Re-run in a stable environment so runtime validation can pass.
- Deterministic source: generates
assertValue(fill/select),assertChecked(check/uncheck), and low-priority coverage fallbackassertVisiblecandidates for click/press/hover interactions. - Snapshot source:
assertVisibleis policy-driven (reliable: stable-structural only;balanced/aggressive: runtime-validated).assertTextcan be inserted after runtime validation. - Determinism guard: runtime-derived apply stays report-only when the test has no
baseUrl, replay targets another host, or replay drifts cross-origin. Check reportdeterminismand diagnostics such asdeterminism_missing_base_url/determinism_cross_origin_drift. - Assertion cap: apply cap is policy-driven (
reliable=1,balanced=2,aggressive=3) per source step; extras show asskipped_policy. - Legacy YAML:
optional: trueis no longer supported on steps. Remove this field from existing tests. - Version mismatch? Run
ui-test doctorto check invocation/version details.
If CLI behavior seems different from local source, check for warnings about binary path outside workspace:
node dist/bin/ui-test.js improve <test-file> --applyIf --assertion-source snapshot-native produces no snapshot-driven candidates:
- Ensure Chromium is installed (
npx playwright install chromium). - Check report diagnostics:
assertion_source_snapshot_native_empty— no page state changes detectedassertion_source_snapshot_native_parse_failed— snapshot could not be parsed
- Improve falls back to deterministic assertion candidates by design.