choo121600 commented on code in PR #63979:
URL: https://github.com/apache/airflow/pull/63979#discussion_r2981297615
##########
airflow-core/src/airflow/ui/tests/e2e/pages/VariablePage.ts:
##########
@@ -76,26 +76,12 @@ export class VariablePage extends BasePage {
}
private async waitForTableData(): Promise<void> {
- await this.page.waitForFunction(
- () => {
- const table = document.querySelector('[data-testid="table-list"]');
+ const noData = this.page.getByText("No variables found");
+ const firstKeyCell = this.tableRows.first().locator("td:nth-child(2)");
- if (!table) return false;
-
- if (document.body.textContent.includes("No variables found")) {
- return true;
- }
-
- const rows = table.querySelectorAll("tbody tr");
-
- if (rows.length === 0) return false;
-
- const keyCells = table.querySelectorAll("tbody tr td:nth-child(2)");
-
- return [...keyCells].some((cell) => Boolean(cell.textContent.trim()));
- },
- undefined,
- { timeout: 60_000 },
- );
+ await Promise.race([
+ noData.waitFor({ state: "visible", timeout: 60_000 }),
+ firstKeyCell.waitFor({ state: "visible", timeout: 60_000 }),
Review Comment:
Would it make sense to switch these to `expect().toBeVisible()` instead of
`waitFor()`?
This could make the test more explicit and rely on Playwright’s built-in
retry + assertion behavior.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]