Skip to content

Fix 19 frontend test failures (browser positioning and HTTP integration tests) #409

Closed

Description

@malibio

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:

  1. "verifies getBoundingClientRect returns real dimensions" (autocomplete)
  2. "can calculate dropdown position relative to cursor" (autocomplete)
  3. "verifies getBoundingClientRect for dropdown positioning" (slash)
  4. "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.ts
  • src/tests/services/event-emission.test.ts
  • src/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

  1. 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
  2. Browser positioning tests

    • Verify Playwright browser is rendering properly
    • Check if elements are mounted before getBoundingClientRect calls
    • May need waitFor or similar async coordination
  3. 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:browser

Acceptance 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


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.ts
  • packages/desktop-app/src/tests/browser/slash-dropdown-interaction.test.ts

Integration Tests:

  • packages/desktop-app/src/tests/integration/edge-cases.test.ts
  • packages/desktop-app/src/tests/integration/integration-scenarios.test.ts
  • packages/desktop-app/src/tests/integration/regression-prevention.test.ts

Service Tests:

  • packages/desktop-app/src/tests/services/database-persistence.test.ts
  • packages/desktop-app/src/tests/services/event-emission.test.ts
  • packages/desktop-app/src/tests/services/node-ordering.test.ts

Activity

  1. added
    bug
    on Nov 4, 2025
  2. self-assigned this
    on Nov 4, 2025
  3. added a commit that references this issue on Nov 4, 2025
    b263b07
  4. added 2 commits that reference this issue on Feb 4, 2026
    672199a
    3d91ea5
  5. added a commit that references this issue on Feb 26, 2026
    1f461e3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugfrontendtesting

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions