From 6452c974db14884aef7c06ee7c131079b50c1e91 Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Tue, 11 Jul 2023 12:52:42 +0200 Subject: [PATCH 1/8] [ftr] replace timePicker UI selection with Kibana API call --- .../dashboard/group2/dashboard_filter_bar.ts | 2 -- .../apps/discover/group1/_filter_editor.ts | 3 ++- .../apps/visualize/group1/_data_table.ts | 15 +++++---------- .../apps/visualize/group3/_add_to_dashboard.ts | 12 ++++-------- .../apps/visualize/group3/_pie_chart.ts | 18 +++++------------- .../apps/visualize/group4/_tsvb_chart.ts | 6 ++++-- .../apps/visualize/group6/_tag_cloud.ts | 7 +++++-- .../replaced_vislib_chart_types/_area_chart.ts | 3 ++- .../_line_chart_split_chart.ts | 7 +++++-- .../_line_chart_split_series.ts | 7 +++++-- .../_point_series_options.ts | 7 +++++-- .../_vertical_bar_chart.ts | 16 ++++++++++++---- .../page_objects/visual_builder_page.ts | 16 +++++++++++----- 13 files changed, 65 insertions(+), 54 deletions(-) diff --git a/test/functional/apps/dashboard/group2/dashboard_filter_bar.ts b/test/functional/apps/dashboard/group2/dashboard_filter_bar.ts index 1244e179f7f6a..dc9f6db8eafa5 100644 --- a/test/functional/apps/dashboard/group2/dashboard_filter_bar.ts +++ b/test/functional/apps/dashboard/group2/dashboard_filter_bar.ts @@ -110,7 +110,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await filterBar.ensureFieldEditorModalIsClosed(); await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.dashboard.clickNewDashboard(); - await PageObjects.timePicker.setDefaultDataRange(); await elasticChart.setNewChartUiDebugFlag(true); }); @@ -198,7 +197,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await filterBar.ensureFieldEditorModalIsClosed(); await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.dashboard.clickNewDashboard(); - await PageObjects.timePicker.setDefaultDataRange(); }); it('are added when a cell magnifying glass is clicked', async function () { diff --git a/test/functional/apps/discover/group1/_filter_editor.ts b/test/functional/apps/discover/group1/_filter_editor.ts index fdc21921833f4..7e338f553d940 100644 --- a/test/functional/apps/discover/group1/_filter_editor.ts +++ b/test/functional/apps/discover/group1/_filter_editor.ts @@ -34,9 +34,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { // and load a set of makelogs data await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional'); await kibanaServer.uiSettings.replace(defaultSettings); + await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); log.debug('discover filter editor'); await PageObjects.common.navigateToApp('discover'); - await PageObjects.timePicker.setDefaultAbsoluteRange(); }); describe('filter editor', function () { @@ -169,6 +169,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { after(async () => { await security.testUser.restoreDefaults(); + await PageObjects.common.unsetTime(); }); }); } diff --git a/test/functional/apps/visualize/group1/_data_table.ts b/test/functional/apps/visualize/group1/_data_table.ts index 19af7438fe202..90936b26808a8 100644 --- a/test/functional/apps/visualize/group1/_data_table.ts +++ b/test/functional/apps/visualize/group1/_data_table.ts @@ -29,13 +29,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { before(async function () { await PageObjects.visualize.initTests(); + await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); log.debug('navigateToApp visualize'); await PageObjects.visualize.navigateToNewAggBasedVisualization(); log.debug('clickDataTable'); await PageObjects.visualize.clickDataTable(); log.debug('clickNewSearch'); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); log.debug('Bucket = Split rows'); await PageObjects.visEditor.clickBucket('Split rows'); log.debug('Aggregation = Histogram'); @@ -47,6 +47,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visEditor.clickGo(); }); + after(async () => { + await PageObjects.common.unsetTime(); + }); + it('should allow applying changed params', async () => { await PageObjects.visEditor.setInterval('1', { type: 'numeric', append: true }); const interval = await PageObjects.visEditor.getNumericInterval(); @@ -131,7 +135,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.navigateToNewAggBasedVisualization(); await PageObjects.visualize.clickDataTable(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); await PageObjects.visEditor.clickBucket('Split rows'); await PageObjects.visEditor.selectAggregation('Range'); await PageObjects.visEditor.selectField('bytes'); @@ -174,7 +177,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.navigateToNewAggBasedVisualization(); await PageObjects.visualize.clickDataTable(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); await PageObjects.visEditor.clickBucket('Metric', 'metrics'); await PageObjects.visEditor.selectAggregation('Average Bucket', 'metrics'); await PageObjects.visEditor.selectAggregation('Terms', 'metrics', true); @@ -188,7 +190,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.navigateToNewAggBasedVisualization(); await PageObjects.visualize.clickDataTable(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); await PageObjects.visEditor.clickBucket('Split rows'); await PageObjects.visEditor.selectAggregation('Date Histogram'); await PageObjects.visEditor.selectField('@timestamp'); @@ -206,7 +207,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.navigateToNewAggBasedVisualization(); await PageObjects.visualize.clickDataTable(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); await PageObjects.visEditor.clickBucket('Split rows'); await PageObjects.visEditor.selectAggregation('Date Histogram'); await PageObjects.visEditor.selectField('UTC time'); @@ -244,7 +244,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.navigateToNewAggBasedVisualization(); await PageObjects.visualize.clickDataTable(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); await PageObjects.visEditor.clickMetricEditor(); await PageObjects.visEditor.selectAggregation('Top Hit', 'metrics'); await PageObjects.visEditor.selectField('agent.raw', 'metrics'); @@ -258,7 +257,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.navigateToNewAggBasedVisualization(); await PageObjects.visualize.clickDataTable(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); await PageObjects.visEditor.clickBucket('Split rows'); await PageObjects.visEditor.selectAggregation('Range'); await PageObjects.visEditor.selectField('bytes'); @@ -275,7 +273,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.navigateToNewAggBasedVisualization(); await PageObjects.visualize.clickDataTable(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); await PageObjects.visEditor.clickBucket('Split rows'); await PageObjects.visEditor.selectAggregation('Terms'); await PageObjects.visEditor.selectField('extension.raw'); @@ -313,7 +310,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.navigateToNewAggBasedVisualization(); await PageObjects.visualize.clickDataTable(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); await PageObjects.visEditor.clickBucket('Split rows'); await PageObjects.visEditor.selectAggregation('Terms'); await PageObjects.visEditor.selectField('extension.raw'); @@ -407,7 +403,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.navigateToNewAggBasedVisualization(); await PageObjects.visualize.clickDataTable(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); await PageObjects.visEditor.clickBucket('Split table'); // split by column to make all tables rows visible await PageObjects.visEditor.clickSplitDirection('Columns'); diff --git a/test/functional/apps/visualize/group3/_add_to_dashboard.ts b/test/functional/apps/visualize/group3/_add_to_dashboard.ts index 32d329cd181da..896826c2caa07 100644 --- a/test/functional/apps/visualize/group3/_add_to_dashboard.ts +++ b/test/functional/apps/visualize/group3/_add_to_dashboard.ts @@ -28,12 +28,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('Add to Dashboard', function describeIndexTests() { before(async () => { await PageObjects.visualize.initTests(); + await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); + }); + after(async () => { + await PageObjects.common.unsetTime(); }); it('adding a new metric to a new dashboard by value', async function () { await PageObjects.visualize.navigateToNewAggBasedVisualization(); await PageObjects.visualize.clickMetric(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); await testSubjects.click('visualizeSaveButton'); @@ -57,7 +60,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.navigateToNewAggBasedVisualization(); await PageObjects.visualize.clickMetric(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); await testSubjects.click('visualizeSaveButton'); @@ -83,7 +85,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.navigateToNewAggBasedVisualization(); await PageObjects.visualize.clickMetric(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); await testSubjects.click('visualizeSaveButton'); @@ -122,7 +123,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.navigateToNewAggBasedVisualization(); await PageObjects.visualize.clickMetric(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); await testSubjects.click('visualizeSaveButton'); @@ -169,7 +169,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.navigateToNewAggBasedVisualization(); await PageObjects.visualize.clickMetric(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); await testSubjects.click('visualizeSaveButton'); @@ -200,7 +199,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.navigateToNewAggBasedVisualization(); await PageObjects.visualize.clickMetric(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); await testSubjects.click('visualizeSaveButton'); @@ -233,7 +231,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.navigateToNewAggBasedVisualization(); await PageObjects.visualize.clickMetric(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); await testSubjects.click('visualizeSaveButton'); @@ -279,7 +276,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.navigateToNewAggBasedVisualization(); await PageObjects.visualize.clickMetric(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); await testSubjects.click('visualizeSaveButton'); diff --git a/test/functional/apps/visualize/group3/_pie_chart.ts b/test/functional/apps/visualize/group3/_pie_chart.ts index e971daa18c8cb..466c82227606f 100644 --- a/test/functional/apps/visualize/group3/_pie_chart.ts +++ b/test/functional/apps/visualize/group3/_pie_chart.ts @@ -35,10 +35,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { log.debug('navigateToApp visualize'); await PageObjects.visualize.navigateToNewAggBasedVisualization(); + await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); log.debug('clickPieChart'); await PageObjects.visualize.clickPieChart(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); log.debug('select bucket Split slices'); await PageObjects.visEditor.clickBucket('Split slices'); log.debug('Click aggregation Histogram'); @@ -53,6 +53,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visEditor.clickGo(isNewChartsLibraryEnabled); }); + after(async () => { + await PageObjects.common.unsetTime(); + }); + it('should save and load', async function () { await PageObjects.visualize.saveVisualizationExpectSuccessAndBreadcrumb(vizName1); @@ -95,7 +99,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { log.debug('clickPieChart'); await PageObjects.visualize.clickPieChart(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); log.debug('select bucket Split slices'); await PageObjects.visEditor.clickBucket('Split slices'); log.debug('Click aggregation Terms'); @@ -293,7 +296,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { log.debug('clickPieChart'); await PageObjects.visualize.clickPieChart(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); log.debug('select bucket Split slices'); await PageObjects.visEditor.clickBucket('Split slices'); log.debug('Click aggregation Filters'); @@ -322,14 +324,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { log.debug('clickPieChart'); await PageObjects.visualize.clickPieChart(); await PageObjects.visualize.clickNewSearch(); - log.debug( - 'Set absolute time range from "' + - PageObjects.timePicker.defaultStartTime + - '" to "' + - PageObjects.timePicker.defaultEndTime + - '"' - ); - await PageObjects.timePicker.setDefaultAbsoluteRange(); log.debug('select bucket Split slices'); await PageObjects.visEditor.clickBucket('Split slices'); log.debug('Click aggregation Histogram'); @@ -459,7 +453,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { log.debug('clickPieChart'); await PageObjects.visualize.clickPieChart(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); log.debug('select bucket Split slices'); await PageObjects.visEditor.clickBucket('Split slices'); log.debug('Click aggregation Filters'); @@ -486,7 +479,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.navigateToNewAggBasedVisualization(); await PageObjects.visualize.clickPieChart(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); log.debug('select bucket Split chart'); await PageObjects.visEditor.clickBucket('Split chart'); await PageObjects.visEditor.selectAggregation('Terms'); diff --git a/test/functional/apps/visualize/group4/_tsvb_chart.ts b/test/functional/apps/visualize/group4/_tsvb_chart.ts index aa66ca7ece7ab..e823f6f22bfec 100644 --- a/test/functional/apps/visualize/group4/_tsvb_chart.ts +++ b/test/functional/apps/visualize/group4/_tsvb_chart.ts @@ -426,8 +426,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); describe('switch panel interval test', () => { + before(async () => { + await visualBuilder.setTime({ useUISettings: true }); + }); beforeEach(async () => { - await visualBuilder.setTime(); await visualBuilder.clickMetric(); await visualBuilder.checkMetricTabIsPresent(); await visualBuilder.clickPanelOptions('metric'); @@ -545,10 +547,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await settings.setFieldFormat('string'); await settings.setScriptedFieldStringTransform('title'); await settings.controlChangeSave(); + await visualBuilder.setTime({ useUISettings: true }); }); beforeEach(async () => { - await visualBuilder.setTime(); await visualBuilder.selectAggType('Average'); await visualBuilder.setFieldForAggregation('bytes'); await visualBuilder.setMetricsGroupByTerms('machine.os.raw'); diff --git a/test/functional/apps/visualize/group6/_tag_cloud.ts b/test/functional/apps/visualize/group6/_tag_cloud.ts index d021e8b08d43a..e1f6109c49608 100644 --- a/test/functional/apps/visualize/group6/_tag_cloud.ts +++ b/test/functional/apps/visualize/group6/_tag_cloud.ts @@ -35,12 +35,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { before(async function () { await PageObjects.visualize.initTests(); + await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); log.debug('navigateToApp visualize'); await PageObjects.visualize.navigateToNewAggBasedVisualization(); log.debug('clickTagCloud'); await PageObjects.visualize.clickTagCloud(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); log.debug('select Tags'); await PageObjects.visEditor.clickBucket('Tags'); log.debug('Click aggregation Terms'); @@ -53,6 +53,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visEditor.clickGo(); }); + after(async () => { + await PageObjects.common.unsetTime(); + }); + it('should have inspector enabled', async function () { await inspector.expectIsEnabled(); }); @@ -161,7 +165,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { navigateToVisualize: false, }); await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); await PageObjects.visChart.waitForVisualization(); }); diff --git a/test/functional/apps/visualize/replaced_vislib_chart_types/_area_chart.ts b/test/functional/apps/visualize/replaced_vislib_chart_types/_area_chart.ts index 3e765baf3ba64..50f0988575750 100644 --- a/test/functional/apps/visualize/replaced_vislib_chart_types/_area_chart.ts +++ b/test/functional/apps/visualize/replaced_vislib_chart_types/_area_chart.ts @@ -33,6 +33,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('area charts', function indexPatternCreation() { before(async () => { await PageObjects.visualize.initTests(); + await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); }); const initAreaChart = async () => { log.debug('navigateToApp visualize'); @@ -41,7 +42,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.clickAreaChart(); log.debug('clickNewSearch'); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); log.debug('Click X-axis'); await PageObjects.visEditor.clickBucket('X-axis'); log.debug('Click Date Histogram'); @@ -67,6 +67,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { after(async function () { await security.testUser.restoreDefaults(); + await PageObjects.common.unsetTime(); }); it('should save and load with special characters', async function () { diff --git a/test/functional/apps/visualize/replaced_vislib_chart_types/_line_chart_split_chart.ts b/test/functional/apps/visualize/replaced_vislib_chart_types/_line_chart_split_chart.ts index ef7e3aa916d4a..ee0653c16fc8e 100644 --- a/test/functional/apps/visualize/replaced_vislib_chart_types/_line_chart_split_chart.ts +++ b/test/functional/apps/visualize/replaced_vislib_chart_types/_line_chart_split_chart.ts @@ -32,7 +32,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { log.debug('clickLineChart'); await PageObjects.visualize.clickLineChart(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); log.debug('Bucket = Split chart'); await PageObjects.visEditor.clickBucket('Split chart'); log.debug('Aggregation = Terms'); @@ -46,9 +45,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { before(async () => { await PageObjects.visualize.initTests(); + await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); await initLineChart(); }); + after(async () => { + await PageObjects.common.unsetTime(); + }); + afterEach(async () => { await inspector.close(); }); @@ -242,7 +246,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { log.debug('clickLineChart'); await PageObjects.visualize.clickLineChart(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); }); describe('parent pipeline', () => { diff --git a/test/functional/apps/visualize/replaced_vislib_chart_types/_line_chart_split_series.ts b/test/functional/apps/visualize/replaced_vislib_chart_types/_line_chart_split_series.ts index 8583220d76a5c..b15f264e144e1 100644 --- a/test/functional/apps/visualize/replaced_vislib_chart_types/_line_chart_split_series.ts +++ b/test/functional/apps/visualize/replaced_vislib_chart_types/_line_chart_split_series.ts @@ -32,7 +32,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { log.debug('clickLineChart'); await PageObjects.visualize.clickLineChart(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); log.debug('Bucket = Split chart'); await PageObjects.visEditor.clickBucket('Split series'); log.debug('Aggregation = Terms'); @@ -44,9 +43,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { before(async () => { await PageObjects.visualize.initTests(); + await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); await initLineChart(); }); + after(async () => { + await PageObjects.common.unsetTime(); + }); + afterEach(async () => { await inspector.close(); }); @@ -240,7 +244,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { log.debug('clickLineChart'); await PageObjects.visualize.clickLineChart(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); }); describe('parent pipeline', () => { diff --git a/test/functional/apps/visualize/replaced_vislib_chart_types/_point_series_options.ts b/test/functional/apps/visualize/replaced_vislib_chart_types/_point_series_options.ts index d093959f45405..6fdaa4d5a0189 100644 --- a/test/functional/apps/visualize/replaced_vislib_chart_types/_point_series_options.ts +++ b/test/functional/apps/visualize/replaced_vislib_chart_types/_point_series_options.ts @@ -33,7 +33,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { log.debug('clickLineChart'); await PageObjects.visualize.clickLineChart(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); log.debug('Bucket = X-axis'); await PageObjects.visEditor.clickBucket('X-axis'); log.debug('Aggregation = Date Histogram'); @@ -64,9 +63,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('point series', function describeIndexTests() { before(async () => { await PageObjects.visualize.initTests(); + await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); await initChart(); }); + after(async () => { + await PageObjects.common.unsetTime(); + }); + describe('secondary value axis', function () { it('should show correct chart', async function () { const expectedChartValues = [ @@ -158,7 +162,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.navigateToNewAggBasedVisualization(); await PageObjects.visualize.clickVerticalBarChart(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); log.debug('Bucket = X-axis'); await PageObjects.visEditor.clickBucket('X-axis'); log.debug('Aggregation = Terms'); diff --git a/test/functional/apps/visualize/replaced_vislib_chart_types/_vertical_bar_chart.ts b/test/functional/apps/visualize/replaced_vislib_chart_types/_vertical_bar_chart.ts index 12a7f62a2801d..6e5d26d52f6e8 100644 --- a/test/functional/apps/visualize/replaced_vislib_chart_types/_vertical_bar_chart.ts +++ b/test/functional/apps/visualize/replaced_vislib_chart_types/_vertical_bar_chart.ts @@ -16,13 +16,24 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const inspector = getService('inspector'); const testSubjects = getService('testSubjects'); const filterBar = getService('filterBar'); - const PageObjects = getPageObjects(['visualize', 'visEditor', 'visChart', 'timePicker']); + const PageObjects = getPageObjects([ + 'visualize', + 'visEditor', + 'visChart', + 'timePicker', + 'common', + ]); const xyChartSelector = 'xyVisChart'; describe('vertical bar chart', function () { before(async () => { await PageObjects.visualize.initTests(); + await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); + }); + + after(async () => { + await PageObjects.common.unsetTime(); }); const vizName1 = 'Visualization VerticalBarChart'; @@ -33,7 +44,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { log.debug('clickVerticalBarChart'); await PageObjects.visualize.clickVerticalBarChart(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); log.debug('Bucket = X-Axis'); await PageObjects.visEditor.clickBucket('X-axis'); log.debug('Aggregation = Date Histogram'); @@ -64,7 +74,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.navigateToNewAggBasedVisualization(); await PageObjects.visualize.clickVerticalBarChart(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); await PageObjects.visEditor.clickBucket('X-axis'); await PageObjects.visEditor.selectAggregation('Date Range'); await PageObjects.visEditor.selectField('@timestamp'); @@ -88,7 +97,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.navigateToNewAggBasedVisualization(); await PageObjects.visualize.clickVerticalBarChart(); await PageObjects.visualize.clickNewSearch(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); await PageObjects.visEditor.clickBucket('X-axis'); log.debug('Aggregation = Date Range'); await PageObjects.visEditor.selectAggregation('Date Range'); diff --git a/test/functional/page_objects/visual_builder_page.ts b/test/functional/page_objects/visual_builder_page.ts index d91a21045f421..9035f39da8527 100644 --- a/test/functional/page_objects/visual_builder_page.ts +++ b/test/functional/page_objects/visual_builder_page.ts @@ -43,14 +43,20 @@ export class VisualBuilderPageObject extends FtrService { await this.visualize.navigateToNewVisualization(); await this.visualize.clickVisualBuilder(); await this.checkVisualBuilderIsPresent(); - await this.setTime(fromTime, toTime); + await this.setTime({ fromTime, toTime }); } - public async setTime( + public async setTime({ fromTime = 'Sep 19, 2015 @ 06:31:44.000', - toTime = 'Sep 22, 2015 @ 18:31:44.000' - ) { - await this.timePicker.setAbsoluteRange(fromTime, toTime); + toTime = 'Sep 22, 2015 @ 18:31:44.000', + useUISettings = false, + } = {}) { + if (useUISettings) { + await this.common.setTime({ from: fromTime, to: toTime }); + } + { + await this.timePicker.setAbsoluteRange(fromTime, toTime); + } } public async checkTabIsLoaded(testSubj: string, name: string) { From b8994b8a418f5305958381cff25ea20a772a6504 Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Tue, 11 Jul 2023 12:55:31 +0200 Subject: [PATCH 2/8] revert changes in dashboard test --- test/functional/apps/dashboard/group2/dashboard_filter_bar.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/functional/apps/dashboard/group2/dashboard_filter_bar.ts b/test/functional/apps/dashboard/group2/dashboard_filter_bar.ts index dc9f6db8eafa5..1244e179f7f6a 100644 --- a/test/functional/apps/dashboard/group2/dashboard_filter_bar.ts +++ b/test/functional/apps/dashboard/group2/dashboard_filter_bar.ts @@ -110,6 +110,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await filterBar.ensureFieldEditorModalIsClosed(); await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.dashboard.clickNewDashboard(); + await PageObjects.timePicker.setDefaultDataRange(); await elasticChart.setNewChartUiDebugFlag(true); }); @@ -197,6 +198,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await filterBar.ensureFieldEditorModalIsClosed(); await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.dashboard.clickNewDashboard(); + await PageObjects.timePicker.setDefaultDataRange(); }); it('are added when a cell magnifying glass is clicked', async function () { From 754c3b5f0e0b009e89d73f37a755e36e17fffed8 Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Tue, 11 Jul 2023 13:05:26 +0200 Subject: [PATCH 3/8] remove extra calls --- test/functional/apps/visualize/group4/_tsvb_chart.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/functional/apps/visualize/group4/_tsvb_chart.ts b/test/functional/apps/visualize/group4/_tsvb_chart.ts index e823f6f22bfec..02ebf6b32f85e 100644 --- a/test/functional/apps/visualize/group4/_tsvb_chart.ts +++ b/test/functional/apps/visualize/group4/_tsvb_chart.ts @@ -35,6 +35,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await common.setTime({ from, to }); }); + after(async () => { + await common.unsetTime(); + }); + beforeEach(async () => { await security.testUser.setRoles( ['kibana_admin', 'test_logstash_reader', 'kibana_sample_admin'], @@ -426,9 +430,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); describe('switch panel interval test', () => { - before(async () => { - await visualBuilder.setTime({ useUISettings: true }); - }); beforeEach(async () => { await visualBuilder.clickMetric(); await visualBuilder.checkMetricTabIsPresent(); @@ -547,7 +548,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await settings.setFieldFormat('string'); await settings.setScriptedFieldStringTransform('title'); await settings.controlChangeSave(); - await visualBuilder.setTime({ useUISettings: true }); }); beforeEach(async () => { From 022bbe5b0b9913e05604d28dec7fb565d0cc5469 Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Tue, 11 Jul 2023 13:08:09 +0200 Subject: [PATCH 4/8] revert changes in /visual_builder_page --- .../page_objects/visual_builder_page.ts | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/test/functional/page_objects/visual_builder_page.ts b/test/functional/page_objects/visual_builder_page.ts index 9035f39da8527..d91a21045f421 100644 --- a/test/functional/page_objects/visual_builder_page.ts +++ b/test/functional/page_objects/visual_builder_page.ts @@ -43,20 +43,14 @@ export class VisualBuilderPageObject extends FtrService { await this.visualize.navigateToNewVisualization(); await this.visualize.clickVisualBuilder(); await this.checkVisualBuilderIsPresent(); - await this.setTime({ fromTime, toTime }); + await this.setTime(fromTime, toTime); } - public async setTime({ + public async setTime( fromTime = 'Sep 19, 2015 @ 06:31:44.000', - toTime = 'Sep 22, 2015 @ 18:31:44.000', - useUISettings = false, - } = {}) { - if (useUISettings) { - await this.common.setTime({ from: fromTime, to: toTime }); - } - { - await this.timePicker.setAbsoluteRange(fromTime, toTime); - } + toTime = 'Sep 22, 2015 @ 18:31:44.000' + ) { + await this.timePicker.setAbsoluteRange(fromTime, toTime); } public async checkTabIsLoaded(testSubj: string, name: string) { From 7e32d00ce7430233fe822320c0b224a7fff85c82 Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Tue, 11 Jul 2023 13:25:14 +0200 Subject: [PATCH 5/8] convert more tests --- .../discover/feature_controls/discover_spaces.ts | 8 ++------ .../functional/apps/discover/value_suggestions.ts | 2 ++ .../test/functional/apps/infra/metrics_explorer.ts | 14 ++++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts b/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts index af10d98352128..d93ea2ea983a6 100644 --- a/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts +++ b/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts @@ -25,10 +25,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const appsMenu = getService('appsMenu'); const kibanaServer = getService('kibanaServer'); - async function setDiscoverTimeRange() { - await PageObjects.timePicker.setDefaultAbsoluteRange(); - } - describe('spaces', () => { before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); @@ -50,6 +46,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { name: 'custom_space', disabledFeatures: [], }); + await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); }); after(async () => { @@ -61,6 +58,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await kibanaServer.importExport.unload( 'x-pack/test/functional/fixtures/kbn_archiver/discover/feature_controls/spaces' ); + await PageObjects.common.unsetTime(); }); it('shows discover navlink', async () => { @@ -84,7 +82,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('discover', { basePath: '/s/custom_space', }); - await setDiscoverTimeRange(); await PageObjects.unifiedFieldList.clickFieldListItem('bytes'); await PageObjects.unifiedFieldList.expectFieldListItemVisualize('bytes'); }); @@ -154,7 +151,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('discover', { basePath: '/s/custom_space', }); - await setDiscoverTimeRange(); await PageObjects.unifiedFieldList.clickFieldListItem('bytes'); await PageObjects.unifiedFieldList.expectMissingFieldListItemVisualize('bytes'); }); diff --git a/x-pack/test/functional/apps/discover/value_suggestions.ts b/x-pack/test/functional/apps/discover/value_suggestions.ts index 41d1b071b6b0d..8d0c0ac5a969a 100644 --- a/x-pack/test/functional/apps/discover/value_suggestions.ts +++ b/x-pack/test/functional/apps/discover/value_suggestions.ts @@ -36,10 +36,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await kibanaServer.uiSettings.update({ 'doc_table:legacy': false, }); + await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); }); after(async () => { await kibanaServer.uiSettings.unset('doc_table:legacy'); + await PageObjects.common.unsetTime(); await kibanaServer.savedObjects.cleanStandardList(); }); diff --git a/x-pack/test/functional/apps/infra/metrics_explorer.ts b/x-pack/test/functional/apps/infra/metrics_explorer.ts index d957db48742af..bbcf6e6a16afa 100644 --- a/x-pack/test/functional/apps/infra/metrics_explorer.ts +++ b/x-pack/test/functional/apps/infra/metrics_explorer.ts @@ -21,7 +21,6 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { 'common', 'infraHome', 'infraMetricsExplorer', - 'timePicker', 'infraSavedViews', ]); const testSubjects = getService('testSubjects'); @@ -37,12 +36,15 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await esArchiver.load('x-pack/test/functional/es_archives/infra/metrics_and_logs'); await pageObjects.common.navigateToApp('infraOps'); await pageObjects.infraHome.goToMetricExplorer(); - await pageObjects.timePicker.setAbsoluteRange( - START_DATE.format(timepickerFormat), - END_DATE.format(timepickerFormat) - ); + await pageObjects.common.setTime({ + from: START_DATE.format(timepickerFormat), + to: END_DATE.format(timepickerFormat), + }); + }); + after(async () => { + await esArchiver.unload('x-pack/test/functional/es_archives/infra/metrics_and_logs'); + await pageObjects.common.unsetTime(); }); - after(() => esArchiver.unload('x-pack/test/functional/es_archives/infra/metrics_and_logs')); it('should render the correct page title', async () => { const documentTitle = await browser.getTitle(); From 5bfffc5b188227b59b3333720114dc65b8d90d2b Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Tue, 11 Jul 2023 15:00:33 +0200 Subject: [PATCH 6/8] revert infra test changes --- x-pack/test/functional/apps/infra/metrics_explorer.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/x-pack/test/functional/apps/infra/metrics_explorer.ts b/x-pack/test/functional/apps/infra/metrics_explorer.ts index bbcf6e6a16afa..79f2358422843 100644 --- a/x-pack/test/functional/apps/infra/metrics_explorer.ts +++ b/x-pack/test/functional/apps/infra/metrics_explorer.ts @@ -21,6 +21,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { 'common', 'infraHome', 'infraMetricsExplorer', + 'timePicker', 'infraSavedViews', ]); const testSubjects = getService('testSubjects'); @@ -36,14 +37,13 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await esArchiver.load('x-pack/test/functional/es_archives/infra/metrics_and_logs'); await pageObjects.common.navigateToApp('infraOps'); await pageObjects.infraHome.goToMetricExplorer(); - await pageObjects.common.setTime({ - from: START_DATE.format(timepickerFormat), - to: END_DATE.format(timepickerFormat), - }); + await pageObjects.timePicker.setAbsoluteRange( + START_DATE.format(timepickerFormat), + END_DATE.format(timepickerFormat) + ); }); after(async () => { await esArchiver.unload('x-pack/test/functional/es_archives/infra/metrics_and_logs'); - await pageObjects.common.unsetTime(); }); it('should render the correct page title', async () => { From 2466a80b128616eaabfec974b26b30dcc60b1448 Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Tue, 11 Jul 2023 15:09:25 +0200 Subject: [PATCH 7/8] rever changes in discover_spaces --- .../apps/discover/feature_controls/discover_spaces.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts b/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts index d93ea2ea983a6..af10d98352128 100644 --- a/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts +++ b/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts @@ -25,6 +25,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const appsMenu = getService('appsMenu'); const kibanaServer = getService('kibanaServer'); + async function setDiscoverTimeRange() { + await PageObjects.timePicker.setDefaultAbsoluteRange(); + } + describe('spaces', () => { before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); @@ -46,7 +50,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { name: 'custom_space', disabledFeatures: [], }); - await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); }); after(async () => { @@ -58,7 +61,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await kibanaServer.importExport.unload( 'x-pack/test/functional/fixtures/kbn_archiver/discover/feature_controls/spaces' ); - await PageObjects.common.unsetTime(); }); it('shows discover navlink', async () => { @@ -82,6 +84,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('discover', { basePath: '/s/custom_space', }); + await setDiscoverTimeRange(); await PageObjects.unifiedFieldList.clickFieldListItem('bytes'); await PageObjects.unifiedFieldList.expectFieldListItemVisualize('bytes'); }); @@ -151,6 +154,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('discover', { basePath: '/s/custom_space', }); + await setDiscoverTimeRange(); await PageObjects.unifiedFieldList.clickFieldListItem('bytes'); await PageObjects.unifiedFieldList.expectMissingFieldListItemVisualize('bytes'); }); From d19f19371eb61a057569425e004f1749bbe3deeb Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Tue, 11 Jul 2023 15:37:42 +0200 Subject: [PATCH 8/8] Update metrics_explorer.ts --- x-pack/test/functional/apps/infra/metrics_explorer.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/x-pack/test/functional/apps/infra/metrics_explorer.ts b/x-pack/test/functional/apps/infra/metrics_explorer.ts index 79f2358422843..d957db48742af 100644 --- a/x-pack/test/functional/apps/infra/metrics_explorer.ts +++ b/x-pack/test/functional/apps/infra/metrics_explorer.ts @@ -42,9 +42,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { END_DATE.format(timepickerFormat) ); }); - after(async () => { - await esArchiver.unload('x-pack/test/functional/es_archives/infra/metrics_and_logs'); - }); + after(() => esArchiver.unload('x-pack/test/functional/es_archives/infra/metrics_and_logs')); it('should render the correct page title', async () => { const documentTitle = await browser.getTitle();