Skip to content

Commit

Permalink
[QA] Switch tests to use importExport - discover
Browse files Browse the repository at this point in the history
Use a fn instead of the kbnarchiver and turn all discover tests back on.
  • Loading branch information
wayneseymour committed Mar 25, 2021
1 parent 148e59f commit 0fff7ea
Show file tree
Hide file tree
Showing 16 changed files with 115 additions and 66 deletions.
9 changes: 7 additions & 2 deletions test/functional/apps/discover/_data_grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import expect from '@kbn/expect';
import { importData } from '../../utils/import_data';

export default function ({
getService,
Expand All @@ -16,15 +17,19 @@ export default function ({
getPageObjects: (pageObjects: string[]) => any;
}) {
describe('discover data grid tests', function describeDiscoverDataGrid() {
const supertest = getService('supertest');
const log = getService('log');
const esArchiver = getService('esArchiver');
const PageObjects = getPageObjects(['common', 'discover', 'timePicker']);
const kibanaServer = getService('kibanaServer');
const defaultSettings = { defaultIndex: 'logstash-*', 'doc_table:legacy': false };
const testSubjects = getService('testSubjects');

before(async function () {
await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
await kibanaServer.importExport.load('discover');
// await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
// await kibanaServer.importExport.load('discover');
await esArchiver.load('empty_kibana');
await importData('discover')(supertest)(log);
await esArchiver.loadIfNeeded('logstash_functional');
await kibanaServer.uiSettings.replace(defaultSettings);
await PageObjects.common.navigateToApp('discover');
Expand Down
9 changes: 7 additions & 2 deletions test/functional/apps/discover/_data_grid_context.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 { importData } from '../../utils/import_data';

const TEST_COLUMN_NAMES = ['@message'];
const TEST_FILTER_COLUMN_NAMES = [
Expand All @@ -33,12 +34,16 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const dashboardAddPanel = getService('dashboardAddPanel');
const browser = getService('browser');
const supertest = getService('supertest');
const log = getService('log');

// FLAKY: https://github.com/elastic/kibana/issues/94545
describe.skip('discover data grid context tests', () => {
before(async () => {
await kibanaServer.savedObjects.clean({ types: ['search'] });
await kibanaServer.importExport.load('discover');
// await kibanaServer.savedObjects.clean({ types: ['search'] });
// await kibanaServer.importExport.load('discover');
await esArchiver.load('empty_kibana');
await importData('discover')(supertest)(log);
await esArchiver.loadIfNeeded('logstash_functional');
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
await kibanaServer.uiSettings.update(defaultSettings);
Expand Down
7 changes: 6 additions & 1 deletion test/functional/apps/discover/_data_grid_doc_navigation.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 { importData } from '../../utils/import_data';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const filterBar = getService('filterBar');
Expand All @@ -17,12 +18,16 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const retry = getService('retry');
const kibanaServer = getService('kibanaServer');
const supertest = getService('supertest');
const log = getService('log');
const defaultSettings = { defaultIndex: 'logstash-*', 'doc_table:legacy': false };

describe('discover data grid doc link', function () {
beforeEach(async function () {
// await esArchiver.loadIfNeeded('discover');
await esArchiver.load('empty_kibana');
await importData('discover')(supertest)(log);
await esArchiver.loadIfNeeded('logstash_functional');
await esArchiver.loadIfNeeded('discover');
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
await kibanaServer.uiSettings.update(defaultSettings);
await PageObjects.common.navigateToApp('discover');
Expand Down
8 changes: 6 additions & 2 deletions test/functional/apps/discover/_data_grid_doc_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
import { importData } from '../../utils/import_data';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const find = getService('find');
const dataGrid = getService('dataGrid');
const log = getService('log');
const supertest = getService('supertest');
const retry = getService('retry');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
Expand All @@ -26,8 +28,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
describe('discover data grid doc table', function describeIndexTests() {
before(async function () {
log.debug('load kibana index with default index pattern');
await kibanaServer.savedObjects.clean({ types: ['search'] });
await kibanaServer.importExport.load('discover');
// await kibanaServer.savedObjects.clean({ types: ['search'] });
// await kibanaServer.importExport.load('discover');
await esArchiver.load('empty_kibana');
await importData('discover')(supertest)(log);
await esArchiver.loadIfNeeded('logstash_functional');
await kibanaServer.uiSettings.replace(defaultSettings);
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
Expand Down
9 changes: 7 additions & 2 deletions test/functional/apps/discover/_data_grid_field_data.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 { importData } from '../../utils/import_data';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry');
Expand All @@ -18,12 +19,16 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'header', 'discover', 'visualize', 'timePicker']);
const defaultSettings = { defaultIndex: 'logstash-*', 'doc_table:legacy': false };
const dataGrid = getService('dataGrid');
const supertest = getService('supertest');
const log = getService('log');

describe('discover data grid field data tests', function describeIndexTests() {
this.tags('includeFirefox');
before(async function () {
await kibanaServer.savedObjects.clean({ types: ['search'] });
await kibanaServer.importExport.load('discover');
// await kibanaServer.savedObjects.clean({ types: ['search'] });
// await kibanaServer.importExport.load('discover');
await esArchiver.load('empty_kibana');
await importData('discover')(supertest)(log);
await esArchiver.loadIfNeeded('logstash_functional');
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
await kibanaServer.uiSettings.update(defaultSettings);
Expand Down
8 changes: 2 additions & 6 deletions test/functional/apps/discover/_discover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
*/

import expect from '@kbn/expect';
import { join } from 'path';
import { FtrProviderContext } from '../../ftr_provider_context';
import { dirFile, importData } from '../../utils/import_data';
import { importData } from '../../utils/import_data';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const browser = getService('browser');
Expand All @@ -36,10 +35,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
// await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
// await kibanaServer.importExport.load('discover');
await esArchiver.load('empty_kibana');
const [, inputFilePath] = dirFile(
join('test/functional/fixtures/exported_saved_objects', 'discover')
)();
await importData(inputFilePath)(supertest)(log);
await importData('discover')(supertest)(log);
// await security.testUser.restoreDefaults(false);
await esArchiver.loadIfNeeded('logstash_functional'); // and load a set of makelogs data

Expand Down
8 changes: 6 additions & 2 deletions test/functional/apps/discover/_discover_fields_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@

import expect from '@kbn/expect';
import { FtrProviderContext } from './ftr_provider_context';
import { importData } from '../../utils/import_data';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const supertest = getService('supertest');
const log = getService('log');
const retry = getService('retry');
const esArchiver = getService('esArchiver');
Expand All @@ -22,8 +24,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
describe('discover uses fields API test', function describeIndexTests() {
before(async function () {
log.debug('load kibana index with default index pattern');
await kibanaServer.savedObjects.clean({ types: ['search'] });
await kibanaServer.importExport.load('discover');
// await kibanaServer.savedObjects.clean({ types: ['search'] });
// await kibanaServer.importExport.load('discover');
await esArchiver.load('empty_kibana');
await importData('discover')(supertest)(log);
await esArchiver.loadIfNeeded('logstash_functional');
await kibanaServer.uiSettings.replace(defaultSettings);
log.debug('discover');
Expand Down
7 changes: 6 additions & 1 deletion test/functional/apps/discover/_doc_navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,24 @@
import expect from '@kbn/expect';

import { FtrProviderContext } from '../../ftr_provider_context';
import { importData } from '../../utils/import_data';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const docTable = getService('docTable');
const filterBar = getService('filterBar');
const testSubjects = getService('testSubjects');
const supertest = getService('supertest');
const log = getService('log');
const PageObjects = getPageObjects(['common', 'discover', 'timePicker', 'context']);
const esArchiver = getService('esArchiver');
const retry = getService('retry');

describe('doc link in discover', function contextSize() {
beforeEach(async function () {
await esArchiver.load('empty_kibana');
await importData('discover')(supertest)(log);
// await esArchiver.loadIfNeeded('discover');
await esArchiver.loadIfNeeded('logstash_functional');
await esArchiver.loadIfNeeded('discover');
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.waitForDocTableLoadingComplete();
Expand Down
8 changes: 6 additions & 2 deletions test/functional/apps/discover/_doc_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
import { importData } from '../../utils/import_data';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const log = getService('log');
const retry = getService('retry');
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const docTable = getService('docTable');
Expand All @@ -27,8 +29,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

before(async function () {
log.debug('load kibana index with default index pattern');
await kibanaServer.savedObjects.clean({ types: ['search'] });
await kibanaServer.importExport.load('discover');
// await kibanaServer.savedObjects.clean({ types: ['search'] });
// await kibanaServer.importExport.load('discover');
await esArchiver.load('empty_kibana');
await importData('discover')(supertest)(log);

// and load a set of makelogs data
await esArchiver.loadIfNeeded('logstash_functional');
Expand Down
9 changes: 3 additions & 6 deletions test/functional/apps/discover/_field_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@

import expect from '@kbn/expect';

import { join } from 'path';
import { FtrProviderContext } from '../../ftr_provider_context';
import { dirFile, importData } from '../../utils/import_data';
import { importData } from '../../utils/import_data';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const supertest = getService('supertest');
Expand All @@ -26,10 +25,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
describe('discover tab', function describeIndexTests() {
this.tags('includeFirefox');
before(async function () {
const [, inputFilePath] = dirFile(
join('test/functional/fixtures/exported_saved_objects', 'discover')
)();
await importData(inputFilePath)(supertest)(log);
await esArchiver.load('empty_kibana');
await importData('discover')(supertest)(log);
// await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
// await kibanaServer.importExport.load('discover');
await esArchiver.loadIfNeeded('logstash_functional');
Expand Down
9 changes: 7 additions & 2 deletions test/functional/apps/discover/_field_data_with_fields_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,26 @@
import expect from '@kbn/expect';

import { FtrProviderContext } from '../../ftr_provider_context';
import { importData } from '../../utils/import_data';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const toasts = getService('toasts');
const queryBar = getService('queryBar');
const supertest = getService('supertest');
const log = getService('log');
const browser = getService('browser');
const PageObjects = getPageObjects(['common', 'header', 'discover', 'visualize', 'timePicker']);

describe('discover tab with new fields API', function describeIndexTests() {
this.tags('includeFirefox');
before(async function () {
await kibanaServer.savedObjects.clean({ types: ['search'] });
await kibanaServer.importExport.load('discover');
// await kibanaServer.savedObjects.clean({ types: ['search'] });
// await kibanaServer.importExport.load('discover');
await esArchiver.load('empty_kibana');
await importData('discover')(supertest)(log);
await esArchiver.loadIfNeeded('logstash_functional');
await kibanaServer.uiSettings.replace({
defaultIndex: 'logstash-*',
Expand Down
10 changes: 7 additions & 3 deletions test/functional/apps/discover/_filter_editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import expect from '@kbn/expect';

import { FtrProviderContext } from '../../ftr_provider_context';
import { importData } from '../../utils/import_data';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const log = getService('log');
Expand All @@ -17,16 +18,19 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const kibanaServer = getService('kibanaServer');
const filterBar = getService('filterBar');
const PageObjects = getPageObjects(['common', 'discover', 'timePicker']);
const supertest = getService('supertest');

const defaultSettings = {
defaultIndex: 'logstash-*',
};

describe('discover filter editor', function describeIndexTests() {
before(async function () {
log.debug('load kibana index with default index pattern');
await kibanaServer.savedObjects.clean({ types: ['search'] });
await kibanaServer.importExport.load('discover');

// await kibanaServer.savedObjects.clean({ types: ['search'] });
// await kibanaServer.importExport.load('discover');
await esArchiver.load('empty_kibana');
await importData('discover')(supertest)(log);
// and load a set of makelogs data
await esArchiver.loadIfNeeded('logstash_functional');
await kibanaServer.uiSettings.replace(defaultSettings);
Expand Down
9 changes: 7 additions & 2 deletions test/functional/apps/discover/_inspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@
import expect from '@kbn/expect';

import { FtrProviderContext } from '../../ftr_provider_context';
import { importData } from '../../utils/import_data';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'visualize', 'timePicker']);
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const supertest = getService('supertest');
const log = getService('log');
const inspector = getService('inspector');

const STATS_ROW_NAME_INDEX = 0;
Expand All @@ -32,8 +35,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

describe('inspect', () => {
before(async () => {
await kibanaServer.savedObjects.clean({ types: ['search'] });
await kibanaServer.importExport.load('discover');
// await kibanaServer.savedObjects.clean({ types: ['search'] });
// await kibanaServer.importExport.load('discover');
await esArchiver.load('empty_kibana');
await importData('discover')(supertest)(log);
await esArchiver.loadIfNeeded('logstash_functional');
// delete .kibana index and update configDoc
await kibanaServer.uiSettings.replace({
Expand Down
8 changes: 6 additions & 2 deletions test/functional/apps/discover/_shared_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import expect from '@kbn/expect';

import { FtrProviderContext } from '../../ftr_provider_context';
import { importData } from '../../utils/import_data';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry');
Expand All @@ -19,6 +20,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const browser = getService('browser');
const toasts = getService('toasts');
const deployment = getService('deployment');
const supertest = getService('supertest');

describe('shared links', function describeIndexTests() {
let baseUrl: string;
Expand All @@ -37,8 +39,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

log.debug('load kibana index with default index pattern');
await kibanaServer.savedObjects.clean({ types: ['search'] });
await kibanaServer.importExport.load('discover');
// await kibanaServer.savedObjects.clean({ types: ['search'] });
// await kibanaServer.importExport.load('discover');
await esArchiver.load('empty_kibana');
await importData('discover')(supertest)(log);
await esArchiver.loadIfNeeded('logstash_functional');

await kibanaServer.uiSettings.replace({
Expand Down
Loading

0 comments on commit 0fff7ea

Please sign in to comment.