mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-04 08:09:27 +00:00
## Summary Two independent improvements to the Playwright E2E test suite. --- ### Part 1 — Sentinel audit fixes (original PR scope) Fixes from the Sentinel audit review of PR #12358 (selector drift stabilization). - **Dead code removal**: delete `clickJobID()` from `logsPageEP.js` (unreachable code containing `console.log`); remove unused `chromium` import - **Critical fix**: replace `console.log`/`console.error` in `decryptLogSQL()` with `testLogger` equivalents - **POM compliance**: replace raw `page.locator()` call in `alerts-ui-operations.spec.js` `beforeEach` with `pm.alertsPage.isIncidentsFeatureEnabled()`; add that method to `alertsPage.js` - **POM compliance**: move per-test `const pm = new PageManager(page)` into `beforeEach` in `service-graph.spec.js`; replace raw `page.waitForLoadState()` with `pm.serviceGraphPage.waitForGraphReload()`; add `waitForGraphReload()` to `serviceGraphPage.js` - **Inline selector cleanup**: move metrics tab inline string literals in `serviceGraphPage.js` into constructor properties - **Tagging**: add `@cipherKeys/@enterprise/@P1/@P2/@negative/@validation` to all 6 tests in `cipherKeys.spec.js` (were untagged); add `@P1/@P2` to all 5 tests in `regexPatternManagement.spec.js` - **ESM fix**: correct `export const path = require('path')` → `import path from 'path'` in `logoManagementPage.js` - **Deduplication**: consolidate `createFirstFunction`/`createSecondFunction` into shared `createFunction(name, vrlCode)` in `pipelinesEP.js` --- ### Part 2 — Parallelize Metrics E2E shard **Problem**: The `e2e / Metrics` CI shard was consistently the slowest job at ~22 minutes per PR run, while all other shards complete in ~5-7 minutes. **Root cause**: 9 of 11 Metrics spec files used `test.describe.configure({ mode: 'serial' })` because they shared a describe-scope `let pm` variable reassigned in `beforeEach`. This forced every test in those files onto a single Playwright worker, eliminating all parallelism despite `fullyParallel: true` and 5 workers being configured. **Fix applied to all 9 affected files** (`metrics.spec.js`, `metrics-config.spec.js`, `metrics-config-tabs.spec.js`, `metrics-visualizations.spec.js`, `metrics-promql-query-persistence.spec.js`, `metrics-table-column-order.spec.js`, `metrics-queries.spec.js`, `metrics-aggregations.spec.js`, `metrics-advanced.spec.js`): - Remove `test.describe.configure({ mode: 'serial' })` - Replace shared `let pm` + `beforeEach` pattern with a `setupTest(page, testInfo)` helper that creates and returns a fresh `PageManager` per test — the same pattern already used in `metrics-promql-builder.spec.js` (the one file that was already parallel) - `metrics-table-column-order.spec.js`: pass `pm` explicitly into `setupTableChart(pm, page, mode)` since it can no longer close over a describe-scope variable - Split consolidated mega-tests (for-loops over multiple independent scenarios) in `metrics-queries`, `metrics-aggregations`, and `metrics-advanced` into individual `test()` blocks so Playwright can distribute them across workers **No test assertions, selectors, query logic, or validation changed.** | File | Tests before | Tests after | |---|---|---| | `metrics.spec.js` | 10 (serial) | 10 (parallel) | | `metrics-config.spec.js` | 2 (serial) | 2 (parallel) | | `metrics-config-tabs.spec.js` | 3 (serial) | 3 (parallel) | | `metrics-visualizations.spec.js` | 4 (serial) | 4 (parallel) | | `metrics-promql-query-persistence.spec.js` | 6 (serial) | 6 (parallel) | | `metrics-table-column-order.spec.js` | 20 (serial) | 20 (parallel) | | `metrics-queries.spec.js` | 4 mega-tests (serial) | 12 individual (parallel) | | `metrics-aggregations.spec.js` | 3 mega-tests (serial) | 10 individual (parallel) | | `metrics-advanced.spec.js` | 4 mega-tests (serial) | 12 individual (parallel) | **Expected impact**: ~1300s (~22 min) → ~300-400s (~5-7 min) wall-clock time. --- ## Test plan - [ ] All 40 tests in the 4 Sentinel-audit spec files enumerate cleanly via `npx playwright test --list` - [ ] Tag filters `@cipherKeys`, `@P2`, `@sdr` match expected tests - [ ] All Metrics spec files enumerate cleanly with no serial mode warnings - [ ] Metrics shard CI time drops to ~5-7 min on next PR run 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>