SIGN IN SIGN UP

test: fix flaky Alerts OSelect dropdowns (click trigger, not root div) (#12869)

## Problem

The scheduled **main** Playwright Regression run failed in the
**Alerts-Regression** shard ([run
28097849118](https://github.com/openobserve/openobserve/actions/runs/28097849118/job/83192928864))
with 2 tests failing on the **same** locator `[data-test$="-popover"]
[data-test$="-option"]` (dropdown options never found):

- `alerts-bugs.spec.js` › "Template should not appear twice in override
template input" (`@bug-10110`)
- `alerts-regression.spec.js` › "Bug #9967: PromQL alert creation"
(`@bug-9967`)

## Root cause

The alert form selects were migrated to the **OSelect** (reka-ui
popover) component. OSelect forwards the consumer's `data-test` onto an
**inner `<button data-test="...-trigger">`**, while the root element is
a plain `<div>`. Both tests clicked the **root `<div>`**, which does
**not** toggle the reka popover — `aria-expanded` stays `false`, the
popover never opens, and the option locator times out.

This is not caused by #12855; it reproduces on an older build too. The
codebase already had the correct pattern elsewhere (group-by select
clicks `[data-test$="-trigger"]`).

## Fix

- New shared helper `openOSelectDropdown(page, rootLocator)`
(`tests/ui-testing/pages/alertsPages/oselectHelpers.js`) that clicks the
inner `-trigger` and **retries until `aria-expanded="true"`** — the reka
trigger can open-then-close on a single Playwright click.
- `alertsPage.openAdvancedTemplateOverrideSelect()` uses the helper; the
spec now calls that page-object method (no raw locator in the spec).
- Routed **all 8** destination-dropdown open sites in
`alertCreationWizard.js` through the same helper (DRY; the same latent
bug affected every one).

## Validation (local, against running o2)

| Spec | Result |
|------|--------|
| `alerts-bugs.spec.js` | **4 passed** |
| `alerts-regression.spec.js` | **5 passed** (incl. Bug #9967 PromQL) |

Both originally-failing tests are green; no regressions across the
changed destination sites. Passed a Sentinel code-quality review (0
critical).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
S
Shrinath Rao committed
0afbe40fe45561de1f124f315000c392c59ea8af
Parent: b0f4b0e
Committed by GitHub <noreply@github.com> on 6/24/2026, 2:36:41 PM