Skip to content

Test harness & developer-docs foundation for topics 4-7#31

Open
Cyclodex wants to merge 40 commits into
mainfrom
feature/test-harness-and-docs
Open

Test harness & developer-docs foundation for topics 4-7#31
Cyclodex wants to merge 40 commits into
mainfrom
feature/test-harness-and-docs

Conversation

@Cyclodex
Copy link
Copy Markdown
Member

Summary

Establishes a reproducible Vitest test harness (plus a thin opt-in Playwright extension-smoke layer) and a docs/architecture/ knowledge base for the four targeted topics: tooltip replacement, the form-manipulation layer (selectors/*, trigger*, waitFor*, fillForm), the shared/ storage wrappers, and the build/release tooling. Tests pin current behaviour — bugs included, flagged // KNOWN ISSUE: and mirrored in the relevant doc.

No runtime behaviour in packages/shared/** or packages/chrome-extension/src/** is changed; only TSDoc comments are added there. Fixing the known issues and TS-ifying the loose .js files are explicit follow-ups (separate specs).

Spec: docs/superpowers/specs/2026-05-12-test-harness-and-docs-foundation-design.md
Plan: docs/superpowers/plans/2026-05-13-test-harness-and-docs-foundation.md

What's in it

  • Harness — root vitest.config.ts with three workspace projects (shared / node, chrome-extension / jsdom, sidePanel-import / node), an in-memory chrome.storage + chrome.runtime fake (throws on un-faked members), a loadFixture helper, and npm test / test:fast / test:watch / test:e2e scripts.
  • Fixtures — 7 anonymised, trimmed bexio HTML captures + .md provenance siblings under packages/chrome-extension/test/fixtures/bexio/. Raw originals stay under git-ignored _raw/; a _raw/__build-fixtures.cjs (also git-ignored) documents the trim + anonymise pipeline.
  • Vitest tests (114)shared/ storage + helpers, the form-layer (selectors, trigger*, waitFor*, fillForm, readFormData, loader/delay/trimAll/pressEnter/generateHash), tooltip replacement (projectTable_TextCell, convertPopover, bexioProjectList happy + negative path), updateManifest.js (temp-dir), and a slow build smoke test (*.slow.test.ts).
  • Playwright extension-smoke (opt-in, 3 tests) — loads the built unpacked/ into Chromium and asserts the monitoring/edit content script injects #SoulcodeExtensionTemplates, the monitoring/list content script injects #PopoverTextSwitcher next to .globalsearch, and the side-panel React app mounts.
  • Docsdocs/architecture/{storage,form-layer,tooltip-replacement,build-and-release,testing}.md, an "Architecture deep-dives" section in CLAUDE.md, and TSDoc comments on the non-obvious source functions.

Known issues pinned (NOT fixed in this PR — follow-up specs)

  • chromeStorage.update / chromeStorage.remove array-only quirks (unknown-id update sets arr[-1]; non-array → []).
  • Build.ps1 swallows sub-build errors in catch blocks (a "successful" run can leave unpacked/ stale).
  • triggerCheckbox never dispatches a change event.
  • None of the waitFor* helpers (or triggerContactField) have a timeout — they poll forever (10k-iteration safety guard).
  • trimAll(null) throws TypeError.
  • pressEnter is constructed with keyCode: 13 but key: "".
  • deleteImportData is a no-op (ImportData is string[], not objects with .id).
  • renderHtml() crashes silently when .globalsearch is absent — pinned as both a success-path and a negative test.
  • kb_invoice modal-table selector is order-dependent — currently works because getElementsByClassName("list block") is order-independent, but a refactor to a CSS selector .list.block would silently break it.

Verification

  • npm test23 files, 114 tests passed (incl. the slow build smoke test).
  • npm run test:fast → 22 files, 112 passed (excludes the slow build test).
  • npm run test:e2e → 3 passed, 0 skipped (Playwright runs headless: false because MV3 service workers don't surface headlessly in the installed Chromium — documented in testing.md; CI can wrap with xvfb).

Test Plan / how to review

  • npm install && npm test → 114 pass.
  • npx playwright install chromium && npm run test:e2e → 3 pass.
  • Spot-read docs/architecture/testing.md for the manual real-bexio walkthrough checklist.
  • Spot-check packages/chrome-extension/test/fixtures/bexio/*.html for any leftover real names — should all be anonymised (Doe/Roe/Acme/Globex/Initech/Project Falcon placeholders).
  • Confirm no runtime source change in packages/shared/** or packages/chrome-extension/src/** (only TSDoc): git diff main...HEAD -- packages/shared packages/chrome-extension/src should be comment-only.

Out of scope (follow-up specs)

  • Fix the pinned known issues.
  • TS-ify updateManifest.js, service_worker.js, and the implicit-any spots in convertPopover.ts / onMessage.ts.
  • Decide whether to test packages/sidePanel-import/src/utils/csvParser.ts and AutoMapTemplatesV3.ts.
  • Remove the vestigial @swc/core dep if confirmed unused.
  • Real-bexio E2E (Playwright against a live account) — documented as manual for now.

Cyclodex added 30 commits May 12, 2026 22:46
f.style.display = 'none';
this.parentNode.appendChild(f);
f.method = 'post';
f.action = selectedDropdown.val();var m = document.createElement('input');
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.

2 participants