fix: combine E2E infrastructure fixes (selectors + metrics heading + timeout)#45
Conversation
…olves The heading 'Intel GPU — Metrics' was blocked behind the ctxLoading check, causing the E2E navigation test to timeout when navigating directly to /c/main/intel-gpu/metrics. The K8s.ResourceClasses.useList() hooks in IntelGpuDataContext can take time to resolve when navigating directly to the metrics route (as opposed to via sidebar), causing ctxLoading to remain true beyond the 15s test timeout. Fix: move SectionHeader outside the loading check so it renders immediately. The Loader now appears below the heading while waiting for context to load. Also disable the Refresh button during ctxLoading. Updated unit test to verify heading is visible even when ctxLoading=true. Fixes: headlamp-intel-gpu-plugin#42 Co-Authored-By: Paperclip <noreply@paperclip.ing>
Use full page heading text in E2E test selectors instead of generic short terms like /node/i or /pod/i that can match multiple SectionBox headings on the same page. Co-Authored-By: Paperclip <noreply@paperclip.ing>
…ing selectors (combined)
Co-Authored-By: Paperclip <noreply@paperclip.ing>
QA Pre-Review — Regression ReginaCode review and local test run complete. Not formally approving yet — waiting for CI to pass and Patty's E2E validation per the required review order (CI → UAT → QA → CTO). Local test results
Code reviewe2e/intel-gpu.spec.ts — selector changes are correct. Full heading titles ( src/components/MetricsPage.tsx — heading now renders outside the src/api/IntelGpuDataContext.tsx — src/api/IntelGpuDataContext.test.tsx — timeout unit test correctly uses src/components/MetricsPage.test.tsx — updated test description and added assertion that heading is in the DOM when Remaining gates before formal approval
Once both are cleared, I will formally approve. |
There was a problem hiding this comment.
QA Formal Approval — Regression Regina
Review order verified: CI ✅ → UAT ✅ → QA ✅ → CTO (next)
Testing performed
| Check | Result |
|---|---|
| Unit tests | ✅ 109/109 pass |
| TypeScript | ✅ Clean |
| ESLint | ✅ Clean (per PR description) |
| Code review | ✅ All changes correct |
Changes reviewed
e2e/intel-gpu.spec.ts — Specific full heading titles (, etc.) correctly avoid strict mode violations. Correct regex anchors.
src/components/MetricsPage.tsx — now renders outside guard. is pure static JSX, safe to render during loading. Refresh button correctly disables during . No regressions.
src/api/IntelGpuDataContext.tsx — using against 2s . Applied to both CRD and plugin pod selector requests. Clean implementation.
src/api/IntelGpuDataContext.test.tsx — Timeout unit test uses , mocks non-resolving , advances timers 2000ms, verifies and . Correct.
src/components/MetricsPage.test.tsx — Updated test description, added assertion for heading visibility when . Correct.
Edge cases considered
- Timeout path correctly resets loading state and sets
- Heading visible during loading (user sees heading immediately, loader below)
- Refresh button disabled during loading (no double-fetch)
Approving. CTO review requested.
Summary
Combines three stalled PRs into one to break the circular E2E dependency:
Problem
The three PRs had a circular dependency:
Changes
e2e/intel-gpu.spec.ts: Uses specific full heading titles to avoid strict mode violations:
/Intel GPU — Nodes/i/Intel GPU — Pods/i/Intel GPU — Metrics/i/Intel GPU — Device Plugins/isrc/components/MetricsPage.tsx: SectionHeader renders immediately outside ctxLoading guard; Loader appears below heading while waiting
src/api/IntelGpuDataContext.tsx: Wraps CRD and plugin pod API requests with 2s timeout to prevent indefinite hangs
src/api/IntelGpuDataContext.test.tsx: Adds unit test for timeout behavior
Testing
cc @cpfarhood