From e8eb295b291c41c7c27e5f5386bbbc27d0f82109 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Wed, 22 Dec 2021 11:08:45 +0100 Subject: [PATCH] [Discover] Unskip `indexpattern without timefield` functional tests (#121505) --- .../_indexpattern_without_timefield.ts | 40 +++++++++++-------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/test/functional/apps/discover/_indexpattern_without_timefield.ts b/test/functional/apps/discover/_indexpattern_without_timefield.ts index 42291691f3f5f..6d6e1af7b2fbc 100644 --- a/test/functional/apps/discover/_indexpattern_without_timefield.ts +++ b/test/functional/apps/discover/_indexpattern_without_timefield.ts @@ -17,8 +17,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const testSubjects = getService('testSubjects'); const PageObjects = getPageObjects(['common', 'timePicker', 'discover']); - // FLAKY 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( @@ -66,28 +65,37 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { 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 retry.waitForWithTimeout( + 'The timepicker not to exist', + 5000, + async () => !(await PageObjects.timePicker.timePickerExists()) + ); await PageObjects.discover.selectIndexPattern('with-timefield'); await PageObjects.discover.waitForDocTableLoadingComplete(); - if (!(await PageObjects.timePicker.timePickerExists())) { - throw new Error('Expected timepicker to exist'); - } - // Navigating back - await browser.goBack(); - await PageObjects.discover.waitForDocTableLoadingComplete(); + await retry.waitForWithTimeout( + 'The timepicker to exist', + 5000, + async () => await PageObjects.timePicker.timePickerExists() + ); await retry.waitForWithTimeout( 'index pattern to have been switched back to "without-timefield"', 5000, - async () => - (await testSubjects.getVisibleText('indexPattern-switch-link')) === 'without-timefield' + async () => { + // Navigating back + await browser.goBack(); + await PageObjects.discover.waitForDocTableLoadingComplete(); + return ( + (await testSubjects.getVisibleText('indexPattern-switch-link')) === 'without-timefield' + ); + } ); - if (await PageObjects.timePicker.timePickerExists()) { - throw new Error('Expected timepicker not to exist'); - } + await retry.waitForWithTimeout( + 'The timepicker not to exist', + 5000, + async () => !(await PageObjects.timePicker.timePickerExists()) + ); }); }); }