You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Copilot (via GitHub)" <gi...@apache.org> on 2026/04/02 00:46:46 UTC

Re: [PR] fix(ui/e2e): improve Playwright test patterns in xcoms.spec.ts [airflow]

Copilot commented on code in PR #63993:
URL: https://github.com/apache/airflow/pull/63993#discussion_r3025330507


##########
airflow-core/src/airflow/ui/tests/e2e/pages/XComsPage.ts:
##########
@@ -54,36 +56,35 @@ export class XComsPage extends BasePage {
       .first();
     const filterInput = filterPill.locator("input");
 
-    await filterInput.waitFor({ state: "visible", timeout: 5000 });
+    await expect(filterInput).toBeVisible({ timeout: 5000 });
     await filterInput.fill(value);
     await filterInput.press("Enter");
-    await this.page.waitForLoadState("networkidle");
+    // Wait for the table to update with filtered results
+    await expect(this.tableRows.first()).toBeVisible({ timeout: 10_000 });

Review Comment:
   This wait doesn’t actually guarantee the filter results have updated: if a row is already visible before applying the filter, `toBeVisible()` can pass immediately and subsequent assertions may race the UI update. To make this reliably state-based, wait for a change that indicates the filter took effect (e.g., row count changes, first-row content changes compared to a pre-filter snapshot, or a specific loading indicator/request completion tied to filtering).



##########
airflow-core/src/airflow/ui/tests/e2e/specs/xcoms.spec.ts:
##########
@@ -43,20 +43,8 @@ test.describe("XComs Page", () => {
     }
 
     await setupXComsPage.navigate();
-    await page.waitForFunction(
-      (minCount) => {
-        const table = document.querySelector('[data-testid="table-list"]');
-
-        if (!table) {
-          return false;
-        }
-        const rows = table.querySelectorAll("tbody tr");
-
-        return rows.length >= minCount;
-      },
-      triggerCount,
-      { timeout: 120_000 },
-    );
+    // Wait for table to contain at least the expected number of rows
+    await expect(setupXComsPage.tableRows).not.toHaveCount(0, { timeout: 120_000 });

Review Comment:
   This no longer enforces the previous intent of waiting for `rows.length >= triggerCount` (it only waits for any non-zero row count). If the test requires at least `triggerCount` rows before proceeding, switch to a wait that asserts `count >= triggerCount` (e.g., polling `tableRows.count()` and checking it’s `>= triggerCount`), or use an assertion that precisely matches the required threshold.
   ```suggestion
       await expect
         .poll(async () => setupXComsPage.tableRows.count(), { timeout: 120_000 })
         .toBeGreaterThanOrEqual(triggerCount);
   ```



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org