-
Notifications
You must be signed in to change notification settings - Fork 0
bugfix(KLEFF): Add #121
bugfix(KLEFF): Add #121
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,299 @@ | ||||||||||||||||||||||||||||||||||
| import { expect } from "@playwright/test"; | ||||||||||||||||||||||||||||||||||
| import { BasePage } from "../base.page"; | ||||||||||||||||||||||||||||||||||
| import { expectPath } from "../../utils/wait"; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||
| * Page Object for the MetricsDashboard component rendered at /dashboard/systems. | ||||||||||||||||||||||||||||||||||
| * Wraps all assertions used by the UC-50 Cluster Health E2E suite. | ||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||
| export class MetricsDashboardPage extends BasePage { | ||||||||||||||||||||||||||||||||||
| // ββ Navigation ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| async open() { | ||||||||||||||||||||||||||||||||||
| await this.goto("/dashboard/systems"); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // ββ Load assertions βββββββββββββββββββββββββββββββββββββββββββββββββββββββ | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| /** Confirms the page container is present (data-testid="systems-page"). */ | ||||||||||||||||||||||||||||||||||
| async expectLoaded() { | ||||||||||||||||||||||||||||||||||
| await expectPath(this.page, /\/dashboard\/systems$/, 30_000); | ||||||||||||||||||||||||||||||||||
| await expect(this.page.getByTestId("systems-page")).toBeVisible({ timeout: 30_000 }); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| /** Confirms the happy-path "ready" state: no error banner visible. */ | ||||||||||||||||||||||||||||||||||
| async expectReady() { | ||||||||||||||||||||||||||||||||||
| await expect(this.page.getByTestId("systems-error")).not.toBeVisible({ timeout: 15_000 }); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // ββ Error state βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| /** Returns the error banner element. */ | ||||||||||||||||||||||||||||||||||
| errorBanner() { | ||||||||||||||||||||||||||||||||||
| return this.page.getByTestId("systems-error"); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| /** Confirms the inline red error alert is visible with the exact FDUC text. */ | ||||||||||||||||||||||||||||||||||
| async expectErrorAlert( | ||||||||||||||||||||||||||||||||||
| text = "Unable to retrieve cluster metrics. Please verify the observability service is running and accessible.", | ||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||
| await expect(this.errorBanner()).toBeVisible({ timeout: 15_000 }); | ||||||||||||||||||||||||||||||||||
| await expect(this.errorBanner()).toContainText(text); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // ββ MetricCard helpers ββββββββββββββββββββββββββββββββββββββββββββββββββββ | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||
| * Returns all metric-card elements. | ||||||||||||||||||||||||||||||||||
| * MetricCard has no individual data-testid so we locate them by their | ||||||||||||||||||||||||||||||||||
| * shared CSS classes rendered inside data-testid="systems-page". | ||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||
| metricCards() { | ||||||||||||||||||||||||||||||||||
| return this.page | ||||||||||||||||||||||||||||||||||
| .getByTestId("systems-page") | ||||||||||||||||||||||||||||||||||
| .locator(".rounded-xl.border.border-white\\/6.bg-white\\/3"); | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+48
to
+54
|
||||||||||||||||||||||||||||||||||
| * MetricCard has no individual data-testid so we locate them by their | |
| * shared CSS classes rendered inside data-testid="systems-page". | |
| */ | |
| metricCards() { | |
| return this.page | |
| .getByTestId("systems-page") | |
| .locator(".rounded-xl.border.border-white\\/6.bg-white\\/3"); | |
| * MetricCard elements are located via a dedicated data-testid to avoid | |
| * brittle Tailwind class selectors and to distinguish loaded cards from | |
| * any skeleton placeholders. | |
| * | |
| * NOTE: Each rendered MetricCard in the app should expose | |
| * `data-testid="systems-metric-card"`. | |
| */ | |
| metricCards() { | |
| return this.page.getByTestId("systems-metric-card"); |
Copilot
AI
Mar 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
timeRangeSelect() targets the first matching select on the page. This page already contains other selects when dropdown menus are opened (e.g., Export Metrics), so this locator is prone to strict-mode failures if UI structure changes. Scope the locator under data-testid="systems-page" and/or select by accessible name/label to keep it stable.
| return this.page.locator("select"); | |
| return this.page.getByTestId("systems-page").locator("select"); |
Copilot
AI
Mar 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The happy-path mock response reports overview.totalNodes: 3 / runningNodes: 3 and nodesMetric.value: "3/3", but the nodes array only contains 2 entries. This inconsistency can make UI behavior or future assertions confusing if counts are cross-checked. Adjust the mock so the overview/node-card counts match the nodes list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expectReady()only asserts that the error banner is not visible, butsystems-erroris also absent during the initial loading state (before the first metrics fetch resolves). That means callers can treat the page as "ready" even though itβs still rendering skeletons. Consider renaming this to reflect what it checks (e.g.,expectNoErrorBanner) and adding a separate readiness assertion that waits for the metrics request to complete and/or for at least one known piece of loaded content to appear.