From d5b95f018718510882cdd8b3cf1f0314e4431fe2 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Wed, 29 Sep 2021 13:52:24 +0200 Subject: [PATCH] [Discover] Unksip and improve index pattern without time field functional test (#112698) --- .../discover/_indexpattern_without_timefield.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/test/functional/apps/discover/_indexpattern_without_timefield.ts b/test/functional/apps/discover/_indexpattern_without_timefield.ts index 74713553fa543..81fb4f92ab730 100644 --- a/test/functional/apps/discover/_indexpattern_without_timefield.ts +++ b/test/functional/apps/discover/_indexpattern_without_timefield.ts @@ -9,6 +9,7 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { + const retry = getService('retry'); const browser = getService('browser'); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); @@ -16,8 +17,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const testSubjects = getService('testSubjects'); const PageObjects = getPageObjects(['common', 'timePicker', 'discover']); - // Failing: See https://github.com/elastic/kibana/issues/107057 - describe.skip('indexpattern without timefield', () => { + describe('indexpattern without timefield', () => { before(async () => { await security.testUser.setRoles(['kibana_admin', 'kibana_timefield']); await esArchiver.loadIfNeeded( @@ -57,22 +57,33 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should display a timepicker after switching to an index pattern with timefield', async () => { await PageObjects.discover.selectIndexPattern('with-timefield'); + await PageObjects.discover.waitForDocTableLoadingComplete(); if (!(await PageObjects.timePicker.timePickerExists())) { throw new Error('Expected timepicker to exist'); } }); it('should switch between with and without timefield using the browser back button', async () => { await PageObjects.discover.selectIndexPattern('without-timefield'); + await PageObjects.discover.waitForDocTableLoadingComplete(); if (await PageObjects.timePicker.timePickerExists()) { throw new Error('Expected timepicker not to exist'); } await PageObjects.discover.selectIndexPattern('with-timefield'); + await PageObjects.discover.waitForDocTableLoadingComplete(); if (!(await PageObjects.timePicker.timePickerExists())) { throw new Error('Expected timepicker to exist'); } - // Navigating back to discover + // Navigating back await browser.goBack(); + await PageObjects.discover.waitForDocTableLoadingComplete(); + await retry.waitForWithTimeout( + 'index pattern to have been switched back to "without-timefield"', + 5000, + async () => + (await testSubjects.getVisibleText('indexPattern-switch-link')) === 'without-timefield' + ); + if (await PageObjects.timePicker.timePickerExists()) { throw new Error('Expected timepicker not to exist'); }