Skip to content

Commit

Permalink
test: Increase robustness of waitForKeyboardToBeHidden utility
Browse files Browse the repository at this point in the history
This utility appeared to fail occasionally due to an empty `addButton`
value.
  • Loading branch information
dcalhoun committed Oct 12, 2023
1 parent 1b83f12 commit 6d30ce6
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,10 @@ class EditorPage {
async waitForKeyboardToBeHidden() {
const { addButtonLocation } = this.initialValues;
const addButton = await this.getAddBlockButton();
const location = await addButton.getLocation();
let location;
if ( addButton ) {
location = await addButton.getLocation();
}
let YLocation = addButtonLocation?.y;
const currentOrientation = await this.driver.getOrientation();
const isLandscape = currentOrientation === 'LANDSCAPE';
Expand All @@ -315,7 +318,7 @@ class EditorPage {
);
}

if ( location.y < YLocation ) {
if ( ! addButton || location?.y < YLocation ) {
await this.waitForKeyboardToBeHidden();
}
}
Expand Down

0 comments on commit 6d30ce6

Please sign in to comment.