Initial commit: Brachnha Insight project setup

- Next.js 14+ with App Router and TypeScript
- Tailwind CSS and ShadCN UI styling
- Zustand state management
- Dexie.js for IndexedDB (local-first data)
- Auth.js v5 for authentication
- BMAD framework integration

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Max
2026-01-26 12:28:43 +07:00
commit 3fbbb1a93b
812 changed files with 150531 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
import { expect } from '@playwright/test';
import { test } from '../support/fixtures/offline.fixture';
test.describe('Sync Action Replay', () => {
test('should process pending actions when network restores', async ({ offlineControl, page }) => {
// GIVEN: Offline queue has actions
await page.goto('/'); // Ensure page is loaded to initialize DB
await page.waitForFunction(() => (window as any).db !== undefined, { timeout: 10000 });
await offlineControl.goOffline(page.context());
// Seed queue via evaluate
await page.evaluate(async () => {
// @ts-ignore
await window.db.syncQueue.add({
action: 'saveDraft',
payload: { draftData: { title: 'Pending Sync', content: '...' } },
status: 'pending',
createdAt: Date.now(),
retries: 0
});
});
// WHEN: Network restores
await offlineControl.goOnline(page.context());
// Trigger sync - The SyncManager listens to 'online' event.
// Note: The 'online' event listeners might execute async.
// Wait for processing
// We can poll the DB
await expect.poll(async () => {
return await page.evaluate(async () => {
// @ts-ignore
return await window.db.syncQueue.where('status').equals('pending').count();
});
}, { timeout: 5000 }).toBe(0);
});
});