From 816d55e03d574cde8a5fd1790c1910c9c386dffd Mon Sep 17 00:00:00 2001 From: rcourtman Date: Sun, 19 Jul 2026 09:51:23 +0100 Subject: [PATCH] Recover spec 68 infrastructure onboarding against evolved discovery UI The discovery-config surface changed: with discovery disabled by default the empty state offers a 'Configure discovery' button (which opens the Discovery settings dialog), and the 'Run discovery' scan button only renders once discovery is enabled. - Landing test: assert 'Configure discovery' and that 'Run discovery' is absent, instead of the stale 'Run discovery' / 'Discovery settings' button names. - Discovery settings dialog test: open it via 'Configure discovery' (the dialog title/copy/close-button assertions were already current). - Explicit discovery scan test: enable discovery for that test by passing the real /api/system/settings response through with discoveryEnabled flipped on, so the 'Run discovery' scan button appears and the candidate->review flow runs. Verified: all 5 desktop tests pass against the managed local backend. Contract-Neutral: E2E quarantine recovery --- .../68-infrastructure-onboarding.spec.ts | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/tests/integration/tests/68-infrastructure-onboarding.spec.ts b/tests/integration/tests/68-infrastructure-onboarding.spec.ts index 0ebf636d2..8880fa49b 100644 --- a/tests/integration/tests/68-infrastructure-onboarding.spec.ts +++ b/tests/integration/tests/68-infrastructure-onboarding.spec.ts @@ -187,15 +187,18 @@ test.describe("Infrastructure onboarding", () => { await expect( page.getByText("Connected systems", { exact: true }), ).toBeVisible(); - await expect( - page.getByRole("button", { name: /Run discovery/i }), - ).toBeVisible(); await expect( page.getByRole("button", { name: /Add infrastructure/i }), ).toBeVisible(); + // Discovery is disabled by default, so the empty state offers + // "Configure discovery" (which opens the Discovery settings dialog); the + // "Run discovery" scan button only appears once discovery is enabled. await expect( - page.getByRole("button", { name: /Discovery settings/i }), + page.getByRole("button", { name: /Configure discovery/i }), ).toBeVisible(); + await expect( + page.getByRole("button", { name: /Run discovery/i }), + ).toHaveCount(0); await expect(page.getByText("VMware vCenter", { exact: true })).toHaveCount( 0, ); @@ -237,7 +240,9 @@ test.describe("Infrastructure onboarding", () => { timeout: 15_000, }); - await page.getByRole("button", { name: /Discovery settings/i }).click(); + // With discovery disabled, the control that opens the Discovery settings + // dialog is labelled "Configure discovery". + await page.getByRole("button", { name: /Configure discovery/i }).click(); const dialog = page.getByRole("dialog", { name: "Discovery settings" }); await expect(dialog).toBeVisible(); @@ -312,6 +317,20 @@ test.describe("Infrastructure onboarding", () => { await prepareOnboardingPage(page); + // The "Run discovery" scan button only renders when discovery is enabled. + // Enable it by passing the real system-settings response through with + // discoveryEnabled flipped on, so this test can exercise the scan flow. + await page.route("**/api/system/settings", async (route) => { + if (route.request().method() !== "GET") { + await route.continue(); + return; + } + const response = await route.fetch(); + const body = await response.json(); + body.discoveryEnabled = true; + await route.fulfill({ response, json: body }); + }); + await page.route("**/api/discover", async (route) => { const requestUrl = new URL(route.request().url()); if (requestUrl.pathname !== "/api/discover") {