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

[8.0] [QA][refactor] Use ui settings - discover histogram (#114997) #118752

Merged
merged 1 commit into from
Nov 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions test/functional/apps/discover/_discover_histogram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
import { TimeStrings } from '../../page_objects/common_page';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
Expand Down Expand Up @@ -40,10 +41,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
'test/functional/fixtures/es_archiver/long_window_logstash_index_pattern'
);
await security.testUser.restoreDefaults();
await PageObjects.common.unsetTime();
});

async function prepareTest(fromTime: string, toTime: string, interval?: string) {
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
async function prepareTest(time: TimeStrings, interval?: string) {
await PageObjects.common.setTime(time);
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.waitUntilSearchingHasFinished();
if (interval) {
await PageObjects.discover.setChartInterval(interval);
Expand All @@ -52,32 +55,32 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}

it('should visualize monthly data with different day intervals', async () => {
const fromTime = 'Nov 1, 2017 @ 00:00:00.000';
const toTime = 'Mar 21, 2018 @ 00:00:00.000';
await prepareTest(fromTime, toTime, 'Month');
const from = 'Nov 1, 2017 @ 00:00:00.000';
const to = 'Mar 21, 2018 @ 00:00:00.000';
await prepareTest({ from, to }, 'Month');
const chartCanvasExist = await elasticChart.canvasExists();
expect(chartCanvasExist).to.be(true);
});
it('should visualize weekly data with within DST changes', async () => {
const fromTime = 'Mar 1, 2018 @ 00:00:00.000';
const toTime = 'May 1, 2018 @ 00:00:00.000';
await prepareTest(fromTime, toTime, 'Week');
const from = 'Mar 1, 2018 @ 00:00:00.000';
const to = 'May 1, 2018 @ 00:00:00.000';
await prepareTest({ from, to }, 'Week');
const chartCanvasExist = await elasticChart.canvasExists();
expect(chartCanvasExist).to.be(true);
});
it('should visualize monthly data with different years scaled to 30 days', async () => {
const fromTime = 'Jan 1, 2010 @ 00:00:00.000';
const toTime = 'Mar 21, 2019 @ 00:00:00.000';
await prepareTest(fromTime, toTime, 'Day');
const from = 'Jan 1, 2010 @ 00:00:00.000';
const to = 'Mar 21, 2019 @ 00:00:00.000';
await prepareTest({ from, to }, 'Day');
const chartCanvasExist = await elasticChart.canvasExists();
expect(chartCanvasExist).to.be(true);
const chartIntervalIconTip = await PageObjects.discover.getChartIntervalWarningIcon();
expect(chartIntervalIconTip).to.be(true);
});
it('should allow hide/show histogram, persisted in url state', async () => {
const fromTime = 'Jan 1, 2010 @ 00:00:00.000';
const toTime = 'Mar 21, 2019 @ 00:00:00.000';
await prepareTest(fromTime, toTime);
const from = 'Jan 1, 2010 @ 00:00:00.000';
const to = 'Mar 21, 2019 @ 00:00:00.000';
await prepareTest({ from, to });
let canvasExists = await elasticChart.canvasExists();
expect(canvasExists).to.be(true);
await testSubjects.click('discoverChartOptionsToggle');
Expand All @@ -95,10 +98,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(canvasExists).to.be(true);
});
it('should allow hiding the histogram, persisted in saved search', async () => {
const fromTime = 'Jan 1, 2010 @ 00:00:00.000';
const toTime = 'Mar 21, 2019 @ 00:00:00.000';
const from = 'Jan 1, 2010 @ 00:00:00.000';
const to = 'Mar 21, 2019 @ 00:00:00.000';
const savedSearch = 'persisted hidden histogram';
await prepareTest(fromTime, toTime);
await prepareTest({ from, to });
await testSubjects.click('discoverChartOptionsToggle');
await testSubjects.click('discoverChartToggle');
let canvasExists = await elasticChart.canvasExists();
Expand Down