e2e: shared volume plugin deployment for CI tests #59

Merged
ghost merged 28 commits from e2e/shared-volume-plugin-deploy into main 2026-03-18 02:42:43 +00:00
Showing only changes of commit 7000a1f77f - Show all commits
+9 -23
View File
@@ -2,31 +2,17 @@ import { test, expect, Page } from '@playwright/test';
/** Navigate to the Polaris plugin settings page and wait for settings to render. */ /** Navigate to the Polaris plugin settings page and wait for settings to render. */
async function goToPolarisSettings(page: Page) { async function goToPolarisSettings(page: Page) {
// Load the main page first so all plugin scripts execute and call // Headlamp's plugin settings page is a HOME-context route at /settings/plugins,
// registerPluginSettings(). Headlamp loads plugins asynchronously — the // not an in-cluster route (/c/main/settings/plugins would 404). Headlamp loads
// PluginSettings component reads the plugin registry once on mount and // plugin scripts asynchronously on SPA init. When registerPluginSettings() fires,
// never re-renders when new plugins register. A full page.goto() to the // it dispatches a Redux action — PluginSettings uses useTypedSelector so it
// settings URL would re-initialize the SPA, causing PluginSettings to // re-renders automatically once the plugin registers. No preloading needed.
// mount before plugin scripts finish executing. await page.goto('/settings/plugins');
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,
});
// Navigate to plugin settings via client-side routing (pushState + popstate) // Wait for the plugin to appear in the settings list. The timeout covers
// instead of page.goto(). This preserves the already-loaded plugin scripts // async plugin script loading + registration.
// and their registerPluginSettings() registrations. React Router's history
// listener picks up the popstate event and re-renders with the new route.
await page.evaluate(() => {
window.history.pushState({}, '', '/c/main/settings/plugins');
window.dispatchEvent(new PopStateEvent('popstate', { state: {} }));
});
// Find and click the Polaris plugin entry to open its settings
const pluginEntry = page.locator('text=headlamp-polaris').first(); const pluginEntry = page.locator('text=headlamp-polaris').first();
await expect(pluginEntry).toBeVisible({ timeout: 15_000 }); await expect(pluginEntry).toBeVisible({ timeout: 30_000 });
await pluginEntry.click(); await pluginEntry.click();
// Wait for the PolarisSettings component to render // Wait for the PolarisSettings component to render