kibana/test/visual_regression/tests/discover/chart_visualization.ts
Spencer bcdeccb39b
[7.x] [esArchiver] drop support for --dir, use repo-relative paths instead (#101345) (#101676)
* [esArchiver] drop support for --dir, use repo-relative paths instead (#101345)

Co-authored-by: spalger <spalger@users.noreply.github.com>
# Conflicts:
#	test/api_integration/apis/suggestions/suggestions.js
#	test/functional/apps/discover/_large_string.ts
#	test/functional/apps/visualize/index.ts
#	x-pack/test/functional/apps/infra/feature_controls/logs_security.ts
#	x-pack/test/functional/apps/saved_objects_management/import_saved_objects_between_versions_6.x_7.x.ts
#	x-pack/test/functional/apps/upgrade_assistant/upgrade_assistant.ts

* convert references to `saved_objects/basic` archive

* adapt other `saved_objects/*` archives

* update management/saved_obejcts/relationships archives

* replace old monitoring setup() usage

* remove reference to `empty_kibana` archive

Co-authored-by: spalger <spalger@users.noreply.github.com>
2021-06-08 22:45:04 -04:00

113 lines
4.1 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry');
const esArchiver = getService('esArchiver');
const browser = getService('browser');
const kibanaServer = getService('kibanaServer');
const PageObjects = getPageObjects(['common', 'discover', 'header', 'timePicker']);
const visualTesting = getService('visualTesting');
const defaultSettings = {
defaultIndex: 'logstash-*',
'discover:sampleSize': 1,
};
describe('discover', function describeIndexTests() {
before(async function () {
await esArchiver.load('test/functional/fixtures/es_archiver/discover');
// and load a set of makelogs data
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
await kibanaServer.uiSettings.replace(defaultSettings);
await PageObjects.common.navigateToApp('discover');
await PageObjects.timePicker.setDefaultAbsoluteRange();
});
after(function unloadMakelogs() {
return esArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional');
});
async function refreshDiscover() {
await browser.refresh();
await PageObjects.header.awaitKibanaChrome();
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.discover.waitForChartLoadingComplete(1);
}
async function takeSnapshot() {
await refreshDiscover();
await visualTesting.snapshot({
show: ['discoverChart'],
});
}
describe('query', function () {
this.tags(['skipFirefox']);
it('should show bars in the correct time zone', async function () {
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
await PageObjects.discover.waitUntilSearchingHasFinished();
await takeSnapshot();
});
it('should show correct data for chart interval Hour', async function () {
await PageObjects.discover.setChartInterval('Hour');
await takeSnapshot();
});
it('should show correct data for chart interval Day', async function () {
await PageObjects.discover.setChartInterval('Day');
await takeSnapshot();
});
it('should show correct data for chart interval Week', async function () {
await PageObjects.discover.setChartInterval('Week');
await takeSnapshot();
});
it('browser back button should show previous interval Day', async function () {
await browser.goBack();
await retry.try(async function tryingForTime() {
const actualInterval = await PageObjects.discover.getChartInterval();
expect(actualInterval).to.be('Day');
});
await takeSnapshot();
});
it('should show correct data for chart interval Month', async function () {
await PageObjects.discover.setChartInterval('Month');
await takeSnapshot();
});
it('should show correct data for chart interval Year', async function () {
await PageObjects.discover.setChartInterval('Year');
await takeSnapshot();
});
it('should show correct data for chart interval Auto', async function () {
await PageObjects.discover.setChartInterval('Auto');
await takeSnapshot();
});
});
describe('time zone switch', () => {
it('should show bars in the correct time zone after switching', async function () {
await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'America/Phoenix' });
await refreshDiscover();
await PageObjects.timePicker.setDefaultAbsoluteRange();
await takeSnapshot();
});
});
});
}