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

Refactored e2e keyboard navigation util functions / tests #16707

Closed
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
9ac4720
Adding an e2e test verifying simple keyboard navigation through block…
Jan 23, 2019
dbdf8ff
Moving `navigateToContentEditorTop`, `tabThroughParagraphBlock`, `tab…
Feb 24, 2019
7246607
Rewriting tabThroughBlockToolbar to allow it to tab through any block…
Feb 24, 2019
267cb0e
Moving navigateToContentEditorTop, tabThroughBlockMoverControl, and t…
tjnicolaides Mar 7, 2019
830f01a
Merge branch 'master' of github.com:WordPress/gutenberg into add/1345…
tjnicolaides May 23, 2019
f0da33d
Updating block editor classNames to convention - tab-through-block-to…
tjnicolaides May 23, 2019
2b62a21
Updating e2e-test-utils readme
tjnicolaides May 23, 2019
0b3d0a4
WIP - refactoring keyboard navigability tests to handle all the defau…
tjnicolaides May 26, 2019
6365c7e
WIP - successfully tabbing through all core content block types
tjnicolaides May 28, 2019
286060a
WIP - continuing to refactor e2e test tabbing functions
tjnicolaides May 28, 2019
1fd556f
Extracting more keyboard navigation assertions / helpers into e2e-tes…
tjnicolaides Jul 21, 2019
4e3feaf
WIP - refactoring test dependencies for keyboard navigability tests
tjnicolaides Jul 21, 2019
3dbbdd4
WIP Better JSdocs for keyboard navigation e2e test utils
tjnicolaides Jul 22, 2019
40a2f37
JSDocs for keyboard navigability e2e test utils in readme
tjnicolaides Jul 22, 2019
e59fbf6
Merge branch 'master' into add/13455-add-e2e-keyboard-navigation-util…
tjnicolaides Jul 22, 2019
97c6ffd
Fixing failing tests after merge from upstream
tjnicolaides Jul 22, 2019
b8dd4b2
Fixing docs build - PR #16707
tjnicolaides Jul 22, 2019
42ecca4
Merge branch 'master' into add/13455-add-e2e-keyboard-navigation-util…
tjnicolaides Jul 29, 2019
7c8c666
Assertion in externalWrapperHasFocus does not need to await
tjnicolaides Aug 27, 2019
42ea406
Improving JSDocs in some e2e-test-utils packages to make clear they a…
tjnicolaides Aug 27, 2019
c6513e6
Improving JSDocs in some e2e-test-utils packages to make clear they a…
tjnicolaides Aug 27, 2019
9badfc1
Improving JSDocs in some e2e-test-utils packages to make clear they a…
tjnicolaides Aug 27, 2019
8726c0f
Fixing typo in tabThroughPlaceholderButtons
tjnicolaides Aug 27, 2019
f6e538c
Fixing undocumented declaration in e2e-test-utils/README. Updating fo…
tjnicolaides Aug 27, 2019
7848c4b
Using page.$$eval instead of getElementList
tjnicolaides Aug 27, 2019
c5889d1
Updating JSDoc in e2e-test-utils/README
tjnicolaides Aug 27, 2019
c664379
Re-evaluate isFocusedTextContentArea and textContentAreaContent withi…
tjnicolaides Aug 27, 2019
71dea07
Refactoring 'Order of block keyboard navigation' to a series of more …
tjnicolaides Aug 27, 2019
f3c9746
Merge branch 'master' into add/13455-add-e2e-keyboard-navigation-util…
tjnicolaides Aug 27, 2019
b56bfe0
Renaming tabThroughBlock to tabThroughBlockControls, tabThroughBlockM…
tjnicolaides Aug 27, 2019
bdf6a8f
Improving confusing variable name in insert-and-populate-block
tjnicolaides Aug 27, 2019
2a5a9ce
Renaming helper function from textContentAreasHaveFocus to tabThrough…
tjnicolaides Aug 27, 2019
43bb03b
Merge branch 'master' into add/13455-add-e2e-keyboard-navigation-util…
Sep 23, 2019
56fd018
Linter fixes for /e2e-test-utils changes
Sep 28, 2019
4c82b7b
JSDoc fix for e2e-test-utils changes
Sep 28, 2019
49ea295
Merge branch 'upstream-master' into add/13455-add-e2e-keyboard-naviga…
Sep 28, 2019
5239a9f
Merge branch 'upstream-master' into add/13455-add-e2e-keyboard-naviga…
Oct 19, 2019
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
Rewriting tabThroughBlockToolbar to allow it to tab through any block…
…'s toolbar buttons
  • Loading branch information
TJ Nicolaides committed Feb 24, 2019
commit 7246607bb3066db1fd3c2e27a611cb8cf09d586d
78 changes: 13 additions & 65 deletions packages/e2e-tests/specs/keyboard-navigable-blocks.test.js
Original file line number Diff line number Diff line change
@@ -67,72 +67,20 @@ const tabThroughBlockMoverControl = async () => {
};

const tabThroughBlockToolbar = async () => {
// Tab to focus on the 'block switcher' control
await page.keyboard.press( 'Tab' );
const isFocusedBlockSwitcherControl = await page.evaluate( () =>
document.activeElement.classList.contains(
'editor-block-switcher__toggle'
)
);
await expect( isFocusedBlockSwitcherControl ).toBe( true );

// Tab to focus on the 'left paragraph alignment' dropdown control
await page.keyboard.press( 'Tab' );
const isFocusedLeftAlignmentControl = await page.evaluate( () =>
document.activeElement.classList.contains( 'components-toolbar__control' )
);
await expect( isFocusedLeftAlignmentControl ).toBe( true );

// Tab to focus on the 'center paragraph alignment' dropdown control
await page.keyboard.press( 'Tab' );
const isFocusedCenterAlignmentControl = await page.evaluate( () =>
document.activeElement.classList.contains( 'components-toolbar__control' )
);
await expect( isFocusedCenterAlignmentControl ).toBe( true );

// Tab to focus on the 'right paragraph alignment' dropdown control
await page.keyboard.press( 'Tab' );
const isFocusedRightAlignmentControl = await page.evaluate( () =>
document.activeElement.classList.contains( 'components-toolbar__control' )
);
await expect( isFocusedRightAlignmentControl ).toBe( true );

// Tab to focus on the 'Bold' formatting button
await page.keyboard.press( 'Tab' );
const isFocusedBoldFormattingButton = await page.evaluate( () =>
document.activeElement.classList.contains( 'components-toolbar__control' )
);
await expect( isFocusedBoldFormattingButton ).toBe( true );

// Tab to focus on the 'Italic' formatting button
await page.keyboard.press( 'Tab' );
const isFocusedItalicFormattingButton = await page.evaluate( () =>
document.activeElement.classList.contains( 'components-toolbar__control' )
);
await expect( isFocusedItalicFormattingButton ).toBe( true );

// Tab to focus on the 'Hyperlink' formatting button
await page.keyboard.press( 'Tab' );
const isFocusedHyperlinkFormattingButton = await page.evaluate( () =>
document.activeElement.classList.contains( 'components-toolbar__control' )
);
await expect( isFocusedHyperlinkFormattingButton ).toBe( true );

// Tab to focus on the 'Strikethrough' formatting button
await page.keyboard.press( 'Tab' );
const isFocusedStrikethroughFormattingButton = await page.evaluate( () =>
document.activeElement.classList.contains( 'components-toolbar__control' )
);
await expect( isFocusedStrikethroughFormattingButton ).toBe( true );
const blockToolbarButtons = await page.evaluate( () => {
// return an array with the classNames of the block toolbar's buttons
return [].slice.call(
document.querySelectorAll( '.editor-block-contextual-toolbar button' )
).map( ( elem ) => elem.className );
} );

// Tab to focus on the 'More formatting' dropdown toggle
await page.keyboard.press( 'Tab' );
const isFocusedMoreFormattingDropdown = await page.evaluate( () =>
document.activeElement.classList.contains(
'editor-block-settings-menu__toggle'
)
);
await expect( isFocusedMoreFormattingDropdown ).toBe( true );
for ( const buttonClassName of blockToolbarButtons ) {
await page.keyboard.press( 'Tab' );
const focusedBlockToolBarButton = await page.evaluate( () =>
document.activeElement.className
);
await expect( focusedBlockToolBarButton ).toEqual( buttonClassName );
}
};

describe( 'Order of block keyboard navigation', () => {