Skip to content

Commit

Permalink
Migrate 'text color' e2e test to Playwright (#55323)
Browse files Browse the repository at this point in the history
* Migrate 'text color' e2e test to Playwright

* Remove old test files
  • Loading branch information
Mamaduka authored Oct 13, 2023
1 parent 6756a0d commit e2ed543
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 59 deletions.

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',
},
},
] );
} );
} );

1 comment on commit e2ed543

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in e2ed543.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6511736361
📝 Reported issues:

Please sign in to comment.