Skip to content

Commit

Permalink
[7.x] scroll to top of #kibana-body before trying to click createInde…
Browse files Browse the repository at this point in the history
…xButton (#77550) (#77652)

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
Lee Drengenberg and elasticmachine authored Sep 16, 2020
1 parent d099920 commit a046c5c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/functional/page_objects/common_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,10 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
const input = await find.byCssSelector('.euiFilePicker__input');
await input.type(path);
}

async scrollKibanaBodyTop() {
await browser.setScrollToById('kibana-body', 0, 0);
}
}

return new CommonPage();
Expand Down
1 change: 1 addition & 0 deletions test/functional/page_objects/settings_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ export function SettingsPageProvider({ getService, getPageObjects }: FtrProvider
}

async clickAddNewIndexPatternButton() {
await PageObjects.common.scrollKibanaBodyTop();
await testSubjects.click('createIndexPatternButton');
}

Expand Down
6 changes: 6 additions & 0 deletions test/functional/services/common/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,12 @@ export async function BrowserProvider({ getService }: FtrProviderContext) {
return this.getScrollTop();
}

public async setScrollToById(elementId: string, xCoord: number, yCoord: number) {
await driver.executeScript(
`document.getElementById("${elementId}").scrollTo(${xCoord},${yCoord})`
);
}

public async setScrollLeft(scrollSize: number | string) {
await driver.executeScript('document.body.scrollLeft = ' + scrollSize);
return this.getScrollLeft();
Expand Down

0 comments on commit a046c5c

Please sign in to comment.