The withTimeout test was failing because:
1. The mock made ALL ApiProxy.request calls hang, but the implementation
has 4 sequential requests (1 CRD + 3 pod selectors) each wrapped in
their own withTimeout
2. Using advanceTimersByTimeAsync with hanging promises causes act() to
hang because flushPromises() waits for pending promises
Fix:
- Use mockReturnValueOnce for the CRD call (hanging) and
mockResolvedValueOnce for each pod selector call (resolves immediately)
- Use synchronous advanceTimersByTime() instead of async version
- Simplified test flow: check loading=true initially, advance timers,
then verify crdAvailable=false and loading=false
Fixes PRI-1040
The previous mock used mockRejectedValue which immediately rejects,
so Promise.race resolved before withTimeout's setTimeout fired.
Now we use new Promise(() => {}) to simulate a hanging request
and advance timers to properly exercise the 2s timeout logic.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
- Reformat withTimeout call to single line (prettier)
- Add unit test for CRD timeout behavior (crdAvailable=false when API fails)
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Add withTimeout() helper that wraps ApiProxy.request calls with a 2s timeout.
This prevents the plugin from hanging indefinitely when CRD requests fail
or network issues occur in the E2E environment.
Root cause: ApiProxy.request to non-existent CRDs would hang forever,
causing the Loading Intel GPU data... progressbar to never resolve.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
- Reformat withTimeout call to single line (prettier)
- Add unit test for CRD timeout behavior (crdAvailable=false when API fails)
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Add withTimeout() helper that wraps ApiProxy.request calls with a 2s timeout.
This prevents the plugin from hanging indefinitely when CRD requests fail
or network issues occur in the E2E environment.
Root cause: ApiProxy.request to non-existent CRDs would hang forever,
causing the Loading Intel GPU data... progressbar to never resolve.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
The /node/i regex was too broad and matched both the page heading
'Intel GPU — Nodes' and the empty state 'No GPU Nodes Found',
causing a strict mode violation in Playwright.
Use /intel gpu.*nodes/i to match only the actual page heading,
which contains 'Intel GPU' before 'Nodes'.
Headlamp sidebar child links (GPU Nodes, GPU Pods, Metrics) do not render
after clicking the parent intel-gpu sidebar button — they only appear when
already on a child route. Replace the sidebar-link assertion approach with
direct URL navigation, matching the pattern used by the device-plugins test.
Closes#34
Co-Authored-By: Paperclip <noreply@paperclip.ing>
The 'navigation between plugin views works' test was navigating directly
to /c/main/intel-gpu and then immediately trying to find sidebar child
links (GPU Nodes, GPU Pods, Metrics). Direct URL navigation does not
guarantee that the Headlamp sidebar parent entry is expanded, so the
child links may not be rendered yet.
Fix: start from the home page and click the 'intel-gpu' sidebar button
to explicitly expand the section before asserting on child link
visibility. This mirrors the real user flow (tests 1 and 2 already
use this approach) and eliminates the race between navigation and
sidebar render.
Fixes#34
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PR #29 accidentally dropped the openapi-types peer dependency entry
from the lock file. This restores it by re-running npm install, which
resolves the CI failure: "Missing: openapi-types@12.1.3 from lock file".
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Adds @playwright/test ^1.58.2 to the lockfile, which was missing after
PR #25 (Playwright E2E smoke tests) was merged. This unblocks CI on main.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-24 23:21:12 +00:00
3 changed files with 50 additions and 22 deletions
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.