diff --git a/test/functional/page_objects/visualize_page.ts b/test/functional/page_objects/visualize_page.ts index ceae95f637493..521d2afe578c4 100644 --- a/test/functional/page_objects/visualize_page.ts +++ b/test/functional/page_objects/visualize_page.ts @@ -66,8 +66,30 @@ export class VisualizePageObject extends FtrService { }); } - public async gotoVisualizationLandingPage() { - await this.common.navigateToApp('visualize'); + /** + * Try to speed resets a bit if the Visualize Library breadcrumb is available + */ + private async clickOnVisualizeLibraryBreadcrumb() { + // Try to navigate to the Visualize Listing page from breadcrumb if available + const selector = '[data-test-subj="breadcrumb first"][title="Visualize Library"]'; + const visualizeLibraryBreadcrumb = await this.find.existsByCssSelector(selector); + if (visualizeLibraryBreadcrumb) { + await this.find.clickByCssSelector(selector); + // Lens offers a last modal before leaving the page for unsaved charts + // so close it as quick as possible + if (await this.testSubjects.exists('confirmModalConfirmButton')) { + await this.testSubjects.click('confirmModalConfirmButton'); + return true; + } + } + } + + public async gotoVisualizationLandingPage( + { forceRefresh }: { forceRefresh: boolean } = { forceRefresh: false } + ) { + if (forceRefresh || !(await this.clickOnVisualizeLibraryBreadcrumb())) { + await this.common.navigateToApp('visualize'); + } } public async selectVisualizationsTab() { @@ -142,8 +164,15 @@ export class VisualizePageObject extends FtrService { }); } - public async navigateToNewVisualization() { - await this.gotoVisualizationLandingPage(); + /** + * Navigation now happens without URL refresh by default + * so a new "forceRefresh" option has been passed in order to + * address those scenarios where a full refresh is required (i.e. changing default settings) + */ + public async navigateToNewVisualization( + options: { forceRefresh: boolean } = { forceRefresh: false } + ) { + await this.gotoVisualizationLandingPage(options); await this.header.waitUntilLoadingHasFinished(); await this.clickNewVisualization(); await this.waitForGroupsSelectPage(); @@ -158,8 +187,7 @@ export class VisualizePageObject extends FtrService { } public async navigateToLensFromAnotherVisualization() { - const button = await this.testSubjects.find('visualizeEditInLensButton'); - await button.click(); + await this.testSubjects.click('visualizeEditInLensButton'); } public async hasNavigateToLensButton() { diff --git a/x-pack/test/functional/apps/lens/group5/geo_field.ts b/x-pack/test/functional/apps/lens/group5/geo_field.ts index 790160a4b1bba..98008e3b7bb12 100644 --- a/x-pack/test/functional/apps/lens/group5/geo_field.ts +++ b/x-pack/test/functional/apps/lens/group5/geo_field.ts @@ -30,7 +30,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('should visualize geo fields in maps', async () => { - await PageObjects.visualize.navigateToNewVisualization(); + // as navigation does not happen via URL refresh by default, force a reset via URL navigation + await PageObjects.visualize.navigateToNewVisualization({ forceRefresh: true }); await PageObjects.visualize.clickVisType('lens'); await PageObjects.lens.switchDataPanelIndexPattern('logstash-*'); await PageObjects.header.waitUntilLoadingHasFinished(); diff --git a/x-pack/test/functional/apps/lens/open_in_lens/tsvb/dashboard.ts b/x-pack/test/functional/apps/lens/open_in_lens/tsvb/dashboard.ts index e5a2a8f6a8971..24fac3f726bc9 100644 --- a/x-pack/test/functional/apps/lens/open_in_lens/tsvb/dashboard.ts +++ b/x-pack/test/functional/apps/lens/open_in_lens/tsvb/dashboard.ts @@ -28,8 +28,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const dashboardAddPanel = getService('dashboardAddPanel'); const filterBar = getService('filterBar'); - // FLAKY: https://github.com/elastic/kibana/issues/179307 - describe.skip('Dashboard to TSVB to Lens', function describeIndexTests() { + describe('Dashboard to TSVB to Lens', function describeIndexTests() { before(async () => { await visualize.initTests(); }); diff --git a/x-pack/test/functional/apps/lens/open_in_lens/tsvb/index.ts b/x-pack/test/functional/apps/lens/open_in_lens/tsvb/index.ts index 90b0eb2c88186..b48211b1af938 100644 --- a/x-pack/test/functional/apps/lens/open_in_lens/tsvb/index.ts +++ b/x-pack/test/functional/apps/lens/open_in_lens/tsvb/index.ts @@ -52,11 +52,12 @@ export default function ({ loadTestFile, getService, getPageObjects }: FtrProvid } await esNode.load(esArchive); - // changing the timepicker default here saves us from having to set it in Discover (~8s) - await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); await kibanaServer.uiSettings.update({ defaultIndex: indexPatternString, 'dateFormat:tz': 'UTC', + // changing the timepicker default here saves us from having to set it in Discover (~8s) + // The TSVB tests are using a slightly difference end date, so it needs to be set manually here + 'timepicker:timeDefaults': `{ "from": "${PageObjects.timePicker.defaultStartTime}", "to": "Sep 22, 2015 @ 18:31:44.000" }`, }); await kibanaServer.importExport.load(fixtureDirs.lensBasic); await kibanaServer.importExport.load(fixtureDirs.lensDefault);