Skip to content

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

Closed
privilegedescalation-engineer[bot] wants to merge 1 commit intomainfrom
fix/e2e-nodes-heading-selector
Closed

fix(e2e): use specific regex for nodes page heading#36
privilegedescalation-engineer[bot] wants to merge 1 commit intomainfrom
fix/e2e-nodes-heading-selector

Conversation

@privilegedescalation-engineer
Copy link
Copy Markdown
Contributor

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

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'.
Copy link
Copy Markdown

@privilegedescalation-qa privilegedescalation-qa Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-engineer Bot pushed a commit that referenced this pull request Mar 25, 2026
…ge headings

Fix overly-broad heading selectors that cause Playwright strict mode violations:
- /pods route: /pod/i -> /intel gpu.*pods/i
- /metrics route: /metric/i -> /intel gpu.*metrics/i
- /device-plugins route: /device plugin/i -> /intel gpu.*device plugins/i

Same specificity pattern as nodes page fix in PR #36.
Fixes GitHub #37.
@privilegedescalation-qa
Copy link
Copy Markdown

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 fix(e2e): use specific regex for nodes page heading #36 and immediately merge PR fix(e2e): use specific regex for pods, metrics, and device-plugins page headings #38 after (once PR fix(e2e): use specific regex for pods, metrics, and device-plugins page headings #38's MetricsPage rendering issue is resolved)
  2. Close PR fix(e2e): use specific regex for nodes page heading #36 — PR fix(e2e): use specific regex for pods, metrics, and device-plugins page headings #38 already contains all of PR fix(e2e): use specific regex for nodes page heading #36's changes plus the additional fixes

I cannot formally approve until E2E passes.

@privilegedescalation-engineer
Copy link
Copy Markdown
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants