diff --git a/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer_grid_in_dashboard.ts b/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer_grid_in_dashboard.ts index 83b54ad5be8af..501f4fec92bf5 100644 --- a/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer_grid_in_dashboard.ts +++ b/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer_grid_in_dashboard.ts @@ -20,6 +20,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { function runTests(testData: TestData) { const savedSearchTitle = `Field stats for ${testData.suiteTitle} ${Date.now()}`; const dashboardTitle = `Dashboard for ${testData.suiteTitle} ${Date.now()}`; + const startTime = 'Jan 1, 2016 @ 00:00:00.000'; + const endTime = 'Nov 1, 2020 @ 00:00:00.000'; describe(`with ${testData.suiteTitle}`, function () { after(async function () { @@ -40,10 +42,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { testData.sourceIndexOrSavedSearch ); } - await PageObjects.timePicker.setAbsoluteRange( - 'Jan 1, 2016 @ 00:00:00.000', - 'Nov 1, 2020 @ 00:00:00.000' - ); + await PageObjects.timePicker.setAbsoluteRange(startTime, endTime); await PageObjects.discover.assertViewModeToggleExists(); await PageObjects.discover.clickViewModeFieldStatsButton(); @@ -58,10 +57,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dashboardAddPanel.addSavedSearch(savedSearchTitle); await PageObjects.dashboard.waitForRenderComplete(); - await PageObjects.timePicker.setAbsoluteRange( - 'Jan 1, 2016 @ 00:00:00.000', - 'Nov 1, 2020 @ 00:00:00.000' - ); + await PageObjects.timePicker.setAbsoluteRange(startTime, endTime); await PageObjects.dashboard.waitForRenderComplete(); for (const fieldRow of testData.expected.metricFields as Array< @@ -100,10 +96,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dashboardAddPanel.addSavedSearch(savedSearchTitle); await PageObjects.dashboard.waitForRenderComplete(); - await PageObjects.timePicker.setAbsoluteRange( - 'Jan 1, 2016 @ 00:00:00.000', - 'Nov 1, 2020 @ 00:00:00.000' - ); + await PageObjects.timePicker.setAbsoluteRange(startTime, endTime); await PageObjects.dashboard.waitForRenderComplete(); await PageObjects.discover.assertFieldStatsTableNotExists(); diff --git a/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer_grid_in_discover.ts b/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer_grid_in_discover.ts index 0fda87e23fa0c..fff2c6fdbf232 100644 --- a/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer_grid_in_discover.ts +++ b/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer_grid_in_discover.ts @@ -23,6 +23,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const ml = getService('ml'); const retry = getService('retry'); + const startTime = 'Jan 1, 2016 @ 00:00:00.000'; + const endTime = 'Nov 1, 2020 @ 00:00:00.000'; + function runTestsWhenDisabled(testData: TestData) { it('should not show view mode toggle or Field stats table', async function () { await PageObjects.common.navigateToApp('discover'); @@ -34,10 +37,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await ml.dashboardEmbeddables.selectDiscoverIndexPattern(testData.sourceIndexOrSavedSearch); } - await PageObjects.timePicker.setAbsoluteRange( - 'Jan 1, 2016 @ 00:00:00.000', - 'Nov 1, 2020 @ 00:00:00.000' - ); + await PageObjects.timePicker.setAbsoluteRange(startTime, endTime); await PageObjects.discover.assertViewModeToggleNotExists(); await PageObjects.discover.assertFieldStatsTableNotExists(); @@ -57,10 +57,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { testData.sourceIndexOrSavedSearch ); } - await PageObjects.timePicker.setAbsoluteRange( - 'Jan 1, 2016 @ 00:00:00.000', - 'Nov 1, 2020 @ 00:00:00.000' - ); + await PageObjects.timePicker.setAbsoluteRange(startTime, endTime); await PageObjects.discover.assertHitCount(testData.expected.totalDocCountFormatted); await PageObjects.discover.assertViewModeToggleExists();