From 073374e6810d935fd72ac096482495986d6caf72 Mon Sep 17 00:00:00 2001 From: Vito Sansevero Date: Tue, 27 Oct 2026 12:16:50 -0700 Subject: [PATCH] test(browser): reload the admin page only after the in-place edit saved The gallery-to-admin workflow pressed Enter and reloaded as soon as the edited text showed; the page saves after showing it, so a reload that won the race abandoned the PUT (WebKit, run 40564511000). The test now waits for the save's answer. Part of #379 --- tests/browser/workflows.spec.mjs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/browser/workflows.spec.mjs b/tests/browser/workflows.spec.mjs index 6ae6d971..62d86454 100644 --- a/tests/browser/workflows.spec.mjs +++ b/tests/browser/workflows.spec.mjs @@ -42,8 +42,13 @@ test('actual gallery form saves a prompt that the admin page can edit and reload await page.locator(`[data-action="edit"][data-prompt-id="${id}"]`).click(); const editor = page.locator(`.prompt-text[data-id="${id}"]`); await editor.fill('Browser edited portrait'); + // The page shows the edit at once and saves it after: reload only once the save answered (a reload that wins the + // race abandons the PUT, as seen on WebKit in CI). + const savedEdit = page.waitForResponse(item => item.request().method() === 'PUT' + && item.url().endsWith(`/prompt_manager/prompts/${id}`)); await editor.press('Enter'); await expect(page.locator('.prompt-text').filter({ hasText: 'Browser edited portrait' })).toBeVisible(); + expect((await savedEdit).ok()).toBe(true); await page.reload(); await expect(page.locator('.prompt-text').filter({ hasText: 'Browser edited portrait' })).toBeVisible(); const saved = await request.post('/prompt_manager/save', { data: { text: 'Browser saved landscape' } });