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 multi-block selection E2E tests to Playwright #48035

Merged
merged 4 commits into from
Mar 3, 2023
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
Fix code reviews
  • Loading branch information
kevin940726 committed Mar 3, 2023
commit 21b65499929736027b2b4663fa951027b0df975b
26 changes: 17 additions & 9 deletions test/e2e/specs/editor/various/multi-block-selection.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ test.describe( 'Multi-block selection', () => {
attributes: { content: '' },
WunderBart marked this conversation as resolved.
Show resolved Hide resolved
} );
await editor.canvas
.getByRole( 'document', { name: /Empty block/i } )
.getByRole( 'document', { name: 'Empty block' } )
.click();
// Move to the middle of the first line.
await pageUtils.pressKeyTimes( 'ArrowUp', 4 );
Expand Down Expand Up @@ -532,9 +532,7 @@ test.describe( 'Multi-block selection', () => {
] );
await page.keyboard.press( 'Backspace' );

for ( let i = 0; i < 3; i += 1 ) {
await page.keyboard.press( 'ArrowLeft' );
}
await pageUtils.pressKeyTimes( 'ArrowLeft', 3 );
await pageUtils.pressKeyWithModifier( 'primary', 'v' );
await page.keyboard.type( '|' );
await expect
Expand Down Expand Up @@ -821,14 +819,22 @@ test.describe( 'Multi-block selection', () => {
.click();

await pageUtils.pressKeyWithModifier( 'primary', 'a' );
await expect
.poll( multiBlockSelectionUtils.getSelectedBlocks )
.toMatchObject( [ { name: 'core/list-item' } ] );

await pageUtils.pressKeyWithModifier( 'primary', 'a' );
await pageUtils.pressKeyWithModifier( 'primary', 'a' );
await expect
.poll( multiBlockSelectionUtils.getSelectedBlocks )
.toMatchObject( [ { name: 'core/list' } ] );

await pageUtils.pressKeyWithModifier( 'primary', 'a' );
await expect
.poll( multiBlockSelectionUtils.getSelectedBlocks )
.toContainEqual(
expect.objectContaining( { name: 'core/paragraph' } )
);
.toMatchObject( [
{ name: 'core/paragraph' },
{ name: 'core/list' },
] );
} );

test( 'should select all from empty selection', async ( {
Expand Down Expand Up @@ -1153,7 +1159,9 @@ test.describe( 'Multi-block selection', () => {
.click();

await page.keyboard.press( 'ArrowLeft' );
const strongText = page.getByText( '1', { exact: true } );
const strongText = editor.canvas
.getByRole( 'region', { name: 'Editor content' } )
.getByText( '1', { exact: true } );
const strongBox = await strongText.boundingBox();
await strongText.click( {
// Ensure clicking on the right half of the element.
Expand Down