tysoncung opened a new pull request, #63993:
URL: https://github.com/apache/airflow/pull/63993
## Problem
`xcoms.spec.ts` and `XComsPage.ts` use several Playwright anti-patterns
including `page.waitForFunction()` with DOM queries,
`waitForLoadState('networkidle')`, CSS attribute selectors instead of
`getByTestId()`, and role string selectors instead of `getByRole()`.
## Solution
**Changes in `XComsPage.ts`:**
- Replace `locator('[data-testid="..."]')` → `getByTestId()` (4 occurrences)
- Replace `locator('[role="menu"]')` → `getByRole('menu')`
- Replace `locator('[role="menuitem"]')` → `getByRole('menuitem')`
- Replace `filterMenu.waitFor()` → `expect().toBeVisible()`
- Replace `filterInput.waitFor()` → `expect().toBeVisible()`
- Replace `xcomsTable.waitFor()` → `expect().toBeVisible()`
- Remove `waitForLoadState('networkidle')` calls (3 occurrences) — replaced
with state-based waiting
- Replace `locator('tbody tr')` → `locator('tbody').getByRole('row')`
- Replace `locator('td')` → `getByRole('cell')`
- Replace manual `count()` assertions → `not.toHaveCount(0)`
- Simplify `verifyXComDetailsDisplay` to use web-first assertions
**Changes in `xcoms.spec.ts`:**
- Replace `page.waitForFunction()` with DOM queries → locator-based
`expect().not.toHaveCount(0)`
## Checklist
- [x] `page.waitForFunction()` with DOM queries → locator-based waiting ✅
- [x] `page.waitForTimeout()` → N/A (not present)
- [x] `waitForLoadState("networkidle")` → wait for specific UI state ✅
- [x] Manual assertions → web-first assertions ✅
- [x] `page.evaluate()` for DOM manipulation → N/A (not present)
- [x] CSS `:has-text()` → user-facing locators ✅
## Files Changed
- `airflow-core/src/airflow/ui/tests/e2e/pages/XComsPage.ts`
- `airflow-core/src/airflow/ui/tests/e2e/specs/xcoms.spec.ts`
Part of #63036
Closes #63966
--
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]