diff --git a/tests/browser/workspace-library-editor.spec.mjs b/tests/browser/workspace-library-editor.spec.mjs index 2a17b3e3..725b5427 100644 --- a/tests/browser/workspace-library-editor.spec.mjs +++ b/tests/browser/workspace-library-editor.spec.mjs @@ -635,7 +635,11 @@ test('restored storage after a confirmed save or before an archive offers an exp const response=await route.fetch();await expect(await restore()).toBeOK();return route.fulfill({response}); }); await page.getByRole('button',{name:'Edit metadata',exact:true}).click();let dialog=editorDialog(page);await ready(dialog); - await field(dialog,'Notes').fill('Lost to a restore');await button(dialog,'Save').click(); + await field(dialog,'Notes').fill('Lost to a restore'); + // The save's answer waits for a whole restore in the route above; wait for that answer, not the 5 s expect + // default (#501 merge queue: under load the restore outlasted it on WebKit). + const saved=page.waitForResponse(item=>item.request().method()==='PATCH'&&new URL(item.url()).pathname===`/prompt_manager/library/${f.positive_id}`); + await button(dialog,'Save').click();await saved; await expect(note(dialog)).toHaveText('Saved; Library refresh failed because prompt storage was restored. Reload the Library to see current data.'); expect(await actionNames(dialog)).toEqual(['Reload Library','Create text revision','Archive…','Cancel','Save']); for(const name of ['Create text revision','Archive…'])await expect(button(dialog,name)).toBeDisabled(); diff --git a/tests/browser/workspace-system-diagnostics.spec.mjs b/tests/browser/workspace-system-diagnostics.spec.mjs index 9f811362..2f4cc07a 100644 --- a/tests/browser/workspace-system-diagnostics.spec.mjs +++ b/tests/browser/workspace-system-diagnostics.spec.mjs @@ -274,11 +274,18 @@ test('level filter is minimum-level over all six choices', async ({ page, reques for (const line of (await lines(page).textContent()).split('\n')) expect(line).toMatch(/^\d\d:\d\d:\d\d [A-Z]+ +\S/); expect(urls.at(-1)).toBe('?limit=100'); for (const minimum of LEVELS) { + // Wait for this level's answer: the previous level's lines also hold the CRITICAL line, so seeing it proved + // nothing, and under load the filtered answer painted after the check (#501 merge queue, firefox). + const answered = page.waitForResponse(item => new URL(item.url()).pathname === LOGS_URL + && new URL(item.url()).search === `?limit=100&level=${minimum}`); await level.selectOption(minimum); + await answered; await expect.poll(() => urls.at(-1)).toBe(`?limit=100&level=${minimum}`); await expect(lines(page)).toContainText('CRITICAL The database could not be opened'); - const shown = await shownLevels(page); - expect(shown.every(name => LEVELS.indexOf(name) >= LEVELS.indexOf(minimum)), `${minimum}: ${shown}`).toBe(true); + await expect.poll(async () => { + const shown = await shownLevels(page); + return shown.every(name => LEVELS.indexOf(name) >= LEVELS.indexOf(minimum)) || `${minimum}: ${shown}`; + }).toBe(true); if (minimum === 'DEBUG') await expect(lines(page)).toContainText('DEBUG Thumbnail cache lookup'); if (minimum === 'WARNING') { await expect(lines(page)).not.toContainText('Database backup verified');