Files
openobserve/tests/ui-testing/playwright-tests/utils
3906bdc296 test: stabilize alpha1 Alerts shard on cloud (fix auto_playwright_stream being-deleted race + concurrency hardening) (#13209)
## What

Stabilizes the **Alerts** shard of the alpha1 cloud E2E suite to green,
running **fully
parallel** (`workers:3`, `fullyParallel:true`) — no serialization.
Test-infra +
page-object changes only; **no product code**. The one product-side
defect surfaced (the
prebuilt destination form unmounts its fields on template auto-load) is
worked around in
the test layer and written up separately for a frontend fix.

## Approach change since the first revision

The first version serialized the contended tests (`@serialAlpha1` + a
dedicated
`chromium-serial` project). Per review feedback ("solve it in
parallel"), that was
**removed** — the shard now runs **fully parallel**, and the flakiness
is fixed at the
source (fixture / registration / render races) instead of by
serializing.

## Root causes & fixes

### Streams / fixtures
- **`auto_playwright_stream` "being deleted" race** — the 3
`alerts-ui-operations` tests
now use the shared, always-protected **`e2e_automate`** stream
(pre-ingested by
global-setup, never deleted by cleanup), eliminating the shared
fixed-name delete race
entirely. `cleanup.spec.js` no longer deletes `auto_playwright_stream`;
`commonActions.ingestTestData` checks `response.ok()`, retries the "is
being deleted"
race, and polls the streams API until the stream is registered before
the wizard opens.

### Alert wizard
- **Dedup alert blocked at save** —
`createScheduledAlertWithDeduplication` typed its SQL
into the Monaco editor without clearing the default `SELECT * FROM
"<stream>"`, producing
malformed SQL → "Please fix the SQL error before saving." Now clears the
editor first.
- **Stream-select ordering + registration poll** — drive the stream
dropdown only after its
list fetch resolves; poll registration; page-reload recovery when the
cached list is stale.

### Prebuilt destinations (the deep one)
- **App defect:** on a *reused* form (2nd+ destination), selecting a
prebuilt type
intermittently **unmounts the credential/name fields ~0.5 s later**
(template auto-load
re-render) and they stay gone. Confirmed via DOM timeline (`count:0` for
25 s+). Since a
wait can't recover an unmounted element, `selectDestinationType` clicks
the card once,
waits for the template network to settle, confirms the fields are
**stable** (not just
present), and — if they unmount — **remounts the form** (cancel+reopen →
full page reload)
  and re-selects. Written up separately for a frontend fix.
- **List verifications raced the OTable loading skeleton** —
`expectDestinationInList` / `verifyDestinationExists` /
`verifyAlertCreated` now wait for
`o2-table-skeleton-body` to clear and poll the **list** endpoint the UI
actually reads
  (not just the single-GET) before asserting the row.

### Form-validation specs
- `alerts-form-validation` + `anomaly-detection-form-validation` flipped
serial→parallel and
made self-sufficient: `beforeAll` seeds a worker-scoped
template+destination via API (the
"Add Alert" button is hard-disabled with zero destinations), `afterAll`
removes them,
  cleanup patterns registered.

### Misc
- Cloud-correct (https) ingestion agent; alert search-input +
`updateAlert` edit-form wait
  hardening for shared-org load.

## Cloud environment gates (legitimate — not coverage drops)

`test.skip(isCloudEnvironment())` (dedup validation), `if
(!isCloudEnvironment())` (import
trigger round-trip), and external destination URLs — all because cloud's
**SSRF guard**
blocks self-referencing destinations by design. All still run fully on
OSS/self-hosted.

## Scope / safety

- 15 files: Alerts page-objects, alpha1 config + global-setup, Alerts
specs, cleanup. **No product code.**
- **No tests deleted, no `.only`, no unconditional skips, no assertions
removed.**
- The temporary Alerts-only playwright matrix (added for faster
iteration) has been
  **reverted** — the full OSS e2e matrix is restored.

## Validation

- Prebuilt P1 validated locally on cloud alpha (repeated clean passes;
every field-unmount
  recovered by the remount).
- alpha1 Alerts CI:
https://github.com/openobserve/o2-enterprise/actions/runs/29391293698


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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Shrinath Rao <shnath@openobserve.ai>
2026-07-17 07:04:48 +00:00
..
2026-01-16 18:48:25 +05:30
2026-01-16 18:48:25 +05:30
2026-07-07 10:09:16 +00:00
2026-07-07 10:09:16 +00:00
2026-07-07 10:09:16 +00:00
2026-01-16 18:48:25 +05:30
2026-07-07 10:09:16 +00:00