Skip to content

Commit

Permalink
Try to fix flaky iframe test (#34776)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix authored Sep 13, 2021
1 parent 0a362fb commit bceee46
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions packages/e2e-tests/specs/editor/plugins/iframed-block.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ describe( 'changing image size', () => {

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

await page.waitForSelector( '.wp-block-test-iframed-block' );
const text = await page.evaluate( () => {
return document.querySelector( '.wp-block-test-iframed-block' )
.innerText;
} );
const element = await page.waitForSelector(
'.wp-block-test-iframed-block'
);
const text = await element.evaluate( ( el ) => el.textContent );

expect( text ).toBe( 'Iframed Block (set with jQuery)' );

Expand All @@ -45,10 +44,12 @@ describe( 'changing image size', () => {
await clickButton( 'Create' );
await page.waitForSelector( 'iframe[name="editor-canvas"]' );

const iframedText = await canvas().evaluate( () => {
return document.querySelector( '.wp-block-test-iframed-block' )
.innerText;
} );
const iframeElement = await canvas().waitForSelector(
'.wp-block-test-iframed-block'
);
const iframedText = await iframeElement.evaluate(
( el ) => el.textContent
);

// Expect the script to load in the iframe, which replaces the block
// text.
Expand Down

0 comments on commit bceee46

Please sign in to comment.