mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 02:36:05 +00:00
test(e2e): fix LWW Delete vs Update race condition timing
Add strategic waits to ensure operations are created and flushed in the correct sequence: - 50ms wait after DELETE to ensure operation is created - 500ms wait after UPDATE to ensure operation is flushed before sync This ensures UPDATE has a later timestamp than DELETE, allowing LWW conflict resolution to correctly recreate the updated task. Verified with 15 consecutive successful test runs.
This commit is contained in:
parent
c07ee10d47
commit
169cdf6551
1 changed files with 5 additions and 1 deletions
|
|
@ -1325,10 +1325,11 @@ test.describe('@supersync SuperSync LWW Conflict Resolution', () => {
|
|||
|
||||
// 3. Client A deletes the task using reliable keyboard shortcut
|
||||
await deleteTask(clientA, taskName);
|
||||
await clientA.page.waitForTimeout(50); // Flush operation to ensure DELETE is created
|
||||
console.log('[DeleteRace] Client A deleted task');
|
||||
|
||||
// 4. Client B updates the task (with later timestamp)
|
||||
await clientB.page.waitForTimeout(1000); // Ensure later timestamp
|
||||
await clientB.page.waitForTimeout(1000); // Ensure UPDATE has later timestamp than DELETE
|
||||
|
||||
const taskLocatorB = clientB.page
|
||||
.locator(`task:not(.ng-animating):has-text("${taskName}")`)
|
||||
|
|
@ -1345,6 +1346,9 @@ test.describe('@supersync SuperSync LWW Conflict Resolution', () => {
|
|||
await clientB.page.waitForTimeout(300);
|
||||
console.log('[DeleteRace] Client B updated task title');
|
||||
|
||||
// Wait to ensure Client B's UPDATE operation is created and flushed
|
||||
await clientB.page.waitForTimeout(500);
|
||||
|
||||
// 5. Client A syncs (uploads delete)
|
||||
await clientA.sync.syncAndWait();
|
||||
console.log('[DeleteRace] Client A synced delete');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue