Skip to content

e2e: Retry transient theme activation failures in pages spec#79171

Merged
jorgefilipecosta merged 1 commit into
trunkfrom
fix/flaky-pages-theme-activation
Jun 15, 2026
Merged

e2e: Retry transient theme activation failures in pages spec#79171
jorgefilipecosta merged 1 commit into
trunkfrom
fix/flaky-pages-theme-activation

Conversation

@jorgefilipecosta

Copy link
Copy Markdown
Member

What?

Fixes the flaky pages site-editor e2e test reported in #74483.

Why?

The test itself isn't the problem — it intermittently fails in its beforeAll/afterAll hooks while activating a theme:

Error: apiRequestContext.get: socket hang up
  - → GET http://localhost:8889/wp-admin/themes.php
  at RequestUtils.activateTheme (.../request-utils/themes.ts:13:36)
  at .../pages.spec.js:88:22

socket hang up is a Node ECONNRESET — the server occasionally drops the connection under CI load. activateTheme issues raw request.get() calls with no retry, so a single dropped connection fails the whole describe.

How?

Wrap the activateTheme() calls in the spec's hooks with a small local retry helper. It retries only on the transient socket hang up / ECONNRESET error (up to 3 attempts) and rethrows any other error immediately, so genuine failures (e.g. a missing theme) still surface right away.

The fix is intentionally scoped to this spec rather than the shared themes.ts util.

Testing Instructions

  • Run npm run test:e2e -- test/e2e/specs/site-editor/pages.spec.js and confirm it passes.
  • The transient failure is load-dependent and won't reliably reproduce locally; the change adds the retry path around the call that fails in CI.

Fixes #74483

The 'pages' site-editor spec intermittently fails in CI when its
beforeAll/afterAll hooks activate a theme, with an 'apiRequestContext.get:
socket hang up' (ECONNRESET) error. This is a transient connection drop, not
a real failure.

Wrap the activateTheme() calls in a small retry helper that retries only on
the socket hang up / ECONNRESET error and rethrows any other error
immediately, so genuine failures still surface.

Fixes #74483
@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: jorgefilipecosta <[email protected]>
Co-authored-by: Mamaduka <[email protected]>

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

@github-actions

Copy link
Copy Markdown

Size Change: 0 B

Total Size: 8.59 MB

compressed-size-action

@github-actions

Copy link
Copy Markdown

Flaky tests detected in cf49c0d.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/27464950672
📝 Reported issues:

@jorgefilipecosta jorgefilipecosta merged commit a0c4ebe into trunk Jun 15, 2026
41 checks passed
@jorgefilipecosta jorgefilipecosta deleted the fix/flaky-pages-theme-activation branch June 15, 2026 09:20
@github-actions github-actions Bot added this to the Gutenberg 23.5 milestone Jun 15, 2026
@bgrgicak bgrgicak added [Type] Flaky Test Auto-generated flaky test report issue [Type] Code Quality Issues or PRs that relate to code quality labels Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Code Quality Issues or PRs that relate to code quality [Type] Flaky Test Auto-generated flaky test report issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Flaky Test] should allow setting page order to zero and negative values

2 participants