Skip to content

fix(e2e): disambiguate Close Tab locator in subagent-child-navigation.spec.ts - #196

Closed
alltomatos wants to merge 1 commit into
devfrom
fix/e2e-close-tab-locator-ambiguity
Closed

alltomatos wants to merge 1 commit into
devfrom
fix/e2e-close-tab-locator-ambiguity

Conversation

@alltomatos

Copy link
Copy Markdown
Owner

Issue for this PR

Closes #195

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

"shows the not found fallback when the viewed session is deleted" was failing consistently on both unit (windows)/e2e (windows) and e2e (linux) CI jobs — confirmed identically failing on dev HEAD baseline and on unrelated PRs (#190, #191) that don't touch this file — always at the same assertion:

Error: strict mode violation: getByRole('button', { name: 'Close Tab' }) resolved to 2 elements

Root cause: two different i18n keys produce near-identical accessible names — common.closeTab → "Close tab" (the tab strip's own close-tab icon button, always present while a tab is open) and session.error.notFound.closeTab → "Close Tab" (the fallback's own button). Playwright's getByRole name matching is case-insensitive by default, so an inexact match resolves to both buttons whenever they're both on screen — exactly this test's scenario (a tab open, showing the not-found fallback). This isn't timing-dependent flakiness; it's a deterministic locator ambiguity in the test itself, which is why it failed the same way on every CI platform every time.

Fixed by adding exact: true, which makes Playwright's name matching case-sensitive and resolves only the fallback's "Close Tab" button.

How did you verify your code works?

  • Before fix: bunx playwright test e2e/regression/subagent-child-navigation.spec.ts -g "shows the not found fallback" fails with the strict-mode violation above, reproduced consistently.
  • After fix: same command passes, reproduced clean 3x in a row.
  • bun run typecheck (root, via pre-push hook, all 30 workspace tasks) passes clean.

Screenshots / recordings

Not applicable — test-only change, no UI/behavior change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

….spec.ts

"shows the not found fallback when the viewed session is deleted" was
failing consistently on both unit(windows)/e2e(windows) and e2e(linux) CI
jobs, always at the same assertion, always with:

  Error: strict mode violation: getByRole('button', { name: 'Close Tab' })
  resolved to 2 elements

Root cause: two different i18n keys produce near-identical accessible
names — common.closeTab ("Close tab", the tab strip's icon button) and
session.error.notFound.closeTab ("Close Tab", the fallback's own button).
Playwright's getByRole name matching is case-insensitive by default, so
an inexact match matches both buttons whenever they're both on screen —
which is exactly this test's scenario (a tab open + the not-found
fallback rendered in it). This isn't timing-dependent flakiness; it's a
deterministic locator ambiguity in the test itself, which is why it
failed the same way on every CI platform.

Fixed by adding `exact: true`, which makes Playwright's name matching
case-sensitive and resolves only the fallback's "Close Tab" button.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
alltomatos pushed a commit that referenced this pull request Sep 11, 2026
….spec.ts

The e2e (linux) job on this PR's CI failed with a strict-mode violation:
getByRole('button', { name: 'Close Tab' }) resolves to two elements
whenever a tab is open and showing the not-found fallback, because
Playwright's getByRole name matching is case-insensitive by default and
two different i18n keys produce near-identical accessible names
(common.closeTab -> "Close tab", session.error.notFound.closeTab ->
"Close Tab"). Confirmed this is not caused by this PR's diff (which
doesn't touch packages/app at all): the same failure reproduces
identically on dev HEAD (9ef686e) and on unrelated PRs #190/#191.

A fix already exists as open PR #196 (closes tracking issue #195),
verified there by reproducing the failure and the fix locally. Ported
the same one-line change (adding exact: true) into this PR so CI goes
green here without waiting on #196 to merge first.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AGh7o4NA8jUjwakDzZo12e
@alltomatos

Copy link
Copy Markdown
Owner Author

Closing as superseded by commit 88c345e on dev which resolved #195 with exact: true locator matching.

@alltomatos alltomatos closed this Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

e2e: subagent-child-navigation 'not found fallback' fails with Close Tab strict-mode violation on all CI platforms

1 participant