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:
27
tests/support/fixtures/offline.fixture.ts
Normal file
27
tests/support/fixtures/offline.fixture.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { test as base, BrowserContext } from '@playwright/test';
|
||||
|
||||
type OfflineFixture = {
|
||||
goOffline: (context: BrowserContext) => Promise<void>;
|
||||
goOnline: (context: BrowserContext) => Promise<void>;
|
||||
};
|
||||
|
||||
export const test = base.extend<{ offlineControl: OfflineFixture }>({
|
||||
offlineControl: async ({ }, use) => {
|
||||
const offlineFixture = {
|
||||
goOffline: async (context: BrowserContext) => {
|
||||
await context.setOffline(true);
|
||||
for (const page of context.pages()) {
|
||||
await page.evaluate(() => window.dispatchEvent(new Event('offline'))).catch(() => { });
|
||||
}
|
||||
},
|
||||
goOnline: async (context: BrowserContext) => {
|
||||
await context.setOffline(false);
|
||||
for (const page of context.pages()) {
|
||||
await page.evaluate(() => window.dispatchEvent(new Event('online'))).catch(() => { });
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
await use(offlineFixture);
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user