-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate shortcut help e2e tests to Playwright (#53832)
* Migrate test case * Migrate test case * Use Role locators * Update to have tests pass locally - swap pressKeyWithModifier for pressKeys - use locator assertions - remove some extraneous steps in latter tests - cleanup comments * Combine tests * Locate platform-agnostically * Locate more rolefully * Assert focus return --------- Co-authored-by: alvitazwar <55917380+alvitazwar@users.noreply.github.com>
- Loading branch information
1 parent
324e9b3
commit 6ede5e2
Showing
2 changed files
with
42 additions
and
47 deletions.
There are no files selected for viewing
47 changes: 0 additions & 47 deletions
47
packages/e2e-tests/specs/editor/various/shortcut-help.test.js
This file was deleted.
Oops, something went wrong.
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,42 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); | ||
|
||
test.describe( 'keyboard shortcut help modal', () => { | ||
test.beforeEach( async ( { admin } ) => { | ||
await admin.createNewPost(); | ||
} ); | ||
|
||
test( 'opens from the options menu, closes with its close button and returns focus', async ( { | ||
page, | ||
} ) => { | ||
await page | ||
.locator( 'role=region[name="Editor top bar"]' ) | ||
.locator( '[aria-label="Options"]' ) | ||
.click(); | ||
const menuItem = page.locator( 'role=menuitem', { | ||
hasText: /^Keyboard shortcuts/i, | ||
} ); | ||
const dialog = page.locator( 'role=dialog[name="Keyboard shortcuts"]' ); | ||
|
||
await menuItem.click(); | ||
await expect( dialog ).toBeVisible(); | ||
|
||
await page.locator( 'role=button[name="Close"]' ).click(); | ||
await expect( dialog ).toBeHidden(); | ||
await expect( menuItem ).toBeFocused(); | ||
} ); | ||
|
||
test( 'toggles open/closed using the keyboard shortcut (access+h)', async ( { | ||
page, | ||
pageUtils, | ||
} ) => { | ||
await pageUtils.pressKeys( 'access+h' ); | ||
const dialog = page.locator( 'role=dialog[name="Keyboard shortcuts"]' ); | ||
await expect( dialog ).toBeVisible(); | ||
|
||
await pageUtils.pressKeys( 'access+h' ); | ||
await expect( dialog ).toBeHidden(); | ||
} ); | ||
} ); |
6ede5e2
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 6ede5e2.
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/6022412194
📝 Reported issues:
/test/e2e/specs/editor/various/multi-block-selection.spec.js