Skip to content

Flaky desktop e2e: code-scroll selection drag intermittently selects nothing #4633

Description

@orangeCatDeveloper

What happened

e2e/code-scroll.spec.ts › a one-line Markdown code block exposes native and selection horizontal scrolling fails intermittently in CI and on cold local runs:

Error: expect(received).toBeGreaterThan(expected)
Expected: > 10
Received:   0

Call Log:
- Timeout 10000ms exceeded while waiting on the predicate

Seen on an unrelated PR's run (https://github.com/apache/maka/actions/runs/33726683004/job/100557131290); locally the first run after a fresh build fails the same way and immediate reruns pass.

Root cause

The drag anchors on a guessed container offset (codeBox.x + 24) and immediately drags out of the viewport. Cold-start font loading reflows the code line after the box was measured, so mousedown can land outside the glyphs: no selection anchor forms, the long drag auto-scrolls (the scroll assertions pass) while the selection stays empty, and the test fails at the end with an opaque zero. Moving the anchor to x + 2 (into the leading whitespace) reproduces the failure 4/5 runs, confirming the anchor-position mechanism.

Reproduction

  1. Fresh npm run build:with-deps in apps/desktop.
  2. npx playwright test --config e2e/playwright.config.ts e2e/code-scroll.spec.ts — first run fails, reruns pass.
  3. Deterministic: change the mousedown x-offset to codeBox.x + 2 and the selection assertions fail almost every run.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions