Repository navigation
Description
Problem
19 frontend tests are currently failing. Analysis shows these are tests that require the HTTP dev server to be running with full database mode, but are failing even when endpoints are available.
Failing Tests Breakdown
Total: 19 failures across 8 test files
Category 1: Browser Positioning Tests (4 failures)
Files:
src/tests/browser/autocomplete-interaction.test.ts(2 failures)src/tests/browser/slash-dropdown-interaction.test.ts(2 failures)
Error Pattern:
AssertionError: expected 0 to be greater than 0
Tests:
- "verifies getBoundingClientRect returns real dimensions" (autocomplete)
- "can calculate dropdown position relative to cursor" (autocomplete)
- "verifies getBoundingClientRect for dropdown positioning" (slash)
- "can calculate cursor position for dropdown placement" (slash)
Root Cause: getBoundingClientRect() returns 0 dimensions in browser test environment.
Category 2: Integration Tests Requiring HTTP Server (12 failures)
Files:
src/tests/services/database-persistence.test.ts(suite-level failure)src/tests/services/event-emission.test.ts(suite-level failure)src/tests/services/node-ordering.test.ts(suite-level failure)src/tests/integration/edge-cases.test.ts(3 tests)src/tests/integration/integration-scenarios.test.ts(3 tests)src/tests/integration/regression-prevention.test.ts(6 tests)
Common Pattern: Tests attempting to use HTTP endpoints but failing with various errors.
Examples:
- "should cleanup resources on timeout"
- "should handle mention creation with non-existent nodes"
- "should create container node and establish mention relationship"
- "should maintain sibling order for container nodes"
- "should handle concurrent container node creation"
Root Cause: These tests expect HTTP dev server but are running in default in-memory mode, or endpoints are returning errors.
Category 3: Suite-Level Failures (3 test suites)
Files:
src/tests/services/database-persistence.test.tssrc/tests/services/event-emission.test.tssrc/tests/services/node-ordering.test.ts
Issue: Entire test suites failing (not individual tests).
Root Cause: Likely setup/teardown issues or missing database initialization.
Investigation Needed
-
Check if tests should be running in in-memory mode or database mode
- If database mode only: Should use
it.skipIf(!shouldUseDatabase()) - If in-memory compatible: Need to fix the test implementation
- If database mode only: Should use
-
Browser positioning tests
- Verify Playwright browser is rendering properly
- Check if elements are mounted before getBoundingClientRect calls
- May need
waitForor similar async coordination
-
Suite-level failures
- Review beforeAll/afterAll hooks
- Check database initialization in test setup
- Verify cleanup between tests
Reproduction
# Default in-memory mode (19 failures)
bun run test
# Database mode (need to verify behavior)
bun run test:db
# Browser tests specifically
bun run test:browserAcceptance Criteria
- All 19 failing tests pass
- Browser positioning tests return non-zero dimensions
- Integration tests properly skip in in-memory mode OR work in in-memory mode
- Suite-level test setup/teardown fixed
- Root cause documented for each failure category
- Tests pass:
bun run test
Related Issues
- Migrate integration tests to Vitest Browser Mode #282 (Browser Mode infrastructure - complete)
- Fix 22 test failures from recent schema and browser test work #406 (closed - addressed backend, but frontend failures remain)
Priority
🔴 HIGH - 19 failing tests reduce confidence in frontend codebase.
Technical Specifications
Reference Files
Browser Tests:
packages/desktop-app/src/tests/browser/autocomplete-interaction.test.tspackages/desktop-app/src/tests/browser/slash-dropdown-interaction.test.ts
Integration Tests:
packages/desktop-app/src/tests/integration/edge-cases.test.tspackages/desktop-app/src/tests/integration/integration-scenarios.test.tspackages/desktop-app/src/tests/integration/regression-prevention.test.ts
Service Tests:
packages/desktop-app/src/tests/services/database-persistence.test.tspackages/desktop-app/src/tests/services/event-emission.test.tspackages/desktop-app/src/tests/services/node-ordering.test.ts
Activity
Fix 19 frontend test failures by adding database mode guards
Archive resolved investigation and handoff documents
Fix 19 frontend test failures by adding database mode guards (#410)
Fix 19 frontend test failures by adding database mode guards (#410)
Fix 19 frontend test failures by adding database mode guards (#410)