From aef7c079216bfdced0a135cccc51221aae43bc31 Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Sun, 18 Jan 2026 15:56:38 +0100 Subject: [PATCH] perf(e2e): reduce arbitrary delays in tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phase 1.3 of E2E test optimization: - triggerSync(): 1000ms → 300ms initial wait - Time tracking tests: 5000ms → 2000ms accumulation wait - Auto-sync setup delay: 2000ms → 500ms Expected impact: 3-8s saved per test Risk: Very low - waits reduced but still safe for test purposes --- e2e/pages/supersync.page.ts | 4 ++-- .../sync/supersync-time-tracking-advanced.spec.ts | 8 ++++---- e2e/tests/sync/supersync.spec.ts | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/e2e/pages/supersync.page.ts b/e2e/pages/supersync.page.ts index cb83bb1b4..cbda39169 100644 --- a/e2e/pages/supersync.page.ts +++ b/e2e/pages/supersync.page.ts @@ -388,8 +388,8 @@ export class SuperSyncPage extends BasePage { * Trigger a sync operation by clicking the sync button. */ async triggerSync(): Promise { - // Wait a bit to ensure any previous internal state is cleared - await this.page.waitForTimeout(1000); + // Wait a bit to ensure any previous internal state is cleared (reduced from 1000ms) + await this.page.waitForTimeout(300); // Check if sync is already running to avoid "Sync already in progress" errors // If it is, wait for it to finish so we can trigger a fresh sync that includes our latest changes diff --git a/e2e/tests/sync/supersync-time-tracking-advanced.spec.ts b/e2e/tests/sync/supersync-time-tracking-advanced.spec.ts index 50edc894a..59c15a3aa 100644 --- a/e2e/tests/sync/supersync-time-tracking-advanced.spec.ts +++ b/e2e/tests/sync/supersync-time-tracking-advanced.spec.ts @@ -61,8 +61,8 @@ test.describe('@supersync Time Tracking Advanced Sync', () => { await startTimeTracking(clientA, taskName); console.log('[Archive Time Test] Started time tracking'); - // Wait for time to accumulate - await clientA.page.waitForTimeout(5000); + // Wait for time to accumulate (reduced from 5000ms to 2000ms) + await clientA.page.waitForTimeout(2000); // Stop tracking await stopTimeTracking(clientA, taskName); @@ -251,10 +251,10 @@ test.describe('@supersync Time Tracking Advanced Sync', () => { await startTimeTracking(clientB, taskName); console.log('[Concurrent Time Test] Client B started tracking'); - await clientB.page.waitForTimeout(5000); + await clientB.page.waitForTimeout(2000); // Reduced from 5000ms await stopTimeTracking(clientB, taskName); - console.log('[Concurrent Time Test] Client B stopped after 5s'); + console.log('[Concurrent Time Test] Client B stopped after 2s'); // ============ PHASE 4: Sync Both ============ await clientA.sync.syncAndWait(); diff --git a/e2e/tests/sync/supersync.spec.ts b/e2e/tests/sync/supersync.spec.ts index 8801e8d13..955d125ea 100644 --- a/e2e/tests/sync/supersync.spec.ts +++ b/e2e/tests/sync/supersync.spec.ts @@ -833,9 +833,9 @@ test.describe('@supersync SuperSync E2E', () => { console.log('[TimeTrack Test] Time tracking active'); // ============ PHASE 3: Accumulate Time ============ - // Wait for time to accumulate (5 seconds to get visible time display) - console.log('[TimeTrack Test] Waiting 5 seconds for time to accumulate...'); - await clientA.page.waitForTimeout(5000); + // Wait for time to accumulate (reduced from 5s to 2s for faster tests) + console.log('[TimeTrack Test] Waiting 2 seconds for time to accumulate...'); + await clientA.page.waitForTimeout(2000); // ============ PHASE 4: Stop Time Tracking ============ await stopTimeTracking(clientA, taskName); @@ -858,9 +858,9 @@ test.describe('@supersync SuperSync E2E', () => { // ============ PHASE 6: Client B Downloads ============ clientB = await createSimulatedClient(browser, baseURL!, 'B', testRunId); await clientB.sync.setupSuperSync(syncConfig); - // Add delay to ensure any auto-sync from setup has time to start/finish + // Add delay to ensure any auto-sync from setup has time to start/finish (reduced from 2000ms) // or to avoid race conditions with "Sync already in progress" - await clientB.page.waitForTimeout(2000); + await clientB.page.waitForTimeout(500); await clientB.sync.syncAndWait(); console.log('[TimeTrack Test] Client B synced');