Testing
Crosswalker has three separate test surfaces. Know which you’re working on before picking commands.
| # | Surface | Framework | When to run |
|---|---|---|---|
| 1 | Plugin unit tests | Jest + ts-jest | Every plugin code change |
| 2 | Plugin E2E tests | WebdriverIO + wdio-obsidian-service | Before release, after core logic changes |
| 3 | Docs E2E tests | Playwright | Every docs change (content, theme, plugins), before deploy |
1. Plugin unit tests (Jest)
Section titled “1. Plugin unit tests (Jest)”Unit tests use Jest with ts-jest and a minimal Obsidian API mock at tests/__mocks__/obsidian.ts. Fully headless — no Obsidian runtime required.
What’s tested
Section titled “What’s tested”- CSV parser — parsing, column analysis, edge cases, streaming
- Settings data — defaults, validation
- Config manager — fingerprinting, matching (planned)
- Generation engine — output structure (planned)
Writing a unit test
Section titled “Writing a unit test”Tests live in tests/ alongside the code they test:
Lint (part of the plugin unit-test surface)
Section titled “Lint (part of the plugin unit-test surface)”Required for community plugin submission:
Uses eslint-plugin-obsidianmd to enforce things like sentence case for UI text, no manual createEl('h3') for settings headings, no plugin name in heading text, etc. See the contributing page for the full rule list.
2. Plugin E2E tests (WebdriverIO)
Section titled “2. Plugin E2E tests (WebdriverIO)”E2E tests use WebdriverIO with wdio-obsidian-service to drive a real Obsidian instance via Chrome DevTools Protocol. Tests can exercise the import wizard, navigate multi-step flows, and verify generated vault structure.
Not run in CI currently (on the roadmap). Verifies:
- Plugin loads correctly into a fresh test vault
- Import wizard opens and all four steps render
- File generation produces expected folder structure and frontmatter
- Settings UI persists changes across reloads
See wdio.conf.mts for the config and test/e2e/ for specs.
3. Docs E2E tests (Playwright)
Section titled “3. Docs E2E tests (Playwright)”The docs site has a Playwright suite in docs/tests/ that runs against a built + previewed site. Catches rendering regressions, 404s, console errors, and verifies the UX/theme decisions.
Test suites
Section titled “Test suites”| Spec | Tests | Covers |
|---|---|---|
smoke.spec.ts | 10 | Homepage load, Nova top nav, sidebar, search, content pages (installation, features, agent-context, blog, architecture) |
deployment.spec.ts | 4 | HTTP 200, no console errors, no failed asset requests, meta tags present |
ux-fixes.spec.ts | 20 | Content width clamp at multiple breakpoints, narrower sidebar width, lastUpdated footer, PageTitle override (volatility badges + h1#_top accessibility anchor), smoke tests for new pages, regression checks |
Running the docs tests
Section titled “Running the docs tests”From docs/:
Or via the orchestrator from the repo root:
Testing against the live site
Section titled “Testing against the live site”Point Playwright at the production deployment instead of local preview:
Prerequisites (first time only)
Section titled “Prerequisites (first time only)”Configuration
Section titled “Configuration”- Config file:
docs/playwright.config.ts - Base path:
/crosswalker(matchesbaseinastro.config.mjs). Allpage.goto()calls must prefix this - Preview server: auto-starts
bun run previewon port 4321 - Browser: Chromium only (sufficient for docs coverage)
- Screenshots on failure: automatically captured to
docs/test-results/
Writing a new Playwright test
Section titled “Writing a new Playwright test”Common pitfalls:
| Issue | Fix |
|---|---|
| 404 on all pages | Forgot bun run build — preview serves from dist/ |
| Chromium not found | bun x playwright install chromium |
| Tailwind classes missing | Check docs/src/styles/global.css has @source directives |
| Base path 404s | Prefix every page.goto() with ${BASE}/ |
| Page renders but elements missing | Check the browser console in headed mode — MDX compilation errors show up as console warnings |
When to add tests here
Section titled “When to add tests here”Add to ux-fixes.spec.ts (or a new spec) when you:
- Add a new Starlight component override (like the
PageTitleone) - Change global CSS that affects layout (content width, sidebar width, figure sizing)
- Add a new page that should be part of the smoke suite
- Fix a visual regression — add a test that would have caught it
Manual testing
Section titled “Manual testing”For things that can’t be automated (mostly plugin UI edge cases):
bun run serve:plugin(watch mode)- Open
test-vault/in Obsidian - Test the import wizard with sample data in
test-vault/Crosswalker Test Data/ - Check
crosswalker-debug.logfor detailed logs (enable in settings) - Use the Hot Reload plugin for faster iteration — no need to toggle the plugin on/off for each rebuild
Manual test documents live in test-vault/Crosswalker Test Docs/ for workflows that need guided human verification.
What to run before a PR
Section titled “What to run before a PR”Matrix by change surface:
| You changed | Minimum tests |
|---|---|
| Plugin TypeScript code | bun run test + bun run lint |
| Plugin UI (settings tab, modals) | Above + manual test in Obsidian |
| Plugin core logic (parser, generation) | Above + bun run e2e if you can run it locally |
docs/ content (.mdx) | cd docs && bun run test:local |
docs/ theme / CSS / components | Above + visually verify in bun run serve:docs at multiple viewport widths |
| Both plugin and docs | All of the above |
- Docs deploy:
.github/workflows/deploy-docs.ymlruns on push tomain, builds docs and publishes to GitHub Pages - Plugin release: manual via
bun run version+ tagged release
E2E tests (both plugin WebdriverIO and docs Playwright) are not currently run in CI — on the roadmap. Run them locally before PRs that touch areas they cover.