Skip to content

Commit

Permalink
Fix native e2e device tests (#34715)
Browse files Browse the repository at this point in the history
Increase the accuracy of the swipe distance required to scroll one page
of blocks within the block inserter. We now have more than two pages of
blocks. The previous implementation would scroll too far (to the
bottom), which caused failures when the test scrolled _past_ the subject
block.
  • Loading branch information
dcalhoun authored Sep 9, 2021
1 parent 2c56a9c commit 43b591e
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,11 @@ class EditorPage {
}
}

static getInserterPageHeight( screenHeight ) {
// Rough estimate of a swipe distance required to scroll one page of blocks
return screenHeight * 0.82;
}

// Attempts to find the given block button in the block inserter control.
async findBlockButton( blockName ) {
const blockAccessibilityLabel = `${ blockName } block`;
Expand All @@ -308,7 +313,7 @@ class EditorPage {
swipeFromTo(
this.driver,
{ x, y: size.height - 100 },
{ x, y: size.height - 450 }
{ x, y: EditorPage.getInserterPageHeight( size.height ) }
);
}

Expand All @@ -330,7 +335,7 @@ class EditorPage {
fromX: 50,
fromY: height,
toX: 50,
toY: height - 450,
toY: EditorPage.getInserterPageHeight( height ),
duration: 0.5,
} );
}
Expand Down

0 comments on commit 43b591e

Please sign in to comment.