Skip to content

Commit 55c8d52

Browse files
committed
Use Playwright assertions directly instead of helper functions that fail silently
1 parent b7664b3 commit 55c8d52

File tree

2 files changed

+8
-54
lines changed

2 files changed

+8
-54
lines changed

airflow-core/src/airflow/ui/tests/e2e/pages/HomePage.ts

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,6 @@ export class HomePage extends BasePage {
7777
this.taskInstanceMetrics = page.getByRole("heading", { name: /task instance/i }).first();
7878
}
7979

80-
/**
81-
* Check if health badges are visible
82-
*/
83-
public async areHealthBadgesVisible(): Promise<boolean> {
84-
try {
85-
await this.metaDatabaseHealth.waitFor({ state: "visible", timeout: 10_000 });
86-
await this.schedulerHealth.waitFor({ state: "visible", timeout: 5000 });
87-
88-
return true;
89-
} catch {
90-
return false;
91-
}
92-
}
93-
9480
/**
9581
* Get Active DAGs count
9682
*/
@@ -123,32 +109,6 @@ export class HomePage extends BasePage {
123109
}
124110
}
125111

126-
/**
127-
* Check if historical metrics (recent runs) section is visible
128-
*/
129-
public async isHistoricalMetricsSectionVisible(): Promise<boolean> {
130-
try {
131-
await this.dagRunMetrics.waitFor({ state: "visible", timeout: 10_000 });
132-
133-
return true;
134-
} catch {
135-
return false;
136-
}
137-
}
138-
139-
/**
140-
* Check if stats section is visible
141-
*/
142-
public async isStatsSectionVisible(): Promise<boolean> {
143-
try {
144-
await this.activeDagsCard.waitFor({ state: "visible", timeout: 10_000 });
145-
146-
return true;
147-
} catch {
148-
return false;
149-
}
150-
}
151-
152112
/**
153113
* Navigate to Home/Dashboard page
154114
*/

airflow-core/src/airflow/ui/tests/e2e/specs/home-dashboard.spec.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ test.describe("Dashboard Metrics Display", () => {
3030
await homePage.navigate();
3131
await homePage.waitForDashboardLoad();
3232

33-
const isStatsVisible = await homePage.isStatsSectionVisible();
34-
35-
expect(isStatsVisible).toBe(true);
33+
// Use Playwright assertions directly for clearer error messages
34+
await expect(homePage.statsSection).toBeVisible();
3635

3736
await expect(homePage.activeDagsCard).toBeVisible();
3837
const activeDagsCount = await homePage.getActiveDagsCount();
@@ -54,10 +53,8 @@ test.describe("Dashboard Metrics Display", () => {
5453
await homePage.navigate();
5554
await homePage.waitForDashboardLoad();
5655

57-
const areHealthBadgesVisible = await homePage.areHealthBadgesVisible();
58-
59-
expect(areHealthBadgesVisible).toBe(true);
60-
56+
// Use Playwright assertions directly for clearer error messages
57+
await expect(homePage.healthSection).toBeVisible();
6158
await expect(homePage.metaDatabaseHealth).toBeVisible();
6259
await expect(homePage.schedulerHealth).toBeVisible();
6360
await expect(homePage.triggererHealth).toBeVisible();
@@ -103,9 +100,8 @@ test.describe("Dashboard Metrics Display", () => {
103100
await homePage.page.reload();
104101
await homePage.waitForDashboardLoad();
105102

106-
const isStatsVisible = await homePage.isStatsSectionVisible();
107-
108-
expect(isStatsVisible).toBe(true);
103+
// Use Playwright assertions directly for clearer error messages
104+
await expect(homePage.statsSection).toBeVisible();
109105

110106
const reloadedActiveCount = await homePage.getActiveDagsCount();
111107
const reloadedRunningCount = await homePage.getRunningDagsCount();
@@ -120,10 +116,8 @@ test.describe("Dashboard Metrics Display", () => {
120116
await homePage.navigate();
121117
await homePage.waitForDashboardLoad();
122118

123-
const isHistoricalMetricsVisible = await homePage.isHistoricalMetricsSectionVisible();
124-
125-
expect(isHistoricalMetricsVisible).toBe(true);
126-
119+
// Use Playwright assertions directly for clearer error messages
120+
await expect(homePage.historicalMetricsSection).toBeVisible();
127121
await expect(homePage.dagRunMetrics).toBeVisible();
128122
await expect(homePage.taskInstanceMetrics).toBeVisible();
129123
});

0 commit comments

Comments
 (0)