Skip to content

test: expand E2E coverage with 30 new Playwright tests#1995

Open
teeohhem wants to merge 10 commits intomainfrom
teeohhem/expand-e2e-coverage
Open

test: expand E2E coverage with 30 new Playwright tests#1995
teeohhem wants to merge 10 commits intomainfrom
teeohhem/expand-e2e-coverage

Conversation

@teeohhem
Copy link
Copy Markdown
Contributor

@teeohhem teeohhem commented Mar 26, 2026

Summary

Expands Playwright E2E test coverage from 88 to 118 tests (+30 net new), covering core user workflows across alerts, chart explorer, dashboards, search, services, sessions, sources, traces, and user preferences.

What changed

New test coverage (30 unique tests across 10 feature areas):

  • Alerts: Alert card state badge, multi-alert ordering, shared createSavedSearchAlert helper
  • Chart explorer: Chart type tabs, group-by series, metric source queries, SQL mode
  • Dashboards: Section creation, tile editing, dashboard deletion from listing page
  • Dashboard list: Search dashboards by name (new feature page)
  • Search: Query mode preservation (SQL↔Lucene round-trip), empty results handling, Escape to close side panel
  • Services dashboard: Top endpoints table, endpoint click navigation
  • Sessions: Multiple session cards, session details drawer, data source filtering
  • Sources: Source listing, source type switching, edit sources navigation
  • Traces: Trace search/filter, side panel tabs, waterfall view with trace attributes
  • Temporary dashboard: Listing page navigation, URL param persistence
  • User preferences: Menu navigation, preferences modal, team settings, Escape to close

Consolidation (7 files deleted, no coverage lost):

  • Merged 6 pairs of split spec files (*-extended, *-workflow, *-management) into single files per feature area
  • Removed 12 tests that duplicated behavior already covered by existing comprehensive tests

Infrastructure:

  • Added data-testid attributes to AlertsPage, DBEditTimeChartForm, SearchWhereInput
  • Added page object methods: ChartExplorerPage.getChartTypeTab(), ServicesDashboardPage.topEndpointsTable, SidePanelComponent.getTabPanel()
  • Created UserPreferencesPage and AlertsPage page objects
  • Updated CI to fail E2E report when a shard is cancelled

Test plan

  • Run full E2E suite: ./scripts/test-e2e.sh
  • Verify no test name collisions across spec files
  • Verify CI sharding distributes new tests evenly

Add comprehensive Playwright E2E tests covering alerts management,
chart explorer, dashboard interactions, search modes/table/side-panel,
services dashboard, sessions, sources, traces, and user preferences.

Add data-testid attributes to AlertsPage, DBEditTimeChartForm, and
SearchWhereInput to support reliable test selectors. Update page
objects and components to use data-testid selectors following
Playwright best practices.
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hyperdx-oss Ready Ready Preview, Comment Mar 26, 2026 9:10pm

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 26, 2026

⚠️ No Changeset found

Latest commit: c2575f2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 26, 2026

PR Review

  • ⚠️ createSavedSearchAlert helper unused in third test (alerts.spec.ts:336) → The "should display multiple alerts and verify ordering" test duplicates ~40 lines of alert-creation setup inline instead of calling createSavedSearchAlert() twice. Use the helper to stay DRY.

  • ⚠️ Misleading test name (alerts.spec.ts:336) → Test claims to "verify ordering" but only asserts both alerts are visible (count() >= 2). Either verify actual ordering or rename to "should display multiple alerts".

  • ⚠️ Fragile locators in traces spec (traces.spec.ts) → locator('[role="button"]').filter({ hasText: /\w+/ }) and locator('div[class*="HyperJson_key__"]') are overly broad/CSS-module-dependent. These existed before but are being promoted into the consolidated spec — worth replacing with data-testid attributes.

✅ No critical bugs or security issues. The data-testid attributes added to source all match what the new page objects/tests query. CI change for cancelled shard handling is correct.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 26, 2026

