mirror of
https://github.com/bretzel-app/crumbs.git
synced 2026-10-12 12:06:57 +02:00
fix: resolve flaky offline sync e2e test in CI
Playwright's setOffline(false) doesn't reliably emit the browser's 'online' DOM event in headless/CI environments. Manually dispatch it as a safety net so the sync client always triggers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
8108e62cf1
commit
990639d804
@@ -62,8 +62,11 @@ test.describe('Offline Support', () => {
|
||||
await expect(page.getByText('Survive Reload')).toBeVisible();
|
||||
|
||||
// When the network is restored and sync completes
|
||||
const syncResponse = page.waitForResponse('**/api/sync');
|
||||
const syncResponse = page.waitForResponse((resp) => resp.url().includes('/api/sync'));
|
||||
await page.context().setOffline(false);
|
||||
// Manually dispatch the online event as a safety net — in CI/headless
|
||||
// environments, setOffline(false) doesn't always emit it reliably
|
||||
await page.evaluate(() => window.dispatchEvent(new Event('online')));
|
||||
await syncResponse;
|
||||
|
||||
// And the user reloads the page
|
||||
|
||||
Reference in New Issue
Block a user