From 4844e9667d82e9a7e162e6f4e534c8e1db9b92f9 Mon Sep 17 00:00:00 2001 From: Gandalf the Greybeard Date: Tue, 17 Mar 2026 22:20:18 +0000 Subject: [PATCH] fix(e2e): load main page before settings to ensure plugin list is populated Headlamp's PluginSettings component initializes its state from localStorage on mount and never syncs when props.plugins updates later. If the settings page loads before fetchAndExecutePlugins completes, the plugin list stays empty and the test can't find "headlamp-polaris". Fix: navigate to the main page first, wait for the Polaris sidebar entry to confirm the plugin is loaded (which populates localStorage), then navigate to the settings page. Co-Authored-By: Paperclip --- e2e/settings.spec.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/e2e/settings.spec.ts b/e2e/settings.spec.ts index a64a714..7a51e87 100644 --- a/e2e/settings.spec.ts +++ b/e2e/settings.spec.ts @@ -2,6 +2,18 @@ import { test, expect, Page } from '@playwright/test'; /** Navigate to the Polaris plugin settings page and wait for settings to render. */ async function goToPolarisSettings(page: Page) { + // Load the main page first so Headlamp fetches the plugin list and stores + // it in localStorage (headlampPluginSettings). The PluginSettings component + // initializes its state from localStorage on mount, so the data must already + // be there before we navigate to the settings page. + await page.goto('/'); + const sidebar = page.getByRole('navigation', { name: 'Navigation' }); + await expect(sidebar).toBeVisible({ timeout: 15_000 }); + await expect(sidebar.getByRole('button', { name: 'Polaris' })).toBeVisible({ + timeout: 15_000, + }); + + // Now navigate to plugin settings — localStorage has the plugin list await page.goto('/c/main/settings/plugins'); // Find and click the Polaris plugin entry to open its settings