This is an automated email from the ASF dual-hosted git repository.
choo121600 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 5a339ebb1e2 Refactor Playwright E2E tests to use locator-based waiting
and web-first assertions in configuration.spec.ts (#63108)
5a339ebb1e2 is described below
commit 5a339ebb1e2be0a275449638f426048eeb06e023
Author: Piyush Mudgal <[email protected]>
AuthorDate: Mon Mar 16 15:23:36 2026 +0530
Refactor Playwright E2E tests to use locator-based waiting and web-first
assertions in configuration.spec.ts (#63108)
* configurationpage.ts making sure it follows best practices
* configuration.spec.ts making sure it follows best practices
* configuration.spec.ts
* getRowCount() and getRowDetails()
* inline waitfortabledate
* chore: remove unwanted www files from common.ai provider
* Update __init__.py
---------
Co-authored-by: Yeonguk Choo <[email protected]>
---
.../ui/tests/e2e/pages/configurationpage.ts | 39 +---------------------
.../ui/tests/e2e/specs/configuration.spec.ts | 12 +++----
2 files changed, 6 insertions(+), 45 deletions(-)
diff --git a/airflow-core/src/airflow/ui/tests/e2e/pages/configurationpage.ts
b/airflow-core/src/airflow/ui/tests/e2e/pages/configurationpage.ts
index 0e393040fd8..69afd62bc4c 100644
--- a/airflow-core/src/airflow/ui/tests/e2e/pages/configurationpage.ts
+++ b/airflow-core/src/airflow/ui/tests/e2e/pages/configurationpage.ts
@@ -37,49 +37,12 @@ export class ConfigurationPage extends BasePage {
});
}
- public async getRowCount(): Promise<number> {
- return this.rows.count();
- }
-
- public async getRowDetails(index: number) {
- const row = this.rows.nth(index);
- const cells = row.locator("td");
-
- const section = await cells.nth(0).textContent();
- const key = await cells.nth(1).textContent();
- const value = await cells.nth(2).textContent();
-
- return {
- key: (key ?? "").trim(),
- section: (section ?? "").trim(),
- value: (value ?? "").trim(),
- };
- }
-
public async navigate(): Promise<void> {
await this.navigateTo("/configs");
}
public async waitForLoad(): Promise<void> {
await this.table.waitFor({ state: "visible", timeout: 30_000 });
- await this.waitForTableData();
- }
-
- private async waitForTableData(): Promise<void> {
- await this.page.waitForFunction(
- () => {
- const table = document.querySelector('[data-testid="table-list"]');
-
- if (!table) {
- return false;
- }
-
- const cells = table.querySelectorAll("tbody tr td");
-
- return cells.length > 0;
- },
- undefined,
- { timeout: 30_000 },
- );
+ await this.rows.first().waitFor({ state: "visible", timeout: 30_000 });
}
}
diff --git a/airflow-core/src/airflow/ui/tests/e2e/specs/configuration.spec.ts
b/airflow-core/src/airflow/ui/tests/e2e/specs/configuration.spec.ts
index d493453003d..d72a4083b66 100644
--- a/airflow-core/src/airflow/ui/tests/e2e/specs/configuration.spec.ts
+++ b/airflow-core/src/airflow/ui/tests/e2e/specs/configuration.spec.ts
@@ -33,14 +33,12 @@ test.describe("Configuration Page", () => {
await expect(configPage.heading).toBeVisible();
await expect(configPage.table).toBeVisible();
- const count = await configPage.getRowCount();
+ await expect(configPage.rows).not.toHaveCount(0);
- expect(count).toBeGreaterThan(0);
+ const firstRow = configPage.rows.nth(0);
- const { key, section, value } = await configPage.getRowDetails(0);
-
- expect(section.length).toBeGreaterThan(0);
- expect(key.length).toBeGreaterThan(0);
- expect(value.length).toBeGreaterThan(0);
+ await expect(firstRow.locator("td").nth(0)).not.toBeEmpty();
+ await expect(firstRow.locator("td").nth(1)).not.toBeEmpty();
+ await expect(firstRow.locator("td").nth(2)).not.toBeEmpty();
});
});