How to use the @wordpress/e2e-test-utils.insertBlock function in @wordpress/e2e-test-utils

To help you get started, we’ve selected a few @wordpress/e2e-test-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github WordPress / gutenberg / packages / e2e-tests / specs / editor / plugins / innerblocks-locking-all-embed.js View on Github external
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' );
	} );
} );
github ampproject / amp-wp / tests / e2e / specs / stories-editor / story-templates.js View on Github external
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' );
}