From 9dde70d319ddf4a803b50be3fa3d25c3484c637a Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Wed, 18 Jan 2023 14:52:11 +0100 Subject: [PATCH] Remove old test now migrated to Playwright. --- .../specs/editor/various/a11y.test.js | 74 ------------------- 1 file changed, 74 deletions(-) delete mode 100644 packages/e2e-tests/specs/editor/various/a11y.test.js diff --git a/packages/e2e-tests/specs/editor/various/a11y.test.js b/packages/e2e-tests/specs/editor/various/a11y.test.js deleted file mode 100644 index 1f87cea42fa3c..0000000000000 --- a/packages/e2e-tests/specs/editor/various/a11y.test.js +++ /dev/null @@ -1,74 +0,0 @@ -/** - * WordPress dependencies - */ -import { createNewPost, pressKeyWithModifier } from '@wordpress/e2e-test-utils'; - -function isCloseButtonFocused() { - return page.$eval( ':focus', ( focusedElement ) => { - return focusedElement.getAttribute( 'aria-label' ) === 'Close'; - } ); -} - -describe( 'a11y', () => { - beforeEach( async () => { - await createNewPost(); - } ); - - it( 'tabs header bar', async () => { - await pressKeyWithModifier( 'ctrl', '`' ); - await pressKeyWithModifier( 'ctrl', '`' ); - await pressKeyWithModifier( 'ctrl', '`' ); - await pressKeyWithModifier( 'ctrl', '`' ); - await page.keyboard.press( 'Tab' ); - - const isFocusedToggle = await page.$eval( - ':focus', - ( focusedElement ) => { - return focusedElement.classList.contains( - 'edit-post-header-toolbar__inserter-toggle' - ); - } - ); - - expect( isFocusedToggle ).toBe( true ); - } ); - - it( 'constrains focus to a modal when tabbing', async () => { - // Open keyboard help modal. - await pressKeyWithModifier( 'access', 'h' ); - - // The close button should not be focused by default; this is a strange UX - // experience. - // See: https://github.com/WordPress/gutenberg/issues/9410 - expect( await isCloseButtonFocused() ).toBe( false ); - - await page.keyboard.press( 'Tab' ); - - // Ensure the Close button of the modal is focused after tabbing. - expect( await isCloseButtonFocused() ).toBe( true ); - } ); - - it( 'returns focus to the first tabbable in a modal after blurring a tabbable', async () => { - await pressKeyWithModifier( 'access', 'h' ); - - // Click to move focus to an element after the last tabbable within the - // modal. - await page.click( '.components-modal__content *:last-child' ); - - await page.keyboard.press( 'Tab' ); - - expect( await isCloseButtonFocused() ).toBe( true ); - } ); - - it( 'returns focus to the last tabbable in a modal after blurring a tabbable and tabbing in reverse direction', async () => { - await pressKeyWithModifier( 'access', 'h' ); - - // Click to move focus to an element before the first tabbable within - // the modal. - await page.click( '.components-modal__header-heading' ); - - await pressKeyWithModifier( 'shift', 'Tab' ); - - expect( await isCloseButtonFocused() ).toBe( true ); - } ); -} );