tysoncung opened a new pull request, #63992:
URL: https://github.com/apache/airflow/pull/63992

   ## Problem
   
   `variable.spec.ts` and `VariablePage.ts` use several Playwright 
anti-patterns that can cause flakiness and reduce maintainability.
   
   ## Solution
   
   **Changes in `VariablePage.ts`:**
   - Replace `page.waitForFunction()` with DOM queries → locator-based `.or()` 
pattern using web-first assertions
   - Replace `this.table.waitFor()` → `expect().toBeVisible()`
   - Replace `locator('tbody tr')` → `locator('tbody').getByRole('row')`
   - Replace `locator('thead input[type=checkbox]')` → 
`locator('thead').getByRole('checkbox')`
   - Replace `locator('[id^=checkbox][id$=:control]')` → `getByRole('checkbox')`
   - Replace `locator('tr:has-text(...)')` → `tableRows.filter({ hasText })`
   - Replace `locator('td:nth-child(2)')` → `getByRole('cell').nth(1)`
   
   **Changes in `variable.spec.ts`:**
   - Replace `locator('[data-part="backdrop"]')` → `getByRole('dialog')`
   
   **Changes in `playwright.config.ts`:**
   - Remove `variable.spec.ts` from `testIgnore` list
   
   ## Checklist
   - [x] `page.waitForFunction()` with DOM queries → locator-based waiting ✅
   - [x] `page.waitForTimeout()` → N/A (not present)
   - [x] `waitForLoadState("networkidle")` → N/A (not present)
   - [x] Manual assertions → web-first assertions ✅
   - [x] `page.evaluate()` for DOM manipulation → N/A (not present)
   - [x] CSS `:has-text()` → user-facing locators ✅
   - [x] Remove from ignore spec list ✅
   
   ## Files Changed
   - `airflow-core/src/airflow/ui/tests/e2e/pages/VariablePage.ts`
   - `airflow-core/src/airflow/ui/tests/e2e/specs/variable.spec.ts`
   - `airflow-core/src/airflow/ui/playwright.config.ts`
   
   Part of #63036
   Closes #63965


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