Skip to content

Commit

Permalink
Simplify e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewserong committed Nov 10, 2023
1 parent 3c73e22 commit 39b91b5
Showing 1 changed file with 12 additions and 111 deletions.
123 changes: 12 additions & 111 deletions test/e2e/specs/editor/various/list-view.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,101 +464,29 @@ test.describe( 'List View', () => {
{ name: 'core/file', selected: true, focused: true },
] );

// Move up to the paragraph block in the first column block.
// Expand children to get to the deeply nested paragraph block.
// Move up to columns block, expand, and then move to the first column block.
await page.keyboard.press( 'ArrowUp' );
await page.keyboard.press( 'ArrowRight' );
await page.keyboard.press( 'ArrowDown' );
await page.keyboard.press( 'ArrowRight' );
await page.keyboard.press( 'ArrowDown' );
await page.keyboard.press( 'ArrowDown' );

await expect
.poll(
listViewUtils.getBlocksWithA11yAttributes,
'The last inserted block should be selected, while the deeply nested paragraph block should be focused.'
'The last inserted block should be selected, while the first column block should be focused.'
)
.toMatchObject( [
{ name: 'core/group' },
{
name: 'core/columns',
innerBlocks: [
{
name: 'core/column',
innerBlocks: [
{ name: 'core/heading' },
{
name: 'core/paragraph',
selected: false,
focused: true,
},
],
},
{ name: 'core/column', selected: false, focused: true },
{ name: 'core/column' },
],
},
{ name: 'core/file', selected: true, focused: false },
] );

// Select all siblings at the current level.
await pageUtils.pressKeys( 'primary+a' );
await expect
.poll(
listViewUtils.getBlocksWithA11yAttributes,
'The deeply nested paragraph block should be selected, along with its sibling heading.'
)
.toMatchObject( [
{ name: 'core/group' },
{
name: 'core/columns',
innerBlocks: [
{
name: 'core/column',
innerBlocks: [
{ name: 'core/heading', selected: true },
{
name: 'core/paragraph',
selected: true,
focused: true,
},
],
},
{ name: 'core/column' },
],
},
{ name: 'core/file', selected: false, focused: false },
] );

// Select next parent.
await pageUtils.pressKeys( 'primary+a' );
await expect
.poll(
listViewUtils.getBlocksWithA11yAttributes,
'The first column block should be selected and focused.'
)
.toMatchObject( [
{ name: 'core/group' },
{
name: 'core/columns',
innerBlocks: [
{
name: 'core/column',
innerBlocks: [
{ name: 'core/heading' },
{
name: 'core/paragraph',
},
],
selected: true,
focused: true,
},
{ name: 'core/column', selected: false },
],
},
{ name: 'core/file', selected: false, focused: false },
] );

// Select all siblings at current level.
// Select all sibling column blocks at current level.
await pageUtils.pressKeys( 'primary+a' );
await expect
.poll(
Expand All @@ -570,23 +498,15 @@ test.describe( 'List View', () => {
{
name: 'core/columns',
innerBlocks: [
{
name: 'core/column',
innerBlocks: [
{ name: 'core/heading' },
{
name: 'core/paragraph',
},
],
selected: true,
focused: true,
},
{ name: 'core/column', selected: true },
{ name: 'core/column', selected: true, focused: true },
{ name: 'core/column', selected: true, focused: false },
],
selected: false,
},
{ name: 'core/file', selected: false, focused: false },
] );
// Select next parent.

// Select next parent (the columns block).
await pageUtils.pressKeys( 'primary+a' );
await expect
.poll(
Expand All @@ -598,15 +518,7 @@ test.describe( 'List View', () => {
{
name: 'core/columns',
innerBlocks: [
{
name: 'core/column',
innerBlocks: [
{ name: 'core/heading' },
{
name: 'core/paragraph',
},
],
},
{ name: 'core/column' },
{ name: 'core/column' },
],
selected: true,
Expand All @@ -627,15 +539,7 @@ test.describe( 'List View', () => {
{
name: 'core/columns',
innerBlocks: [
{
name: 'core/column',
innerBlocks: [
{ name: 'core/heading' },
{
name: 'core/paragraph',
},
],
},
{ name: 'core/column' },
{ name: 'core/column' },
],
selected: true,
Expand All @@ -646,10 +550,7 @@ test.describe( 'List View', () => {

// Deselect blocks via Escape key.
await page.keyboard.press( 'Escape' );
// Collapse the column block and the columns block.
await page.keyboard.press( 'ArrowDown' );
await page.keyboard.press( 'ArrowLeft' );
await page.keyboard.press( 'ArrowUp' );
// Collapse the columns block.
await page.keyboard.press( 'ArrowLeft' );

await expect
Expand Down

0 comments on commit 39b91b5

Please sign in to comment.