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 'text color' e2e test to Playwright #55323

Merged
merged 2 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

54 changes: 54 additions & 0 deletions test/e2e/specs/editor/various/format-library/text-color.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* WordPress dependencies
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );

test.describe( 'Format Library - Text color', () => {
test.beforeEach( async ( { admin } ) => {
await admin.createNewPost();
} );

test( 'should remove highlighting element', async ( {
editor,
page,
pageUtils,
} ) => {
await editor.canvas
.getByRole( 'button', { name: 'Add default block' } )
.click();

await page.keyboard.type( '1' );
await pageUtils.pressKeys( 'primary+a' );
await editor.clickBlockToolbarButton( 'More' );
await page
.getByRole( 'menuitemcheckbox', { name: 'Highlight' } )
.click();

// Use a color name with multiple words to ensure that it becomes
// active. Previously we had a broken regular expression.
const color = page
.getByRole( 'listbox', { name: 'Custom color picker' } )
.getByRole( 'option', { name: 'Color: Cyan bluish gray' } );

await color.click();
await expect.poll( editor.getBlocks ).toMatchObject( [
{
name: 'core/paragraph',
attributes: {
content:
'<mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-cyan-bluish-gray-color">1</mark>',
},
},
] );

await color.click();
await expect.poll( editor.getBlocks ).toMatchObject( [
{
name: 'core/paragraph',
attributes: {
content: '1',
},
},
] );
} );
} );
Loading