Knip - Unused Code Analysis

⚪ No changes detected (182 issues on both main and PR)

What is this?

Knip finds unused files, dependencies, and exports in your codebase.
This comment compares the PR branch against main to detect regressions.

Run yarn knip locally to see full details.

- Remove duplicate tests: consolidate alert card/badge/navigation into
  one test, removing 3 near-duplicate tests (5 → 2 alert tests)
- Add assertion to sessions 'open session details' test (Drawer visible)
- Remove all waitForLoadState('networkidle') anti-pattern, replace with
  explicit element/URL assertions
- Remove unused networkidle waits in dashboard, services, and search tests
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 26, 2026

E2E Test Results

All tests passed • 125 passed • 3 skipped • 1090s

Status Count
✅ Passed 125
❌ Failed 0
⚠️ Flaky 3
⏭️ Skipped 3

Tests ran across 4 shards in parallel.

View full report →

- SidePanelComponent.getTab() now scopes to tabsContainer instead of
  page, fixing strict mode violation when trace tab content has nested
  tab-parsed elements
- Increase side panel container timeout to 10s for trace tests since
  trace data loading can be slower in CI
The setChartType method uses getByTestId('chart-type-${type}') for all
DisplayType values but only line, table, and number had data-testid
attributes. Add the missing testids for pie, search, and markdown tabs.
The e2e-report job only checked for needs.e2e-tests.result == "failure"
but a cancelled shard reports "cancelled", silently passing the check.
Now also fails on cancelled shards.
…nel test

Extract raw page.getByTestId() calls from user-preferences.spec.ts into a
UserPreferencesPage page object to follow the established page object pattern.
Remove duplicate "should close side panel with Escape key from context" test
that was identical to "should close side panel with Escape key".
Merge 6 pairs of split spec files into single files per feature area:
- sessions + sessions-extended → sessions
- chart-explorer + chart-explorer-extended → chart-explorer
- services-dashboard + services-dashboard-extended → services-dashboard
- traces-extended + traces-workflow → traces
- alerts + alerts-management → alerts
- sources + sources-extended → sources

Fix page object pattern violations:
- Add getChartTypeTab() to ChartExplorerPage
- Add topEndpointsTable getter to ServicesDashboardPage
- Add getTabPanel() to SidePanelComponent
- Replace raw page.getByTestId() in side-panel.spec.ts

Add clarifying comments to dashboard.spec.ts and
dashboard-interactions.spec.ts explaining the split between
complex workflows vs simple CRUD operations.
Remove tests whose behavior is already exercised by existing tests:

Search:
- search-modes: "Lucene search with field syntax" (covered by search.spec "Different Query Types")
- search-modes: "switch to SQL mode" (subset of "preserve query mode")
- search-table: "switch between SQL and Lucene" (duplicate of search-modes)
- search-table: "display custom SELECT columns" (covered by search.spec histogram test)

Side panel:
- 4 individual tab navigation tests (overview, parsed, trace, context)
  all covered by search.spec "navigate side panel tabs" and traces.spec

Dashboard:
- dashboard-interactions: "duplicate a tile" (covered by dashboard.spec comprehensive workflow)
- dashboard-interactions: "open and close filters modal" (covered by dashboard.spec filters test)

Temporary dashboard:
- "convert to saved dashboard" (covered by dashboard.spec temporary banner test)

Services:
- "filter endpoints with Lucene" (same mechanism as existing Lucene filter test)
@teeohhem teeohhem changed the title test: expand E2E coverage with 45 new Playwright tests test: expand E2E coverage with 30 new Playwright tests Mar 26, 2026
Add a "Reviewing or Writing E2E Tests" section that requires mapping
existing coverage before adding new tests, to prevent redundant tests
from being introduced.
@teeohhem
Copy link
Copy Markdown
Contributor Author

@claude are you able to use your new pull request review feature on this PR?

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 27, 2026

