Skip to content

Repair wp/5.8 branch Actions: Fix theme-activation navigation race in activate-theme.js - #545

Closed
desrosj wants to merge 1 commit into
fix-actions-5.8/ignore-browserslist-old-datafrom
fix-actions-5.8/fix-activate-theme-navigation-race
Closed

desrosj wants to merge 1 commit into
fix-actions-5.8/ignore-browserslist-old-datafrom
fix-actions-5.8/fix-activate-theme-navigation-race

Conversation

@desrosj

@desrosj desrosj commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

What?

Fixes a navigation race in activateTheme() (packages/e2e-test-utils/src/activate-theme.js), which the Puppeteer end-to-end tests use, including the shared setup that activates a theme before each test file.

  • The click on the "Activate" link is wrapped in Promise.all() with page.waitForNavigation( { waitUntil: 'networkidle0' } ).
  • The waitForSelector() that checks the theme is active gets an explicit 45-second timeout.

Why?

"Activate" is a plain link: the click switches the theme on the server, then redirects back to themes.php. Without waiting for that navigation, one waitForSelector() with Puppeteer's default 30 seconds has to cover the whole switch, redirect and reload, and can time out:

TimeoutError: waiting for selector `div[data-slug="..."].active` failed: timeout 30000ms exceeded

This failed CI repeatedly on wp/6.5 and wp/6.4 (on wp/6.4, 20 of 114 failed end-to-end runs without the fix, 0 of 49 with it), which are fixed in WordPress#83002 and WordPress#83686.

It hasn't failed on this branch: none of the 20 most recent failed end-to-end runs on this stack hit it. It is included so the helper is the same on every branch, and a future failure here doesn't have to be investigated again.

How?

The code is the same as on wp/6.5 and wp/6.4, including waitUntil: 'networkidle0' (this branch's login-user.js uses a plain page.waitForNavigation(), but matching the other branches keeps the helper identical). The early return when the theme is already active is unchanged.

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 self-assigned this Sep 28, 2026
@desrosj
desrosj changed the base branch from wp/5.8 to fix-actions-5.8/ignore-browserslist-old-data September 28, 2026 14:41
@desrosj
desrosj added this pull request to stack #546 September 28, 2026 14:41
@desrosj
desrosj removed this pull request from stack #546 September 28, 2026 19:14
@desrosj
desrosj changed the base branch from fix-actions-5.8/ignore-browserslist-old-data to wp/5.8 September 28, 2026 19:15
@desrosj
desrosj force-pushed the fix-actions-5.8/fix-activate-theme-navigation-race branch from e31fcfd to 1c64e64 Compare September 28, 2026 19:15
@desrosj
desrosj changed the base branch from wp/5.8 to fix-actions-5.8/ignore-browserslist-old-data September 28, 2026 19:16
@desrosj
desrosj added this pull request to stack #571 September 28, 2026 19:16
@desrosj
desrosj force-pushed the fix-actions-5.8/fix-activate-theme-navigation-race branch from 1c64e64 to 0a3b4aa Compare October 5, 2026 20:47
@desrosj
desrosj removed this pull request from stack #571 October 5, 2026 20:48
@desrosj
desrosj added this pull request to stack #615 October 5, 2026 20:48
@desrosj
desrosj force-pushed the fix-actions-5.8/fix-activate-theme-navigation-race branch from 0a3b4aa to fe1b024 Compare October 6, 2026 17:56
@desrosj
desrosj removed this pull request from stack #615 October 7, 2026 01:12
@desrosj
desrosj added this pull request to stack #647 October 7, 2026 01:12
@desrosj
desrosj removed this pull request from stack #647 October 7, 2026 18:05
@desrosj
desrosj changed the base branch from fix-actions-5.8/ignore-browserslist-old-data to wp/5.8 October 7, 2026 18:06
@desrosj
desrosj force-pushed the fix-actions-5.8/fix-activate-theme-navigation-race branch from fe1b024 to d4d3407 Compare October 7, 2026 18:07
@desrosj
desrosj changed the base branch from wp/5.8 to fix-actions-5.8/ignore-browserslist-old-data October 7, 2026 18:09
@desrosj
desrosj added this pull request to stack #671 October 7, 2026 18:09
WordPress core's "Activate" link on wp-admin/themes.php is a plain
<a href>: clicking it causes a real, full-page, server-driven navigation
(switch_theme(), then a redirect back to themes.php). activateTheme()
clicked that link without waiting for the navigation, so the single,
bare 30s page.waitForSelector() immediately afterward had to cover the
entire click -> switch_theme() -> redirect -> admin page reload chain
by itself.

Wrap the click in Promise.all() with page.waitForNavigation( {
waitUntil: 'networkidle0' } ), so the final page.waitForSelector() only
runs once the navigation has finished, and give that wait an explicit
45s timeout instead of Puppeteer's 30s default, as headroom for the
page's own post-navigation render.

The "no activate button found" branch (the theme is already active)
returns before the click and is unchanged.

This is the same change as the equivalent fixes on wp/6.5
(WordPress#83002) and wp/6.4 (#328), where
this race failed the Puppeteer suite in CI. It has not been seen to fail
on this branch; it is included so the helper behaves the same across
branches and a future failure here does not need to be rediscovered.
@desrosj
desrosj removed this pull request from stack #671 October 8, 2026 19:34
@desrosj
desrosj force-pushed the fix-actions-5.8/fix-activate-theme-navigation-race branch from d4d3407 to 7b07190 Compare October 8, 2026 19:34
@desrosj
desrosj added this pull request to stack #694 October 8, 2026 19:35
@desrosj
desrosj removed this pull request from stack #694 October 9, 2026 13:13
@desrosj
desrosj added this pull request to stack #702 October 9, 2026 13:14
@desrosj
desrosj removed this pull request from stack #702 October 9, 2026 13:34
@desrosj
desrosj added this pull request to stack #705 October 9, 2026 13:34
@desrosj
desrosj removed this pull request from stack #705 October 9, 2026 14:01
@desrosj
desrosj added this pull request to stack #708 October 9, 2026 14:02
@desrosj
desrosj removed this pull request from stack #708 October 9, 2026 14:13
@desrosj
desrosj added this pull request to stack #712 October 9, 2026 14:13
@desrosj
desrosj marked this pull request as ready for review October 9, 2026 17:43
@github-actions

github-actions Bot commented Oct 9, 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. You can also manually ask me to refresh this list by adding the props-bot label.

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>

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

@desrosj

desrosj commented Oct 9, 2026

Copy link
Copy Markdown
Owner Author

Moved to WordPress#84444.

@desrosj desrosj closed this Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant