choo121600 commented on code in PR #63979:
URL: https://github.com/apache/airflow/pull/63979#discussion_r2985953040


##########
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:
   Cool 👍 
   Using `.or()` combinator sounds like a good approach.
   It would keep the assertion-based style while still handling both cases 
correctly :)



-- 
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]

Reply via email to