diff --git a/x-pack/test/functional/apps/lens/group1/ad_hoc_data_view.ts b/x-pack/test/functional/apps/lens/group1/ad_hoc_data_view.ts index a97577696b0c6..4af556b8c83b8 100644 --- a/x-pack/test/functional/apps/lens/group1/ad_hoc_data_view.ts +++ b/x-pack/test/functional/apps/lens/group1/ad_hoc_data_view.ts @@ -73,6 +73,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expect(await dataViews.isAdHoc()).to.be(true); }; + const waitForPageReady = async () => { + await PageObjects.header.waitUntilLoadingHasFinished(); + await retry.waitFor('page ready after refresh', async () => { + const queryBarVisible = await testSubjects.exists('globalQueryBar'); + return queryBarVisible; + }); + }; + describe('lens ad hoc data view tests', () => { it('should allow building a chart based on ad hoc data view', async () => { await setupAdHocDataView(); @@ -225,9 +233,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const [lensHandle] = await browser.getAllWindowHandles(); await browser.switchToWindow(lensHandle); }); - - // Failing: See https://github.com/elastic/kibana/issues/164623 - it.skip('should navigate to discover from embeddable correctly', async () => { + it('should navigate to discover from embeddable correctly', async () => { const [lensHandle] = await browser.getAllWindowHandles(); await browser.switchToWindow(lensHandle); await PageObjects.header.waitUntilLoadingHasFinished(); @@ -247,6 +253,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { 'new' ); + await PageObjects.header.waitUntilLoadingHasFinished(); await checkDiscoverNavigationResult(); await browser.closeCurrentWindow(); @@ -256,6 +263,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { // adhoc data view should be persisted after refresh await browser.refresh(); + await waitForPageReady(); await checkDiscoverNavigationResult(); await browser.closeCurrentWindow();