fix: mock oEmbed proxy in embed E2E test to prevent CI flakes#354
Merged
fix: mock oEmbed proxy in embed E2E test to prevent CI flakes#354
Conversation
The embed content test was hitting YouTube's oEmbed endpoint via the WordPress proxy, which can flake in CI due to rate-limiting or network issues. Use Playwright's page.route() to intercept the oEmbed proxy REST API request and return canned responses instead.
Parse the embed URL and match the hostname with a regex instead of using a substring check, which could match unintended URLs containing "youtube.com" in other positions.
kean
approved these changes
Mar 6, 2026
Contributor
kean
left a comment
There was a problem hiding this comment.
Nice, thanks for addressing it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Mocks the WordPress oEmbed proxy endpoint in the embed content E2E test using Playwright's
page.route().Why?
The embed test (
embed-content.spec.js) hits YouTube's oEmbed endpoint via the WordPress proxy during CI. If YouTube rate-limits or is unreachable, the test flakes. This was flagged in #329 (comment).How?
mockOembedProxy()helper that intercepts requests to the/oembed/1.0/proxyREST API endpoint using Playwright's route interception.mockOembedProxy(page)beforeeditor.setup(), so no external network calls are made.Testing Instructions
make wp-env-startto start the local WordPress environment.npx playwright test e2e/embed-content.spec.js.Accessibility Testing Instructions
N/A — no UI changes.
Screenshots or screencast
N/A — test infrastructure only.