Skip to content

Repair wp/5.4 branch Actions: Improve reliability of the TypeWriter E2E test - #85620

Merged
desrosj merged 1 commit into
fix-actions-5.4/fix-flaky-metabox-tinymce-init-racefrom
fix-actions-5.4/fix-flaky-typewriter-caret-test
Oct 29, 2026
Merged

desrosj merged 1 commit into
fix-actions-5.4/fix-flaky-metabox-tinymce-init-racefrom
fix-actions-5.4/fix-flaky-typewriter-caret-test

Conversation

@desrosj

@desrosj desrosj commented Oct 26, 2026

Copy link
Copy Markdown
Member

Part of #83419.

What?

Makes the TypeWriter E2E test's should maintain caret position after scroll case wait for the Typewriter to catch up with the scroll before reading the caret position, and wait for the Typewriter to scroll after pressing Enter. No change to what the test checks.

Why?

This is a preventive fix: the test has not failed on the wp/5.4 or wp/5.3 stacks (it passed in every failed e2e run on them that included it). packages/e2e-tests/specs/editor/various/typewriter.test.js sets the scroll container's scrollTop, reads the caret position straight away and presses Enter. The scroll event only fires on the next animation frame, and the Typewriter recalculates its saved caret rectangle in an animation frame of its own after that (onScrollResize()), so the test can read the position, and press Enter, before the Typewriter has caught up. The same case failed this way on wp/5.7 (job), and the wp/5.7–wp/5.5 stacks now carry a fix.

How?

Ports the waits from 9c242ee (#31472, "Stabilise typewriter e2e test"):

  • Before reading the initial caret position, wait for the Typewriter to recalculate the caret rectangle.
  • After pressing Enter, wait for the Typewriter to scroll the container down past the initial position.

It differs from the upstream version, and from the wp/5.7–wp/5.5 fixes, in one way: those also port d372c85 (#28376), which scrolls with page.mouse.wheel(). This branch's Puppeteer (2.0.0) has no Mouse.wheel() (it was added in Puppeteer 5.4), so the test keeps scrolling by setting scrollTop. A programmatic scroll's event fires one frame later than a wheel scroll's, so the test waits two animation frames instead of one. The existing 1px BUFFER assertion is kept.

This sits on top of the meta box TinyMCE fix, as on wp/5.5. wp/5.3 gets the same change; wp/5.2 and wp/5.1 do not have this test.

Testing Instructions

The end-to-end tests should pass on this PR. The test hasn't failed on this branch yet, so a run mainly shows the change is safe.

Use of AI Tools

This PR was created by Claude Code under my supervision. All code should be treated as AI-produced and not yet reviewed by a human until this PR is marked Ready for Review.

🤖 Generated with Claude Code

@desrosj desrosj added [Type] Build Tooling Issues or PRs related to build tooling [Package] E2E Tests /packages/e2e-tests labels Oct 26, 2026
@desrosj desrosj self-assigned this Oct 26, 2026
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1332ce01-fe9d-4fce-9949-d919b2b851c4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: desrosj <desrosj@git.wordpress.org>
Co-authored-by: andrewserong <andrewserong@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@andrewserong andrewserong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and waiting two frames sounds reasonable 👍

@desrosj
desrosj force-pushed the fix-actions-5.4/fix-flaky-typewriter-caret-test branch from 34c0a0d to 911d3ef Compare October 29, 2026 12:48
@desrosj
desrosj merged commit 7fb70cf into wp/5.4 Oct 29, 2026
24 of 37 checks passed
@desrosj
desrosj deleted the fix-actions-5.4/fix-flaky-typewriter-caret-test branch October 29, 2026 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] E2E Tests /packages/e2e-tests [Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants