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 list view E2E tests to Playwright #47919

Merged
merged 24 commits into from
Feb 24, 2023
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5e261e4
Migrate block list drag&drop test
WunderBart Feb 9, 2023
c29c64c
Migrate first block removal regression test
WunderBart Feb 9, 2023
6a37983
Don't use the generated snapshot
WunderBart Feb 9, 2023
8073e6c
Migrate previous block selection test
WunderBart Feb 9, 2023
d6377af
Migrate the next block selection test
WunderBart Feb 9, 2023
3f978f7
Migrate test for removing all blocks
WunderBart Feb 9, 2023
1e054f0
Migrate nested items test
WunderBart Feb 9, 2023
bea0a97
Avoid extra nesting
WunderBart Feb 10, 2023
7ff6c03
Migrate the Home/End keynavigation test
WunderBart Feb 10, 2023
d88bd71
Make test titles consistent
WunderBart Feb 10, 2023
97befc8
Remove old List View tests (complete migration)
WunderBart Feb 10, 2023
889e631
Update a few more comments
WunderBart Feb 10, 2023
1045fe3
Fix the dragging test
WunderBart Feb 10, 2023
6a43855
Move the most repeated part to a helper fn
WunderBart Feb 10, 2023
d3ff02e
Remove obsolete snapshot
WunderBart Feb 10, 2023
8b891b3
Revert "Move the most repeated part to a helper fn"
WunderBart Feb 11, 2023
6d9a7ce
Revert "Avoid extra nesting"
WunderBart Feb 11, 2023
f3223ec
Replace waitFor with expect.toBeVisible
WunderBart Feb 12, 2023
ace5e75
Add some more locator nesting for readability
WunderBart Feb 12, 2023
cdd101c
Use editor.canvas where appropriate
WunderBart Feb 12, 2023
13e794f
Remove unnecessary page error check
WunderBart Feb 12, 2023
594638a
Use getByRole( 'link' ) instead of locator( 'a' )
WunderBart Feb 12, 2023
4b80291
Use testid for the expander element
WunderBart Feb 12, 2023
4dd325f
Migrate test added in #45135
WunderBart Feb 21, 2023
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
Migrate the Home/End keynavigation test
  • Loading branch information
WunderBart committed Feb 21, 2023
commit 7ff6c03382e4b687c6b643e9bc2894b6cd4c5ccb
58 changes: 58 additions & 0 deletions test/e2e/specs/editor/various/list-view.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,4 +307,62 @@ test.describe( 'List view', () => {
} )
.waitFor();
WunderBart marked this conversation as resolved.
Show resolved Hide resolved
} );

test( 'ensures the Home/End keyboard keys move focus to start/end of list', async ( {
editor,
page,
pageUtils,
} ) => {
// Insert a couple of blocks of different types.
await editor.insertBlock( { name: 'core/image' } );
await editor.insertBlock( { name: 'core/heading' } );
await editor.insertBlock( { name: 'core/paragraph' } );
await editor.insertBlock( { name: 'core/columns' } );
await editor.insertBlock( { name: 'core/group' } );

// Open list view.
await pageUtils.pressKeyWithModifier( 'access', 'o' );

// The last inserted block should be selected.
await page
.getByRole( 'gridcell', {
name: 'Group link',
selected: true,
} )
.waitFor();

// Press Home to go to the first inserted block (image).
await page.keyboard.press( 'Home' );
await expect(
page
.getByRole( 'gridcell', {
name: 'Image link',
} )
.locator( 'a' )
).toBeFocused();

// Press End followed by Arrow Up to go to the second to last block (columns).
await page.keyboard.press( 'End' );
await page.keyboard.press( 'ArrowUp' );
await expect(
page
.getByRole( 'gridcell', {
name: 'Columns link',
} )
.locator( 'a' )
).toBeFocused();

// Navigate the right column to image block options button via Home key.
await page.keyboard.press( 'ArrowRight' );
await page.keyboard.press( 'Home' );
await expect(
page.getByRole( 'button', { name: 'Options for Image block' } )
).toBeFocused();

// Navigate the right column to group block options button.
await page.keyboard.press( 'End' );
await expect(
page.getByRole( 'button', { name: 'Options for Group block' } )
).toBeFocused();
} );
} );