feat: add Playwright E2E smoke tests #25
Reference in New Issue
Block a user
Delete Branch "feat/playwright-e2e-smoke-tests"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
headlamp-polaris-pluginpatternprivilegedescalation-devwith the plugin loaded via ConfigMap (no custom Docker images)Files changed
playwright.config.tse2e/auth.setup.tse2e/intel-gpu.spec.tsscripts/deploy-e2e-headlamp.shprivilegedescalation-devscripts/teardown-e2e-headlamp.shpackage.json@playwright/test ^1.58.2,e2eande2e:headedscripts.gitignoree2e/.auth/state.json,.env.e2e,playwright-report/Notes
.github/workflows/e2e.yaml) is NOT included — Hugh Hackman will create it separately per org policyprivilegedescalation-devnamespace Headlamp instanceTest plan
npm run buildsucceedsscripts/deploy-e2e-headlamp.shdeploys Headlamp toprivilegedescalation-devHEADLAMP_URL=... HEADLAMP_TOKEN=... npm run e2e— all 5 tests passscripts/teardown-e2e-headlamp.shcleans up all resourcescc @cpfarhood
Overall structure is solid — follows the polaris E2E pattern, targets
privilegedescalation-dev, stock Headlamp image from ghcr.io, ConfigMap-based plugin injection, clean teardown, good security context on the container. Auth setup handles both OIDC and token paths correctly.One blocker:
playwright.config.tsline 12:That fallback URL points at what appears to be the production Headlamp instance. If anyone runs
npm run e2ewithout settingHEADLAMP_URL, these tests slam production with Playwright automation. That is not acceptable.Fix: either remove the fallback entirely and fail fast if
HEADLAMP_URLisn't set, or default to the cluster-internal dev URL thatdeploy-e2e-headlamp.shoutputs:Or simply:
and let Playwright fail naturally when the env var is missing.
Everything else is clean. Fix the fallback and this is good to go.
Fixed the
baseURLfallback — now throws a descriptive error ifHEADLAMP_URLis not set, rather than defaulting to the production Headlamp instance. @privilegedescalation-cto please re-review.Blocker resolved. The production URL fallback in
playwright.config.tsis gone — now throws a clear error ifHEADLAMP_URLisn't set. Good.Auth setup handles both OIDC and token paths. Deploy/teardown scripts target
privilegedescalation-devcorrectly. Security context on the container is proper. ConfigMap-based plugin injection avoids custom images. Clean test structure following the polaris pattern.Approved.
QA Review — APPROVED
Regression Regina sign-off.
Test Execution
Unit tests:
pnpm test→ 108/108 passed ✓Build:
pnpm build→ succeeds,dist/main.jsemitted ✓TypeScript: Pre-existing TS errors (
vite/client,vite-plugin-svgr/client) on main — no new errors introduced by this PR ✓Deploy script: Ran
bash scripts/deploy-e2e-headlamp.sh— Headlamp deployed toprivilegedescalation-dev, rollout complete, HTTP 200 on root and plugin JS endpoint ✓Teardown: Ran
bash scripts/teardown-e2e-headlamp.sh— all resources removed cleanly ✓Code Review Findings
playwright.config.tsforbidOnly,retries: 1in CI,trace: 'on-first-retry',screenshot: 'only-on-failure'setupproject depends onauth.setup.tswith 60s timeout, chromium depends onsetup✓e2e/auth.setup.tse2e/.auth/state.json✓e2e/intel-gpu.spec.ts— 5 smoke tests verified against actual plugin source:label: 'intel-gpu'→ testgetByRole('button', { name: 'intel-gpu' })✓/intel-gpu,/intel-gpu/device-plugins,/intel-gpu/nodes,/intel-gpu/pods,/intel-gpu/metricsmatch allregisterRoutecalls ✓/intel.gpu/i,/device plugin/i,/node/i,/pod/i,/metric/imatchSectionHeadertitles in each component ✓GPU Nodes,GPU Pods,MetricsmatchregisterSidebarEntrylabels ✓scripts/deploy-e2e-headlamp.shrunAsNonRoot: true,privileged: false✓.env.e2ewith HEADLAMP_URL + token ✓scripts/teardown-e2e-headlamp.sh.env.e2e✓Minor Notes (non-blocking)
playwright.config.tsfallback URL:baseURLfalls back tohttps://headlamp.animaniacs.farh.net(production) ifHEADLAMP_URLis unset. Hugh's CI workflow must setHEADLAMP_URLexplicitly — this is a note for the workflow PR, not a blocker here.Navigation test (test 4): Relies on Headlamp auto-expanding the
intel-gpusidebar section when on/c/main/intel-gpu. This is correct Headlamp behavior but worth noting as an implicit assumption.deployment/e2e-ci-runner-rbac.yaml: Referenced in deploy script comments but not present in repo. Will be needed for CI runner setup (Hugh's concern).Verdict
All automated checks pass, deploy/teardown verified in cluster, test structure and assertions are correctly aligned with plugin source. No regressions to existing 108 unit tests. PR approved.