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 test stability and assertion ordering for dashboard management flows.
    • Standardized selector scoping and test data for more reliable UI checks.
  • Bug Fixes
    • Success alert after saving a dashboard no longer auto-closes, ensuring users see confirmation.
    • Import/create error messages now include clearer, user-facing prefixes for migration/import failures and duplicate names.
  • Style
    • Dashboard metadata tags normalized to lowercase for consistent display.

@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

Cypress tests and page objects were updated: preliminary navigation steps added in multiple RBAC tests, dialog scoping applied for dropdown/error selectors, validation messages and fixture tags adjusted, a few support test sequences and selectors were reordered or corrected, and one page-object method signature was simplified.

Changes

Cohort / File(s) Summary
RBAC test navigation additions
web/cypress/e2e/perses/99.coo_rbac_perses_user[1-6].cy.ts
Inserted an extra navigation step in beforeEach to click Observe > Dashboards before Observe > Dashboards (Perses).
Support test flow tweaks
web/cypress/support/perses/99.coo_rbac_perses_user[1,3,5].cy.ts, web/cypress/support/perses/00.coo_bvt_perses_admin_1.cy.ts, web/cypress/support/perses/01.coo_list_perses_admin_namespace.cy.ts
Reordered project-dropdown existence assertions, removed some closeSuccessAlert() calls after delete flows, fixed a stray trailing character, and replaced some direct filter actions with side-navigation steps.
Page object scoping & assertions
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/cypress/views/perses-dashboards.ts
Switched dropdown/error element lookups to use dialog-scoped selectors (cy.byPFRole('dialog').find(...)) in multiple helpers; adjusted several assertion targets and removed an automatic success-alert close after Save.
Selectors / test IDs changed
web/src/components/data-test.ts
Updated dashboard name input test ID and project-dropdown selector; added a new public selector PersesDuplicateDashboardNameError.
Constants / validation messages
web/cypress/fixtures/perses/constants.ts
Added DIALOG_DUPLICATED_NAME_PF_VALIDATION_SUFFIX_PROJECT, split/reworded duplicate-name and max-length validation messages, and prefixed some import/migration error strings with explicit "Error ..." text.
Fixture normalization
web/cypress/fixtures/coo/coo141_perses/import/acm-vm-status.json
Normalized tag values from capitalized to lowercase (ACMacm, KubeVirtkubevirt, OpenShiftopenshift, Virtualizationvirtualization).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through tests at break of dawn,

Scoped dialogs snug, old selectors gone.
Tags humbled to lowercase, messages polite,
Navigation ordered, assertions set right.
A tiny rabbit cheers the test-suite bright 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.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 clearly summarizes the main purpose of the changes: automation testing fixes for Perses following project selector updates.

✏️ 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
📝 Coding Plan
  • Generate coding plan for human review comments

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

Tip

You can disable the changed files summary in the walkthrough.

Disable the reviews.changed_files_summary setting to disable the changed files summary in the walkthrough.

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

});

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.

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.

♻️ Duplicate comments (1)
web/cypress/support/perses/99.coo_rbac_perses_user1.cy.ts (1)

479-494: ⚠️ Potential issue | 🟠 Major

Use the exact generated dashboard name for delete cleanup (not a shared prefix).

Line 480 and Line 493 still filter by 'Testing Dashboard - UP', which can match multiple leftover dashboards and make delete/counter assertions flaky.

🛠️ Suggested fix
+let createdDashboardName = '';

 it(`5.${perspective.name} perspective - Create Dashboard with panel groups, panels and variables`, () => {
-  let dashboardName = 'Testing Dashboard - UP ';
-  let randomSuffix = Math.random().toString(5);
-  dashboardName += randomSuffix;
+  createdDashboardName = `Testing Dashboard - UP ${Math.random().toString(36).slice(2, 10)}`;
@@
-  persesCreateDashboardsPage.enterDashboardName(dashboardName);
+  persesCreateDashboardsPage.enterDashboardName(createdDashboardName);
@@
 });

 it(`9.${perspective.name} perspective - Delete dashboard`, () => {
+  expect(createdDashboardName, 'created dashboard name').to.not.equal('');
@@
-  listPersesDashboardsPage.filter.byName('Testing Dashboard - UP');
+  listPersesDashboardsPage.filter.byName(createdDashboardName);
@@
-  listPersesDashboardsPage.filter.byName('Testing Dashboard - UP');
+  listPersesDashboardsPage.filter.byName(createdDashboardName);
 });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/cypress/support/perses/99.coo_rbac_perses_user1.cy.ts` around lines 479 -
494, The test is filtering and deleting using the shared prefix 'Testing
Dashboard - UP', which can match multiple dashboards and make assertions flaky;
update both calls to listPersesDashboardsPage.filter.byName(...) (lines
filtering before delete and final verify) to use the exact generated dashboard
name variable used when the dashboard was created (e.g., createdDashboardName or
dashboardName) instead of the hardcoded prefix, ensuring
listPersesDashboardsPage.countDashboards(...) and subsequent delete steps
(clickKebabIcon, clickDeleteOption, deleteDashboardDeleteButton, emptyState)
operate on the single intended dashboard.
🧹 Nitpick comments (2)
web/cypress/support/perses/01.coo_list_perses_admin_namespace.cy.ts (1)

73-76: Extract repeated “return to Dashboards (Perses)” navigation into one helper.

The same two-step nav sequence is duplicated in two places. A small local helper will reduce drift and keep future fixes in one place.

♻️ Suggested refactor
 export function testCOOListPersesNamespace(perspective: PerspectiveConfig) {
+  const returnToPersesDashboards = () => {
+    nav.sidenav.clickNavLink(['Observe', 'Alerting']);
+    nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
+    listPersesDashboardsPage.shouldBeLoaded();
+  };

   it(`1.${perspective.name} perspective - List Dashboards (Perses) page`, () => {
@@
-    nav.sidenav.clickNavLink(['Observe', 'Alerting']);
-    nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
+    returnToPersesDashboards();

     cy.log(`1.11. Click on a dashboard`);
@@
   it(`2.${perspective.name} perspective - Duplicate from a project to another, Rename and Delete`, () => {
@@
-    nav.sidenav.clickNavLink(['Observe', 'Alerting']);
-    nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
+    returnToPersesDashboards();

Also applies to: 125-126

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

In `@web/cypress/support/perses/01.coo_list_perses_admin_namespace.cy.ts` around
lines 73 - 76, The duplicated two-step navigation using
nav.sidenav.clickNavLink(['Observe', 'Alerting']) followed by
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']) should be extracted
into a small helper (e.g., returnToDashboardsPerses or goToDashboardsPerses) and
called from both places where it repeats; update the calls that currently
perform the two-step sequence (the lines invoking nav.sidenav.clickNavLink with
['Observe','Alerting'] and ['Observe','Dashboards (Perses)']) to a single call
to the new helper to centralize the behavior and reduce duplication.
web/cypress/views/perses-dashboards-create-dashboard.ts (1)

67-69: Replace hard-coded waits with explicit UI state assertions.

Lines 67 and 69 use arbitrary 2-second delays that slow tests and mask synchronization issues. The pre-click wait (line 67) is redundant since the cancel button already checks .should('be.visible') before clicking. Replace both waits with assertions that verify the dialog closes or expected state changes—for example, wait for the dialog to disappear or confirm that submit/cancel actions complete.

🤖 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 67 -
69, Replace the two hard-coded cy.wait(2000) calls by relying on explicit UI
assertions: keep the existing
cy.byPFRole('dialog').find('button').contains('Cancel').should('be.visible').click({
force: true }) but remove the pre-click wait, and after the click assert the
dialog has closed (e.g., cy.byPFRole('dialog').should('not.exist') or
should('not.be.visible')) or assert the expected post-cancel state (a specific
element appears/disappears or URL changes) so the test synchronizes on UI state
instead of timeouts; update the code referencing cy.byPFRole('dialog') and the
Cancel button accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@web/cypress/support/perses/99.coo_rbac_perses_user1.cy.ts`:
- Around line 479-494: The test is filtering and deleting using the shared
prefix 'Testing Dashboard - UP', which can match multiple dashboards and make
assertions flaky; update both calls to
listPersesDashboardsPage.filter.byName(...) (lines filtering before delete and
final verify) to use the exact generated dashboard name variable used when the
dashboard was created (e.g., createdDashboardName or dashboardName) instead of
the hardcoded prefix, ensuring listPersesDashboardsPage.countDashboards(...) and
subsequent delete steps (clickKebabIcon, clickDeleteOption,
deleteDashboardDeleteButton, emptyState) operate on the single intended
dashboard.

---

Nitpick comments:
In `@web/cypress/support/perses/01.coo_list_perses_admin_namespace.cy.ts`:
- Around line 73-76: The duplicated two-step navigation using
nav.sidenav.clickNavLink(['Observe', 'Alerting']) followed by
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']) should be extracted
into a small helper (e.g., returnToDashboardsPerses or goToDashboardsPerses) and
called from both places where it repeats; update the calls that currently
perform the two-step sequence (the lines invoking nav.sidenav.clickNavLink with
['Observe','Alerting'] and ['Observe','Dashboards (Perses)']) to a single call
to the new helper to centralize the behavior and reduce duplication.

In `@web/cypress/views/perses-dashboards-create-dashboard.ts`:
- Around line 67-69: Replace the two hard-coded cy.wait(2000) calls by relying
on explicit UI assertions: keep the existing
cy.byPFRole('dialog').find('button').contains('Cancel').should('be.visible').click({
force: true }) but remove the pre-click wait, and after the click assert the
dialog has closed (e.g., cy.byPFRole('dialog').should('not.exist') or
should('not.be.visible')) or assert the expected post-cancel state (a specific
element appears/disappears or URL changes) so the test synchronizes on UI state
instead of timeouts; update the code referencing cy.byPFRole('dialog') and the
Cancel button accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 65c31440-367e-4770-b822-aad7914f4997

📥 Commits

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

📒 Files selected for processing (18)
  • 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/01.coo_list_perses_admin_namespace.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/cypress/views/perses-dashboards.ts
  • web/src/components/data-test.ts
💤 Files with no reviewable changes (1)
  • web/cypress/views/perses-dashboards.ts
🚧 Files skipped from review as they are similar to previous changes (7)
  • web/cypress/views/perses-dashboards-list-dashboards.ts
  • web/cypress/views/perses-dashboards-import-dashboard.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user6.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user3.cy.ts
  • web/cypress/support/perses/99.coo_rbac_perses_user5.cy.ts
  • web/cypress/support/perses/00.coo_bvt_perses_admin_1.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user2.cy.ts

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 14, 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.

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