diff --git a/test/functional/apps/discover/group1/_shared_links.ts b/test/functional/apps/discover/group1/_shared_links.ts index e8f79ea1b427a..c6269cabfda98 100644 --- a/test/functional/apps/discover/group1/_shared_links.ts +++ b/test/functional/apps/discover/group1/_shared_links.ts @@ -33,11 +33,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { baseUrl = baseUrl.replace(':80', '').replace(':443', ''); log.debug('New baseUrl = ' + baseUrl); - // delete .kibana index and update configDoc - await kibanaServer.uiSettings.replace({ - defaultIndex: 'logstash-*', - }); - log.debug('load kibana index with default index pattern'); await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] }); await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover.json'); @@ -45,17 +40,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await kibanaServer.uiSettings.replace({ 'state:storeInSessionStorage': storeStateInSessionStorage, + defaultIndex: 'logstash-*', }); + await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); - log.debug('discover'); await PageObjects.common.navigateToApp('discover'); - - await PageObjects.timePicker.setDefaultAbsoluteRange(); - - // After hiding the time picker, we need to wait for - // the refresh button to hide before clicking the share button - await PageObjects.common.sleep(1000); - await PageObjects.share.clickShareTopNavButton(); return async () => { @@ -144,8 +133,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); - // FLAKY: https://github.com/elastic/kibana/issues/167405 - describe.skip('shared links with state in sessionStorage', async () => { + describe('shared links with state in sessionStorage', async () => { let teardown: () => Promise; before(async function () { teardown = await setup({ storeStateInSessionStorage: true }); @@ -168,31 +156,29 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await browser.clearSessionStorage(); await browser.get(actualUrl, false); - await retry.waitFor('shortUrl resolves and opens', async () => { + await retry.try(async () => { const resolvedUrl = await browser.getCurrentUrl(); expect(resolvedUrl).to.match(/discover/); const resolvedTime = await PageObjects.timePicker.getTimeConfig(); expect(resolvedTime.start).to.equal(actualTime.start); expect(resolvedTime.end).to.equal(actualTime.end); - await toasts.dismissAllToasts(); - return true; }); + await toasts.dismissAllToasts(); }); it("sharing hashed url shouldn't crash the app", async () => { const currentUrl = await browser.getCurrentUrl(); - await browser.clearSessionStorage(); - await browser.get(currentUrl, false); - await retry.waitFor('discover to open', async () => { + await retry.try(async () => { + await browser.clearSessionStorage(); + await browser.get(currentUrl, false); const resolvedUrl = await browser.getCurrentUrl(); expect(resolvedUrl).to.match(/discover/); - const { message } = await toasts.getErrorToast(); - expect(message).to.contain( + const { title } = await toasts.getErrorToast(1, true); + expect(title).to.contain( 'Unable to completely restore the URL, be sure to use the share functionality.' ); - await toasts.dismissAllToasts(); - return true; }); + await toasts.dismissAllToasts(); }); }); }); diff --git a/test/functional/services/toasts.ts b/test/functional/services/toasts.ts index ea105eb82fa93..a4d3b2dd3e457 100644 --- a/test/functional/services/toasts.ts +++ b/test/functional/services/toasts.ts @@ -19,12 +19,16 @@ export class ToastsService extends FtrService { * an additional button, that should not be part of the message. * * @param index The index of the toast (1-based, NOT 0-based!) of the toast. Use first by default. + * @param titleOnly If this is true, only the title of the error message is returned. There are error messages that only contain a title, no message. * @returns The title and message of the specified error toast.https://github.com/elastic/kibana/issues/17087 */ - public async getErrorToast(index: number = 1) { + public async getErrorToast(index: number = 1, titleOnly: boolean = false) { const toast = await this.getToastElement(index); const titleElement = await this.testSubjects.findDescendant('euiToastHeader', toast); const title: string = await titleElement.getVisibleText(); + if (titleOnly) { + return { title }; + } const messageElement = await this.testSubjects.findDescendant('errorToastMessage', toast); const message: string = await messageElement.getVisibleText(); return { title, message };