Improve Playwright test patterns in VariablePage (#63965)#63979
Improve Playwright test patterns in VariablePage (#63965)#63979choo121600 merged 4 commits intoapache:mainfrom
Conversation
- Replace CSS :has-text() with locator.filter({ hasText }) in rowByKey
- Replace CSS attribute selector with getByRole('checkbox') in selectRow
- Replace page.waitForFunction() DOM queries with locator-based
waiting (Promise.race of noData text vs first table row)
- Replace CSS input[type='checkbox'] with getByRole('checkbox')
in selectAllCheckbox
Aligns with Playwright best practices per apache#63036.
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
…ByRole
getByRole('checkbox') resolves to Chakra UI's hidden <input> which
is not visible/stable, causing TimeoutError. Keep original CSS
selectors for checkbox interactions until Chakra components expose
proper accessible roles.
There was a problem hiding this comment.
Hello, @kimimgo Thanks for contribution :)
Could you try running the test locally after removing **/variable.spec.ts from testIgnore in playwright.config.ts?
|
Thanks @choo121600! I'll set up the local Airflow dev environment and run the test with |
|
Ran the tests locally with All 5 tests failed due to locale mismatch — my local Airflow renders in Korean (e.g. "변수 추가" instead of "Add Variable"), so English-text locators fail. Not related to PR changes. The test file parses correctly ( Could you verify with an English locale, or should I set |
|
I've applied the fix in this PR, thanks! |
|
Nice to meet you too @choo121600! 🙌 Thanks for the tip — I'll clear localStorage next time to reset the locale before running E2E tests. Good to know about the i18n setup. |
|
Ran locally with clean localStorage — all 5 tests pass! ✅ Ready for merge. |
Replace Promise.race + waitFor() with Playwright's built-in .or() combinator for assertion-based waiting. Verified locally with 5/5 pass.
|
Cool, thanks for the contribution! |
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
…he#63979) * Improve Playwright test patterns in VariablePage (apache#63965) - Replace CSS :has-text() with locator.filter({ hasText }) in rowByKey - Replace CSS attribute selector with getByRole('checkbox') in selectRow - Replace page.waitForFunction() DOM queries with locator-based waiting (Promise.race of noData text vs first table row) - Replace CSS input[type='checkbox'] with getByRole('checkbox') in selectAllCheckbox Aligns with Playwright best practices per apache#63036. * Revert checkbox selectors — Chakra hidden input incompatible with getByRole getByRole('checkbox') resolves to Chakra UI's hidden <input> which is not visible/stable, causing TimeoutError. Keep original CSS selectors for checkbox interactions until Chakra components expose proper accessible roles. * Use expect().toBeVisible() with .or() combinator Replace Promise.race + waitFor() with Playwright's built-in .or() combinator for assertion-based waiting. Verified locally with 5/5 pass. --------- Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
…he#63979) * Improve Playwright test patterns in VariablePage (apache#63965) - Replace CSS :has-text() with locator.filter({ hasText }) in rowByKey - Replace CSS attribute selector with getByRole('checkbox') in selectRow - Replace page.waitForFunction() DOM queries with locator-based waiting (Promise.race of noData text vs first table row) - Replace CSS input[type='checkbox'] with getByRole('checkbox') in selectAllCheckbox Aligns with Playwright best practices per apache#63036. * Revert checkbox selectors — Chakra hidden input incompatible with getByRole getByRole('checkbox') resolves to Chakra UI's hidden <input> which is not visible/stable, causing TimeoutError. Keep original CSS selectors for checkbox interactions until Chakra components expose proper accessible roles. * Use expect().toBeVisible() with .or() combinator Replace Promise.race + waitFor() with Playwright's built-in .or() combinator for assertion-based waiting. Verified locally with 5/5 pass. --------- Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
Fixes #63965
Changes in
VariablePage.tstr:has-text(key)tableRows.filter({ hasText: key })[id^="checkbox"][id":control"]getByRole('checkbox')page.waitForFunction()with DOM queriesPromise.raceof locatorwaitFor()thead input[type='checkbox']thead getByRole('checkbox')No test coverage or behavior changes. Test patterns only.