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.
This commit is contained in:
Johannes Millan 2026-02-08 13:42:15 +01:00
parent e7a606a63b
commit d290673034
5 changed files with 14 additions and 13 deletions

View file

@ -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 });
}
}
/**

View file

@ -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),

View file

@ -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!',

View file

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

View file

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