From 191d129ff3d53d92b11ddc99c666c1a62db52063 Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Sat, 18 Apr 2026 12:39:49 +0200 Subject: [PATCH] test(e2e): restore title tolerance in LWW archive resurrection assertion --- .../sync/supersync-archive-conflict.spec.ts | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/e2e/tests/sync/supersync-archive-conflict.spec.ts b/e2e/tests/sync/supersync-archive-conflict.spec.ts index 2b738507bb..6d78366117 100644 --- a/e2e/tests/sync/supersync-archive-conflict.spec.ts +++ b/e2e/tests/sync/supersync-archive-conflict.spec.ts @@ -9,6 +9,7 @@ import { renameTask, archiveDoneTasks, expectTaskInWorklog, + hasTaskInWorklog, navigateToWorkView, type SimulatedE2EClient, } from '../../utils/supersync-helpers'; @@ -267,10 +268,30 @@ test.describe('@supersync Archive Conflict Resolution', () => { console.log('[BugB] Client B: task not visible in active list'); // ============ PHASE 7: Verify task IN worklog ============ - await expectTaskInWorklog(clientA, taskName); + // After archive-wins conflict + sync rounds, the archived task may appear under + // either the original title (if archive applied first) or the renamed title (if + // the rename op was also synced). Accept either to avoid brittleness. + const clientAFound = + (await hasTaskInWorklog(clientA, taskName)) || + (await hasTaskInWorklog(clientA, taskRenamed)); + if (!clientAFound) { + throw new Error( + `[BugB] Client A: Expected task to be in worklog under "${taskName}" or "${taskRenamed}"`, + ); + } console.log('[BugB] Client A: task found in worklog'); - await expectTaskInWorklog(clientB, taskName); + // Client B applied the rename locally before archive was received, so the task + // is archived under the renamed title. But also accept the original in case the + // archive was applied before the rename reached Client B. + const clientBFound = + (await hasTaskInWorklog(clientB, taskRenamed)) || + (await hasTaskInWorklog(clientB, taskName)); + if (!clientBFound) { + throw new Error( + `[BugB] Client B: Expected task to be in worklog under "${taskRenamed}" or "${taskName}"`, + ); + } console.log('[BugB] Client B: task found in worklog'); console.log('[BugB] ✓ Test B passed: LWW Update did not resurrect archived task');