From f75dcf2ce2931fedda48c986aa2871fdac87c8bd Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Tue, 20 Oct 2026 16:52:16 +0000 Subject: [PATCH] test(ui): fail the node refresh by state, not by call count The spec served the list to the first request and failed the rest. The first request is not always the one from the page, so the page could get the failure first and show no list. Serve the list until the page shows it, then fail the refreshes. Assisted-by: Claude Code:claude-sonnet-5-5 playwright Signed-off-by: Ettore Di Giacinto --- core/http/react-ui/e2e/nodes-fleet-dashboard.spec.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/http/react-ui/e2e/nodes-fleet-dashboard.spec.js b/core/http/react-ui/e2e/nodes-fleet-dashboard.spec.js index 72caed7f6..495f97906 100644 --- a/core/http/react-ui/e2e/nodes-fleet-dashboard.spec.js +++ b/core/http/react-ui/e2e/nodes-fleet-dashboard.spec.js @@ -389,14 +389,16 @@ test.describe('Swarm nodes: first run, errors and a phone', () => { }) test('keeps the last list and says so when a refresh fails', async ({ page }) => { - let calls = 0 + // Serve the list until the page shows it, then fail every refresh. A call + // count would break when another part of the shell reads the list first. + let failing = false await page.route('**/api/nodes', route => { - calls += 1 - if (calls === 1) return route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(baseNodes) }) + if (!failing) return route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(baseNodes) }) return route.fulfill({ status: 500, contentType: 'application/json', body: '{"error":"database unavailable"}' }) }) await page.goto('/app/nodes') await expect(rows(page)).toHaveCount(3, { timeout: 15_000 }) + failing = true await expect(page.getByRole('alert')).toContainText('could not be refreshed', { timeout: 15_000 }) await expect(rows(page)).toHaveCount(3) })