Skip to content

NO-JIRA: perses automation testing fixes after project selector fixes#833

Open
etmurasaki wants to merge 1 commit intoopenshift:mainfrom
etmurasaki:etmura-perses-fix
Open

NO-JIRA: perses automation testing fixes after project selector fixes#833
etmurasaki wants to merge 1 commit intoopenshift:mainfrom
etmurasaki:etmura-perses-fix

Conversation

@etmurasaki
Copy link
Contributor

@etmurasaki etmurasaki commented Mar 11, 2026

Summary by CodeRabbit

  • Tests
    • Improved error messaging for dashboard creation and import validation to provide clearer user feedback
    • Enhanced test suite stability with refined navigation flows and assertion ordering for dashboard management operations
    • Updated test infrastructure with optimized element selector scoping and standardized test data conventions

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

@etmurasaki: This pull request explicitly references no jira issue.

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
Contributor

openshift-ci bot commented Mar 11, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: etmurasaki

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

The pull request process is described 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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 11, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

📝 Walkthrough

Walkthrough

Multiple Cypress test files are updated to add preliminary navigation steps before reaching Perses dashboards, test page objects are refactored to scope DOM selectors within dialog contexts, error validation messages in constants are revised, and fixture tag values are normalized to lowercase.

Changes

Cohort / File(s) Summary
RBAC Test Setup Navigation
web/cypress/e2e/perses/99.coo_rbac_perses_user[1-6].cy.ts
Each test file adds a navigation step in the beforeEach block to open "Observe > Dashboards" prior to navigating to "Observe > Dashboards (Perses)", establishing an intermediate navigation state before Perses dashboard access.
Test Support Flow Adjustments
web/cypress/support/perses/99.coo_rbac_perses_user[1,3,5].cy.ts
Project dropdown assertions are reordered across multiple test blocks, closeSuccessAlert() calls are removed from delete flows, and duplicate/import validation checks are repositioned to verify field presence at different points in the assertion sequence.
Test Page Object Selector Refactoring
web/cypress/views/perses-dashboards-create-dashboard.ts, web/cypress/views/perses-dashboards-import-dashboard.ts, web/cypress/views/perses-dashboards-list-dashboards.ts
DOM selectors for dropdown interactions and error assertions are updated to use cy.byPFRole('dialog').find(...) scoping instead of global selectors, improving isolation within dialog contexts; assertion for duplicated name validation is simplified by removing parameters.
Test Constants and Validation Messages
web/cypress/fixtures/perses/constants.ts
Error validation messages are rewritten with more descriptive text; a new constant DIALOG_DUPLICATED_NAME_PF_VALIDATION_SUFFIX_PROJECT is added; existing validation messages are split or reformatted for clarity.
Test Data IDs and Selectors
web/src/components/data-test.ts
Dashboard name input test ID is updated to a more specific form group selector; project dropdown selector is changed from typeahead/menu-toggle to a button element selector; new test ID PersesDuplicateDashboardNameError is added.
Fixture Tag Normalization
web/cypress/fixtures/coo/coo141_perses/import/acm-vm-status.json
Tag values are updated from capitalized ("ACM", "KubeVirt", "OpenShift", "Virtualization") to lowercase equivalents.
Support File Cleanup
web/cypress/support/perses/00.coo_bvt_perses_admin_1.cy.ts
Trailing character in deletion flow is removed from navigation line.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Hops through dashboards with glee,
Selectors now scoped, oh what clarity!
Tags are lowercase, errors refined,
Tests flow smoother, by design!
This rabbit's work makes quality shine!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 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 primary purpose of the changeset: fixing Perses automation tests following project selector fixes.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Copy link

@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: 3

🧹 Nitpick comments (2)
web/cypress/e2e/perses/99.coo_rbac_perses_user1.cy.ts (1)

66-67: Extract the two-step Perses navigation into one helper.

This exact sequence now appears across all 99.coo_rbac_perses_user{1..6}.cy.ts specs. Wrapping it in something like nav.sidenav.openPersesDashboards() would keep future route fixes in one place.

♻️ Suggested cleanup
-    nav.sidenav.clickNavLink(['Observe', 'Dashboards']);
-    nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
+    nav.sidenav.openPersesDashboards();
// web/cypress/views/nav.ts
openPersesDashboards: () => {
  nav.sidenav.clickNavLink(['Observe', 'Dashboards']);
  nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
},
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/cypress/e2e/perses/99.coo_rbac_perses_user1.cy.ts` around lines 66 - 67,
Extract the repeated two-step navigation into a single helper method on the nav
view: create a function named openPersesDashboards (e.g.,
nav.sidenav.openPersesDashboards) that calls
nav.sidenav.clickNavLink(['Observe', 'Dashboards']) then
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']), and replace the
two-line sequences in all 99.coo_rbac_perses_user{1..6}.cy.ts specs with a
single call to nav.sidenav.openPersesDashboards() so future route changes are
centralized.
web/cypress/views/perses-dashboards-create-dashboard.ts (1)

65-69: Drop the new fixed pause before clicking Cancel.

The button is already gated by should('be.visible'), so the extra cy.wait(2000) only adds suite latency and still leaves the interaction time-based instead of state-based.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/cypress/views/perses-dashboards-create-dashboard.ts` around lines 65 -
69, In createDashboardDialogCancelButton remove the pre-click fixed pause (the
cy.wait(2000) immediately before the .byPFRole('dialog')...click call) and rely
on the existing should('be.visible') assertion for a state-based interaction;
leave the rest of the method unchanged so the click uses the visibility guard
instead of a time-based wait.
🤖 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/support/perses/99.coo_rbac_perses_user1.cy.ts`:
- Around line 479-494: The test is filtering/deleting using a hard-coded prefix
('Testing Dashboard - UP') which can match multiple dashboards; change the flow
to use the exact generated dashboard name stored in suite scope (e.g. a variable
created when the dashboard is made) and pass that variable to
listPersesDashboardsPage.filter.byName(generatedName) and to the delete action;
instead of listPersesDashboardsPage.clickKebabIcon() use a row-scoped action
(e.g. clickKebabForDashboard(generatedName) or locate the row by name before
clicking) so the kebab targets the exact row, and update countDashboards
assertions to expect '1'/'0' against that exact name. Ensure the generatedName
is accessible where the delete steps run (store in outer describe or
create+delete in the same it).

In `@web/cypress/views/perses-dashboards-import-dashboard.ts`:
- Around line 101-108: The assertions assertFailedToMigrateGrafanaDashboard and
assertDuplicatedDashboardError currently use cy.get('h4') which is too broad;
scope them to the alert component instead (e.g., use cy.get('[role="alert"]') or
your alert class) and then check the heading text inside that alert (for
example, cy.get('[role="alert"]').contains('h4',
persesDashboardsImportDashboard.DIALOG_FAILED_TO_MIGRATE_GRAFANA_DASHBOARD').should('be.visible')
and similarly for DIALOG_DUPLICATED_DASHBOARD_ERROR) so the match is constrained
to the alert component.

In `@web/src/components/data-test.ts`:
- Line 221: The selector PersesCreateDashboardProjectDropdown uses an exact
class-match string which is brittle; replace it with a standard class selector
(e.g., button.pf-v6-c-menu-toggle__button or just .pf-v6-c-menu-toggle__button)
wherever PersesCreateDashboardProjectDropdown is defined/used so it tolerates
additional classes and order changes—update the definition in
web/src/components/data-test.ts and replace all 13 usages across the Cypress
helpers (create, duplicate, import) to reference the new class-style selector.

---

Nitpick comments:
In `@web/cypress/e2e/perses/99.coo_rbac_perses_user1.cy.ts`:
- Around line 66-67: Extract the repeated two-step navigation into a single
helper method on the nav view: create a function named openPersesDashboards
(e.g., nav.sidenav.openPersesDashboards) that calls
nav.sidenav.clickNavLink(['Observe', 'Dashboards']) then
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']), and replace the
two-line sequences in all 99.coo_rbac_perses_user{1..6}.cy.ts specs with a
single call to nav.sidenav.openPersesDashboards() so future route changes are
centralized.

In `@web/cypress/views/perses-dashboards-create-dashboard.ts`:
- Around line 65-69: In createDashboardDialogCancelButton remove the pre-click
fixed pause (the cy.wait(2000) immediately before the
.byPFRole('dialog')...click call) and rely on the existing should('be.visible')
assertion for a state-based interaction; leave the rest of the method unchanged
so the click uses the visibility guard instead of a time-based wait.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f57fe68d-cda1-40c6-a1d1-6480b2a0fdc9

📥 Commits

Reviewing files that changed from the base of the PR and between 4b2ccc0 and 337dbdc.

📒 Files selected for processing (16)
  • web/cypress/e2e/perses/99.coo_rbac_perses_user1.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user2.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user3.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user4.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user5.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user6.cy.ts
  • web/cypress/fixtures/coo/coo141_perses/import/acm-vm-status.json
  • web/cypress/fixtures/perses/constants.ts
  • web/cypress/support/perses/00.coo_bvt_perses_admin_1.cy.ts
  • web/cypress/support/perses/99.coo_rbac_perses_user1.cy.ts
  • web/cypress/support/perses/99.coo_rbac_perses_user3.cy.ts
  • web/cypress/support/perses/99.coo_rbac_perses_user5.cy.ts
  • web/cypress/views/perses-dashboards-create-dashboard.ts
  • web/cypress/views/perses-dashboards-import-dashboard.ts
  • web/cypress/views/perses-dashboards-list-dashboards.ts
  • web/src/components/data-test.ts

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 11, 2026

@etmurasaki: all tests passed!

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.

});

beforeEach(() => {
nav.sidenav.clickNavLink(['Observe', 'Dashboards']);
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure why we need to click on legacy dashboards to test perses. Is it some reset step missing?

cy.log(`5.5. Click on the Kebab icon - Delete`);
nav.sidenav.clickNavLink(['Observe', 'Alerting']);
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);s
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are the testing files being excluded from typescript and lint checks? This should have been caught by the ts compiler.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. 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.

3 participants