Skip to content

[lexical-playground] Bug Fix: Fix unawaited playwright promises in e2e test suite - #8521

Merged
etrepum merged 9 commits into
meta:mainfrom
etrepum:claude/fix-playwright-pause-debug-jcIeH
May 18, 2026
Merged

etrepum merged 9 commits into
meta:mainfrom
etrepum:claude/fix-playwright-pause-debug-jcIeH

Conversation

@etrepum

@etrepum etrepum commented May 15, 2026

Copy link
Copy Markdown
Collaborator

Description

Unawaited promises in playwright cause the --debug behavior to not work in very surprising and hard to debug ways, in particular await page.pause() doesn't work.

Test plan

Try running a test with await pause.pause() under --debug and make sure it actually pauses.

claude added 5 commits May 15, 2026 18:11
Logs Node inspector URL, env vars, and timing of two consecutive
page.pause() calls to /tmp/lexical-pause-probe.log. If either pause
returns in under 200ms, that confirms the debugger isn't engaging.

Run:
  pnpm exec playwright test --debug --project=chromium \
    packages/lexical-playground/__tests__/regression/temp-pause-probe.spec.mjs

Click Resume in the Inspector after each pause, then share the log.
…ge.pause() works under --debug

initialize() was firing setViewportSize without awaiting it. Under
--debug, Playwright's Debugger pauses on the first action with
pause:true metainfo (which setViewportSize has) and stores it in
_pausedCall. Because the test code never awaited the call, _pausedCall
stayed set indefinitely, and every subsequent page.pause() hit the
"already paused, bail" early-return in Debugger._pause and resolved
immediately. Awaiting the call lets the initial pause complete normally
before the test reaches its own page.pause().

Also remove the two temp probe spec files that were used to bisect this.
…lize()

The per-test page.setViewportSize() in initialize() was the source of
the page.pause() bug under --debug (the unawaited version poisoned
Debugger._pausedCall). Setting viewport at the playwright config use
level applies it at context creation, so we no longer need to call
setViewportSize per test. IS_COLLAB still determines width since it's
fixed per run via E2E_EDITOR_MODE.
…in tests

Un-awaited page.setViewportSize calls have pause:true metainfo, so
under --debug they fire the channel call, hit Debugger._pause, and
leave Debugger._pausedCall set indefinitely. That causes every later
page.pause() to bail at the "already paused" early-return in _pause.
Awaiting the call lets the pause complete normally before the test
proceeds. Affects Tables.spec and one regression spec.
@vercel

vercel Bot commented May 15, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment May 15, 2026 8:11pm
lexical-playground Ready Ready Preview, Comment May 15, 2026 8:11pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 15, 2026
@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label May 15, 2026
claude added 2 commits May 15, 2026 19:59
… calls

An un-awaited Playwright call with pause:true metainfo (setViewportSize,
goto, click, keyboard.*, mouse.*, etc.) leaves Debugger._pausedCall set
indefinitely under --debug, which silently breaks page.pause(). Adds a
no-restricted-syntax rule scoped to lexical-playground __tests__ that
catches the common offenders by AST so we can't reintroduce the bug.
Retrying after a pause during interactive debugging is just confusing.
--debug sets PWDEBUG=1 before the config loads, so we read it here to
short-circuit retries to 0.
… per-test setViewportSize

The 23 Tables/regression calls to setViewportSize({width: 3000}) were
all gated on isCollab with the same "contextual menu positioning" note.
Bumping the collab default viewport to 3000 in playwright.config.mjs
covers all of them. Also drops the redundant setViewportSize in
Images.spec ("Select image, then select text") since its height matched
the default and 1250/3000 already give enough horizontal room.

The only remaining setViewportSize is in AutoScroll's "Pressing Enter
scrolls new caret above the on-screen keyboard" test, which needs a
600x400 mobile-shaped viewport that can't come from the default.
@etrepum etrepum changed the title [e2e-tests] Bug Fix: Fix unawaited playwright promises in e2e test suite [lexical-playground] Bug Fix: Fix unawaited playwright promises in e2e test suite May 15, 2026
@etrepum
etrepum added this pull request to the merge queue May 18, 2026
Merged via the queue into meta:main with commit 53d46bf May 18, 2026
40 checks passed
@etrepum
etrepum deleted the claude/fix-playwright-pause-debug-jcIeH branch May 19, 2026 17:54
@etrepum etrepum mentioned this pull request May 28, 2026

This branch was successfully deployed

2 active deployments
Preview – lexical-playground — cc62e313 Deployed May 15, 2026 by vercel[bot]
Preview – lexical — cc62e313 Deployed May 15, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants