Repository navigation
Description
Failed once on main (373ca37, run 31274006508), passed on re-run of the same commit, and passed on a branch containing that same commit. Pre-existing and intermittent, not a regression from anything merged around it.
What Playwright reported
Error: strict mode violation: getByTestId('provider-github').getByText('Connected')
resolved to 2 elements:
2 × <span class="...text-success">Connected</span>
- unexpected value "hidden"
apps/web/e2e/account-and-workspaces.spec.ts:85
What it is not
connected-accounts.tsx renders exactly one <Badge tone="success">Connected</Badge> per provider card, and describeProvider returns Account <id> when linked, so the description does not contain the word. Two identical badges means getByTestId('provider-github') matched two list items, not that one card held two badges.
Likely cause
One of the two is hidden, which is what a soft navigation looks like while the outgoing tree is still mounted: the test does page.goto('/settings/account/connections') and asserts immediately, with no wait for the previous view to unmount. Playwright resolves both trees and strict mode rejects the ambiguity.
That would also explain why it is rare and why a re-run passes.
Worth fixing regardless
Even if the duplication is transient, the assertion is too loose to be trustworthy: it passes or fails depending on which tree Playwright resolves first. Options, roughly in order of preference:
- wait for the connections view to settle before asserting, so only one tree is mounted
- scope to the visible card, e.g.
getByTestId('provider-github').filter({ visible: true }) - give the badge its own test id and assert on that
Reproducing it reliably probably needs the e2e stack running in a loop, since it did not reproduce on demand.
Activity
test(e2e): fix account and workspaces flaky test (Noveum#335)