How to use the @wordpress/e2e-test-utils.clickBlockToolbarButton 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 liip / bootstrap-blocks-wordpress-plugin / e2e-tests / row / row-block.spec.js View on Github external
it( 'Should be possible to change alignment', async () => {
		expect( console ).toHaveWarned();

		await insertRowBlock();
		await selectRowBlock();

		// Change horizontal alignment
		await clickBlockToolbarButton( 'Change horizontal alignment of columns' );
		await clickButton( 'Align columns right' );
		expect( await page.$( '[data-type="wp-bootstrap-blocks/row"][data-alignment="right"]' ) ).not.toBeNull();
		expect( await getEditedPostContent() ).toMatchSnapshot();

		// Change vertical alignment
		await clickBlockToolbarButton( 'Change vertical alignment of columns' );
		await clickButton( 'Align columns bottom' );
		expect( await page.$( '[data-type="wp-bootstrap-blocks/row"][data-vertical-alignment="bottom"]' ) ).not.toBeNull();
		expect( await getEditedPostContent() ).toMatchSnapshot();
	} );
github liip / bootstrap-blocks-wordpress-plugin / e2e-tests / row / row-block.spec.js View on Github external
it( 'Should be possible to change alignment', async () => {
		expect( console ).toHaveWarned();

		await insertRowBlock();
		await selectRowBlock();

		// Change horizontal alignment
		await clickBlockToolbarButton( 'Change horizontal alignment of columns' );
		await clickButton( 'Align columns right' );
		expect( await page.$( '[data-type="wp-bootstrap-blocks/row"][data-alignment="right"]' ) ).not.toBeNull();
		expect( await getEditedPostContent() ).toMatchSnapshot();

		// Change vertical alignment
		await clickBlockToolbarButton( 'Change vertical alignment of columns' );
		await clickButton( 'Align columns bottom' );
		expect( await page.$( '[data-type="wp-bootstrap-blocks/row"][data-vertical-alignment="bottom"]' ) ).not.toBeNull();
		expect( await getEditedPostContent() ).toMatchSnapshot();
	} );
github liip / bootstrap-blocks-wordpress-plugin / e2e-tests / button / button-block.spec.js View on Github external
it( 'Should be possible to change alignment', async () => {
		await insertButtonBlock();
		await selectButtonBlock();

		// Change alignment
		await clickBlockToolbarButton( 'Change button alignment' );
		await clickButton( 'Align Text Center' );
		expect( await page.$( '[data-type="wp-bootstrap-blocks/button"][data-alignment="center"]' ) ).not.toBeNull();

		// Editor content should match snapshot
		expect( await getEditedPostContent() ).toMatchSnapshot();
	} );
} );
github liip / bootstrap-blocks-wordpress-plugin / e2e-tests / helper.js View on Github external
export const toolbarOptionIsActive = async ( toolbarLabel, buttonText ) => {
	await clickBlockToolbarButton( toolbarLabel ); // Open toolbar
	const isActive = ( await page.$x( `//button[contains(text(),"${ buttonText }") and contains(@class,"is-active")]` ) ).length === 1;
	await page.keyboard.press( 'Escape' ); // Close toolbar
	return isActive;
};
github Automattic / jetpack / tests / e2e / lib / blocks / word-ads.js View on Github external
async switchFormat( buttonNumber ) {
		await clickBlockToolbarButton( 'Pick an ad format' );

		const formatButtonsSelector = '.wp-block-jetpack-wordads__format-picker button';
		await waitForSelector( this.page, formatButtonsSelector );
		const allButtons = await this.page.$$( formatButtonsSelector );
		await allButtons[ buttonNumber ].click();
	}