From c757ff500d03db86201de8e45f5755a3b511dd7f Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Mon, 22 Dec 2025 12:08:04 +0100 Subject: [PATCH] test(sync): re-enable sync after import in tests and adjust baseURL fallback --- e2e/fixtures/test-backup.json | 35 ++++++++++++++++++++++++++++-- e2e/tests/sync/import-sync.spec.ts | 8 +++++++ e2e/utils/supersync-helpers.ts | 5 ++++- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/e2e/fixtures/test-backup.json b/e2e/fixtures/test-backup.json index 60064fe88..4234109a7 100644 --- a/e2e/fixtures/test-backup.json +++ b/e2e/fixtures/test-backup.json @@ -4,8 +4,39 @@ "crossModelVersion": 4.5, "data": { "project": { - "ids": [], - "entities": {} + "ids": ["INBOX_PROJECT"], + "entities": { + "INBOX_PROJECT": { + "id": "INBOX_PROJECT", + "title": "Inbox", + "isHiddenFromMenu": false, + "taskIds": ["active-task-1", "active-task-2"], + "backlogTaskIds": [], + "noteIds": [], + "theme": { + "primary": "#607d8b", + "accent": "#ff4081", + "warn": "#e91e63", + "isAutoContrast": true + }, + "icon": "inbox", + "workStart": {}, + "workEnd": {}, + "breakNr": {}, + "breakTime": {}, + "isArchived": false, + "advancedCfg": { + "worklogExportSettings": { + "cols": ["DATE", "START", "END", "TIME_CLOCK", "TITLES_INCLUDING_SUB"], + "roundWorkTimeTo": null, + "roundStartTimeTo": null, + "roundEndTimeTo": null, + "groupBy": "DATE", + "separateTasksBy": "" + } + } + } + } }, "menuTree": { "tagTree": [], diff --git a/e2e/tests/sync/import-sync.spec.ts b/e2e/tests/sync/import-sync.spec.ts index ad7aefe97..07ca579ec 100644 --- a/e2e/tests/sync/import-sync.spec.ts +++ b/e2e/tests/sync/import-sync.spec.ts @@ -95,6 +95,10 @@ base.describe('@importsync @supersync Import + Sync E2E', () => { await waitForTask(clientA.page, 'E2E Import Test - Simple Active Task'); console.log('[Import Test] Client A has imported tasks visible'); + // Re-enable sync after import (import overwrites globalConfig including sync settings) + console.log('[Import Test] Re-enabling sync after import'); + await clientA.sync.setupSuperSync(syncConfig); + // ============ PHASE 2: Client A Syncs to Server ============ console.log('[Import Test] Phase 2: Client A syncing to server'); await clientA.sync.syncAndWait(); @@ -269,6 +273,10 @@ base.describe('@importsync @supersync Import + Sync E2E', () => { await importPage.importBackupFile(backupPath); console.log('[Merge Test] Client A imported backup'); + // Re-enable sync after import (import overwrites globalConfig including sync settings) + console.log('[Merge Test] Re-enabling sync after import'); + await clientA.sync.setupSuperSync(syncConfig); + // ============ PHASE 3: Sync After Import ============ console.log('[Merge Test] Phase 3: Syncing after import'); diff --git a/e2e/utils/supersync-helpers.ts b/e2e/utils/supersync-helpers.ts index c9476a5cc..9d9ccd8b3 100644 --- a/e2e/utils/supersync-helpers.ts +++ b/e2e/utils/supersync-helpers.ts @@ -166,10 +166,13 @@ export const createSimulatedClient = async ( clientName: string, testPrefix: string, ): Promise => { + // Use provided baseURL or fall back to localhost:4242 (Playwright fixture may be undefined) + const effectiveBaseURL = baseURL || 'http://localhost:4242'; + const context = await browser.newContext({ storageState: undefined, // Clean slate - no shared state userAgent: `PLAYWRIGHT SYNC-CLIENT-${clientName}`, - baseURL, + baseURL: effectiveBaseURL, viewport: { width: 1920, height: 1080 }, });