Skip to content
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

Fix intermittent embeds failure #31860

Merged
merged 1 commit into from
May 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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