Stabilize createNewDashboard testfunction (#41008)

* This function will be flaky if the page is still loading and newItemButton does not exist but will soon.

* Skip only the other flaky test, this PR should fix the one
This commit is contained in:
Stacey Gammon 2019-07-15 17:38:04 -04:00 committed by GitHub
parent b10d50535f
commit fbfee1e973
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 12 deletions

View file

@ -34,9 +34,7 @@ export default function ({ getService, getPageObjects }) {
const dashboardPanelActions = getService('dashboardPanelActions');
const PageObjects = getPageObjects(['dashboard', 'header', 'visualize']);
// FLAKY: https://github.com/elastic/kibana/issues/41088
// FLAKY: https://github.com/elastic/kibana/issues/41087
describe.skip('dashboard filtering', async function () {
describe('dashboard filtering', async function () {
this.tags('smoke');
before(async () => {
await PageObjects.dashboard.gotoDashboardLandingPage();
@ -219,7 +217,8 @@ export default function ({ getService, getPageObjects }) {
await dashboardExpect.tsvbMarkdownWithValuesExists(['7,209.286']);
});
it('saved searches', async () => {
// FLAKY: https://github.com/elastic/kibana/issues/41087
it.skip('saved searches', async () => {
await dashboardExpect.savedSearchRowCount(1);
});

View file

@ -217,15 +217,20 @@ export function DashboardPageProvider({ getService, getPageObjects }) {
}
async clickNewDashboard() {
// newItemButton button is only visible when dashboard listing table is displayed
// (at least one dashboard).
const exists = await testSubjects.exists('newItemButton');
if (exists) {
return await testSubjects.click('newItemButton');
}
// One or the other will eventually show up on the landing page, depending on whether there are
// dashboards.
await retry.try(async () => {
const createNewItemButtonExists = await testSubjects.exists('newItemButton');
if (createNewItemButtonExists) {
return await testSubjects.click('newItemButton');
}
const createNewItemPromptExists = await this.getCreateDashboardPromptExists();
if (createNewItemPromptExists) {
return await this.clickCreateDashboardPrompt();
}
// If no dashboards exist, then newItemButton to create a new dashboard.
return await this.clickCreateDashboardPrompt();
throw new Error('Page is still loading... waiting for create new prompt or button to appear');
});
}
async clickCreateDashboardPrompt() {