OBSINTA-1290: fix incident detection test selectors#1022
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: DavidRajnoha The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
WalkthroughCypress incidents coverage was updated with case-insensitive tab detection, row-based incident detail selectors, data-attribute-based incident ID extraction, reordered walkthrough setup, and more targeted scrolling and chip visibility assertions. ChangesIncidents Cypress coverage
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
The console changed the data-test-id from "horizontal-link-incidents" to "horizontal-link-Incidents". Use the CSS `i` flag so the selector matches both casings. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The detail table component never applied the data-test IDs defined in data-test.ts. Switch to data-label attribute selectors matching the actual dataLabel props rendered by IncidentsDetailsRowTable, consistent with the regression test helpers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract incident IDs from data-test attributes instead of text content to avoid description text pollution. Use container existence check instead of visibility assertion for 0-height dropdown. Add scrollIntoView and .first() to fix viewport and multi-element ambiguity issues. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fd2f1fd to
0a520a2
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
web/cypress/views/incidents-page.ts (2)
282-287: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winFixed
cy.wait(250)calls aroundsetDaysinteraction.Two arbitrary sleeps bracket the toggle click. The
.should('be.visible')assertion already retries until the dropdown renders, so the trailingcy.wait(250)is redundant, and the leading one doesn't guarantee the toggle is ready — Cypress's built-in actionability retries already handle that. Fixed waits add flakiness risk without a real synchronization guarantee, and slow down every test callingsetDays.♻️ Proposed fix
setDays: (value: '1 day' | '3 days' | '7 days' | '15 days') => { cy.log('incidentsPage.setDays'); - cy.wait(250); incidentsPage.elements.daysSelectToggle().scrollIntoView().click({ force: true }); incidentsPage.elements.daysSelectList().should('be.visible'); - cy.wait(250); const dayKey = value.replace(' ', '-');🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/cypress/views/incidents-page.ts` around lines 282 - 287, Remove both arbitrary cy.wait(250) calls from the setDays interaction. Keep the existing scrollIntoView().click({ force: true }) action and daysSelectList().should('be.visible') assertion so Cypress handles actionability and dropdown readiness through its built-in retries.
186-229: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueInconsistent side-effect:
scrollIntoView()only on the alert-rule cell getter.
incidentsDetailsAlertRuleCellscrolls into view as part of the selector, but the siblingincidentsDetailsAlertRuleLinkand the other cell getters (Namespace/Severity/State/Start/End) don't. Baking an action (scroll) into a query getter is inconsistent with the rest of theelementsobject and could produce different assertion behavior depending on which sibling selector a caller picks.Consider moving the scroll to the call site (e.g., in the test, before
.should('be.visible')) or applying it uniformly across all detail cell getters.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/cypress/views/incidents-page.ts` around lines 186 - 229, Remove the embedded scrollIntoView side effect from incidentsDetailsAlertRuleCell so all incidents detail getters, including incidentsDetailsAlertRuleLink and the Namespace/Severity/State/Start/End cell getters, remain selector-only. Move scrolling to the relevant test call sites before visibility assertions, preserving the existing visibility behavior without making getter selection alter Cypress actions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@web/cypress/e2e/incidents/01.incidents.cy.ts`:
- Around line 96-102: Add an explicit incidentsPage.goTo() call at the start of
the “6. Admin perspective - Incidents page - Bar click selection walkthrough”
test before loading fixtures or applying filters, so it always begins on the
Incidents page independently of prior test state.
---
Nitpick comments:
In `@web/cypress/views/incidents-page.ts`:
- Around line 282-287: Remove both arbitrary cy.wait(250) calls from the setDays
interaction. Keep the existing scrollIntoView().click({ force: true }) action
and daysSelectList().should('be.visible') assertion so Cypress handles
actionability and dropdown readiness through its built-in retries.
- Around line 186-229: Remove the embedded scrollIntoView side effect from
incidentsDetailsAlertRuleCell so all incidents detail getters, including
incidentsDetailsAlertRuleLink and the Namespace/Severity/State/Start/End cell
getters, remain selector-only. Move scrolling to the relevant test call sites
before visibility assertions, preserving the existing visibility behavior
without making getter selection alter Cypress actions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: f83b6335-29a9-4837-b77e-b0c1c6c48e53
📒 Files selected for processing (4)
web/cypress/e2e/incidents/01.incidents.cy.tsweb/cypress/e2e/incidents/regression/01.reg_filtering.cy.tsweb/cypress/e2e/incidents/regression/04.reg_redux_effects.cy.tsweb/cypress/views/incidents-page.ts
|
@DavidRajnoha: This pull request references OBSINTA-1290 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@DavidRajnoha: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
these cells, while data-label is a built-in PatternFly structural attribute
for filter selection
Summary by CodeRabbit