From 904a4c3bdc13aaf1e19f36e09e2f3d78d23d863c Mon Sep 17 00:00:00 2001 From: Jonas Date: Wed, 23 Sep 2026 15:06:58 +0200 Subject: [PATCH 1/2] test(playwright): try to fix flakiness of conflict resolution tests Wait for the UI indicators of unsaved/saved changes instead of just awaiting requests/timeouts. Signed-off-by: Jonas Assisted-by: OpenCode:claude-fable-5.1 --- playwright/e2e/conflict.spec.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/playwright/e2e/conflict.spec.ts b/playwright/e2e/conflict.spec.ts index 3f89e8d2d86..ec54956829d 100644 --- a/playwright/e2e/conflict.spec.ts +++ b/playwright/e2e/conflict.spec.ts @@ -98,14 +98,13 @@ resolutionVariants.forEach(({ source, buttonName, headingName }) => { container, editor, file, - page, reader, user, }) => { await expect(editor.el).toBeVisible() - const pushPromise = page.waitForRequest(/push/) await editor.typeHeading('Hello world') - await pushPromise + // Wait for the steps to be pushed so the editor knows about unsaved changes + await expect(editor.saveIndicator).toHaveAccessibleName(/Unsaved changes/) await user.uploadFile({ name: file.name, content: '## Good bye' }) // Verify both verisons are shown @@ -146,6 +145,8 @@ test.describe('Plaintext conflict resolution', () => { }) => { await expect(editor.el).toBeVisible() await editor.type('Hello world') + // Wait for the steps to be pushed so the editor knows about unsaved changes + await expect(editor.saveIndicator).toHaveAccessibleName(/Unsaved changes/) await user.uploadFile({ name: file.name, content: 'Good bye' }) // Verify both verisons are shown @@ -164,16 +165,16 @@ test('[conflict] automatic resolution if no unsaved changes', async ({ container, editor, file, - page, reader, user, }) => { await expect(editor.el).toBeVisible() await editor.typeHeading('Hello world') - const requestPromise = page.waitForRequest(/save/) + // Wait for the steps to be pushed so the editor knows about unsaved changes + await expect(editor.saveIndicator).toHaveAccessibleName(/Unsaved changes/) await editor.saveIndicator.click() - await requestPromise - await page.waitForTimeout(500) // More robust against 423 Locked + // Wait until client has successfully saved + await expect(editor.saveIndicator).not.toHaveAccessibleName(/Unsaved changes/) await user.uploadFile({ name: file.name, content: '## Good bye' }) From 1ceff2abf148a20c1b652f9fd5aff9e02893d6c1 Mon Sep 17 00:00:00 2001 From: Jonas Date: Wed, 23 Sep 2026 15:33:46 +0200 Subject: [PATCH 2/2] test(playwright): upload file with old mtime in reconnect test Signed-off-by: Jonas --- playwright/e2e/reconnect.spec.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/playwright/e2e/reconnect.spec.ts b/playwright/e2e/reconnect.spec.ts index 39458e85594..e2be6cf10d8 100644 --- a/playwright/e2e/reconnect.spec.ts +++ b/playwright/e2e/reconnect.spec.ts @@ -14,6 +14,9 @@ const test = mergeTests(editorTest, offlineTest, uploadFileTest) // we cannot run tests in parallel. test.describe.configure({ mode: 'serial' }) +// Upload with an old mtime so the server accepts the first autosave after reopening +test.use({ mtime: Date.now() / 1000 - 10 }) + test.beforeEach(async ({ open }) => { await open() }) @@ -32,9 +35,9 @@ test('opening a file with unsaved changes', async ({ await expect(editor.saveIndicator).toHaveAccessibleName(/Unsaved changes/) await close() await setOnline() - await expect(await file.getContent()).toBe('') + expect(await file.getContent()).toBe('') await open() await expect(editor.getHeading({ name: 'Hello world' })).toBeVisible() await expect(editor.saveIndicator).not.toHaveAccessibleName(/Unsaved changes/) - await expect(await file.getContent()).toBe('## Hello world') + expect(await file.getContent()).toBe('## Hello world') })