super-productivity/e2e/tests/sync
Johannes Millan 68a268c18d test(sync): add comprehensive tests for encryption key re-fetch bug
Added extensive test coverage to prevent regression of the password
change + gap detection bug:

**Unit Tests - operation-log-download.service.spec.ts (38 tests, +3 new):**
1. "should re-fetch encryption key after gap detection for password change scenario"
   - Simulates Client A password change → gap → Client B re-download
   - Verifies getEncryptKey() called twice (initial + after gap)
   - Ensures decryption uses NEW password after gap

2. "should handle gap detection and fetch updated encryption key"
   - Tests key is re-fetched when gap occurs
   - Verifies different passwords are used before/after gap

3. "should use updated encryption key even when no gap but key changed"
   - Tests normal flow isn't broken by the fix
   - Ensures correct password is always used for decryption

4. "should re-fetch key on gap even when encryption was disabled then enabled"
   - Edge case: encryption disabled → enabled during gap
   - Verifies undefined → password transition works

**Unit Tests - encryption-password-change.service.spec.ts (19 tests, +3 new):**
1. "should upload clean slate with isCleanSlate=true flag"
   - Verifies server receives flag to delete all old encrypted data
   - This deletion triggers gap detection on other clients

2. "should clear derived key cache twice on upload failure"
   - Tests cache clearing on both password change AND revert
   - Prevents stale cached keys for either password

3. "should generate new client ID via clean slate"
   - Confirms clean slate creates new client ID
   - Explains why this prevents vector clock conflicts

**E2E Test - supersync-encryption-password-change.spec.ts (+1 new):**
1. "Error dialog recovery: entering new password after change works"
   - Full end-to-end test of the bug scenario
   - Client A changes password → Client B syncs with old password
   - Client B gets decrypt error → enters new password in dialog
   - Verifies sync succeeds with new password after gap detection
   - Tests bidirectional sync works after recovery

These tests ensure:
- Encryption key is always re-fetched after gap detection
- Password changes via error dialog work correctly
- Gap detection properly triggers key refresh
- Cache invalidation works in all scenarios
- Clean slate mechanism triggers gap detection as expected

