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/shortcut help #46179

Closed
wants to merge 3 commits into from
Closed
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
47 changes: 0 additions & 47 deletions packages/e2e-tests/specs/editor/various/shortcut-help.test.js

This file was deleted.

77 changes: 77 additions & 0 deletions test/e2e/specs/editor/various/shortcut-help.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/**
* 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( 'displays the shortcut help modal when opened using the menu item in the more menu', async ( {
page,
} ) => {
// Add a paragraph block.
await page
.locator( '.interface-more-menu-dropdown [aria-label="Options"]' )
.click();
await page
.locator( 'role=menuitem[name="Keyboard shortcuts ⌃⌥H"]' )
.click();
//await editor.clickBlockOptionsMenuItem('Keyboard shortcuts');
const shortcutHelpModalElements = await page.locator(
'role=dialog[name="Keyboard shortcuts"]'
);
await expect( shortcutHelpModalElements ).toHaveCount( 1 );
} );
test( 'closes the shortcut help modal when the close icon is clicked', async ( {
page,
} ) => {
await page
.locator( '.interface-more-menu-dropdown [aria-label="Options"]' )
.click();
await page
.locator( 'role=menuitem[name="Keyboard shortcuts ⌃⌥H"]' )
.click();
await page.locator( 'role=button[name="Close"]' ).click();
const shortcutHelpModalElements = await page.locator(
'role=dialog[name="Keyboard shortcuts"]'
);
await expect( shortcutHelpModalElements ).toHaveCount( 0 );
} );
test( 'displays the shortcut help modal when opened using the shortcut key (access+h)', async ( {
page,
pageUtils,
} ) => {
await page
.locator( '.interface-more-menu-dropdown [aria-label="Options"]' )
.click();
await page
.locator( 'role=menuitem[name="Keyboard shortcuts ⌃⌥H"]' )
.click();
await page.locator( 'role=button[name="Close"]' ).click();
await pageUtils.pressKeyWithModifier( 'access', 'h' );
const shortcutHelpModalElements = await page.locator(
'role=dialog[name="Keyboard shortcuts"]'
);
await expect( shortcutHelpModalElements ).toHaveCount( 1 );
} );
test( 'closes the shortcut help modal when the shortcut key (access+h) is pressed again', async ( {
page,
pageUtils,
} ) => {
await page
.locator( '.interface-more-menu-dropdown [aria-label="Options"]' )
.click();
await page
.locator( 'role=menuitem[name="Keyboard shortcuts ⌃⌥H"]' )
.click();
await page.locator( 'role=button[name="Close"]' ).click();
await pageUtils.pressKeyWithModifier( 'access', 'h' );
await pageUtils.pressKeyWithModifier( 'access', 'h' );
const shortcutHelpModalElements = await page.locator(
'role=dialog[name="Keyboard shortcuts"]'
);
await expect( shortcutHelpModalElements ).toHaveCount( 0 );
} );
} );