Skip to content

Commit

Permalink
[QA] Switch tests to use importExport - visualize
Browse files Browse the repository at this point in the history
Switch visualize tests to use kbnarchiver instead of esarchvier

Partially closes #93797
  • Loading branch information
wayneseymour committed May 3, 2021
1 parent ae2e076 commit d9d32a4
Show file tree
Hide file tree
Showing 5 changed files with 354 additions and 15 deletions.
21 changes: 16 additions & 5 deletions test/functional/apps/visualize/_tsvb_chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const inspector = getService('inspector');
const retry = getService('retry');
const security = getService('security');
const kibanaServer = getService('kibanaServer');
const PageObjects = getPageObjects([
'visualize',
'visualBuilder',
Expand All @@ -28,11 +29,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
describe('visual builder', function describeIndexTests() {
this.tags('includeFirefox');
beforeEach(async () => {
await security.testUser.setRoles([
'kibana_admin',
'test_logstash_reader',
'kibana_sample_admin',
]);
await security.testUser.setRoles(
['kibana_admin', 'test_logstash_reader', 'kibana_sample_admin'],
false
);
await initTests();
await PageObjects.visualize.navigateToNewVisualization();
await PageObjects.visualize.clickVisualBuilder();
await PageObjects.visualBuilder.checkVisualBuilderIsPresent();
Expand Down Expand Up @@ -142,6 +143,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
after(async () => {
await security.testUser.restoreDefaults();
await esArchiver.unload('index_pattern_without_timefield');
await esArchiver.load('empty_kibana');
});

const switchIndexTest = async (useKibanaIndexes: boolean) => {
Expand Down Expand Up @@ -249,4 +251,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
});
});

async function initTests() {
await kibanaServer.savedObjects.clean({ types: ['visualization'] });
await kibanaServer.importExport.load('visualize');

await kibanaServer.uiSettings.replace({
defaultIndex: 'logstash-*',
});
}
}
40 changes: 32 additions & 8 deletions test/functional/apps/visualize/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const deployment = getService('deployment');

let isOss = true;

describe('visualize app', () => {
before(async () => {
log.debug('Starting visualize before method');
await browser.setWindowSize(1280, 800);
await esArchiver.load('empty_kibana');

await esArchiver.loadIfNeeded('logstash_functional');
await esArchiver.loadIfNeeded('long_window_logstash');
await esArchiver.load('visualize');
await kibanaServer.uiSettings.replace({
defaultIndex: 'logstash-*',
[UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN]: '0,0.[000]b',
});

isOss = await deployment.isOss();
});

Expand All @@ -36,6 +35,8 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
this.tags('ciGroup7');

before(async () => {
await initTests();

await kibanaServer.uiSettings.update({
'visualization:visualize:legacyChartsLibrary': false,
});
Expand All @@ -50,7 +51,6 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
});

// Test replaced vislib chart types
loadTestFile(require.resolve('./_area_chart'));
loadTestFile(require.resolve('./_line_chart_split_series'));
loadTestFile(require.resolve('./_line_chart_split_chart'));
loadTestFile(require.resolve('./_point_series_options'));
Expand All @@ -61,6 +61,10 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
describe('', function () {
this.tags('ciGroup9');

before(async () => {
await initTests();
});

loadTestFile(require.resolve('./_embedding_chart'));
loadTestFile(require.resolve('./_area_chart'));
loadTestFile(require.resolve('./_data_table'));
Expand All @@ -76,6 +80,10 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
describe('', function () {
this.tags('ciGroup10');

before(async () => {
await initTests();
});

loadTestFile(require.resolve('./_inspector'));
loadTestFile(require.resolve('./_experimental_vis'));
loadTestFile(require.resolve('./_gauge_chart'));
Expand All @@ -88,8 +96,10 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
describe('', function () {
this.tags('ciGroup4');

loadTestFile(require.resolve('./_line_chart_split_series'));
loadTestFile(require.resolve('./_line_chart_split_chart'));
before(async () => {
await initTests();
});

loadTestFile(require.resolve('./_pie_chart'));
loadTestFile(require.resolve('./_point_series_options'));
loadTestFile(require.resolve('./_markdown_vis'));
Expand All @@ -108,6 +118,10 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
describe('', function () {
this.tags('ciGroup12');

before(async () => {
await initTests();
});

loadTestFile(require.resolve('./_tag_cloud'));
loadTestFile(require.resolve('./_vertical_bar_chart'));
loadTestFile(require.resolve('./_vertical_bar_chart_nontimeindex'));
Expand All @@ -118,4 +132,14 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
loadTestFile(require.resolve('./_vega_chart'));
});
});

async function initTests() {
await kibanaServer.savedObjects.clean({ types: ['visualization'] });
await kibanaServer.importExport.load('visualize');

await kibanaServer.uiSettings.replace({
defaultIndex: 'logstash-*',
[UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN]: '0,0.[000]b',
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const find = getService('find');
const security = getService('security');

const { visualize, visEditor } = getPageObjects(['visualize', 'visEditor']);

describe('input control range', () => {
Expand Down Expand Up @@ -49,9 +51,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
after(async () => {
await esArchiver.unload('kibana_sample_data_flights_index_pattern');
// loading back default data
await esArchiver.load('empty_kibana');

await kibanaServer.importExport.load('discover');
await esArchiver.loadIfNeeded('logstash_functional');
await esArchiver.loadIfNeeded('long_window_logstash');
await esArchiver.load('visualize');
await security.testUser.restoreDefaults();
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/visualize/legacy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
await browser.setWindowSize(1280, 800);
await esArchiver.loadIfNeeded('logstash_functional');
await esArchiver.loadIfNeeded('long_window_logstash');
await esArchiver.load('visualize');
await kibanaServer.importExport.load('visualize');
await kibanaServer.uiSettings.replace({
defaultIndex: 'logstash-*',
[UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN]: '0,0.[000]b',
Expand Down
Loading

0 comments on commit d9d32a4

Please sign in to comment.