Claude finished @teeohhem's task in 2m 12s —— View job


PR Review

  • Gather context
  • Read changed files
  • Review test quality and patterns
  • Check for fragile locators and anti-patterns
  • Verify page object usage and structure
  • Post comprehensive review

Overall this is solid work — the consolidation is good, the new page objects are clean, and all 125 tests passed in CI. A few issues worth addressing before merge:

Issues

1. createSavedSearchAlert helper unused in "verify ordering" test (alerts.spec.ts:162–228)

The bot already flagged this. The "should display multiple alerts and verify ordering" test duplicates ~40 lines of alert-creation setup inline instead of calling createSavedSearchAlert() twice. The helper exists precisely for this. Fix this →

2. Misleading test name (alerts.spec.ts:162)

"should display multiple alerts and verify ordering" but expect(await alertCards.count()).toBeGreaterThanOrEqual(2) only asserts both alerts are visible — it doesn't verify ordering. Rename to "should display multiple alerts" or add an ordering assertion (e.g., verify alert A appears before alert B in the DOM). Fix this →

3. Fragile locators in traces waterfall test (traces.spec.ts:97–123)

Two locators that will be brittle:

// Line 98 — too broad: matches any button with any text anywhere on the page
locator('[role="button"]').filter({ hasText: /\w+/ })

// Line 121 — depends on CSS module hash in class name, breaks if build config changes
locator('div[class*="HyperJson_key__"]').filter({ hasText: new RegExp(`^${attribute}$`) })

For the trace timeline buttons, add a data-testid="trace-waterfall-span" and use getByTestId(). For HyperJson_key__, add a data-testid="hyperjson-key" to the HyperJson component. Fix this →

4. Single-test files in search/ (search/search-modes.spec.ts, search/search-table.spec.ts, search/side-panel.spec.ts)

Each of these new files contains exactly 1 test. The added overhead (3 describe blocks, 3 beforeEach setups, 3 file paths to maintain) isn't worth isolating 3 tests. These belong in the existing search/search.spec.ts (for side panel and modes) and search/search-filters.spec.ts (for empty results), or at minimum collapsed into a single new search/search-ui.spec.ts. Fix this →

5. Missing waitForRowsToPopulate() before clickFirstRow() (search/side-panel.spec.ts:14)

await searchPage.table.clickFirstRow();  // no wait — first row may not exist yet

Other specs that open the side panel (e.g. search.spec.ts) call submitEmptySearch() first to ensure data is loaded. This test skips directly to clicking, which will be flaky on a cold start. Fix this →

6. Page object bypassed for data-testid lookup (search/search-table.spec.ts:20)

const noResults = searchPage.page.getByTestId('db-row-table-no-results');

Direct getByTestId in a spec file bypasses the page object layer. This belongs in SearchPage or its TableComponent. Fix this →

Minor

  • Stale AlertsPage.ts comment (AlertsPage.ts:4): "Currently not used until Alerts tests are implemented" — alerts tests are now implemented, remove the comment.

  • sessions.spec.ts:37locator('role=dialog') should be getByRole('dialog'). The locator() form with role selector is legacy Playwright syntax.

  • sessions.spec.ts:57–68 ("should filter sessions by selecting data source") is nearly identical to the test at line 15–25 ("should display multiple session cards") — both select the source and assert a card is visible. The distinction is thin enough to consider merging.

What's good

  • The consolidation of *-extended/*-workflow/*-management split files is clean and removes duplication without losing coverage.
  • UserPreferencesPage and AlertsPage page objects are well-structured with proper encapsulation.
  • data-testid additions to AlertsPage.tsx (alert-card-{id}, alert-link-{id}, alert-state-badge) are well-placed and scoped correctly.
  • SidePanelComponent.getTabPanel() is a clean addition.
  • CI shard cancellation fix in main.yml is correct.
  • The SQL query in chart-explorer.spec.ts tests a realistic workflow with proper parametrized timestamps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant