From 522024d0d163143d49cbcfdb10c96a707cba10e9 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Thu, 29 Jul 2021 17:11:56 +0200 Subject: [PATCH] Improve functional test with waitFor --- test/functional/apps/discover/_discover.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/functional/apps/discover/_discover.ts b/test/functional/apps/discover/_discover.ts index 616c07dd8cf9c..19a4f7271be33 100644 --- a/test/functional/apps/discover/_discover.ts +++ b/test/functional/apps/discover/_discover.ts @@ -268,8 +268,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await kibanaServer.uiSettings.replace({ 'discover:searchOnPageLoad': true }); await PageObjects.common.navigateToApp('discover'); await PageObjects.header.awaitKibanaChrome(); - - expect(await PageObjects.discover.getNrOfFetches()).to.be(1); + await retry.waitFor('number of fetches to be 1', async () => { + const nrOfFetches = await PageObjects.discover.getNrOfFetches(); + return nrOfFetches === 1; + }); }); });