How to use the @wordpress/e2e-test-utils.createNewPost 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 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' );
github gocodebox / lifterlms / packages / llms-e2e-test-utils / src / create-course.js View on Github external
export async function createCourse( title = 'Test Course' ) {

	page.on( 'dialog', dialog => dialog.accept() );

	await createNewPost( {
		title,
		postType: 'course',
	} );

	await publishPost();

	return await page.evaluate( () => wp.data.select( 'core/editor' ).getCurrentPostId() );

}
github gocodebox / lifterlms / packages / llms-e2e-test-utils / src / create-post.js View on Github external
export async function createPost( postType, title = 'Test Course' ) {

	page.on( 'dialog', dialog => dialog.accept() );

	await createNewPost( {
		title,
		postType,
	} );

	await publishPost();

	return await page.evaluate( () => wp.data.select( 'core/editor' ).getCurrentPostId() );

}