perf(e2e): reduce arbitrary delays in tests

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
This commit is contained in:
Johannes Millan 2026-01-18 15:56:38 +01:00
parent 8c62b87315
commit aef7c07921
3 changed files with 11 additions and 11 deletions

View file

@ -388,8 +388,8 @@ export class SuperSyncPage extends BasePage {
* Trigger a sync operation by clicking the sync button.
*/
async triggerSync(): Promise<void> {
// 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

View file

@ -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();

View file

@ -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');