Total new test coverage: 7 unit tests + 1 E2E test
2026-01-24 21:14:58 +01:00
..
ENCRYPTION-E2E-STATUS.md fix(sync): re-fetch encryption key after gap detection 2026-01-24 21:14:58 +01:00
import-sync.spec.ts fix(sync): prevent SYNC_IMPORT filtering concurrent ops in file-based sync 2026-01-07 20:39:13 +01:00
supersync-account-deletion.spec.ts fix(e2e): wait for button enabled state instead of visibility + timeout 2026-01-24 21:14:57 +01:00
supersync-account-reset.spec.ts feat(server): add Account Settings page with reset and delete options 2026-01-05 12:54:53 +01:00
supersync-advanced-edge-cases.spec.ts fix(test): improve e2e sync test stability 2026-01-14 16:16:08 +01:00
supersync-advanced.spec.ts fix(sync): prevent SYNC_IMPORT filtering concurrent ops in file-based sync 2026-01-07 20:39:13 +01:00
supersync-archive-data-sync.spec.ts fix(sync): preserve archived tasks during server migration and backup 2026-01-14 13:45:27 +01:00
supersync-archive-subtasks.spec.ts fix(e2e): improve test stability for parallel execution 2026-01-04 17:35:47 +01:00
supersync-backup-import-id-mismatch.spec.ts test(e2e): fix supersync tests to navigate to correct settings tabs 2026-01-18 12:46:20 +01:00
supersync-backup-recovery.spec.ts test(e2e): fix supersync tests to navigate to correct settings tabs 2026-01-18 12:46:20 +01:00
supersync-cross-entity.spec.ts fix(e2e): improve test stability for parallel execution 2026-01-04 17:35:47 +01:00
supersync-daily-summary.spec.ts fix(e2e): improve test stability for parallel execution 2026-01-04 17:35:47 +01:00
supersync-edge-cases.spec.ts test(e2e): fix flaky SuperSync undo test with increased timeouts 2026-01-22 21:37:42 +01:00
supersync-encryption-enable-disable.spec.ts fix(test): complete encryption enable/disable E2E tests with proper dialog handling 2026-01-24 21:14:57 +01:00
supersync-encryption-password-change.spec.ts test(sync): add comprehensive tests for encryption key re-fetch bug 2026-01-24 21:14:58 +01:00
supersync-encryption.spec.ts fix(e2e): stabilize flaky supersync tests with better waiting strategies 2026-01-13 18:26:45 +01:00
supersync-error-handling.spec.ts fix(e2e): improve test stability for parallel execution 2026-01-04 17:35:47 +01:00
supersync-import-clean-slate.spec.ts fix(sync): prevent SYNC_IMPORT filtering concurrent ops in file-based sync 2026-01-07 20:39:13 +01:00
supersync-import-conflict-dialog.spec.ts fix(test): improve e2e sync test stability 2026-01-14 16:16:08 +01:00
supersync-import-encryption-change.spec.ts feat(sync): add confirmation dialog when disabling SuperSync encryption (#6129) 2026-01-24 12:54:58 +01:00
supersync-late-join.spec.ts fix(e2e): improve test stability for parallel execution 2026-01-04 17:35:47 +01:00
supersync-legacy-migration-sync.spec.ts test(e2e): add legacy migration sync tests for WebDAV and SuperSync 2026-01-13 18:26:45 +01:00
supersync-lww-conflict.spec.ts test(supersync): fix flaky E2E tests with timing adjustments 2026-01-24 21:14:57 +01:00
supersync-models.spec.ts fix(e2e): reduce task count in tag deletion test to prevent timeout 2026-01-14 14:22:15 +01:00
supersync-network-failure.spec.ts test(supersync): fix flaky E2E tests with timing adjustments 2026-01-24 21:14:57 +01:00
supersync-planner.spec.ts fix(e2e): improve test stability for parallel execution 2026-01-04 17:35:47 +01:00
supersync-repeat-task-advanced.spec.ts fix(e2e): improve test stability for parallel execution 2026-01-04 17:35:47 +01:00
supersync-repeat-task.spec.ts fix(sync): only show import conflict dialog for local unsynced imports 2026-01-11 11:22:32 +01:00
supersync-server-migration.spec.ts test(supersync): fix flaky E2E tests with timing adjustments 2026-01-24 21:14:57 +01:00
supersync-simple-counter.spec.ts test(e2e): fix supersync tests to navigate to correct settings tabs 2026-01-18 12:46:20 +01:00
supersync-snapshot-vector-clock.spec.ts fix(e2e): improve test stability for parallel execution 2026-01-04 17:35:47 +01:00
supersync-stale-clock-regression.spec.ts fix(e2e): fix stale-clock regression tests timeout after import 2026-01-07 20:58:18 +01:00
supersync-stress.spec.ts fix(e2e): improve test stability for parallel execution 2026-01-04 17:35:47 +01:00
supersync-task-ordering.spec.ts fix(e2e): stabilize flaky supersync tests with better waiting strategies 2026-01-13 18:26:45 +01:00
supersync-time-tracking-advanced.spec.ts perf(e2e): reduce arbitrary delays in tests 2026-01-18 15:56:38 +01:00
supersync-worklog.spec.ts fix(e2e): improve test stability for parallel execution 2026-01-04 17:35:47 +01:00
supersync-wrong-password-error.spec.ts fix(sync): surface DecryptError password dialog instead of silent error 2026-01-24 21:14:57 +01:00
supersync.spec.ts perf(e2e): reduce arbitrary delays in tests 2026-01-18 15:56:38 +01:00
webdav-first-sync-conflict.spec.ts fix(ci): exclude WebDAV and SuperSync tests from build workflow 2026-01-21 20:42:50 +01:00
webdav-legacy-migration-sync.spec.ts fix(ci): exclude WebDAV and SuperSync tests from build workflow 2026-01-21 20:42:50 +01:00
webdav-provider-switch.spec.ts perf(e2e): cache WebDAV health checks at worker level 2026-01-21 19:16:58 +01:00
webdav-sync-advanced.spec.ts fix(ci): exclude WebDAV and SuperSync tests from build workflow 2026-01-21 20:42:50 +01:00
webdav-sync-archive.spec.ts test(e2e): fix flaky tests and improve timeout handling 2026-01-22 21:29:25 +01:00
webdav-sync-delete-cascade.spec.ts perf(e2e): cache WebDAV health checks at worker level 2026-01-21 19:16:58 +01:00
webdav-sync-error-handling.spec.ts fix(ci): exclude WebDAV and SuperSync tests from build workflow 2026-01-21 20:42:50 +01:00
webdav-sync-expansion.spec.ts fix(ci): exclude WebDAV and SuperSync tests from build workflow 2026-01-21 20:42:50 +01:00
webdav-sync-full.spec.ts fix(ci): exclude WebDAV and SuperSync tests from build workflow 2026-01-21 20:42:50 +01:00
webdav-sync-tags.spec.ts fix(ci): exclude WebDAV and SuperSync tests from build workflow 2026-01-21 20:42:50 +01:00
webdav-sync-task-order.spec.ts fix(ci): exclude WebDAV and SuperSync tests from build workflow 2026-01-21 20:42:50 +01:00
webdav-sync-today-tag.spec.ts perf(e2e): cache WebDAV health checks at worker level 2026-01-21 19:16:58 +01:00