-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reset embed mocks on every request, stop request to instagram #15046
Conversation
// Respond to the instagram URL with a non-image response, doesn't matter what it is, | ||
// just make sure the image errors. | ||
{ | ||
match: createURLMatcher( 'https://www.instagram.com/p/Bvl97o2AK6x/' ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove the other matcher?
gutenberg/packages/e2e-tests/specs/embedding.test.js
Lines 105 to 106 in 82a5ecc
match: createEmbeddingMatcher( 'https://www.instagram.com/p/Bvl97o2AK6x/' ), | |
onRequestMatch: createJSONResponse( MOCK_EMBED_IMAGE_SUCCESS_RESPONSE ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't seem to be used at the moment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, one is to match the embed preview request for the URL and one is to match the URL itself. The image block creates a new image, and sets the URL as the source. If the image errors, it replaces itself with an appropriate embed block if there is one. So we need to mock the instagram URL, and the embed proxy call that generates the preview.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, it makes sense now :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks for working on this fix. Let's get this in and see if it resolves the issue I have in #15018 :)
I'm not positive that it's related to the changes here, though it appears relevant: In #15049 I've encountered an intermittent test failure from the
|
Got the same error in another PR @aduth I think we should start disabling all intermittent failures and create issues about these tests. |
…rnmobile/887-History-stack-is-not-empty-on-a-fresh-start-of-the-editor * 'master' of https://github.com/WordPress/gutenberg: Reset embed mocks on every request, stop request to instagram (#15046) Refactor core blocks to have save and transforms in their own files (part 2) (#14899) Fix pullquote import (#15036) Refactor core blocks to have save and transforms in their own files (part 4) (#14903) Refactor core blocks to have save and transforms in their own files (part 3) (#14902) Refactor core blocks to have deprecated extracted to their ownf files (p.1) (#14979) Test transform from media to embed blocks (#13997) If a more recent revision/autosave exists, store its state on editor setup (#7945) chore(release): publish
Yes, the timeout failures aren't caused by the changes here, they're uncovered by the changes here. Previously the tests were failing most of the time with console errors due to the mocks not being applied. I've seen these happen once running the tests locally, I'm not sure what causes it, but the end result is that the blocks aren't getting replaced with embed blocks when they should be. The failure I saw locally was the video block turned into a video player, trying to play a youtube URL. I agree with disabling the tests, and I can see if I can track down what's causing it, although I doubt it's related to the embed blocks, as the problem is we don't get on to the stage where the embed blocks appear. |
Description
After the retry test, mocks were not reset and so actual network requests happened. This made the tests unreliable, so this PR makes sure the mocks are reset for every test, and the instagram request is also mocked.
Types of changes
Bug fix
Checklist: