Skip to content

OU-1040: Tests Absolute start dates and Matching start/end/dates#910

Open
DavidRajnoha wants to merge 1 commit intoopenshift:mainfrom
DavidRajnoha:test/OU-1040-incidents-mocking-min-timestamp
Open

OU-1040: Tests Absolute start dates and Matching start/end/dates#910
DavidRajnoha wants to merge 1 commit intoopenshift:mainfrom
DavidRajnoha:test/OU-1040-incidents-mocking-min-timestamp

Conversation

@DavidRajnoha
Copy link
Copy Markdown
Contributor

@DavidRajnoha DavidRajnoha commented Apr 29, 2026

Summary by CodeRabbit

  • Tests
    • Added regression suite for 15-day data loading and expanded tooltip boundary tests with structured assertions across 15/7/3-day filters, including escalating-severity scenarios.
  • Chores
    • Temporarily disabled a monitoring UI plugin in test configs and adjusted query timestamp alignment to 5-minute boundaries.
    • Added and removed incident scenario fixtures to exercise multi-day clipping behavior.
  • Documentation
    • Updated test docs to describe automated 15-day data-loading flows and removed a prior permission-denied test.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 29, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 29, 2026

@DavidRajnoha: This pull request references OU-1040 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 bug to target the "5.0.0" version, but no target version was set.

Details

In 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.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 29, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: DavidRajnoha
Once this PR has been reviewed and has the lgtm label, please assign jgbernalp for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 2026

Walkthrough

Updates incident detection E2E test suite and fixtures to add a 15‑day data‑loading scenario, refactors incidents page helpers (visibility/tooltip collection), aligns Prometheus mock timestamps to 5‑minute boundaries, adjusts Cypress support, and removes obsolete test documentation.

Changes

Cohort / File(s) Summary
Test Documentation
docs/incident_detection/tests/3.api_calls_data_loading_flows.md
Replaces manual Prometheus request-size scenario with an automated "15‑day data loading" description: UI fetches 15 days via repeated query_range, client-side filtering for "Last N Days", instant-query timestamps for Start tooltips; removes OU-1213 permission-denied section.
E2E Regression Specs
web/cypress/e2e/incidents/regression/02.reg_ui_tooltip_boundary_times.cy.ts, web/cypress/e2e/incidents/regression/03.reg_15day_data_loading.cy.ts
Restructures tooltip spec into six focused it blocks using page-object collectors; adds new 03.reg_15day_data_loading.cy.ts suite asserting tooltip↔table start/end consistency across 15/7/3‑day filters and an escalating‑severity clipping scenario.
Fixtures (added/removed)
web/cypress/fixtures/incident-scenarios/19-15-day-data-loading.yaml, web/cypress/fixtures/incident-scenarios/21-multi-severity-boundary-times.yaml
Adds a multi‑incident 14/10/14/2‑day scenario for 15‑day loading tests; removes the old 5‑hour multi‑severity boundary fixture.
Cypress plugin fixture
web/cypress/fixtures/coo/monitoring-ui-plugin.yaml
Temporarily disables Perses monitoring (spec.monitoring.perses.enabled: false).
Prometheus mock logic
web/cypress/support/incidents_prometheus_query_mocks/mock-generators.ts, web/cypress/support/incidents_prometheus_query_mocks/prometheus-mocks.ts
Snaps generated timestamps to Prometheus 300s (5‑minute) grid and bases short-range decisions on aligned window; renames MOCK_QUERYMOCK_QUERY_RANGE in intercepts.
Cypress support
web/cypress/support/e2e.js
Injects a one‑time stylesheet into window.top.document.head to hide Cypress XHR/request command‑log entries.
Page object / UI helpers
web/cypress/views/incidents-page.ts
Adds centralized isPathVisible (opacity-based), new selectors for incident/expanded start/end cells, safer hover methods with visible-segment bounds checks, and structured tooltip collectors (SegmentDates, AlertDates).
Test ID docs
web/src/components/data-test.ts
Adds inline comments documenting missing/limited data-test IDs for Incidents table and details table and current dataLabel fallback usage.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: adding tests for absolute start dates and matching start/end dates across incidents UI, aligning with the comprehensive test additions in the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The custom check for Ginkgo test name stability is not applicable to this pull request. The PR exclusively modifies Cypress tests (TypeScript), YAML fixtures, and support files.
Test Structure And Quality ✅ Passed The custom check assesses Ginkgo test code quality, but the PR contains only Cypress end-to-end tests in TypeScript/JavaScript, making the check not applicable and therefore passing by exclusion.
Microshift Test Compatibility ✅ Passed This PR does not add any Ginkgo e2e tests; it exclusively modifies Cypress tests (JavaScript/TypeScript-based web UI testing framework).
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR adds only Cypress UI tests (.cy.ts files), not Ginkgo e2e tests. Custom check applies only to Go-based Ginkgo tests.
Topology-Aware Scheduling Compatibility ✅ Passed PR modifications are exclusively to Cypress test files and test fixtures in the web/cypress directory, with no changes to operator code, controllers, or production deployment manifests.
Ote Binary Stdout Contract ✅ Passed This pull request contains no Go source code modifications and therefore cannot violate the OTE Binary Stdout Contract.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed This pull request does not contain any Ginkgo e2e tests. All modifications are exclusively to Cypress UI tests, test fixtures, test infrastructure, and component source code. The custom check for Ginkgo e2e tests is not applicable.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Review rate limit: 9/10 reviews remaining, refill in 6 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 7

🧹 Nitpick comments (1)
web/cypress/support/e2e.js (1)

6-13: Gate the command-log CSS behind a suite flag.

This support file runs for every Cypress spec, so hiding all request/xhr entries here makes unrelated failures much harder to debug. Prefer an env flag or an incidents-only hook so the noise reduction stays local to these suites.

Possible adjustment
 // Hide fetch/XHR request entries from the Cypress command log to reduce noise
-const app = window.top;
-if (app && !app.document.head.querySelector('[data-hide-command-log-request]')) {
-  const style = app.document.createElement('style');
-  style.innerHTML = '.command-name-request, .command-name-xhr { display: none }';
-  style.setAttribute('data-hide-command-log-request', '');
-  app.document.head.appendChild(style);
+if (Cypress.env('HIDE_REQUEST_COMMAND_LOG') === true) {
+  const app = window.top;
+  if (app && !app.document.head.querySelector('[data-hide-command-log-request]')) {
+    const style = app.document.createElement('style');
+    style.innerHTML = '.command-name-request, .command-name-xhr { display: none }';
+    style.setAttribute('data-hide-command-log-request', '');
+    app.document.head.appendChild(style);
+  }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/cypress/support/e2e.js` around lines 6 - 13, Wrap the existing
DOM-injection that hides request/xhr entries in a conditional driven by an
opt-in suite flag (e.g. Cypress.env('hideCommandLogRequests')) instead of
running unconditionally: check Cypress.env('hideCommandLogRequests') at the top,
and only execute the block that creates the style element (the code referencing
app, style, and the data-hide-command-log-request attribute and style.innerHTML)
when that env flag is truthy; ensure the flag name is documented in the README
or example CI config so affected suites can enable it when desired.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/incident_detection/tests/3.api_calls_data_loading_flows.md`:
- Around line 87-119: Update section 3.4 to mark the scenario as AUTOMATED by
referencing the new Cypress test suite and only keep truly manual steps as
manual; specifically, change "Automation Status: NOT AUTOMATED" to "Automation
Status: AUTOMATED" and add a line citing the test file
`web/cypress/e2e/incidents/regression/03.reg_15day_data_loading.cy.ts` (or test
suite/fixture name) as the automated coverage, then remove or annotate any steps
that are now covered by that e2e test so the checklist only contains remaining
manual verification items.

In `@web/cypress/e2e/incidents/regression/02.reg_ui_tooltip_boundary_times.cy.ts`:
- Around line 377-424: The test is indexing alerts by position which is brittle;
update the block using incidentsPage.getSelectedIncidentAlerts() to first read a
stable identifier (e.g., severity via getSeverityCell() or name via
getNameCell()) for each alert, build a small map keyed by that identifier, then
read start/end cells from the mapped alert elements and assign to
tableInfoStart/tableInfoEnd, tableWarningStart/tableWarningEnd,
tableCriticalStart/tableCriticalEnd accordingly; ensure you still assert
alerts.length === 3 and use the identifier values to pick the correct alert
element rather than alerts[0/1/2].
- Around line 50-55: The intercept for test data is being registered after
navigation which can race with network requests; move the
cy.mockIncidentFixture('incident-scenarios/19-15-day-data-loading.yaml') call
before incidentsPage.goTo() in the beforeEach so the fixture/intercepts are set
up prior to triggering initial incidents queries (i.e., swap the order of
cy.mockIncidentFixture and incidentsPage.goTo in the beforeEach).

In `@web/cypress/e2e/incidents/regression/03.reg_15day_data_loading.cy.ts`:
- Around line 82-99: collectAllStartDates() currently expands and reads fixed
row index 0 (calls like incidentsPage.expandRow(0),
incidentsDetailsStartCell(0), incidentsDetailsFiringStartCell(0)) so it ignores
the passed incidentId; update the helper to locate and operate on the row for
the given incidentId instead of index 0 — e.g. use or add a selector helper that
finds the incident row by incidentId (or call an existing
incidentsPage.findRowByIncidentId / incidentsPage.rowForIncidentId) then call
expandRow on that row and use incident-specific cell getters (replace
incidentsDetailsStartCell(0) and incidentsDetailsFiringStartCell(0) with their
incident-row-aware equivalents) so the function reads the correct table cells
for the requested incident.
- Around line 255-264: The tooltip start date assertion is too loose: replace
the loose expect(d).to.not.be.empty in the hover test that uses
incidentsPage.hoverOverIncidentBarById('ESCALATING-14d-monitoring-severity',
warningIndex) and incidentsPage.getTooltipStartDate() with a strict check that
the returned value equals one of the two acceptable documented values (the
warning segment start or the incident/info segment start), i.e. assert that d
=== warningSegment.start OR d === infoSegment.start (or use a
predicate/satisfy-style assertion) so only those two documented outputs pass.
- Around line 51-56: The test currently calls incidentsPage.goTo() before
registering the mock which causes a race; remove the explicit
incidentsPage.goTo() call in the beforeEach and instead call
cy.mockIncidentFixture('incident-scenarios/19-15-day-data-loading.yaml') first
so the mock interceptor is registered and let cy.mockIncidentFixture() perform
navigation (it already calls goTo() internally).

In `@web/cypress/support/incidents_prometheus_query_mocks/mock-generators.ts`:
- Around line 15-31: The code currently snaps start/end to an absolute 5-minute
grid (alignedStart/alignedEnd) which can produce timestamps outside the
requested range; change it to use the caller-provided startTime as the grid
origin: set the first timestamp to startTime (or startTime when duration <
fiveMinutes) and then loop currentTime = startTime; while (currentTime <=
endTime) { timestamps.push(currentTime); currentTime += fiveMinutes; } remove
Math.ceil/Math.floor alignment and reference fiveMinutes, startTime, endTime,
timestamps, currentTime when making the change.

---

Nitpick comments:
In `@web/cypress/support/e2e.js`:
- Around line 6-13: Wrap the existing DOM-injection that hides request/xhr
entries in a conditional driven by an opt-in suite flag (e.g.
Cypress.env('hideCommandLogRequests')) instead of running unconditionally: check
Cypress.env('hideCommandLogRequests') at the top, and only execute the block
that creates the style element (the code referencing app, style, and the
data-hide-command-log-request attribute and style.innerHTML) when that env flag
is truthy; ensure the flag name is documented in the README or example CI config
so affected suites can enable it when desired.
🪄 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: 555ed8fe-6cad-46ab-bce4-895a6a2e538e

📥 Commits

Reviewing files that changed from the base of the PR and between 831ad1c and 15a00ac.

📒 Files selected for processing (11)
  • docs/incident_detection/tests/3.api_calls_data_loading_flows.md
  • web/cypress/e2e/incidents/regression/02.reg_ui_tooltip_boundary_times.cy.ts
  • web/cypress/e2e/incidents/regression/03.reg_15day_data_loading.cy.ts
  • web/cypress/fixtures/coo/monitoring-ui-plugin.yaml
  • web/cypress/fixtures/incident-scenarios/19-15-day-data-loading.yaml
  • web/cypress/fixtures/incident-scenarios/21-multi-severity-boundary-times.yaml
  • web/cypress/support/e2e.js
  • web/cypress/support/incidents_prometheus_query_mocks/mock-generators.ts
  • web/cypress/support/incidents_prometheus_query_mocks/prometheus-mocks.ts
  • web/cypress/views/incidents-page.ts
  • web/src/components/data-test.ts
💤 Files with no reviewable changes (1)
  • web/cypress/fixtures/incident-scenarios/21-multi-severity-boundary-times.yaml

Comment thread docs/incident_detection/tests/3.api_calls_data_loading_flows.md
…d 15-day data loading

Add regression tests for mixed severity interval boundary times (OU-1205,
OU-1221) and 15-day data loading with time filter consistency. Extend the
incidents page object with tooltip date extraction helpers, visible segment
counting, and incident-by-ID hover/select methods. Rename 05.reg_15day to
03.reg_15day to reflect correct test ordering.

Made-with: Cursor
@DavidRajnoha DavidRajnoha force-pushed the test/OU-1040-incidents-mocking-min-timestamp branch from 15a00ac to 29ae97e Compare April 29, 2026 09:57
@DavidRajnoha
Copy link
Copy Markdown
Contributor Author

/test e2e-incidents

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@web/cypress/e2e/incidents/regression/02.reg_ui_tooltip_boundary_times.cy.ts`:
- Around line 50-60: The beforeEach setup currently mocks the fixture but
doesn't navigate to the incidents page, which makes tests brittle; update the
beforeEach block to call incidentsPage.goTo() immediately after
cy.mockIncidentFixture('incident-scenarios/19-15-day-data-loading.yaml') so each
test explicitly navigates to the incidents page (match the pattern used in
02.incidents-mocking-example.cy.ts) and retains the existing setup functions
(incidentsPage.clearAllFilters(), incidentsPage.setDays('15 days'), etc.).

In `@web/cypress/views/incidents-page.ts`:
- Around line 648-667: hoverOverAlertBar returns incidentsPage.waitForTooltip()
which waits for the global .incidents__tooltip and can pass if an unrelated
incident tooltip is already visible; change the hover flow to wait specifically
for the alert-chart tooltip used by collectAlertTooltip (e.g., call a new or
existing helper like incidentsPage.waitForAlertTooltip() or
incidentsPage.waitForTooltip('.alerts__tooltip') after triggering the hover),
ensuring the hoverOverAlertBar function (and the call site using
collectAlertTooltip) awaits the alert-specific tooltip update rather than any
visible tooltip.
🪄 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: 59629f06-4936-4813-9306-fcaf5669c760

📥 Commits

Reviewing files that changed from the base of the PR and between 15a00ac and 29ae97e.

📒 Files selected for processing (11)
  • docs/incident_detection/tests/3.api_calls_data_loading_flows.md
  • web/cypress/e2e/incidents/regression/02.reg_ui_tooltip_boundary_times.cy.ts
  • web/cypress/e2e/incidents/regression/03.reg_15day_data_loading.cy.ts
  • web/cypress/fixtures/coo/monitoring-ui-plugin.yaml
  • web/cypress/fixtures/incident-scenarios/19-15-day-data-loading.yaml
  • web/cypress/fixtures/incident-scenarios/21-multi-severity-boundary-times.yaml
  • web/cypress/support/e2e.js
  • web/cypress/support/incidents_prometheus_query_mocks/mock-generators.ts
  • web/cypress/support/incidents_prometheus_query_mocks/prometheus-mocks.ts
  • web/cypress/views/incidents-page.ts
  • web/src/components/data-test.ts
💤 Files with no reviewable changes (1)
  • web/cypress/fixtures/incident-scenarios/21-multi-severity-boundary-times.yaml
✅ Files skipped from review due to trivial changes (3)
  • web/cypress/fixtures/coo/monitoring-ui-plugin.yaml
  • web/src/components/data-test.ts
  • web/cypress/support/incidents_prometheus_query_mocks/prometheus-mocks.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • web/cypress/support/e2e.js
  • web/cypress/fixtures/incident-scenarios/19-15-day-data-loading.yaml
  • web/cypress/e2e/incidents/regression/03.reg_15day_data_loading.cy.ts
  • docs/incident_detection/tests/3.api_calls_data_loading_flows.md

Comment thread web/cypress/views/incidents-page.ts
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 29, 2026

@DavidRajnoha: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-incidents 29ae97e link false /test e2e-incidents

Full PR test history. Your PR dashboard.

Details

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 kubernetes-sigs/prow repository. I understand the commands that are listed here.

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

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants