Files
openobserve/tests/ui-testing
ktx-akshay 4531ae74d8 test(dashboards): e2e coverage for favorites cross-folder search fix (#13437) (#13758)
## Summary

Adds E2E coverage for #13437 (`fix: dashboard all folder search for
favorites`).
That PR changed three things in `Dashboards.vue`; this adds one test per
change.

## Test cases added

| # | Test case | Covers | Priority |
|---|-----------|--------|----------|
| 1 | `should surface a non-favorited dashboard in the Favorites folder
when searching across folders` | Favorites view yields to an active
cross-folder search instead of short-circuiting to the stored favorites
list | P0 |
| 2 | `should restore the favorites-only list after clearing a
cross-folder search` | Clearing resets both scope models (`searchQuery`
+ `filterQuery`), so the favorites-only list comes back | P1 |
| 3 | `should expose a clear button for a current-folder search and
restore the full list` | Search field is unconditionally `clearable` —
the clear (X) button now renders in "This folder" scope too | P1 |

## What each test proves

**1.** Seeds two dashboards in one folder, favorites only the first.
Asserts the
un-favorited one is **absent** from the Favorites view, then switches
the scope
toggle to "All folders", searches it by name, and asserts it appears.
Before the
fix the rows computed returned `favorites.value.map(...)` whenever the
`__favorites__` pseudo-folder was active, so a cross-folder hit could
never render.

**2.** Runs that same cross-folder search, then clicks clear and asserts
the field
is empty, the searched-for dashboard drops out, and the favorite is
listed again.

**3.** Searches in the default "This folder" scope, asserts the filter
is active
(second dashboard filtered out), that
`[data-test="dashboard-search-clear"]` is
visible, and that clicking it empties the field and restores both rows.
Previously `:clearable="searchAcrossFolders"` meant no clear button
existed in
this mode at all.

## Files changed

-
`tests/ui-testing/playwright-tests/dashboards/dashboard-favorites.spec.js`
— 3 new tests (file now has 9)
- `tests/ui-testing/pages/dashboardPages/dashboard-favorites.js` — 3
locators (`searchScopeAllFolders`, `searchScopeCurrentFolder`,
`searchClearBtn`) + 5 methods (`searchAcrossFolders`, `clearSearch`,
`verifySearchClearButtonVisible`, `verifySearchInputEmpty`)

## Test design

Each test seeds a second, deliberately un-favorited dashboard
(`DashB_<ts>`), named
so neither dashboard's name is a substring of the other — that second
row is the
only thing that can prove the search reached past the favorites list.
Every test
asserts its own baseline *before* the action, so a pass is attributable
to the
change under test rather than to a permissive list. All selectors read
from source;
no new `waitForTimeout` sleeps; cleanup covered by the existing
`afterEach`.

## Test results

`9 passed` locally against `localhost:5080`. New tests verified green on
repeated
isolated runs.

## Caveats

- Tests were **not** verified to fail against pre-fix code — the app is
served from
a prebuilt bundle (no dev server), so reverting the hunks would require
a full
frontend rebuild. The in-test baseline assertions mitigate this but
don't replace it.
- This spec file is **self-hosted-only**: `login()` in `dashLogin.js`
waits for the
`login-user-id-field` form, while alpha cloud uses Dex SSO. Confirmed
pre-existing
(an untouched test in this file fails at the identical line), but it
means these
  tests won't run in a cloud-targeted CI job.
2026-08-11 11:01:33 +00:00
..
2024-11-13 15:13:36 +05:30

zinc-observe-ui-automation

Playwright UI Testing

Installation

npm install

Running Tests

cd playwright-runner
npm start

Then open http://localhost:3000 to access the test runner interface.

Using Command Line

# Run all tests
npx playwright test

# Run specific test by tag
npx playwright test -g @alertsImportExport

# Run in headed mode
npx playwright test --headed

# Run specific test file
npx playwright test Alerts/alerts-import.spec.js

Environment Configuration

Tests can be configured using:

  1. Playwright Runner UI - Set environment variables through the web interface
  2. Environment Variables - Set variables in terminal or .env file