Files
openobserve/tests/ui-testing
Shrinath Rao 56bedcb126 test(logs): fix flaky pattern-card click under OVirtualScroll windowing (#13752)
## Summary

Fixes the flaky failure seen in ENT PR #2386's `e2e / Logs-Features`
shard:

```
Logs/searchPatterns.spec.js:293 › should open pattern details dialog when clicking pattern card
TimeoutError: locator.click: Timeout 45000ms exceeded.
  - waiting for locator('[data-test="pattern-card-0"]')
```

Failed all 4 attempts, took the rest of the shard down (`1 failed, 10
did not run, 57 passed`). **Unrelated to #2386's LLM-annotation
changes** — it's pre-existing test-infra.

## Root cause

`PatternList` renders cards inside `OVirtualScroll`, which stamps the
**absolute** item index onto each card (`pattern-card-<absoluteIndex>`)
and mounts **only the visible window**. The card getters were already
migrated to address cards by *rendered position* (`patternCardAt()` /
`patternCardPart()` — suffix + `.nth()`), but three code paths were left
on the absolute-index selector:

- `clickPatternDetailsIcon()` → clicked
`[data-test="pattern-card-${index}"]`
- `clickPatternIncludeBtn()` / `clickPatternExcludeBtn()`
- the `waitForPatternsToLoad()` `'patterns'` visibility check

When the mounted window starts above index 0, `getPatternCardCount()`
(suffix `.count()`) still reports cards present, but the absolute
`pattern-card-0` root is absent → the click waits the full 45s. Locally
the whole list fits (no windowing), so `pattern-card-0` is always
mounted and the bug hides — which is why it only surfaces in CI's
headless viewport.

## Fix

Migrate the card-root click helpers and the load-check to
`patternCardAt(index)` (rendered position), consistent with
`getPatternCardCount()` and the getters. Remove the now-unused
absolute-index `patternCard` / `patternCardDetailsIcon` locators (the
latter also misleadingly named — it resolved to the card root, not an
icon).

## Validation

Ran the full spec locally headless against a local **enterprise** build
(v0.92.0-rc3):

```
playwright-tests/Logs/searchPatterns.spec.js — 15 passed (1.3m)
```

including the previously-failing `should open pattern details dialog
when clicking pattern card`, with no regression to the other 14. Also
verified via DOM probe that rendered cards are addressed correctly by
rendered position while the absolute `pattern-card-0` root is the
fragile anchor under windowing.

## Scope

Test-only (`tests/ui-testing/pages/logsPages/logsPage.js`). No product
code touched.
2026-08-11 09:49:03 +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