-
Notifications
You must be signed in to change notification settings - Fork 116
E2E Test Suite for Query-Driven Sync #773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: query-driven-sync
Are you sure you want to change the base?
Conversation
|
More templates
@tanstack/angular-db
@tanstack/db
@tanstack/db-ivm
@tanstack/electric-db-collection
@tanstack/offline-transactions
@tanstack/powersync-db-collection
@tanstack/query-db-collection
@tanstack/react-db
@tanstack/rxdb-db-collection
@tanstack/solid-db
@tanstack/svelte-db
@tanstack/trailbase-db-collection
@tanstack/vue-db
commit: |
|
Size Change: 0 B Total Size: 84.1 kB ℹ️ View Unchanged
|
|
Size Change: 0 B Total Size: 3.34 kB ℹ️ View Unchanged
|
7d9a5ae to
d65f4cf
Compare
Implement end-to-end tests for sync feature Implement end-to-end tests for sync feature chore: revert pnpm-lock.yaml to match query-driven-sync chore: update pnpm-lock.yaml with e2e test pg dependencies bump pnpm/action-setup version fix pnpmlockfile format only run normal tests on test command tidy and fix types fixes ci fix tidy
f9168b8 to
0e62f00
Compare
0e62f00 to
3c126b3
Compare
dec84cb to
2edeb4f
Compare
Summary
Implements a comprehensive end-to-end test suite for the query-driven sync feature with on-demand collection loading (RFC #676, PR #763). This PR adds a new shared test infrastructure package and integrates it with both Electric and Query collection implementations.
What's New
New Package:
@tanstack/db-collection-e2eA reusable e2e test infrastructure package providing:
Test Suites Implemented
eq,gt,gte,lt,lte,inArray,isNull, boolean logicorderBy,limit,offset, edge casesTotal: 86+ test scenarios
Integration
Electric Collection (
packages/electric-db-collection/e2e/):Query Collection (
packages/query-db-collection/e2e/):Test Results
Electric Collection E2E
Failures are expected - tests are exposing real Electric sync timing issues where
preload()returns before data is synced. This is valuable feedback for the query-driven sync implementation.Query Collection E2E
Architecture
Shared Test Suite Pattern
Test suites are factory functions that accept a config provider:
This pattern allows any collection implementation to reuse the same test suites.
Test Data Schema
Three interrelated tables with realistic data:
Infrastructure
Docker Setup
Vitest Configuration
test.extend()fileParallelism: falsefor shared databaseHow to Run
Start Docker Services
cd packages/db-collection-e2e/docker docker compose up -dRun Electric E2E Tests
cd packages/electric-db-collection pnpm test:e2eRun Query E2E Tests
cd packages/query-db-collection pnpm test:e2eStop Services
cd packages/db-collection-e2e/docker docker compose downPerformance
Execution Time:
Note: Docker startup (first time) adds 2-3 minutes, but subsequent runs are near-instant if Docker is already running.
Files Changed
New Files (40+)
Core Package:
packages/db-collection-e2e/(26 files)Integration:
packages/electric-db-collection/e2e/(2 files)packages/query-db-collection/e2e/(2 files)packages/electric-db-collection/vitest.e2e.config.tspackages/query-db-collection/vitest.e2e.config.tsCI/CD:
.github/workflows/e2e-tests.ymlDocumentation:
Modified Files
packages/electric-db-collection/package.json(added pg dependency)packages/electric-db-collection/vite.config.ts(include e2e tests)packages/query-db-collection/package.json(added test:e2e script)packages/query-db-collection/vite.config.ts(include e2e tests)packages/db-collection-e2e/docker/docker-compose.yml(removed obsolete version key)packages/db-collection-e2e/docker/postgres.conf(added listen_addresses)Known Issues
Electric Collection Tests (37 failures)
Most failures follow this pattern:
Root Cause: Electric collections start syncing asynchronously, but
preload()returns before sync completes. Tests run with empty collections.Impact: Tests are correctly identifying that the sync completion mechanism needs work. This is valuable feedback for the query-driven sync implementation.
Affected Areas:
Not Affected:
Query Collection Tests (1 failure)
Single UUID comparison edge case - minor issue.
Breaking Changes
None - this is purely additive.
Testing
The e2e tests themselves have been tested by running them!
Validation:
Documentation
Comprehensive documentation provided:
Next Steps
To improve Electric test pass rate:
The test framework is production-ready - it's finding real bugs!
Related
Checklist
Branch:
query-driven-sync(or appropriate branch name)Type: Feature (Testing Infrastructure)
Scope: e2e, testing, infrastructure