Skip to content

Improve Playwright test patterns in VariablePage (#63965)#63979

Merged
choo121600 merged 4 commits intoapache:mainfrom
kimimgo:fix/e2e-variable-playwright-63965
Mar 26, 2026
Merged

Improve Playwright test patterns in VariablePage (#63965)#63979
choo121600 merged 4 commits intoapache:mainfrom
kimimgo:fix/e2e-variable-playwright-63965

Conversation

@kimimgo
Copy link
Copy Markdown
Contributor

@kimimgo kimimgo commented Mar 20, 2026

Fixes #63965

Changes in VariablePage.ts

Before After Checklist item
tr:has-text(key) tableRows.filter({ hasText: key }) CSS :has-text() → user-facing locators
[id^="checkbox"][id":control"] getByRole('checkbox') CSS attr selector → role-based
page.waitForFunction() with DOM queries Promise.race of locator waitFor() waitForFunction → locator-based waiting
thead input[type='checkbox'] thead getByRole('checkbox') CSS selector → role-based

No test coverage or behavior changes. Test patterns only.

- 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.
@boring-cyborg
Copy link
Copy Markdown

boring-cyborg bot commented Mar 20, 2026

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)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@boring-cyborg boring-cyborg bot added the area:UI Related to UI/UX. For Frontend Developers. label Mar 20, 2026
…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.
Copy link
Copy Markdown
Member

@choo121600 choo121600 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, @kimimgo Thanks for contribution :)
Could you try running the test locally after removing **/variable.spec.ts from testIgnore in playwright.config.ts?

@kimimgo
Copy link
Copy Markdown
Contributor Author

kimimgo commented Mar 22, 2026

Thanks @choo121600! I'll set up the local Airflow dev environment and run the test with variable.spec.ts removed from testIgnore. Will report back with results.

@kimimgo
Copy link
Copy Markdown
Contributor Author

kimimgo commented Mar 22, 2026

Ran the tests locally with breeze testing ui-e2e-tests --test-pattern 'variable.spec.ts'.

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 (playwright test --list shows all 15 cases across 3 browsers), and the locator patterns are syntactically valid.

Could you verify with an English locale, or should I set locale: 'en-US' in the Playwright config?

@choo121600
Copy link
Copy Markdown
Member

I've applied the fix in this PR, thanks!
Looks like you're Korean — nice to meet you 🙌
Since Airflow i18n are stored in localStorage, clearing it should resolve the issue 😉

@kimimgo
Copy link
Copy Markdown
Contributor Author

kimimgo commented Mar 24, 2026

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.

@kimimgo
Copy link
Copy Markdown
Contributor Author

kimimgo commented Mar 24, 2026

Ran locally with clean localStorage — all 5 tests pass! ✅

  ✓ verify variables table displays (1.2s)
  ✓ verify editing a variable (1.5s)
  ✓ verify search filters (1.5s)
  ✓ verify importing variables using Import Variables button (1.9s)
  ✓ verify deleting the variable (3.0s)

  5 passed (9.7s)

Ready for merge.

Replace Promise.race + waitFor() with Playwright's built-in
.or() combinator for assertion-based waiting. Verified locally
with 5/5 pass.
@choo121600 choo121600 merged commit 283ab81 into apache:main Mar 26, 2026
222 of 224 checks passed
@choo121600
Copy link
Copy Markdown
Member

Cool, thanks for the contribution!
Welcome to the Airflow community 🙌

@boring-cyborg
Copy link
Copy Markdown

boring-cyborg bot commented Mar 26, 2026

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

nailo2c pushed a commit to nailo2c/airflow that referenced this pull request Mar 30, 2026
…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>
Suraj-kumar00 pushed a commit to Suraj-kumar00/airflow that referenced this pull request Apr 7, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:UI Related to UI/UX. For Frontend Developers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

E2E: Improve Playwright test patterns in specs/variable.spec.ts

3 participants