Skip to content

Commit

Permalink
fix dashboard view/edit flaky test (#12026)
Browse files Browse the repository at this point in the history
* attempt to fix dashboard view/edit flaky test

hope to fix #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
  • Loading branch information
stacey-gammon authored May 31, 2017
1 parent b53724b commit 5bc5c03
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
9 changes: 9 additions & 0 deletions test/functional/page_objects/common_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
10 changes: 7 additions & 3 deletions test/functional/page_objects/header_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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() {
Expand Down

0 comments on commit 5bc5c03

Please sign in to comment.