Skip to content

Flaky WebKit collab E2E tests in playground (sleep(50) too short) #8112

@screenfluent

Description

@screenfluent

Hi! I'm seeing intermittent failures in the Lexical playground collab E2E suite on WebKit that usually pass on re-run. This looks like timing/synchronization rather than a real regression.

I noticed this while upgrading svelte-lexical (a Svelte port of the playground) through the 0.33 to 0.40 chain. The webkit collab job failed sporadically and passed on re-run.

In packages/lexical-playground/tests/e2e/Collaboration.spec.mjs there are a couple of places that use very short fixed sleeps, e.g. await sleep(50) around operations like Undo / delete + cross-frame actions.

Examples:

  • Test: Remove dangling text from YJS when there is no preceding text node (there is a sleep(50) right before clicking Undo)
  • Test: $handleNormalizationMergeConflicts handles nodes that have been reparented (there is a sleep(50) between delete in left frame and delete in right frame)

Hypothesis: 50ms is sometimes not enough for Yjs merge / editor state propagation on CI WebKit, so the next action/assertion happens too early.

Suggested fix: Replace the fixed sleep(50) with an explicit wait for the expected state before proceeding. For example, wait via expect(async () => { ...assertHTML/assertSelection... }).toPass(...) or wait for a UI/editor condition that implies the merge/normalization has completed. If an explicit condition is hard to define, increase the sleep conservatively, but I think explicit waits would be more stable long-term.

If you want, I can open a PR with a minimal change (only replacing those sleeps with explicit waits), keeping the rest of the test logic intact.

Metadata

Metadata

Assignees

No one assigned

    Labels

    infra-bugAn issue that doesn't affect external users

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions