Skip to content

Commit

Permalink
E2e: wait for selection to update
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Nov 29, 2019
1 parent a1095bf commit 9ea4bc4
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ async function getSelectedFlatIndices() {
* Tests if the native selection matches the block selection.
*/
async function testNativeSelection() {
// Wait for the selection to update.
await page.evaluate( () => new Promise( window.requestAnimationFrame ) );
await page.evaluate( () => {
const selection = window.getSelection();
const elements = Array.from(
Expand Down Expand Up @@ -287,9 +289,8 @@ describe( 'Multi-block selection', () => {
await page.mouse.down();
await page.mouse.move( coord2.x, coord2.y, { steps: 10 } );
await page.mouse.up();
await page.evaluate( () => new Promise( window.requestAnimationFrame ) );

expect( await getSelectedFlatIndices() ).toEqual( [ 1, 2 ] );
await testNativeSelection();
expect( await getSelectedFlatIndices() ).toEqual( [ 1, 2 ] );
} );
} );

0 comments on commit 9ea4bc4

Please sign in to comment.