Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ftr] migrate time picker GUI selection to uiSettings API call #161642

Merged
merged 9 commits into from
Jul 12, 2023
3 changes: 2 additions & 1 deletion test/functional/apps/discover/group1/_filter_editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -169,6 +169,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

after(async () => {
await security.testUser.restoreDefaults();
await PageObjects.common.unsetTime();
});
});
}
15 changes: 5 additions & 10 deletions test/functional/apps/visualize/group1/_data_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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();
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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);
Expand All @@ -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');
Expand All @@ -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');
Expand Down Expand Up @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand Down
12 changes: 4 additions & 8 deletions test/functional/apps/visualize/group3/_add_to_dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand All @@ -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');

Expand All @@ -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');

Expand Down Expand Up @@ -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');

Expand Down Expand Up @@ -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');

Expand Down Expand Up @@ -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');

Expand Down Expand Up @@ -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');

Expand Down Expand Up @@ -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');

Expand Down
18 changes: 5 additions & 13 deletions test/functional/apps/visualize/group3/_pie_chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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);

Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand All @@ -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');
Expand Down
6 changes: 4 additions & 2 deletions test/functional/apps/visualize/group4/_tsvb_chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down Expand Up @@ -427,7 +431,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

describe('switch panel interval test', () => {
beforeEach(async () => {
await visualBuilder.setTime();
await visualBuilder.clickMetric();
await visualBuilder.checkMetricTabIsPresent();
await visualBuilder.clickPanelOptions('metric');
Expand Down Expand Up @@ -548,7 +551,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

beforeEach(async () => {
await visualBuilder.setTime();
await visualBuilder.selectAggType('Average');
await visualBuilder.setFieldForAggregation('bytes');
await visualBuilder.setMetricsGroupByTerms('machine.os.raw');
Expand Down
7 changes: 5 additions & 2 deletions test/functional/apps/visualize/group6/_tag_cloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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();
});
Expand Down Expand Up @@ -161,7 +165,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
navigateToVisualize: false,
});
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.timePicker.setDefaultAbsoluteRange();
await PageObjects.visChart.waitForVisualization();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
Expand All @@ -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 () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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();
});
Expand Down Expand Up @@ -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', () => {
Expand Down
Loading