-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate 'text color' e2e test to Playwright (#55323)
* Migrate 'text color' e2e test to Playwright * Remove old test files
- Loading branch information
Showing
3 changed files
with
54 additions
and
59 deletions.
There are no files selected for viewing
13 changes: 0 additions & 13 deletions
13
packages/e2e-tests/specs/editor/various/format-library/__snapshots__/text-color.test.js.snap
This file was deleted.
Oops, something went wrong.
46 changes: 0 additions & 46 deletions
46
packages/e2e-tests/specs/editor/various/format-library/text-color.test.js
This file was deleted.
Oops, something went wrong.
54 changes: 54 additions & 0 deletions
54
test/e2e/specs/editor/various/format-library/text-color.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}, | ||
}, | ||
] ); | ||
} ); | ||
} ); |
e2ed543
There was a problem hiding this comment.
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:
/test/e2e/specs/editor/various/writing-flow.spec.js