Skip to content

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

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

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

Conversation

@desrosj

@desrosj desrosj commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

What?

Fixes a theme-activation navigation race in packages/e2e-test-utils/src/activate-theme.js's activateTheme() helper, used by the Puppeteer end-to-end suite (including the shared config/setup-test-framework.js setup, which activates a theme before each spec file).

activateTheme() clicks the "Activate" link on wp-admin/themes.php, then immediately calls page.waitForSelector() with Puppeteer's default 30s timeout to confirm the theme became active. This PR wraps the click in Promise.all() with page.waitForNavigation( { waitUntil: 'networkidle0' } ), and gives the final waitForSelector() an explicit 45s timeout.

Why?

The "Activate" link is a plain link: clicking it triggers a real, full-page navigation (switch_theme() on the server, then a redirect back to themes.php). Without waiting for that navigation, the single waitForSelector() that follows has to cover the whole click → theme switch → redirect → page reload chain by itself, which can time out with:

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

On wp/6.5 and wp/6.4 this race failed the Puppeteer suite in CI repeatedly (on wp/6.4, 20 of 114 failed end-to-end runs without the fix hit it; 0 of 49 with it), and it is fixed there by WordPress#83002 and WordPress#83686. This branch has the same race in an older form of the helper, but it has not been seen to fail here: none of the 20 most recent failed end-to-end runs on this branch's stack hit it. It is included proactively, so the helper behaves the same across branches and a future failure here does not have to be investigated from scratch. (An earlier review on 2026-09-13 decided not to include it on the branches where it had not failed; that decision has been reversed for consistency.)

The code is the same as on wp/6.5 and wp/6.4, including waitUntil: 'networkidle0'. This branch's login-user.js waits for its own submit navigation with a plain page.waitForNavigation(); the same form as the other branches' fix is used here so the helper is identical everywhere. The "theme is already active" early return 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.7 to fix-actions-5.7/ignore-browserslist-old-data September 28, 2026 14:43
@desrosj
desrosj added this pull request to stack #548 September 28, 2026 14:43
@desrosj
desrosj removed this pull request from stack #548 September 28, 2026 17:15
@desrosj
desrosj changed the base branch from fix-actions-5.7/ignore-browserslist-old-data to wp/5.7 September 28, 2026 17:16
@desrosj
desrosj force-pushed the fix-actions-5.7/fix-activate-theme-navigation-race branch from 5451c3b to 7e7ce58 Compare September 28, 2026 17:16
@desrosj
desrosj changed the base branch from wp/5.7 to fix-actions-5.7/ignore-browserslist-old-data September 28, 2026 17:17
@desrosj
desrosj added this pull request to stack #556 September 28, 2026 17:17
@desrosj
desrosj force-pushed the fix-actions-5.7/fix-activate-theme-navigation-race branch from 7e7ce58 to 085b686 Compare October 5, 2026 20:47
@desrosj
desrosj removed this pull request from stack #556 October 5, 2026 20:48
@desrosj
desrosj added this pull request to stack #614 October 5, 2026 20:48
@desrosj
desrosj force-pushed the fix-actions-5.7/fix-activate-theme-navigation-race branch from 085b686 to 34bd436 Compare October 6, 2026 17:57
@desrosj
desrosj force-pushed the fix-actions-5.7/fix-activate-theme-navigation-race branch from 34bd436 to 3551d65 Compare October 6, 2026 18:22
@desrosj
desrosj removed this pull request from stack #614 October 7, 2026 01:24
@desrosj
desrosj added this pull request to stack #649 October 7, 2026 01:24
@desrosj
desrosj force-pushed the fix-actions-5.7/fix-activate-theme-navigation-race branch from 3551d65 to fb48249 Compare October 7, 2026 13:02
@desrosj
desrosj removed this pull request from stack #649 October 7, 2026 18:05
@desrosj
desrosj changed the base branch from fix-actions-5.7/ignore-browserslist-old-data to wp/5.7 October 7, 2026 18:06
@desrosj
desrosj force-pushed the fix-actions-5.7/fix-activate-theme-navigation-race branch from fb48249 to ed9ec89 Compare October 7, 2026 18:07
@desrosj
desrosj changed the base branch from wp/5.7 to fix-actions-5.7/ignore-browserslist-old-data October 7, 2026 18:09
@desrosj
desrosj added this pull request to stack #672 October 7, 2026 18:09
@desrosj
desrosj force-pushed the fix-actions-5.7/fix-activate-theme-navigation-race branch from ed9ec89 to 14ddaec Compare October 8, 2026 17:04
@desrosj
desrosj removed this pull request from stack #672 October 8, 2026 17:58
@desrosj
desrosj added this pull request to stack #688 October 8, 2026 17:59
@desrosj
desrosj removed this pull request from stack #688 October 8, 2026 19:33
@desrosj
desrosj force-pushed the fix-actions-5.7/fix-activate-theme-navigation-race branch from 14ddaec to 2e84bdb Compare October 8, 2026 19:33
@desrosj
desrosj added this pull request to stack #693 October 8, 2026 19:34
@desrosj
desrosj removed this pull request from stack #693 October 9, 2026 14:02
@desrosj
desrosj added this pull request to stack #710 October 9, 2026 14:03
@desrosj
desrosj removed this pull request from stack #710 October 9, 2026 14:46
@desrosj
desrosj added this pull request to stack #714 October 9, 2026 14:48
@desrosj
desrosj removed this pull request from stack #714 October 9, 2026 15:13
@desrosj
desrosj added this pull request to stack #717 October 9, 2026 15:13
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 #717 October 9, 2026 19:50
@desrosj
desrosj changed the base branch from fix-actions-5.7/ignore-browserslist-old-data to wp/5.7 October 9, 2026 19:51
@desrosj
desrosj force-pushed the fix-actions-5.7/fix-activate-theme-navigation-race branch from 2e84bdb to 939c701 Compare October 9, 2026 19:53
@desrosj
desrosj changed the base branch from wp/5.7 to fix-actions-5.7/ignore-browserslist-old-data October 9, 2026 19:55
@desrosj
desrosj added this pull request to stack #719 October 9, 2026 19:55
@desrosj
desrosj marked this pull request as ready for review October 15, 2026 02:11
@github-actions

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 15, 2026

Copy link
Copy Markdown
Owner Author

Moved to WordPress#84780.

@desrosj desrosj closed this Oct 15, 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