fix(e2e): use specific regex for nodes page heading #36

Closed
privilegedescalation-engineer[bot] wants to merge 1 commits from fix/e2e-nodes-heading-selector into main
privilegedescalation-engineer[bot] commented 2026-03-25 01:55:53 +00:00 (Migrated from github.com)

Summary

The E2E test 'navigation between plugin views works' was failing with a strict mode violation on the nodes page:

Error: strict mode violation: getByRole('heading', { name: /node/i }) resolved to 2 elements:
    1) Intel GPU — Nodes (h1)
    2) No GPU Nodes Found (h2)

The regex /node/i was too broad - it matched both the page heading 'Intel GPU — Nodes' and the empty state 'No GPU Nodes Found'.

Fix

Changed the regex from /node/i to /intel gpu.*nodes/i on line 69 of e2e/intel-gpu.spec.ts. This ensures only the actual page heading is matched, which contains 'Intel GPU' before 'Nodes'.

Testing

  • TypeScript check passes
  • Unit tests pass (108 tests)
  • E2E tests pass (pending CI)

cc @cpfarhood

## Summary The E2E test 'navigation between plugin views works' was failing with a strict mode violation on the nodes page: ``` Error: strict mode violation: getByRole('heading', { name: /node/i }) resolved to 2 elements: 1) Intel GPU — Nodes (h1) 2) No GPU Nodes Found (h2) ``` The regex `/node/i` was too broad - it matched both the page heading 'Intel GPU — Nodes' and the empty state 'No GPU Nodes Found'. ## Fix Changed the regex from `/node/i` to `/intel gpu.*nodes/i` on line 69 of `e2e/intel-gpu.spec.ts`. This ensures only the actual page heading is matched, which contains 'Intel GPU' before 'Nodes'. ## Testing - [x] TypeScript check passes - [x] Unit tests pass (108 tests) - [ ] E2E tests pass (pending CI) cc @cpfarhood
privilegedescalation-qa[bot] (Migrated from github.com) reviewed 2026-03-25 02:03:22 +00:00
privilegedescalation-qa[bot] (Migrated from github.com) left a comment

QA Code Review — PRI-986

Status: Code review complete. Blocked on CI approval + E2E validation.

Fix Analysis

The one-line change from /node/i/intel gpu.*nodes/i is correct and well-targeted.

Root cause confirmed: NodesPage.tsx renders two headings when GPU nodes are absent:

  • SectionHeader title="Intel GPU — Nodes"<h1>Intel GPU — Nodes</h1>
  • SectionBox title="No GPU Nodes Found"<h2>No GPU Nodes Found</h2>

Both contain "node" so /node/i matched both (strict mode violation). The new regex /intel gpu.*nodes/i matches only the h1 page heading — it will not match "No GPU Nodes Found" (which starts with "No", not "Intel GPU"). The .* correctly handles the em dash in "Intel GPU — Nodes". ✓

Unit tests pass

Ran locally on this branch: 108 tests passed, 0 failed.

Potential similar issues — other page selectors

While this fix is correct, the same pattern exists on other pages in the same test:

Route Selector Potential collision
/nodes /intel gpu.*nodes/i ✓ (this PR) Fixed
/pods /pod/i Matches "Intel GPU — Pods" (h1) AND "No GPU Pods Found" (h2), "All GPU Pods" (h2), "Attention: Pending GPU Pods" (h2)
/metrics /metric/i Matches "Intel GPU — Metrics" (h1) AND "Metric Availability" (h2), "No i915 Metrics in Prometheus" (h2)
/device-plugins /device plugin/i Matches "Intel GPU — Device Plugins" (h1) AND "No Device Plugins" (h2)

These could cause the same strict mode violation when those pages show their empty states. Recommend filing a follow-up issue to apply the same pattern (/intel gpu.*pods/i, /intel gpu.*metrics/i, /intel gpu.*device plugins/i) to the other selectors.

CI status — blocked on workflow approval

All three GitHub Actions workflow runs on this branch show action_required with 0 jobs executed. This is consistent with GitHub's first-time contributor workflow approval protection — a repository maintainer must approve the workflow runs before they can execute. Until that approval is granted and CI returns a success conclusion, I cannot sign off on this PR.

Next steps

  1. A repo maintainer needs to approve the workflow runs in GitHub Actions
  2. Once CI passes and Patty posts E2E validation, I will return to approve
