[NA] [QA] test(e2e): retry model-picker click to fix Playground flake#7401
Conversation
setModelForVariant clicked the model picker once then waited for the listbox, but on higher-latency environments the first click sometimes registers as a hover (surfacing a tooltip instead of opening the popover), so the listbox never appears and the step times out. Wrap the click in an expect().toPass() loop that re-clicks until the popover actually opens. Observed as a repeated failure (initial + 2 retries) on the Bayer stsaas regression run; the test has a long clean streak everywhere else and is flagged flaky in TestOps. Change is strictly safer than the original (retries the click rather than firing once). Verified green locally 3x. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
📋 PR Linter Failed❌ Missing Section. The description is missing the ❌ Missing Section. The description is missing the ❌ Missing Section. The description is missing the ❌ Missing Section. The description is missing the |
⏱️ pre-commit per-hook timingNo linted files changed — nothing to run. ⏭️ 41 skipped (no matching files changed)
|
| private async setModelForVariant(index: number, modelDisplayName: string): Promise<void> { | ||
| await this.modelPicker(index).click(); | ||
| const listbox = this.page.getByRole('listbox'); | ||
| await listbox.waitFor({ state: 'visible' }); | ||
| // The trigger occasionally swallows the first click as a hover (surfacing a | ||
| // tooltip instead of opening the popover), so retry the click until the | ||
| // listbox actually opens rather than firing once and waiting. |
There was a problem hiding this comment.
Missing POM step tracing
setModelForVariant() now does the click/retry sequence inline, so Playwright only records the outer callers and we lose a dedicated step for model selection, which makes flakes harder to isolate — should we wrap the helper body in test.step(...) like the other POM methods, as .agents/skills/writing-e2e-tests/conventions.md asks?
Want Baz to fix this for you? Activate Fixer You can also update your AI coding guidelines based on this comment by apply pr to [branch name]
Other fix methods
Prompt for AI Agents
Before applying, verify this suggestion against the current code. In
tests_end_to_end/e2e/pom/playground.page.ts around lines 470-481, in the private helper
`setModelForVariant(index: number, modelDisplayName: string)`, wrap the entire method
body in a dedicated `test.step(...)` block (including the click/retry logic and the
listbox fill/option click). Use a clear step description like `select model for variant
{index}` (or similar) so the Playwright report includes a trace specifically for this
interaction. Ensure the existing retry behavior remains unchanged inside the step.
Problem
PlaygroundPage.setModelForVariantclicks the model picker once, then waits for the optionslistboxto appear. On higher-latency environments the first click sometimes registers as a hover — surfacing the model's tooltip instead of opening the popover — so the listbox never becomes visible and the step times out after 15s.Observed as a repeated failure (initial attempt + both retries) on the Bayer stsaas regression run (
playground-smoke→ "Run prompts against a dataset auto-creates an experiment"). The failure snapshot showed the trigger[active]with a tooltip rendered but no listbox — the click landed but didn't open the popover. The test has a long clean pass streak on every other environment and is flagged flaky in TestOps.Fix
Wrap the click in
expect(async () => { … }).toPass()so it re-clicks the trigger until the listbox actually opens, instead of firing once and waiting. Strictly safer than the original — same selectors, same assertions, just resilient to a click that doesn't register as opening the popover.Testing
tsc --noEmitclean;playground-smokeverified green locally 3× against a 2.1.13 instance.selectModelon thee2e-compat/2.1.13branch (that POM doesn't exist onmainyet), which has the identical single-click-then-wait shape.🤖 Generated with Claude Code