How to use the @wordpress/e2e-test-utils.pressKeyWithModifier 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 getblocklab / block-lab / tests / e2e / specs / create-block.js View on Github external
it( 'creates the block and makes it available in the block editor', async () => {
		const blockName = 'Testing Example';
		const fieldName = 'Testing Text';

		// Create the Block Lab block (a 'block_lab' post).
		await visitAdminPage( 'post-new.php', '?post_type=block_lab' );
		await page.click( '[name="post_title"]' );
		await pressKeyWithModifier( 'primary', 'a' );
		await page.keyboard.type( blockName );

		// Add a Text field.
		await page.click( '#block-add-field' );
		await page.click( '.block-fields-edit-label input' );
		await pressKeyWithModifier( 'primary', 'a' );
		await page.keyboard.type( fieldName );

		// Publish the block.
		await page.click( '#publish' );

		// There should be a success notice.
		await page.waitForSelector( '.updated' );

		// Create a new post and add the new block.
		await createNewPost();
		await insertBlockFromInserter( blockName );
		await page.waitForSelector( '.wp-block' );

		const fieldValue = 'this is some example text';
		const fieldSelector = '.components-base-control__field';
github Automattic / jetpack / tests / e2e / lib / page-helper.js View on Github external
export async function waitAndType( page, selector, value, options = { visible: true } ) {
	const el = await waitForSelector( page, selector, options );
	await page.focus( selector );
	await pressKeyWithModifier( 'primary', 'a' );
	// await el.click( { clickCount: 3 } );
	await page.waitFor( 300 );
	await el.type( value, options );
}
github ampproject / amp-wp / tests / e2e / specs / stories-editor / context-menu.js View on Github external
it( 'should open the context menu when pressing Shift+F10 on a page', async () => {
			await insertBlock( 'Page' );
			await pressKeyWithModifier( 'shift', 'F10' );

			expect( page ).toMatchElement( POPOVER_SELECTOR );
			expect( page ).toMatchElement( POPOVER_SELECTOR + ' .right-click-duplicate-page' );
			expect( page ).toMatchElement( POPOVER_SELECTOR + ' .right-click-remove-page' );
		} );
	} );
github xwp / wp-foo-bar / tests / e2e / utils / search-for-block.js View on Github external
export async function searchForBlock( searchTerm ) {
	await openGlobalBlockInserter();
	await page.focus( '.block-editor-inserter__search' );
	await pressKeyWithModifier( 'primary', 'a' );
	await page.keyboard.type( searchTerm );
}
github gocodebox / lifterlms / packages / llms-e2e-test-utils / src / fill-field.js View on Github external
export async function fillField( selector, text ) {

	await page.focus( selector );
	await pressKeyWithModifier( 'primary', 'a' );
	await page.type( selector, text.toString() );

}