Files
openobserve/tests
ktx-akshay b9e79ed433 test: prevent flaky DOM detachment in searchAndAddField and validate API response status (#12726)
## PR #12726 — Change Summary

### Problem
Test `should render table with histogram(_timestamp) as X and count
aggregation as Y` was flaky with:

Error: locator.scrollIntoViewIfNeeded: Element is not attached to the
DOM
  at dashboard-chart.js:163

Root cause: After searchInput.fill(fieldName), Vue reactively re-renders
the field list
multiple times (debounce / virtual scroll). waitFor({ state: "visible"
}) passed during
an intermediate render, then Vue triggered another re-render, detaching
the element before
scrollIntoViewIfNeeded() could act on it.

---

### Changes Made

1. tests/ui-testing/pages/dashboardPages/dashboard-chart.js — Flakiness
Fix
- Removed redundant scrollIntoViewIfNeeded() — hover() already
auto-scrolls
- Wrapped hover() in a 3-attempt retry loop that re-waits for the
element after
     each DOM detachment
- Raised initial waitFor timeout from 5000ms → 10000ms for heavier field
lists

2.
tests/ui-testing/playwright-tests/Dashboards/dashboard-table-chart.spec.js
— Two changes

a) Replaced waitForStreamComplete with page.waitForResponse + explicit
status assertion
- waitForStreamComplete silently timed out on non-200 responses — no
assertion
      - page.waitForResponse resolves on any matching URL response, then
        expect(apiResponse.status()).toBe(200) fails clearly on 401/500

   b) Fixed vacuous assertion (Test Inspector finding)
- Original predicate had && r.status() === 200 — waitForResponse would
only resolve
on 200, making expect(apiResponse.status()).toBe(200) always true
(no-op)
- Removed status condition from predicate so the expect() is now a real
assertion

---

### Test Inspector Findings Addressed

| Finding | Status |

|----------------------------------------------------------------------|---------------------|
| Vacuous assertion — expect(apiResponse.status()).toBe(200) was no-op |
Fixed |
| Selector cross-validation — o-field-list-row-* matches
OFieldList.vue:67 | Verified |
2026-06-18 07:05:12 +00:00
..
2026-06-18 04:25:21 +00:00
2024-09-22 17:57:47 +08:00