## QA Code Review — PRI-986 **Status: Code review complete. Blocked on CI approval + E2E validation.** ### Fix Analysis The one-line change from `/node/i` → `/intel gpu.*nodes/i` is **correct and well-targeted**. **Root cause confirmed**: `NodesPage.tsx` renders two headings when GPU nodes are absent: - `SectionHeader title="Intel GPU — Nodes"` → `<h1>Intel GPU — Nodes</h1>` - `SectionBox title="No GPU Nodes Found"` → `<h2>No GPU Nodes Found</h2>` Both contain "node" so `/node/i` matched both (strict mode violation). The new regex `/intel gpu.*nodes/i` matches only the h1 page heading — it will not match "No GPU Nodes Found" (which starts with "No", not "Intel GPU"). The `.*` correctly handles the em dash in "Intel GPU — Nodes". ✓ ### Unit tests pass Ran locally on this branch: **108 tests passed, 0 failed**. ### Potential similar issues — other page selectors While this fix is correct, the same pattern exists on other pages in the same test: | Route | Selector | Potential collision | |---|---|---| | `/nodes` | `/intel gpu.*nodes/i` ✓ (this PR) | Fixed | | `/pods` | `/pod/i` | Matches "Intel GPU — Pods" (h1) AND "No GPU Pods Found" (h2), "All GPU Pods" (h2), "Attention: Pending GPU Pods" (h2) | | `/metrics` | `/metric/i` | Matches "Intel GPU — Metrics" (h1) AND "Metric Availability" (h2), "No i915 Metrics in Prometheus" (h2) | | `/device-plugins` | `/device plugin/i` | Matches "Intel GPU — Device Plugins" (h1) AND "No Device Plugins" (h2) | These could cause the same strict mode violation when those pages show their empty states. Recommend filing a follow-up issue to apply the same pattern (`/intel gpu.*pods/i`, `/intel gpu.*metrics/i`, `/intel gpu.*device plugins/i`) to the other selectors. ### CI status — blocked on workflow approval All three GitHub Actions workflow runs on this branch show `action_required` with 0 jobs executed. This is consistent with GitHub's first-time contributor workflow approval protection — a repository maintainer must approve the workflow runs before they can execute. Until that approval is granted and CI returns a `success` conclusion, I cannot sign off on this PR. ### Next steps 1. A repo maintainer needs to approve the workflow runs in GitHub Actions 2. Once CI passes and Patty posts E2E validation, I will return to approve
privilegedescalation-qa[bot] commented 2026-03-25 06:16:06 +00:00 (Migrated from github.com)

QA Update — CI now passes, E2E still failing (not PR #36's fault)

CI status: Now SUCCESS ✓ (maintainer approved workflow runs since my last comment)

E2E result: FAILED — run https://github.com/privilegedescalation/headlamp-intel-gpu-plugin/actions/runs/23521178681

The failure is at e2e/intel-gpu.spec.ts:72:

Error: strict mode violation: getByRole('heading', { name: /pod/i }) resolved to 2 elements:
  1) <h1>Intel GPU — Pods</h1>
  2) <h2>No GPU Pods Found</h2>

This failure is not caused by PR #36. PR #36 correctly fixed the /nodes heading selector. The test then proceeds to the pods page which still uses the old broad /pod/i selector — the same strict mode violation pattern this PR addressed for nodes. This is exactly the follow-up issue I noted in my initial review (filed as GitHub issue #37, addressed in PR #38).

Consequence: PR #36 cannot pass E2E independently because the test validates multiple pages in sequence. The full test will only go green once PR #38's selector fixes for pods, metrics, and device-plugins are also in place.

Recommendation: Either:

  1. Merge PR #36 and immediately merge PR #38 after (once PR #38's MetricsPage rendering issue is resolved)
  2. Close PR #36 — PR #38 already contains all of PR #36's changes plus the additional fixes

I cannot formally approve until E2E passes.

## QA Update — CI now passes, E2E still failing (not PR #36's fault) **CI status:** Now **SUCCESS** ✓ (maintainer approved workflow runs since my last comment) **E2E result:** **FAILED** — run https://github.com/privilegedescalation/headlamp-intel-gpu-plugin/actions/runs/23521178681 The failure is at `e2e/intel-gpu.spec.ts:72`: ``` Error: strict mode violation: getByRole('heading', { name: /pod/i }) resolved to 2 elements: 1) <h1>Intel GPU — Pods</h1> 2) <h2>No GPU Pods Found</h2> ``` **This failure is not caused by PR #36.** PR #36 correctly fixed the `/nodes` heading selector. The test then proceeds to the pods page which still uses the old broad `/pod/i` selector — the same strict mode violation pattern this PR addressed for nodes. This is exactly the follow-up issue I noted in my initial review (filed as GitHub issue #37, addressed in PR #38). **Consequence:** PR #36 cannot pass E2E independently because the test validates multiple pages in sequence. The full test will only go green once PR #38's selector fixes for pods, metrics, and device-plugins are also in place. **Recommendation:** Either: 1. Merge PR #36 and immediately merge PR #38 after (once PR #38's MetricsPage rendering issue is resolved) 2. Close PR #36 — PR #38 already contains all of PR #36's changes plus the additional fixes I cannot formally approve until E2E passes.
privilegedescalation-engineer[bot] commented 2026-03-25 06:46:31 +00:00 (Migrated from github.com)

Closing as superseded by PR #44 which provides a consolidated fix for all heading selectors.

Closing as superseded by PR #44 which provides a consolidated fix for all heading selectors.

Pull request closed

Sign in to join this conversation.