From d290673034a74e2fbc1ed47ac333685791c43ee7 Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Sun, 8 Feb 2026 13:42:15 +0100 Subject: [PATCH] fix(e2e): fix failing and flaky supersync tests Replace fixed timeouts with deterministic waits and use correct methods for expected-failure scenarios in supersync E2E tests. --- e2e/pages/supersync.page.ts | 12 +++++++++++- e2e/tests/sync/supersync-account-deletion.spec.ts | 2 +- .../sync/supersync-encryption-enable-disable.spec.ts | 6 ++---- ...upersync-encryption-password-preservation.spec.ts | 3 --- e2e/tests/sync/supersync.spec.ts | 4 ---- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/e2e/pages/supersync.page.ts b/e2e/pages/supersync.page.ts index 4dc42f0962..190281ef86 100644 --- a/e2e/pages/supersync.page.ts +++ b/e2e/pages/supersync.page.ts @@ -1185,7 +1185,17 @@ export class SuperSyncPage extends BasePage { } // Wait for password change operation to complete (server wipe + re-upload) - await this.page.waitForTimeout(2000); + const checkAlreadyVisible = await this.syncCheckIcon.isVisible().catch(() => false); + if (!checkAlreadyVisible) { + const spinnerVisible = await this.syncSpinner + .waitFor({ state: 'visible', timeout: 3000 }) + .then(() => true) + .catch(() => false); + if (spinnerVisible) { + await this.syncSpinner.waitFor({ state: 'hidden', timeout: 30000 }); + } + await this.syncCheckIcon.waitFor({ state: 'visible', timeout: 10000 }); + } } /** diff --git a/e2e/tests/sync/supersync-account-deletion.spec.ts b/e2e/tests/sync/supersync-account-deletion.spec.ts index b8939910b3..f16c2bdd8d 100644 --- a/e2e/tests/sync/supersync-account-deletion.spec.ts +++ b/e2e/tests/sync/supersync-account-deletion.spec.ts @@ -65,7 +65,7 @@ test.describe('@supersync SuperSync Account Deletion', () => { console.log(`[Account-Deletion] ✓ Deleted user ${user.userId}`); // 3. Try to sync again - should fail with auth error - await client.sync.triggerSync(); + await client.sync.syncBtn.click(); // 4. Wait for error indicator to appear // The sync button should show error state (sync_problem icon), diff --git a/e2e/tests/sync/supersync-encryption-enable-disable.spec.ts b/e2e/tests/sync/supersync-encryption-enable-disable.spec.ts index 3a10c90295..c196ffee11 100644 --- a/e2e/tests/sync/supersync-encryption-enable-disable.spec.ts +++ b/e2e/tests/sync/supersync-encryption-enable-disable.spec.ts @@ -7,6 +7,7 @@ import { waitForTask, type SimulatedE2EClient, } from '../../utils/supersync-helpers'; +import { expectTaskNotVisible } from '../../utils/supersync-assertions'; /** * SuperSync Encryption Enable/Disable E2E Tests @@ -535,10 +536,7 @@ test.describe('@supersync @encryption Encryption Enable/Disable', () => { // CRITICAL: Client B's concurrent task should be GONE // (it was never synced, and the fresh client doesn't have it) - const concurrentTaskLocator = clientB.page.locator( - `task:has-text("${concurrentTask}")`, - ); - await expect(concurrentTaskLocator).not.toBeVisible({ timeout: 5000 }); + await expectTaskNotVisible(clientB, concurrentTask); console.log( '[Concurrent] ✓ Concurrent (unsynced) changes correctly lost after encryption state change!', diff --git a/e2e/tests/sync/supersync-encryption-password-preservation.spec.ts b/e2e/tests/sync/supersync-encryption-password-preservation.spec.ts index db17117cb2..558693a308 100644 --- a/e2e/tests/sync/supersync-encryption-password-preservation.spec.ts +++ b/e2e/tests/sync/supersync-encryption-password-preservation.spec.ts @@ -384,9 +384,6 @@ test.describe('@supersync @encryption Password Preservation', () => { await clientA.sync.changeEncryptionPassword(password2); console.log('[PasswordChange] Password changed'); - // Wait for password change operation to complete - await clientA.page.waitForTimeout(2000); - // ============ PHASE 3: Create task with new password ============ console.log('[PasswordChange] Phase 3: Creating task with new password'); diff --git a/e2e/tests/sync/supersync.spec.ts b/e2e/tests/sync/supersync.spec.ts index 959d6c6681..fa9b17d1d1 100644 --- a/e2e/tests/sync/supersync.spec.ts +++ b/e2e/tests/sync/supersync.spec.ts @@ -289,10 +289,6 @@ test.describe('@supersync SuperSync E2E', () => { // Client B syncs to receive the deletion await clientB.sync.syncAndWait(); - // Wait for DOM to settle after sync - await clientB.page.waitForLoadState('domcontentloaded'); - await clientB.page.waitForTimeout(300); - // Verify task is removed from both clients await expectTaskNotVisible(clientA, taskName); await expectTaskNotVisible(clientB, taskName);