Skip to content

Repository files navigation

Synclib Test Harness

Integration/stress test tool for synclib sync. Run as different users, join shared rooms, insert/delete items, and watch changes propagate in real-time across browser tabs.

Setup

1. Create the database (one-time)

createdb synclib_test
cd /Users/phil/projects/sync/org/synclib_server
JWT_SECRET=synclib_test_secret DATABASE_URL=ecto://phil@localhost/synclib_test mix ecto.migrate

2. Start the server

cd /Users/phil/projects/sync/org/synclib_server
JWT_SECRET=synclib_test_secret DATABASE_URL=ecto://phil@localhost/synclib_test mix phx.server

Server runs on localhost:4444.

3. Start the client

cd /Users/phil/projects/sync/org/test-harness
pnpm install
pnpm dev

Client runs on localhost:3000.

Playwright Tests

Automated integration tests using Playwright. Requires the Phoenix server running on localhost:4444.

Note: The sync server must be running locally on localhost:4444 before running tests (see Start the server above).

# Install (first time)
pnpm install
npx playwright install chromium

# Run all tests
pnpm test

# Run with Playwright UI
pnpm test:ui

# Run a single test file
npx playwright test tests/topic-matching.spec.ts

Vite dev server starts automatically via the Playwright webServer config.

Manual Testing

  1. Open localhost:3000 in two browser tabs
  2. Tab 1: User = alice, Room = room-1 → click Connect
  3. Tab 2: User = bob, Room = room-1 → click Connect
  4. Add items in either tab — they should appear in the other tab within a second
  5. Delete items — deletions should sync across tabs too

What to verify

  • Basic sync: Add item as Alice → appears in Bob's tab
  • Delete sync: Delete item as Bob → disappears from Alice's tab
  • Reconnect: Disconnect Alice, add items as Bob, reconnect Alice → items appear
  • Room isolation: Connect Charlie to room-2 — should NOT see room-1 items
  • Event log: Watch the right panel for sync state changes, push/pull counts, and remote change events

Reset buttons

  • Reset Local — clears IndexedDB in the current browser tab (server data stays)
  • Reset All — clears both server items and all local IndexedDB databases

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages