CONSOLE-5283: Migrate dashboard Cypress tests to Playwright#16669
CONSOLE-5283: Migrate dashboard Cypress tests to Playwright#16669rhamilto wants to merge 1 commit into
Conversation
|
@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. 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. |
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (19)
💤 Files with no reviewable changes (3)
✅ Files skipped from review due to trivial changes (9)
🚧 Files skipped from review as they are similar to previous changes (5)
WalkthroughMigrates dashboard e2e coverage from Cypress to Playwright, adds Playwright page objects and specs for cluster and project dashboards, adds ChangesDashboard e2e migration and selector support
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 13 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (13 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (19)
frontend/e2e/clients/kubernetes-client.tsfrontend/e2e/fixtures/cleanup-fixture.tsfrontend/e2e/pages/cluster-dashboard-page.tsfrontend/e2e/pages/project-dashboard-page.tsfrontend/e2e/tests/console/dashboards/cluster-dashboard.spec.tsfrontend/e2e/tests/console/dashboards/project-dashboard.spec.tsfrontend/packages/console-shared/src/components/dashboard/utilization-card/UtilizationDurationDropdown.tsxfrontend/packages/console-shared/src/components/dashboard/utilization-card/UtilizationItem.tsxfrontend/packages/integration-tests/tests/dashboards/cluster-dashboard.cy.tsfrontend/packages/integration-tests/tests/dashboards/insights-popup.cy.tsfrontend/packages/integration-tests/tests/dashboards/project-dashboard.cy.tsfrontend/public/components/dashboard/dashboards-page/cluster-dashboard/details-card.tsxfrontend/public/components/dashboard/dashboards-page/cluster-dashboard/inventory-card.tsxfrontend/public/components/dashboard/dashboards-page/cluster-dashboard/status-card.tsxfrontend/public/components/dashboard/project-dashboard/details-card.tsxfrontend/public/components/dashboard/project-dashboard/inventory-card.tsxfrontend/public/components/dashboard/project-dashboard/launcher-card.tsxfrontend/public/components/dashboard/project-dashboard/resource-quota-card.tsxfrontend/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()}`; |
There was a problem hiding this comment.
🩺 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.
| 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.
|
/retest |
|
/tech debt |
|
/verified by CI |
|
@rhamilto: This PR has been marked as verified by 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. |
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
2 similar comments
|
/retest |
|
/retest |
|
/test e2e-gcp-console |
|
/retest |
|
/retest |
|
/retest |
1 similar comment
|
/retest |
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>
|
New changes are detected. LGTM label has been removed. |
|
@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. 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. |
There was a problem hiding this comment.
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/clients/kubernetes-client.ts`:
- Around line 621-640: The polling helper in waitForPodReady is swallowing every
readNamespacedPod failure and converting it to false, which hides
RBAC/auth/network/server errors until timeout. Update waitForPodReady, and the
other polling helper mentioned in the same diff, to catch the read error from
this.k8sApi.readNamespacedPod and only continue polling when it is a
not-found/404 case; for any other error, rethrow immediately. Use the existing
waitForPodReady symbol and the shared pollUntil callback structure to keep the
logic localized.
🪄 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: 488bb54b-d1ae-4bef-b4ca-aa2bab65b2d8
📒 Files selected for processing (19)
frontend/e2e/clients/kubernetes-client.tsfrontend/e2e/fixtures/cleanup-fixture.tsfrontend/e2e/pages/cluster-dashboard-page.tsfrontend/e2e/pages/project-dashboard-page.tsfrontend/e2e/tests/console/dashboards/cluster-dashboard.spec.tsfrontend/e2e/tests/console/dashboards/project-dashboard.spec.tsfrontend/packages/console-shared/src/components/dashboard/utilization-card/UtilizationDurationDropdown.tsxfrontend/packages/console-shared/src/components/dashboard/utilization-card/UtilizationItem.tsxfrontend/packages/integration-tests/tests/dashboards/cluster-dashboard.cy.tsfrontend/packages/integration-tests/tests/dashboards/insights-popup.cy.tsfrontend/packages/integration-tests/tests/dashboards/project-dashboard.cy.tsfrontend/public/components/dashboard/dashboards-page/cluster-dashboard/details-card.tsxfrontend/public/components/dashboard/dashboards-page/cluster-dashboard/inventory-card.tsxfrontend/public/components/dashboard/dashboards-page/cluster-dashboard/status-card.tsxfrontend/public/components/dashboard/project-dashboard/details-card.tsxfrontend/public/components/dashboard/project-dashboard/inventory-card.tsxfrontend/public/components/dashboard/project-dashboard/launcher-card.tsxfrontend/public/components/dashboard/project-dashboard/resource-quota-card.tsxfrontend/public/components/dashboard/project-dashboard/status-card.tsx
💤 Files with no reviewable changes (3)
- 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
✅ Files skipped from review due to trivial changes (9)
- frontend/public/components/dashboard/project-dashboard/resource-quota-card.tsx
- frontend/public/components/dashboard/dashboards-page/cluster-dashboard/details-card.tsx
- frontend/public/components/dashboard/project-dashboard/status-card.tsx
- frontend/public/components/dashboard/project-dashboard/launcher-card.tsx
- frontend/packages/console-shared/src/components/dashboard/utilization-card/UtilizationDurationDropdown.tsx
- frontend/public/components/dashboard/dashboards-page/cluster-dashboard/inventory-card.tsx
- frontend/packages/console-shared/src/components/dashboard/utilization-card/UtilizationItem.tsx
- frontend/public/components/dashboard/project-dashboard/inventory-card.tsx
- frontend/public/components/dashboard/project-dashboard/details-card.tsx
🚧 Files skipped from review as they are similar to previous changes (5)
- frontend/e2e/fixtures/cleanup-fixture.ts
- frontend/public/components/dashboard/dashboards-page/cluster-dashboard/status-card.tsx
- frontend/e2e/pages/project-dashboard-page.ts
- frontend/e2e/pages/cluster-dashboard-page.ts
- frontend/e2e/tests/console/dashboards/cluster-dashboard.spec.ts
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
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/clients/kubernetes-client.ts`:
- Around line 621-640: The polling helper in waitForPodReady is swallowing every
readNamespacedPod failure and converting it to false, which hides
RBAC/auth/network/server errors until timeout. Update waitForPodReady, and the
other polling helper mentioned in the same diff, to catch the read error from
this.k8sApi.readNamespacedPod and only continue polling when it is a
not-found/404 case; for any other error, rethrow immediately. Use the existing
waitForPodReady symbol and the shared pollUntil callback structure to keep the
logic localized.
🪄 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: 488bb54b-d1ae-4bef-b4ca-aa2bab65b2d8
📒 Files selected for processing (19)
frontend/e2e/clients/kubernetes-client.tsfrontend/e2e/fixtures/cleanup-fixture.tsfrontend/e2e/pages/cluster-dashboard-page.tsfrontend/e2e/pages/project-dashboard-page.tsfrontend/e2e/tests/console/dashboards/cluster-dashboard.spec.tsfrontend/e2e/tests/console/dashboards/project-dashboard.spec.tsfrontend/packages/console-shared/src/components/dashboard/utilization-card/UtilizationDurationDropdown.tsxfrontend/packages/console-shared/src/components/dashboard/utilization-card/UtilizationItem.tsxfrontend/packages/integration-tests/tests/dashboards/cluster-dashboard.cy.tsfrontend/packages/integration-tests/tests/dashboards/insights-popup.cy.tsfrontend/packages/integration-tests/tests/dashboards/project-dashboard.cy.tsfrontend/public/components/dashboard/dashboards-page/cluster-dashboard/details-card.tsxfrontend/public/components/dashboard/dashboards-page/cluster-dashboard/inventory-card.tsxfrontend/public/components/dashboard/dashboards-page/cluster-dashboard/status-card.tsxfrontend/public/components/dashboard/project-dashboard/details-card.tsxfrontend/public/components/dashboard/project-dashboard/inventory-card.tsxfrontend/public/components/dashboard/project-dashboard/launcher-card.tsxfrontend/public/components/dashboard/project-dashboard/resource-quota-card.tsxfrontend/public/components/dashboard/project-dashboard/status-card.tsx
💤 Files with no reviewable changes (3)
- 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
✅ Files skipped from review due to trivial changes (9)
- frontend/public/components/dashboard/project-dashboard/resource-quota-card.tsx
- frontend/public/components/dashboard/dashboards-page/cluster-dashboard/details-card.tsx
- frontend/public/components/dashboard/project-dashboard/status-card.tsx
- frontend/public/components/dashboard/project-dashboard/launcher-card.tsx
- frontend/packages/console-shared/src/components/dashboard/utilization-card/UtilizationDurationDropdown.tsx
- frontend/public/components/dashboard/dashboards-page/cluster-dashboard/inventory-card.tsx
- frontend/packages/console-shared/src/components/dashboard/utilization-card/UtilizationItem.tsx
- frontend/public/components/dashboard/project-dashboard/inventory-card.tsx
- frontend/public/components/dashboard/project-dashboard/details-card.tsx
🚧 Files skipped from review as they are similar to previous changes (5)
- frontend/e2e/fixtures/cleanup-fixture.ts
- frontend/public/components/dashboard/dashboards-page/cluster-dashboard/status-card.tsx
- frontend/e2e/pages/project-dashboard-page.ts
- frontend/e2e/pages/cluster-dashboard-page.ts
- frontend/e2e/tests/console/dashboards/cluster-dashboard.spec.ts
🛑 Comments failed to post (1)
frontend/e2e/clients/kubernetes-client.ts (1)
621-640: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Fail fast on non-404 API errors in the polling helpers.
Both waits currently turn every read failure into
false, so RBAC/auth/network/server errors get hidden until the full timeout expires. Only the “resource not there yet” case should keep polling; everything else should be rethrown immediately.Suggested fix
async waitForPodReady(name: string, namespace: string, timeoutMs = 120_000): Promise<boolean> { return pollUntil( async () => { try { const pod = await this.k8sApi.readNamespacedPod({ name, namespace }); if (pod?.status?.phase !== 'Running') { return false; } const containers = pod?.status?.containerStatuses; if (!containers || containers.length === 0) { return false; } return containers.every((c) => c.ready === true); - } catch { - return false; + } catch (err) { + if (isNotFound(err)) { + return false; + } + throw err; } }, timeoutMs, 2_000, ); } @@ async waitForDeploymentReady( name: string, namespace: string, timeoutMs = 120_000, ): Promise<boolean> { return pollUntil( async () => { try { const dep = await this.appsApi.readNamespacedDeployment({ name, namespace }); const ready = dep?.status?.readyReplicas ?? 0; const desired = dep?.spec?.replicas ?? 1; return ready >= desired; - } catch { - return false; + } catch (err) { + if (isNotFound(err)) { + return false; + } + throw err; } }, timeoutMs, 2_000, ); }Also applies to: 647-665
🤖 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/clients/kubernetes-client.ts` around lines 621 - 640, The polling helper in waitForPodReady is swallowing every readNamespacedPod failure and converting it to false, which hides RBAC/auth/network/server errors until timeout. Update waitForPodReady, and the other polling helper mentioned in the same diff, to catch the read error from this.k8sApi.readNamespacedPod and only continue polling when it is a not-found/404 case; for any other error, rethrow immediately. Use the existing waitForPodReady symbol and the shared pollUntil callback structure to keep the logic localized.
|
@rhamilto: 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. |
|
@fsgreco, mind retagging after rebase? |
Analysis / Root cause:
CONSOLE-5283 — Migrate console e2e dashboard tests from Cypress to Playwright.
Solution description:
Migrate
cluster-dashboard.cy.ts(8 tests) andproject-dashboard.cy.ts(8 tests) to Playwright.data-testattributes alongside existingdata-test-idon dashboard card components (details, status, inventory, utilization, launcher, resource-quotas, duration-select) for both cluster and project dashboardsProjectDashboardPagepage object and extendClusterDashboardPagewith locators for all dashboard card elementscreateResourceQuota/deleteResourceQuotatoKubernetesClientandResourceQuotacleanup handling to the cleanup fixtureinsights-popup.cy.ts)Screenshots / screen recording:
Test setup:
Requires a running OpenShift cluster with
e2e/.envconfigured.Test cases:
npx playwright test --project=console frontend/e2e/tests/console/dashboards/— all 16 tests should passBrowser conformance:
Additional info:
N/A
Summary by CodeRabbit
data-testattributes (including utilization duration and item containers)