Skip to content

Feat/e2e testing - #47

Merged
7sg56 merged 9 commits into
mainfrom
feat/e2e-testing
May 26, 2026
Merged

7sg56 merged 9 commits into
mainfrom
feat/e2e-testing

Conversation

@7sg56

@7sg56 7sg56 commented May 24, 2026 •

Copy link
Copy Markdown
Owner

What does this PR do?

Full testing infrastructure for Cinder-notes across three tiers: Rust backend unit tests, React component tests, and Playwright end-to-end tests.

Related issue

#46

Commits

bd82f51
test(rust): add comprehensive unit tests for commands, trash, and workspace modules

43730bb
test(react): add Vitest + React Testing Library component tests

0604fc3
chore: add data-testid attributes to 7 components for E2E testing

fa87702
test(e2e): add Playwright E2E test suite with 42 tests across 6 specs

7d89ef6
ci: add tests.yml workflow for Rust, React, and Playwright tests

fae49ba
ci: rename workflow files for clarity


Rust Backend Tests (41 tests)

Unit tests added directly within each module behind #[cfg(test)], using tempfile for isolated filesystem testing.

  • commands.rs (18 tests) -- read_note, write_note, create_note, rename_note, create_folder, scan_workspace, search_workspace, workspace_stats, delete_note, delete_folder
  • trash.rs (12 tests) -- manifest read/write roundtrip, move_to_trash (file and folder), restore_item, delete_item, empty_all
  • workspace.rs (10 tests, 7 new) -- validate_workspace_path, nested directory scanning, sort order (folders first, alphabetical within type), hidden directory and non-markdown file exclusion

React Component Tests (26 tests)

Vitest + React Testing Library + jsdom. Tauri APIs are fully mocked in a shared setup file.

  • SearchPanel (8 tests) -- conditional rendering, search input, close button, empty state, results display, result click
  • EditorTabs (10 tests) -- tab name rendering (Welcome, Untitled, Settings, About, Trash, regular file), tab click, new tab, sidebar toggle, fullscreen toggle
  • WorkspaceWelcome (8 tests) -- brand rendering, action buttons, recent workspaces list, keyboard shortcut hint

Playwright E2E Tests (42 tests)

Browser-based tests running against the Vite dev server. All selectors use data-testid attributes.

  • smoke.spec.ts (5 tests) -- app load, page title, CSS variables, console errors, initial render
  • welcome.spec.ts (9 tests) -- brand display, action buttons, description text, hint, recent workspaces, layout structure
  • layout.spec.ts (10 tests) -- sidebar, editor area, file explorer, file tree, toolbar buttons
  • editor.spec.ts (10 tests) -- tab bar, new tab creation, sidebar toggle, fullscreen, editor header, undo/redo, preview toggle
  • search.spec.ts (8 tests) -- modal visibility, keyboard shortcut open/close, input focus, Escape close, button close, backdrop click

CI Changes

Workflow files renamed for clarity and a new test pipeline added:

build.yml
(was
ci.yml
)
Build
Lint, typecheck, prettier, Vite build, Tauri build

tests.yml
Tests
Rust tests, React component tests, Playwright E2E (parallel)

node-setup.yml
(was
setup.yml
)
Node Setup
Reusable
npm ci
+
node_modules
cache

The Playwright job uploads the HTML report as a GitHub artifact (14-day retention) for failure inspection.

npm Scripts

test:rust
cargo test --manifest-path src-tauri/Cargo.toml

test:ui
vitest run --config vitest.config.ts

test:ui:watch
vitest --config vitest.config.ts

test:e2e
npx playwright test

test:e2e:ui
npx playwright test --ui

7sg56 added 9 commits May 24, 2026 22:45
…kspace modules

- commands.rs: 18 tests covering CRUD, search, scan, stats, delete
- trash.rs: 12 tests covering manifest, move/restore/delete/empty
- workspace.rs: 7 new tests for validation, nested scan, sort order

Total: 41 Rust tests passing
- Configure vitest with jsdom environment and Tauri API mocks
- SearchPanel: 8 tests (rendering, search input, close, results)
- EditorTabs: 10 tests (tab names, clicks, sidebar toggle, fullscreen)
- WorkspaceWelcome: 8 tests (brand, actions, recents, keyboard hint)
- Add test:rust, test:ui, test:ui:watch scripts to package.json

Total: 26 component tests passing
37 testids added across:
- WorkspaceWelcome (welcome-page, welcome-create-new, etc.)
- MainLayout (main-layout, sidebar, editor-area)
- FileExplorer (file-explorer, explorer-search, file-tree, etc.)
- EditorTabs (editor-tabs, editor-tab, new-tab-button, etc.)
- EditorPane (editor-pane)
- EditorHeader (editor-header, undo-button, redo-button, preview-toggle)
- SearchPanel (search-backdrop, search-modal, search-input, etc.)
- Upgrade playwright.config.ts: CI reporters, trace/video/screenshot
- Add shared helpers (resetApp, locators, utility functions)
- smoke.spec.ts: 5 tests (load, title, CSS vars, console, render)
- welcome.spec.ts: 9 tests (brand, buttons, descriptions, hints)
- layout.spec.ts: 10 tests (sidebar, editor, explorer, toolbar)
- editor.spec.ts: 10 tests (tabs, new tab, toggle, header, undo/redo)
- search.spec.ts: 8 tests (modal, shortcuts, input, close, backdrop)
- Update .gitignore with Playwright output directories
Separate test pipeline running in parallel:
- Rust backend tests (cargo test, no node setup needed)
- React component tests (vitest, needs node_modules)
- Playwright E2E tests (with browser install and report artifact)
- Gate job to verify all test jobs pass

Existing ci.yml remains unchanged for build checks.
- ci.yml -> build.yml (lint, typecheck, prettier, vite/tauri build)
- setup.yml -> node-setup.yml (reusable npm ci + cache)
- Update all internal references
@7sg56
7sg56 merged commit 5903fd1 into main May 26, 2026
11 of 13 checks 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