Skip to content

test(charts): fix flaky ORDER BY chart e2e by dismissing autocomplete#2639

Open
jordan-simonovski wants to merge 2 commits into
mainfrom
jordansimonovski/fix-chart-editor-orderby-flake
Open

test(charts): fix flaky ORDER BY chart e2e by dismissing autocomplete#2639
jordan-simonovski wants to merge 2 commits into
mainfrom
jordansimonovski/fix-chart-editor-orderby-flake

Conversation

@jordan-simonovski

Copy link
Copy Markdown
Contributor

Why

The should apply a custom ORDER BY on a categorical bar chart e2e test (chart-explorer.spec.ts) is intermittently failing in CI with:

TimeoutError: locator.click: Timeout 20000ms exceeded.
Call log:
  - waiting for getByTestId('order-by-input').locator('.cm-content')
   at components/ChartEditorComponent.ts:83  (ChartEditorComponent.setOrderBy)

Root cause: setGroupBy types into the "SQL Columns" CodeMirror editor but never dismisses the resulting autocomplete dropdown, whereas setOrderBy presses Escape at the end. In the failing sequence setChartType(Bar) → setGroupBy('ServiceName') → setOrderBy(...), the group-by autocomplete popup is still open and overlays the ORDER BY editor. Playwright's click() then waits on actionability (element must receive pointer events) and times out after 20s. On retry the timing differs and it passes — a classic overlay/timing flake.

What

  • setGroupBy now dismisses its autocomplete with Escape after typing, mirroring the convention already used in setOrderBy.
  • setOrderBy defensively dismisses any lingering popup before its click, so the exact failing call site is robust regardless of the preceding interaction.

Both are one-line additions that match existing patterns in the same file.

Notes

  • Test-only change to a shared page-object component; no runtime/user-facing impact, so no changeset.
  • This helper is also consumed downstream (e.g. hyperdx-ee), so the fix flows there on the next upstream merge.
  • Verified: prettier --check and eslint pass on the changed file. The full e2e wasn't run locally (the flake is intermittent and needs the seeded full stack); the fix is grounded in the CI call log + the setGroupBy/setOrderBy asymmetry.

The "custom ORDER BY on a categorical bar chart" e2e test intermittently
failed with `locator.click: Timeout 20000ms` on the ORDER BY editor
(ChartEditorComponent.setOrderBy). Root cause: setGroupBy types into the
"SQL Columns" CodeMirror editor but never dismisses the autocomplete
dropdown, unlike setOrderBy which presses Escape. The lingering group-by
autocomplete overlays the ORDER BY editor, so the subsequent click fails
Playwright's actionability check until it times out; on retry the timing
differs and it passes — a classic flake.

- setGroupBy now dismisses its autocomplete (Escape), mirroring setOrderBy.
- setOrderBy defensively dismisses any lingering popup before clicking, so
  the failing call site is robust regardless of the preceding interaction.

Test-only change; no changeset (no user-facing package impact).
@changeset-bot

changeset-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 40d6b56

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

@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
hyperdx-oss Ready Ready Preview, Comment Jul 14, 2026 7:25pm
hyperdx-storybook Ready Ready Preview, Comment Jul 14, 2026 7:25pm

Request Review

@github-actions github-actions Bot added the review/tier-2 Low risk — AI review + quick human skim label Jul 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔵 Tier 2 — Low Risk

Small, isolated change with no API route or data model modifications.

Why this tier:

  • Standard feature/fix — introduces new logic or modifies core functionality

Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns.
SLA: Resolve within 4 business hours.

Stats
  • Production files changed: 0
  • Production lines changed: 0 (+ 7 in test files, excluded from tier calculation)
  • Branch: jordansimonovski/fix-chart-editor-orderby-flake
  • Author: jordan-simonovski

To override this classification, remove the review/tier-2 label and apply a different review/tier-* label. Manual overrides are preserved on subsequent pushes.

@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR stabilizes chart editor end-to-end tests by dismissing autocomplete overlays.

  • Closes autocomplete after entering a group-by expression.
  • Clears lingering autocomplete before clicking the ORDER BY editor.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
packages/app/tests/e2e/components/ChartEditorComponent.ts Dismisses CodeMirror autocomplete after group-by input and before interacting with the ORDER BY editor.

Reviews (2): Last reviewed commit: "Merge branch 'main' into jordansimonovsk..." | Re-trigger Greptile

@github-actions

Copy link
Copy Markdown
Contributor

Deep Review

Test-only change to a shared Playwright page object (ChartEditorComponent): adds keyboard.press('Escape') after typing in setGroupBy and defensively before the click in setOrderBy, to dismiss a lingering CodeMirror autocomplete that overlays the next input and fails the click's actionability check.

✅ No critical issues found.

🟡 P2 -- recommended

  • packages/app/tests/e2e/components/ChartEditorComponent.ts:74 -- The new unscoped keyboard.press('Escape') in setGroupBy is only absorbed by CodeMirror while its completion tooltip is actually open; when the popup is closed at that instant the key bubbles to the enclosing tile-editor Mantine Modal (EditTileModal, closeOnEscape defaults true), closing it or raising the unsaved-changes prompt and breaking later steps in the tile-editor specs, so the fix can trade one flake for the inverse one in the modal caller path.
    • Fix: Gate the dismissal on the autocomplete being present (e.g. press Escape only when .cm-tooltip-autocomplete is visible) and await its detachment, instead of an unconditional keypress inside the modal.
    • correctness, testing, julik-frontend-races
🔵 P3 nitpicks (1)
  • packages/app/tests/e2e/components/ChartEditorComponent.ts:89 -- The blind Escape narrows but does not close the race: it does not wait for the autocomplete listbox to detach before the following editor.click(), so a slow-to-animate popup can still intercept the pointer event.
    • Fix: Await .cm-tooltip-autocomplete reaching the hidden state after pressing Escape (also applies to setGroupBy:74) rather than relying on timing.

Reviewers (8): correctness, testing, maintainability, project-standards, kieran-typescript, julik-frontend-races, agent-native, learnings-researcher.

Testing gaps:

  • No assertion that the tile-editor modal stays open immediately after setGroupBy; the popup-not-open branch would surface only as a downstream timeout, not a clear failure.
  • No assertion that .cm-tooltip-autocomplete is hidden/detached after the Escape — the exact condition the fix depends on.

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

E2E Test Results

All tests passed • 118 passed • 2 skipped • 714s

Status Count
✅ Passed 118
❌ Failed 0
⚠️ Flaky 0
⏭️ Skipped 2

Tests ran across 4 shards in parallel.

View full report →

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

Labels

automerge review/tier-2 Low risk — AI review + quick human skim

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants