From 59ce2f8a2fe8e8282ad4fda9b10bb66a932bdaf3 Mon Sep 17 00:00:00 2001 From: efiten Date: Sat, 31 Oct 2026 11:16:13 +0100 Subject: [PATCH] test(web): release the mocked resolver when the popup is open, not after 600 ms (#761) The popup-survives-redraw e2e assumed the popup opened within a fixed 600 ms resolver delay. Under load the setup took longer, the name landed first and the test failed on its own premise. The resolver now waits for the test to release it. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01TDXX3ZV8LEdZgVTNFYFvZi --- web/e2e/ui.spec.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/web/e2e/ui.spec.js b/web/e2e/ui.spec.js index 374045a7..c33b681d 100644 --- a/web/e2e/ui.spec.js +++ b/web/e2e/ui.spec.js @@ -507,9 +507,13 @@ test('an open popup survives a name-resolution redraw, and the redraw still happ : [] route.fulfill({ json: { points: pts } }) }) - // Slow resolver, so the popup is open and waiting when the name lands. + // The resolver answers only when the test lets it (#761), so the popup is + // open and waiting when the name lands. A fixed delay raced everything the + // test does before the click, and lost under load. + let release + const gate = new Promise((res) => { release = res }) await page.route('**/api/resolve*', async (r) => { - await new Promise((res) => setTimeout(res, 600)) + await gate r.fulfill({ json: { name: 'BE-HSS-DinX', ambiguous: false } }) }) await page.goto('/') @@ -527,8 +531,12 @@ test('an open popup survives a name-resolution redraw, and the redraw still happ }).toPass() await expect(page.locator('.maplibregl-popup-content')).not.toContainText('BE-HSS-DinX') - // Past the resolver delay the popup is still there — this is the regression. - await page.waitForTimeout(1200) + // Let the name land. The popup is still there afterwards: this is the + // regression. + const answered = page.waitForResponse((r) => r.url().includes('/api/resolve')) + release() + await answered + await page.waitForTimeout(600) await expect(page.locator('.maplibregl-popup-content')).toBeVisible() // ...and the held redraw runs on close, so the name is not lost either.