Skip to content
23 changes: 17 additions & 6 deletions x-pack/test/functional/apps/watcher/watcher_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,23 @@ export default function({ getService, getPageObjects }) {
}

await browser.setWindowSize(1600, 1000);
// TODO: Remove the retry.try wrapper once https://github.com/elastic/kibana/issues/55985 is resolved
retry.try(async () => {
// Try to give the license time to come through.
await PageObjects.common.sleep(2000);
await PageObjects.common.navigateToApp('watcher');
await testSubjects.find('createWatchButton');

// License values are emitted ES -> Kibana Server -> Kibana Public. The current implementation
// creates a situation the Watcher plugin may not have received a minimum required license at setup time
// so the public app may not have registered in the UI.
//
// For functional testing this is a problem. The temporary solution is we wait for watcher
// to be visible.
//
// See this issue https://github.com/elastic/kibana/issues/55985 for future resolution.
await retry.waitFor('watcher to display in management UI', async () => {
try {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, Jean-Louis. This is looking good so far. You can remove this extra try because retry.waitFor() is just a wrapper function around try. So you don't need the second one. Other than that, we I think we are looking good.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh. Gotcha. I reran the test and you are correct. LGTM.

await PageObjects.common.navigateToApp('watcher');
await testSubjects.find('createWatchButton');
} catch (e) {
return false;
}
return true;
});
});

Expand Down