Skip to content

test: audit and clean up Playwright E2E suite#306

Merged
tomasz-tomczyk merged 1 commit intomainfrom
chore/e2e-audit
Apr 18, 2026
Merged

test: audit and clean up Playwright E2E suite#306
tomasz-tomczyk merged 1 commit intomainfrom
chore/e2e-audit

Conversation

@tomasz-tomczyk
Copy link
Copy Markdown
Owner

Summary

Audited all 60 Playwright E2E spec files across 5 projects (git-mode, file-mode, single-file, no-git, multi-file). Found and fixed:

  • Redundant tests: Removed file tree status/stats tests from loading.spec.ts that duplicated file-tree.spec.ts coverage (same assertions, same fixture)
  • Anti-pattern: Replaced bare setTimeout(1500) in rendered-diff.filemode.spec.ts with a polling loop that waits for the file watcher to detect edits before triggering round-complete — follows the documented exception pattern (sleep inside retry loop)
  • Type safety: Fixed any types in templates.spec.ts helper functions to use proper Page type from Playwright
  • Misleading comment: Corrected comment on tautological assertion (>= 0) in rendered-diff.filemode.spec.ts to accurately describe why the assertion is weak

What the audit found was already good

The suite is generally well-structured. Most files properly use clearAllComments in beforeEach, import from ./helpers, follow naming conventions, and use Playwright auto-retrying assertions. The toPass() wrapper is correctly used where snapshot counts are needed inside retry loops. No truly dead tests were found.

Notable observations (not actionable in this PR)

  • The accessibility.spec.ts dark theme contrast test has a waitForTimeout(100) that is pragmatically necessary for axe-core CSS propagation — no clean replacement exists
  • settings-panel.filemode.spec.ts and theme.filemode.spec.ts are near-duplicates of their git-mode counterparts, but they exercise different server fixtures so removing them would reduce coverage
  • Many .count() + expect(count).toBeGreaterThan(N) patterns exist but are preceded by toBeVisible() assertions that stabilize the DOM, making them low-risk

Test plan

  • Full E2E suite passes (make e2e) — 554 tests across 5 projects

- Remove redundant file tree tests from loading.spec.ts (already
  covered by file-tree.spec.ts)
- Fix `any` types in templates.spec.ts helpers to use proper
  `Page` type from Playwright
- Replace bare `setTimeout(1500)` in rendered-diff.filemode.spec.ts
  with a polling loop that waits for the file watcher to detect
  edits before triggering round-complete
- Fix misleading comment on tautological assertion in
  rendered-diff.filemode.spec.ts
@tomasz-tomczyk tomasz-tomczyk merged commit f4fe207 into main Apr 18, 2026
4 checks passed
@tomasz-tomczyk tomasz-tomczyk deleted the chore/e2e-audit branch April 18, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant