Skip to content

CONSOLE-5283: Migrate dashboard Cypress tests to Playwright#16669

Open
rhamilto wants to merge 1 commit into
openshift:mainfrom
rhamilto:CONSOLE-5283
Open

CONSOLE-5283: Migrate dashboard Cypress tests to Playwright#16669
rhamilto wants to merge 1 commit into
openshift:mainfrom
rhamilto:CONSOLE-5283

Conversation

@rhamilto

@rhamilto rhamilto commented Jun 23, 2026

Copy link
Copy Markdown
Member

Analysis / Root cause:
CONSOLE-5283 — Migrate console e2e dashboard tests from Cypress to Playwright.

Solution description:
Migrate cluster-dashboard.cy.ts (8 tests) and project-dashboard.cy.ts (8 tests) to Playwright.

  • Add data-test attributes alongside existing data-test-id on dashboard card components (details, status, inventory, utilization, launcher, resource-quotas, duration-select) for both cluster and project dashboards
  • Create ProjectDashboardPage page object and extend ClusterDashboardPage with locators for all dashboard card elements
  • Add createResourceQuota/deleteResourceQuota to KubernetesClient and ResourceQuota cleanup handling to the cleanup fixture
  • Delete original Cypress test files (including previously migrated insights-popup.cy.ts)

Screenshots / screen recording:

Test setup:
Requires a running OpenShift cluster with e2e/.env configured.

Test cases:

  • Run npx playwright test --project=console frontend/e2e/tests/console/dashboards/ — all 16 tests should pass
  • Cluster Dashboard: Details Card fields, View settings link, Status Card alerts link, health indicators, Inventory Card items, Utilization Card items, duration dropdown
  • Project Dashboard: Details Card fields, View all link, Status Card Active status, Inventory Card items, Utilization Card items, duration dropdown, Launcher Card with ConsoleLink CR, Resource Quotas Card

Browser conformance:

  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)

Additional info:
N/A

Summary by CodeRabbit

  • Tests

    • Added end-to-end test coverage for cluster dashboard validating all card components, metrics, health indicators, and navigation links
    • Added end-to-end test coverage for project dashboard including resource quota and launcher features
    • Removed legacy integration test suites
  • Chores

    • Enhanced testing infrastructure with new page objects and Kubernetes ResourceQuota client capabilities
    • Updated dashboard components with additional test identifiers

Migrate cluster-dashboard.cy.ts (8 tests) and project-dashboard.cy.ts
(8 tests) to Playwright, completing the CONSOLE-5283 story.

- Add data-test attributes alongside existing data-test-id on dashboard
  card components (details, status, inventory, utilization, launcher,
  resource-quotas, duration-select) for both cluster and project dashboards
- Create ProjectDashboardPage page object and extend ClusterDashboardPage
  with locators for all dashboard card elements
- Add createResourceQuota/deleteResourceQuota to KubernetesClient and
  ResourceQuota cleanup handling to the cleanup fixture
- Delete original Cypress test files (including previously migrated
  insights-popup.cy.ts)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jun 23, 2026
@openshift-ci-robot

openshift-ci-robot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

@rhamilto: This pull request references CONSOLE-5283 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 story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Analysis / Root cause:
CONSOLE-5283 — Migrate console e2e dashboard tests from Cypress to Playwright.

Solution description:
Migrate cluster-dashboard.cy.ts (8 tests) and project-dashboard.cy.ts (8 tests) to Playwright.

  • Add data-test attributes alongside existing data-test-id on dashboard card components (details, status, inventory, utilization, launcher, resource-quotas, duration-select) for both cluster and project dashboards
  • Create ProjectDashboardPage page object and extend ClusterDashboardPage with locators for all dashboard card elements
  • Add createResourceQuota/deleteResourceQuota to KubernetesClient and ResourceQuota cleanup handling to the cleanup fixture
  • Delete original Cypress test files (including previously migrated insights-popup.cy.ts)

Screenshots / screen recording:

Test setup:
Requires a running OpenShift cluster with e2e/.env configured.

Test cases:

  • Run npx playwright test --project=console frontend/e2e/tests/console/dashboards/ — all 16 tests should pass
  • Cluster Dashboard: Details Card fields, View settings link, Status Card alerts link, health indicators, Inventory Card items, Utilization Card items, duration dropdown
  • Project Dashboard: Details Card fields, View all link, Status Card Active status, Inventory Card items, Utilization Card items, duration dropdown, Launcher Card with ConsoleLink CR, Resource Quotas Card

Browser conformance:

  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)

Additional info:
N/A

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.

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Migrates cluster and project dashboard e2e coverage from Cypress to Playwright by deleting three Cypress test files and adding two new Playwright specs. Introduces ProjectDashboardPage and expands ClusterDashboardPage page objects. Adds data-test attributes to dashboard React components, and extends KubernetesClient with createResourceQuota/deleteResourceQuota methods wired into the cleanup fixture.

Changes

Dashboard e2e Cypress → Playwright migration

Layer / File(s) Summary
Add data-test attributes to dashboard components
frontend/public/components/dashboard/dashboards-page/cluster-dashboard/details-card.tsx, frontend/public/components/dashboard/dashboards-page/cluster-dashboard/inventory-card.tsx, frontend/public/components/dashboard/dashboards-page/cluster-dashboard/status-card.tsx, frontend/public/components/dashboard/project-dashboard/details-card.tsx, frontend/public/components/dashboard/project-dashboard/inventory-card.tsx, frontend/public/components/dashboard/project-dashboard/launcher-card.tsx, frontend/public/components/dashboard/project-dashboard/resource-quota-card.tsx, frontend/public/components/dashboard/project-dashboard/status-card.tsx, frontend/packages/console-shared/src/components/dashboard/utilization-card/UtilizationDurationDropdown.tsx, frontend/packages/console-shared/src/components/dashboard/utilization-card/UtilizationItem.tsx
All cluster and project dashboard card components and shared utilization components add a data-test attribute alongside the existing data-test-id attribute on their root Card/div elements.
ResourceQuota support in KubernetesClient and cleanup fixture
frontend/e2e/clients/kubernetes-client.ts, frontend/e2e/fixtures/cleanup-fixture.ts
KubernetesClient gains createResourceQuota and deleteResourceQuota async methods. executeCleanup adds a ResourceQuota case to its core-resource switch that calls deleteResourceQuota.
ClusterDashboardPage page object
frontend/e2e/pages/cluster-dashboard-page.ts
Adds private getByTestId-based locator fields for all cluster dashboard card regions (details, status, inventory, utilization, links, items, duration select) and public getter methods exposing each locator.
ProjectDashboardPage page object
frontend/e2e/pages/project-dashboard-page.ts
New ProjectDashboardPage extending BasePage declares locators for all project dashboard sections (cards, detail items, status, inventory/utilization/launcher items, resource quota link and gauge chart) and exposes them via getter methods plus navigateToProject.
Cluster dashboard Playwright spec + Cypress removal
frontend/e2e/tests/console/dashboards/cluster-dashboard.spec.ts, frontend/packages/integration-tests/tests/dashboards/cluster-dashboard.cy.ts
New Playwright spec adds @admin/@smoke tagged tests for Details, Status, Inventory, and Utilization cards using ClusterDashboardPage. The old Cypress cluster-dashboard.cy.ts suite is deleted.
Project dashboard Playwright spec
frontend/e2e/tests/console/dashboards/project-dashboard.spec.ts
New Playwright spec provisions a per-run namespace and asserts Details, Status, Inventory, Utilization, Launcher (with created ConsoleLink), and Resource Quotas (with created ResourceQuota) cards using ProjectDashboardPage and cleanup tracking.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

kind/cypress, component/shared, component/core

Suggested reviewers

  • cajieh
  • jhadvig
🚥 Pre-merge checks | ✅ 13 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Structure And Quality ❓ Inconclusive The custom check asks to review Ginkgo test code, but this PR contains Playwright tests (*.spec.ts using test.describe/test.beforeEach). These are different testing frameworks with incompatible pat... Clarify: Is the check intended for Ginkgo tests only, or should it be adapted to evaluate Playwright test quality using equivalent Playwright patterns (test.describe, test.beforeEach, test.afterAll, expect)?
✅ Passed checks (13 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: migrating dashboard Cypress tests to Playwright, which aligns with the primary objective of the PR.
Description check ✅ Passed The description covers all major template sections: analysis/root cause, solution description, test setup, test cases, and browser conformance. It provides sufficient detail about the changes, testing approach, and migration scope.
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 All test names in cluster-dashboard.spec.ts and project-dashboard.spec.ts are stable and deterministic. Test titles use static, descriptive strings without timestamps, random IDs, namespace names,...
Microshift Test Compatibility ✅ Passed This PR adds Playwright frontend e2e tests, not Ginkgo backend tests. The MicroShift compatibility check applies only to Ginkgo e2e tests; this check does not apply to Playwright UI tests.
Single Node Openshift (Sno) Test Compatibility ✅ Passed This PR adds Playwright tests (TypeScript UI tests), not Ginkgo e2e tests (Go-based). The SNO compatibility check is inapplicable to non-Ginkgo tests.
Topology-Aware Scheduling Compatibility ✅ Passed PR migrates dashboard e2e tests from Cypress to Playwright; contains only test code and test infrastructure (page objects, fixtures, test specs) plus minor test selector attributes on existing Reac...
Ote Binary Stdout Contract ✅ Passed PR contains only frontend TypeScript/React code; OTE Binary Stdout Contract applies exclusively to Go binaries with process-level entry points (main, init, TestMain, suite setup), which are absent...
Ipv6 And Disconnected Network Test Compatibility ✅ Passed This PR adds Playwright (TypeScript) e2e tests, not Ginkgo (Go) e2e tests. The custom check applies only to Ginkgo tests, so it is not applicable. Additionally, the Playwright tests contain no IPv4...
No-Weak-Crypto ✅ Passed No weak crypto algorithms, custom crypto implementations, or insecure token comparisons detected. PR changes are limited to E2E test infrastructure and UI test attributes.
Container-Privileges ✅ Passed No Kubernetes manifests or container security configurations are modified in this PR; all changes are TypeScript/TSX test files and UI components, making this security check not applicable.
No-Sensitive-Data-In-Logs ✅ Passed No sensitive data logging detected in the PR. The new test files and page objects contain no console logging. The cleanup fixture's logging only exposes test names, resource types, and non-sensitiv...

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

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

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

@openshift-ci openshift-ci Bot requested review from jhadvig and rawagner June 23, 2026 15:44
@openshift-ci openshift-ci Bot added component/core Related to console core functionality component/dashboard Related to dashboard approved Indicates a PR has been approved by an approver from all required OWNERS files. component/shared Related to console-shared kind/cypress Related to Cypress e2e integration testing labels Jun 23, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@frontend/e2e/tests/console/dashboards/project-dashboard.spec.ts`:
- Line 5: The namespace constant is using only Date.now() for uniqueness, which
can result in collisions when tests run in parallel across multiple workers.
Enhance the uniqueness of the namespace variable by appending an additional
random identifier such as a random number or UUID to the existing
timestamp-based string, ensuring that concurrent test runs generate distinct
namespaces and avoid interference.
🪄 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: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 40c29520-233d-43d6-a219-57ce5fcc1f3a

📥 Commits

Reviewing files that changed from the base of the PR and between 329e322 and 437fc5a.

📒 Files selected for processing (19)
  • frontend/e2e/clients/kubernetes-client.ts
  • frontend/e2e/fixtures/cleanup-fixture.ts
  • frontend/e2e/pages/cluster-dashboard-page.ts
  • frontend/e2e/pages/project-dashboard-page.ts
  • frontend/e2e/tests/console/dashboards/cluster-dashboard.spec.ts
  • frontend/e2e/tests/console/dashboards/project-dashboard.spec.ts
  • frontend/packages/console-shared/src/components/dashboard/utilization-card/UtilizationDurationDropdown.tsx
  • frontend/packages/console-shared/src/components/dashboard/utilization-card/UtilizationItem.tsx
  • frontend/packages/integration-tests/tests/dashboards/cluster-dashboard.cy.ts
  • frontend/packages/integration-tests/tests/dashboards/insights-popup.cy.ts
  • frontend/packages/integration-tests/tests/dashboards/project-dashboard.cy.ts
  • frontend/public/components/dashboard/dashboards-page/cluster-dashboard/details-card.tsx
  • frontend/public/components/dashboard/dashboards-page/cluster-dashboard/inventory-card.tsx
  • frontend/public/components/dashboard/dashboards-page/cluster-dashboard/status-card.tsx
  • frontend/public/components/dashboard/project-dashboard/details-card.tsx
  • frontend/public/components/dashboard/project-dashboard/inventory-card.tsx
  • frontend/public/components/dashboard/project-dashboard/launcher-card.tsx
  • frontend/public/components/dashboard/project-dashboard/resource-quota-card.tsx
  • frontend/public/components/dashboard/project-dashboard/status-card.tsx
💤 Files with no reviewable changes (3)
  • frontend/packages/integration-tests/tests/dashboards/project-dashboard.cy.ts
  • frontend/packages/integration-tests/tests/dashboards/insights-popup.cy.ts
  • frontend/packages/integration-tests/tests/dashboards/cluster-dashboard.cy.ts

import { warmupSPA } from '../../../pages/base-page';
import { ProjectDashboardPage } from '../../../pages/project-dashboard-page';

const namespace = `test-project-dashboard-${Date.now()}`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Avoid namespace collisions across concurrent runs.

Line 5 uses only Date.now() for uniqueness. Parallel workers/projects can still collide and share the same namespace, which can cause flaky create/delete interference.

Suggested fix
-const namespace = `test-project-dashboard-${Date.now()}`;
+const namespace = `test-project-dashboard-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const namespace = `test-project-dashboard-${Date.now()}`;
const namespace = `test-project-dashboard-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
🤖 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 `@frontend/e2e/tests/console/dashboards/project-dashboard.spec.ts` at line 5,
The namespace constant is using only Date.now() for uniqueness, which can result
in collisions when tests run in parallel across multiple workers. Enhance the
uniqueness of the namespace variable by appending an additional random
identifier such as a random number or UUID to the existing timestamp-based
string, ensuring that concurrent test runs generate distinct namespaces and
avoid interference.

@rhamilto

Copy link
Copy Markdown
Member Author

/retest

@openshift-ci

openshift-ci Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

@rhamilto: 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.

@rhamilto

Copy link
Copy Markdown
Member Author

/tech debt
/label docs-approved
/label px-approved

@rhamilto

Copy link
Copy Markdown
Member Author

/verified by CI

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jun 24, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@rhamilto: This PR has been marked as verified by CI.

Details

In response to this:

/verified by CI

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 openshift-ci Bot added docs-approved Signifies that Docs has signed off on this PR px-approved Signifies that Product Support has signed off on this PR labels Jun 24, 2026

@fsgreco fsgreco left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jun 24, 2026
@openshift-ci

openshift-ci Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fsgreco, rhamilto

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

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. component/core Related to console core functionality component/dashboard Related to dashboard component/shared Related to console-shared docs-approved Signifies that Docs has signed off on this PR jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. kind/cypress Related to Cypress e2e integration testing lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants