Skip to content

Add desktop e2e tests in CI and auto-migrate old metadata - #3

Merged
antono merged 4 commits into
mainfrom
feat/semantic-vault
Nov 1, 2026
Merged

antono merged 4 commits into
mainfrom
feat/semantic-vault

Conversation

@antono

@antono antono commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Summary

Two pieces of work on this branch:

  1. Desktop e2e testing (1729ccd, eded90b): the first tests that drive the real cerbo-desktop binary.
  2. Automatic metadata migration (ddd71cf, 3974f22): the CLI and the desktop launcher detect pre-schema.org metadata and migrate it; README updated.

Desktop e2e tests

Tauri 3 is still alpha (3.0.0-alpha.5) and adds no e2e tooling, so this uses the official Tauri 2 route, which should survive the upgrade:

WebdriverIO ──:4444──▶ tauri-driver ──▶ WebKitWebDriver ──▶ cerbo-desktop (WebKitGTK)
  • Nix: tauri-driver 2.1.0 packaged in nix/pkgs.nix (it is not in nixpkgs) and exposed as .#tauri-driver. The devshell adds tauri-driver, xvfb-run and WEBKIT_WEBDRIVER. That variable points at the WebKitWebDriver shipped by the same webkitgtk_4_1 the app links, so driver and webview versions always match.
  • Harness (e2e/): WebdriverIO 10.1.0 spawns tauri-driver. Each spec file runs with its own temporary XDG config, cache and data dirs, set through a launcher script. Specs under e2e/specs/vault/ also get a fresh copy of test-vault/. The run fails fast if the binary is missing.
  • Smoke specs: first launch with no vaults shows the add-vault prompt; launch with a seeded vault opens that vault and lists its Index page.
  • Command: bun run test:e2e runs under xvfb-run when DISPLAY is unset. Usage is in the README.
  • CI (.github/workflows/e2e.yml): runs on pushes to main, on PRs and on manual dispatch. It reuses release.yml's Nix closure cache pattern under its own key, builds with bun run tauri build --no-bundle in the devshell and runs the suite headless.
  • Spec: openspec/changes/add-desktop-e2e-tests, a new desktop-e2e-testing capability.

Metadata migration

See ddd71cf for details:

  • CLI commands warn about vaults in the old format and migrate them first; --json stdout stays clean.
  • Verified files are cached per vault, so an unchanged vault costs one stat per file.
  • Nothing is rewritten while the desktop app holds desktop.lock.
  • New cerbo migrate vocabulary --if-needed.
  • The cerbo-desktop launcher runs the migration before starting the app; installCheckPhase verifies the launcher.

Notes for reviewers

  • CI tests the cargo-built binary, not the Nix package. It does not exercise the new migration launcher. nix build .#cerbo-desktop cannot cache incrementally without a binary cache and would rerun the whole workspace test suite on every PR. The trade-off is recorded in the openspec design.
  • The first e2e run will be slow because the caches start empty; the job timeout is 45 minutes.
  • WebKitWebDriver reports no rendered text for the sidebar vault label, so the vault check reads textContent instead.
  • vite.config.js: dropped a now-unused @ts-expect-error. WebdriverIO pulls in @types/node, so process is typed.

Test plan

  • bun run test:e2e passes locally, 3 of 3, headless, against both the nix build .#cerbo-desktop binary and the cargo-built target/release/cerbo-desktop
  • Developer ~/.config/cerbo and test-vault/ are unchanged after runs (checksums and git diff compared)
  • Missing CERBO_DESKTOP_BIN aborts the run with the path in the error
  • actionlint on e2e.yml; openspec validate add-desktop-e2e-tests --strict
  • vitest (76 tests), svelte-check (0 errors), nix build .#cerbo-frontend
  • E2E workflow passes on this PR

- package tauri-driver 2.1.0 in nix and add it, xvfb-run and
  WEBKIT_WEBDRIVER (from webkitgtk_4_1) to the devshell
- add e2e/ harness: WebdriverIO spawns tauri-driver, each spec runs
  with temp XDG dirs and its own copy of test-vault/
- add smoke specs for empty state and opening the fixture vault
- add `bun run test:e2e` (xvfb-run when DISPLAY is unset), README docs
- add openspec change add-desktop-e2e-tests
- drop stale @ts-expect-error in vite.config.js (@types/node now present)
- check every vault a command works on for pre-schema.org metadata,
  warn on stderr and migrate it first; --json stdout stays clean
- cache verified (mtime, size) per vault in $XDG_CACHE_HOME/cerbo/
  vocabulary so unchanged vaults cost one stat per file
- never rewrite while the desktop app runs: it holds desktop.lock and
  migrations defer; rewrite a file only if unchanged since planning
- add `cerbo migrate vocabulary --if-needed`; `cerbo migrate` no longer
  auto-registers the current directory's vault
- cerbo-desktop launcher runs the migration before starting the app,
  checked in installCheckPhase
- add e2e.yml: build app with `tauri build --no-bundle` in the devshell,
  run `bun run test:e2e` headless; cache Nix closure, target/, bun
- extend openspec add-desktop-e2e-tests with CI requirement and design
@antono
antono merged commit de7e969 into main Nov 1, 2026
1 check passed
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