You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Kunal8954 (via GitHub)" <gi...@apache.org> on 2026/09/02 14:33:09 UTC
[PR] Fix XComs e2e filter tests: scope the filter input by testid [airflow]
Kunal8954 opened a new pull request, #72438:
URL: https://github.com/apache/airflow/pull/72438
closes: #72433
### What's the problem
`XComsPage.applyFilter()` locates the just-added filter pill's input with:
```ts
const filterPill = this.page
.locator("div")
.filter({ hasText: `${filterName}:` })
.first();
const filterInput = filterPill.getByRole("textbox");
```
`.filter({ hasText })` matches on **descendant** text, so it doesn't just match the specific filter pill `div` — it matches every ancestor `div` whose subtree happens to contain that text too. That used to be harmless because `.first()` happened to land on the right element, but #71554's DOM restructuring changed the filter bar's markup enough that `.first()` now resolves to a much broader ancestor, and `getByRole("textbox")` on it matches every textbox inside that ancestor instead of the one intended — hence "strict mode violation: locator resolved to 12 elements instead of 1".
### The fix
Give the actively-editing pill's input a stable `data-testid="filter-pill-input"` (`TextSearchFilter.tsx`, passed straight through `InputWithAddon`'s prop spread onto the underlying `<Input>`), and scope `applyFilter()` to `page.getByTestId("filter-pill-input")` directly instead of the ancestor-text search.
Only one filter pill is ever in edit mode at a time (an added pill enters edit mode immediately, and closes — collapsing to a chip — as soon as `Enter`/`Escape` is pressed or it loses focus), so a single, non-keyed testid is all `applyFilter()` needs; no per-filter key plumbing into the e2e layer.
### Tests
Added a `FilterBar` test (`FilterBar.test.tsx`) asserting `getByTestId("filter-pill-input")` returns exactly the active pill's textbox. Verified it's a real regression test by temporarily reverting the `data-testid` locally — the new test (and only that test) failed with the same kind of "unable to find element" error this issue describes, confirming it actually exercises the bug.
### Verification
- `vitest run` on `src/components/FilterBar`: 22/22 passing (including the new test).
- `eslint --quiet` on every touched file: clean.
- `tsc -p tsconfig.app.json`: clean.
- `prettier --check`: clean.
- Branch rebased onto current `main` before running all of the above.
- Could not run the actual Playwright e2e spec here (no live Airflow webserver/browser in this environment) — the added unit test exercises the same DOM-shape bug at the component level instead, and `XComsPage.applyFilter()`'s new locator is a straightforward, minimal change built directly on top of that verified testid.
---
<sub>Disclosure: this PR was prepared with the assistance of [Claude Code](https://claude.com/claude-code) (the commit carries a `Co-Authored-By` trailer). I reviewed the change and take responsibility for it.</sub>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_015kAvbZ6SeKgp6jbGcvpXSh
--
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
Re: [PR] Fix XComs e2e filter tests: scope the filter input by testid [airflow]
Posted by "Kunal8954 (via GitHub)" <gi...@apache.org>.
Kunal8954 commented on code in PR #72438:
URL: https://github.com/apache/airflow/pull/72438#discussion_r3915585039
##########
airflow-core/newsfragments/72438.bugfix.rst:
##########
Review Comment:
Removed — thanks, agreed this is a test-only fix and doesn't need a newsfragment.
--
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
Re: [PR] Fix XComs e2e filter tests: scope the filter input by testid [airflow]
Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #72438:
URL: https://github.com/apache/airflow/pull/72438#issuecomment-5543644492
Awesome work, congrats on your first merged pull request! You are invited to check our [Issue Tracker](https://github.com/apache/airflow/issues) for additional contributions.
--
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
Re: [PR] Fix XComs e2e filter tests: scope the filter input by testid [airflow]
Posted by "Kunal8954 (via GitHub)" <gi...@apache.org>.
Kunal8954 commented on PR #72438:
URL: https://github.com/apache/airflow/pull/72438#issuecomment-5543845170
Thanks for the review @bbovenzi. Will pick up more in this area.
--
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
Re: [PR] Fix XComs e2e filter tests: scope the filter input by testid [airflow]
Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #72438:
URL: https://github.com/apache/airflow/pull/72438#discussion_r3915551268
##########
airflow-core/newsfragments/72438.bugfix.rst:
##########
Review Comment:
Please remove this newsfragment
--
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
Re: [PR] Fix XComs e2e filter tests: scope the filter input by testid [airflow]
Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi merged PR #72438:
URL: https://github.com/apache/airflow/pull/72438
--
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