Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add e2e tests
  • Loading branch information
kevin940726 committed May 26, 2021
commit c470aac004a5838a613897842759e2d7a1f6e8c4
51 changes: 51 additions & 0 deletions packages/e2e-tests/specs/widgets/customizing-widgets.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,57 @@ describe( 'Widgets Customizer', () => {
"The page delivered both an 'X-Frame-Options' header and a 'Content-Security-Policy' header with a 'frame-ancestors' directive. Although the 'X-Frame-Options' header alone would have blocked embedding, it has been ignored."
);
} );

it( 'should handle esc key events', async () => {
const widgetsPanel = await find( {
role: 'heading',
name: /Widgets/,
level: 3,
} );
await widgetsPanel.click();

const footer1Section = await find( {
role: 'heading',
name: /^Footer #1/,
level: 3,
} );
await footer1Section.click();

const paragraphBlock = await addBlock( 'Paragraph' );
await page.keyboard.type( 'First Paragraph' );
await showBlockToolbar();

// Open the more menu dropdown in block toolbar.
await clickBlockToolbarButton( 'Options' );
await expect( {
role: 'menu',
name: 'Options',
} ).toBeFound();

// Expect pressing the Escape key to close the dropdown,
// but not close the editor.
await page.keyboard.press( 'Escape' );
await expect( {
role: 'menu',
name: 'Options',
} ).not.toBeFound();
await expect( paragraphBlock ).toBeVisible();

await paragraphBlock.focus();

// Expect pressing the Escape key to enter navigation mode,
// but not close the editor.
await page.keyboard.press( 'Escape' );
await expect( {
text: /^You are currently in navigation mode\./,
selector: '*[aria-live="polite"][aria-relevant="additions text"]',
} ).toBeFound();
await expect( paragraphBlock ).toBeVisible();

expect( console ).toHaveWarned(
"The page delivered both an 'X-Frame-Options' header and a 'Content-Security-Policy' header with a 'frame-ancestors' directive. Although the 'X-Frame-Options' header alone would have blocked embedding, it has been ignored."
);
} );
} );

/**
Expand Down