Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it( 'embed block should be able to embed external content', async () => {
await insertBlock( 'Test Inner Blocks Locking All Embed' );
const embedInputSelector = '.components-placeholder__input[aria-label="Embed URL"]';
await page.waitForSelector( embedInputSelector );
await page.click( embedInputSelector );
// This URL should not have a trailing slash.
await page.keyboard.type( 'https://twitter.com/WordPress' );
await page.keyboard.press( 'Enter' );
// The twitter block should appear correctly.
await page.waitForSelector( 'figure.wp-block-embed' );
} );
} );
async function addReusableBlock() {
await createNewPost();
const isTopToolbarEnabled = await page.$eval( '.edit-post-layout', ( layout ) => {
return layout.classList.contains( 'has-fixed-toolbar' );
} );
if ( ! isTopToolbarEnabled ) {
await clickOnMoreMenuItem( 'Top Toolbar' );
}
await removeAllBlocks();
// Insert a paragraph block
await insertBlock( 'Paragraph' );
await page.keyboard.type( 'Reusable block!' );
await clickButtonByLabel( 'More options' );
const convertButton = await page.waitForXPath( '//button[text()="Add to Reusable Blocks"]' );
await convertButton.click();
// Wait for the snackbar confirmation of the block creation result.
await page.waitForSelector( '.components-snackbar__content' );
}