fix dashboard view/edit flaky test (#12026)

* attempt to fix dashboard view/edit flaky test

hope to fix https://github.com/elastic/kibana/issues/12014

* Need to wait for global loading indicator to be hidden once top nav is visible

* use Error object for throw

* inline function only used once
This commit is contained in:
Stacey Gammon 2017-05-31 12:29:08 -04:00 committed by GitHub
parent b53724bb36
commit 5bc5c03ab8
2 changed files with 16 additions and 3 deletions

View file

@ -270,6 +270,15 @@ export function CommonPageProvider({ getService, getPageObjects, getPageObject }
async isChromeVisible() {
return await testSubjects.exists('kibanaChrome');
}
async waitForTopNavToBeVisible() {
await retry.try(async () => {
const isNavVisible = await testSubjects.exists('top-nav');
if (!isNavVisible) {
throw new Error('Local nav not visible yet');
}
});
}
}
return new CommonPage();

View file

@ -10,6 +10,7 @@ export function HeaderPageProvider({ getService, getPageObjects }) {
const defaultFindTimeout = config.get('timeouts.find');
class HeaderPage {
async clickSelector(selector) {
remote.setFindTimeout(defaultFindTimeout);
await remote.findByCssSelector(selector).click();
@ -18,19 +19,22 @@ export function HeaderPageProvider({ getService, getPageObjects }) {
async clickDiscover() {
log.debug('click Discover tab');
await this.clickSelector('a[href*=\'discover\']');
await PageObjects.common.sleep(3000);
await PageObjects.common.waitForTopNavToBeVisible();
await this.isGlobalLoadingIndicatorHidden();
}
async clickVisualize() {
log.debug('click Visualize tab');
await this.clickSelector('a[href*=\'visualize\']');
await PageObjects.common.sleep(3000);
await PageObjects.common.waitForTopNavToBeVisible();
await this.isGlobalLoadingIndicatorHidden();
}
async clickDashboard() {
log.debug('click Dashboard tab');
await this.clickSelector('a[href*=\'dashboard\']');
await PageObjects.common.sleep(3000);
await PageObjects.common.waitForTopNavToBeVisible();
await this.isGlobalLoadingIndicatorHidden();
}
async clickSettings() {