Skip to content

Commit

Permalink
Fix intermittent embeds failure (#31860)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed May 15, 2021
1 parent 6cc1016 commit b1f0b3d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ https://www.youtube.com/watch?v=lXMskKTw3Bc
</div></figure>
<!-- /wp:embed -->
<!-- wp:embed {\\"url\\":\\"https://cloudup.com/cQFlxqtY4ob\\"} -->
<figure class=\\"wp-block-embed\\"><div class=\\"wp-block-embed__wrapper\\">
<!-- wp:embed {\\"url\\":\\"https://cloudup.com/cQFlxqtY4ob\\",\\"type\\":\\"photo\\",\\"providerNameSlug\\":\\"cloudup\\",\\"responsive\\":true} -->
<figure class=\\"wp-block-embed is-type-photo is-provider-cloudup wp-block-embed-cloudup\\"><div class=\\"wp-block-embed__wrapper\\">
https://cloudup.com/cQFlxqtY4ob
</div></figure>
<!-- /wp:embed -->"
Expand Down
15 changes: 14 additions & 1 deletion packages/e2e-tests/specs/editor/various/embedding.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ const MOCK_EMBED_RICH_SUCCESS_RESPONSE = {
version: '1.0',
};

const MOCK_EMBED_PHOTO_SUCCESS_RESPONSE = {
url: 'https://cloudup.com/cQFlxqtY4ob',
html: '<p>Mock success response.</p>',
type: 'photo',
provider_name: 'Cloudup',
provider_url: 'https://cloudup.com',
version: '1.0',
};

const MOCK_EMBED_VIDEO_SUCCESS_RESPONSE = {
url: 'https://www.youtube.com/watch?v=lXMskKTw3Bc',
html: '<iframe width="16" height="9"></iframe>',
Expand Down Expand Up @@ -123,7 +132,7 @@ const MOCK_RESPONSES = [
},
{
match: createEmbeddingMatcher( 'https://cloudup.com/cQFlxqtY4ob' ),
onRequestMatch: createJSONResponse( MOCK_EMBED_RICH_SUCCESS_RESPONSE ),
onRequestMatch: createJSONResponse( MOCK_EMBED_PHOTO_SUCCESS_RESPONSE ),
},
{
match: createEmbeddingMatcher( 'https://twitter.com/notnownikki' ),
Expand Down Expand Up @@ -208,6 +217,10 @@ describe( 'Embedding content', () => {

// Photo content. Should render valid figure element.
await insertEmbed( 'https://cloudup.com/cQFlxqtY4ob' );
await page.waitForSelector(
'iframe[title="Embedded content from cloudup"'
);

expect( await getEditedPostContent() ).toMatchSnapshot();
} );

Expand Down

0 comments on commit b1f0b3d

Please sign in to comment.