Skip to content

Comments

fix(adoption-insights): e2e tooltip assertions and a11y filter#2361

Open
HusneShabbir wants to merge 2 commits intoredhat-developer:mainfrom
HusneShabbir:fix/adoption-insights-e2e-tooltip-and-a11y
Open

fix(adoption-insights): e2e tooltip assertions and a11y filter#2361
HusneShabbir wants to merge 2 commits intoredhat-developer:mainfrom
HusneShabbir:fix/adoption-insights-e2e-tooltip-and-a11y

Conversation

@HusneShabbir
Copy link
Contributor

@HusneShabbir HusneShabbir commented Feb 19, 2026

Resolves

https://issues.redhat.com/browse/RHIDP-12034

Summary

Makes adoption-insights e2e tests more stable and fixes CI failures for tooltips, accessibility, and flaky “no data” assertions.

Changes

Tooltip assertions

  • Assert tooltip format by pipe-separated segment count (component: 2 segments x | y, template: 3 segments x | y | z) instead of hardcoded text; no regex (avoids Sonar ReDoS).
  • Scroll row into view before hover and wait for tooltip with 10s timeout so tests are reliable in headless.

Flakiness

  • “Rest of the panels have no data”: increase timeout to 15s for the “no results” text so the empty state has time to appear.

Accessibility

  • In runAccessibilityTests, ignore known third-party issues: color-contrast (MUI Tooltip), svg-img-alt (Recharts), aria-progressbar-name (MUI CircularProgress spinner).

@rhdh-qodo-merge
Copy link

rhdh-qodo-merge bot commented Feb 19, 2026

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
No custom compliance provided

Follow the guide to enable custom compliance check.

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@rhdh-qodo-merge
Copy link

rhdh-qodo-merge bot commented Feb 19, 2026

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Scope accessibility violation filters narrowly

Refine the accessibility violation filter to be more specific. Instead of
globally ignoring color-contrast and svg-img-alt violations, only ignore them
for the intended MUI Tooltips and Recharts elements.

workspaces/adoption-insights/e2e-tests/utils/accessibility.ts [29-37]

-const filteredViolations = accessibilityScanResults.violations.filter(
-  v =>
-    ![
-      'aria-input-field-name',
-      'button-name',
-      'color-contrast', // MUI Tooltip default styling
-      'svg-img-alt', // Recharts SVG paths (e.g. pie chart segments)
-    ].includes(v.id),
-);
+const filteredViolations = accessibilityScanResults.violations.filter(v => {
+  if (['aria-input-field-name', 'button-name'].includes(v.id)) {
+    return false;
+  }
+  // Ignore color-contrast on MUI Tooltips
+  if (
+    v.id === 'color-contrast' &&
+    v.nodes.some(node => node.target.includes('[role="tooltip"]'))
+  ) {
+    return false;
+  }
+  // Ignore svg-img-alt on Recharts SVG paths
+  if (
+    v.id === 'svg-img-alt' &&
+    v.nodes.some(node => node.target.some(t => t.startsWith('.recharts-')))
+  ) {
+    return false;
+  }
+  return true;
+});
  • Apply / Chat
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies that broadly disabling accessibility rules like color-contrast is risky. The proposed change makes the filter more specific, aligning with the comments' intent and preventing the accidental suppression of valid accessibility issues in other parts of the application.

High
General
Scope hover to panel

Scope the hover action to the specific panel context. Change page.getByText(...)
to panel.getByText(...) to avoid interacting with unintended elements.

workspaces/adoption-insights/e2e-tests/insights.test.ts [277]

-await page.getByText('Example Node.js Template').hover();
+await panel.getByText('Example Node.js Template').hover();
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly points out that using the panel locator instead of page makes the test more robust and less likely to fail due to unrelated elements on the page. This is a best practice for writing stable e2e tests.

Medium
Assert tooltip visibility

Add an explicit visibility check for the tooltip before asserting its content.
Use await expect(page.getByRole('tooltip')).toBeVisible() to improve test
robustness.

workspaces/adoption-insights/e2e-tests/insights.test.ts [231]

+await expect(page.getByRole('tooltip')).toBeVisible();
 await expect(page.getByRole('tooltip')).toContainText(/.+\s*\|\s*.+/);

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 5

__

Why: While Playwright's toContainText assertion auto-waits for visibility, explicitly asserting toBeVisible first is a good practice that can improve test stability and make debugging easier.

Low
  • Update

- Assert tooltip content with pipe-separated pattern (x|y|z) instead of hardcoded text
- Add color-contrast and svg-img-alt to a11y filter for MUI tooltip and Recharts

Co-authored-by: Cursor <cursoragent@cursor.com>
@HusneShabbir HusneShabbir force-pushed the fix/adoption-insights-e2e-tooltip-and-a11y branch 2 times, most recently from fc66dc7 to 7046508 Compare February 19, 2026 13:08
- Wait for tooltip with 10s timeout, scroll into view before hover (headless)
- Remove filter for component tooltip; keep filter for template (two tooltips)
- Set workers: 2 in playwright.config

Co-authored-by: Cursor <cursoragent@cursor.com>
@HusneShabbir HusneShabbir force-pushed the fix/adoption-insights-e2e-tooltip-and-a11y branch from 7046508 to da41f10 Compare February 19, 2026 13:11
@sonarqubecloud
Copy link

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant