Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate style variation test to Playwright #40216

Merged
merged 8 commits into from
Apr 11, 2022
Merged
30 changes: 30 additions & 0 deletions test/e2e/specs/editor/various/style-variation.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* WordPress dependencies
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );

test.describe( 'adding blocks', () => {
test( 'Should switch to the plain style of the quote block', async ( {
page,
pageUtils,
} ) => {
await pageUtils.createNewPost();

// Inserting a quote block
await pageUtils.insertBlock( { name: 'core/quote' } );
await page.keyboard.type( 'Quote content' );
kevin940726 marked this conversation as resolved.
Show resolved Hide resolved

await pageUtils.clickBlockToolbarButton( 'Quote' );

const plainStyleButton = await page.locator(
'button[role="menuitem"]:has-text("Plain")'
JustinyAhin marked this conversation as resolved.
Show resolved Hide resolved
);
await plainStyleButton.click();
JustinyAhin marked this conversation as resolved.
Show resolved Hide resolved

// Check the content
const quoteContent = `<!-- wp:quote {"className":"is-style-plain"} -->\n<blockquote class="wp-block-quote is-style-plain"><p>Quote content</p></blockquote>\n<!-- /wp:quote -->`;
kevin940726 marked this conversation as resolved.
Show resolved Hide resolved

const content = await pageUtils.getEditedPostContent();
expect( content ).toBe( quoteContent );
} );
} );