Skip to content

Commit

Permalink
[test] Migrates discover esArchive to kbnArchiver
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Smalley <[email protected]>
  • Loading branch information
Tyler Smalley committed Jun 22, 2021
1 parent 3673019 commit 0546a1c
Show file tree
Hide file tree
Showing 17 changed files with 68 additions and 580 deletions.
3 changes: 2 additions & 1 deletion test/accessibility/apps/discover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

describe('Discover a11y tests', () => {
before(async () => {
await esArchiver.load('test/functional/fixtures/es_archiver/discover');
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover.json');
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
await kibanaServer.uiSettings.update({
defaultIndex: 'logstash-*',
Expand All @@ -30,6 +30,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

after(async () => {
await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover.json');
await esArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional');
});

Expand Down
3 changes: 2 additions & 1 deletion test/accessibility/apps/management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

describe('Management', () => {
before(async () => {
await esArchiver.load('test/functional/fixtures/es_archiver/discover');
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover.json');
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
await kibanaServer.uiSettings.update({
defaultIndex: 'logstash-*',
Expand All @@ -26,6 +26,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

after(async () => {
await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover.json');
await esArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional');
});

Expand Down
8 changes: 6 additions & 2 deletions test/accessibility/apps/visualize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ import { FtrProviderContext } from '../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'visualize', 'header']);
const a11y = getService('a11y');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');

describe('Visualize', () => {
before(async () => {
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/discover');
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover.json');
await PageObjects.common.navigateToApp('visualize');
});

after(async () => {
await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover.json');
});

it('visualize', async () => {
await a11y.testAppSnapshot();
});
Expand Down
11 changes: 9 additions & 2 deletions test/functional/apps/discover/_data_grid_doc_navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,16 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const defaultSettings = { defaultIndex: 'logstash-*', 'doc_table:legacy': false };

describe('discover data grid doc link', function () {
beforeEach(async function () {
before(async () => {
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/discover');
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover.json');
});

after(async () => {
await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover.json');
});

beforeEach(async function () {
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
await kibanaServer.uiSettings.update(defaultSettings);
await PageObjects.common.navigateToApp('discover');
Expand Down
3 changes: 2 additions & 1 deletion test/functional/apps/discover/_doc_navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
describe('doc link in discover', function contextSize() {
before(async () => {
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/discover');
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover.json');
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
await kibanaServer.uiSettings.update({
'doc_table:legacy': true,
'discover:searchFieldsFromSource': true,
});
});
after(async () => {
await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover.json');
await kibanaServer.uiSettings.replace({});
});

Expand Down
6 changes: 5 additions & 1 deletion test/functional/apps/discover/_runtime_fields_editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,18 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

describe('discover integration with runtime fields editor', function describeIndexTests() {
before(async function () {
await esArchiver.load('test/functional/fixtures/es_archiver/discover');
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover.json');
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
await kibanaServer.uiSettings.replace(defaultSettings);
log.debug('discover');
await PageObjects.common.navigateToApp('discover');
await PageObjects.timePicker.setDefaultAbsoluteRange();
});

after(async () => {
await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover.json');
});

it('allows adding custom label to existing fields', async function () {
const customLabel = 'megabytes';
await PageObjects.discover.editField('bytes');
Expand Down
6 changes: 5 additions & 1 deletion test/functional/apps/discover/_sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
describe.skip('discover sidebar', function describeIndexTests() {
before(async function () {
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/discover');
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover.json');
await kibanaServer.uiSettings.replace({
defaultIndex: 'logstash-*',
});
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
await PageObjects.common.navigateToApp('discover');
});

after(async () => {
await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover.json');
});

describe('field filtering', function () {
it('should reveal and hide the filter form when the toggle is clicked', async function () {
await PageObjects.discover.openSidebarFieldFilter();
Expand Down
7 changes: 6 additions & 1 deletion test/functional/apps/home/_navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'header', 'home', 'timePicker']);
const appsMenu = getService('appsMenu');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');

describe('Kibana browser back navigation should work', function describeIndexTests() {
before(async () => {
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/discover');
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover.json');
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
});

after(async () => {
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover.json');
});

it('detect navigate back issues', async () => {
let currUrl;
// Detects bug described in issue #31238 - where back navigation would get stuck to URL encoding handling in Angular.
Expand Down
3 changes: 2 additions & 1 deletion test/functional/apps/management/_field_formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ export default function ({ getService, getPageObjects }) {

before(async function () {
await browser.setWindowSize(1200, 800);
await esArchiver.load('test/functional/fixtures/es_archiver/discover');
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover.json');
await kibanaServer.uiSettings.replace({});
await kibanaServer.uiSettings.update({});
});

after(async function afterAll() {
await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover.json');
await PageObjects.settings.navigateTo();
await esArchiver.emptyKibanaIndex();
});
Expand Down
8 changes: 6 additions & 2 deletions test/functional/apps/management/_handle_version_conflict.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import expect from '@kbn/expect';

export default function ({ getService, getPageObjects }) {
const testSubjects = getService('testSubjects');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const browser = getService('browser');
const es = getService('es');
const retry = getService('retry');
Expand All @@ -30,7 +30,11 @@ export default function ({ getService, getPageObjects }) {
describe('index version conflict', function describeIndexTests() {
before(async function () {
await browser.setWindowSize(1200, 800);
await esArchiver.load('test/functional/fixtures/es_archiver/discover');
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover.json');
});

after(async () => {
await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover.json');
});

it('Should be able to surface version conflict notification while creating scripted field', async function () {
Expand Down
16 changes: 9 additions & 7 deletions test/functional/apps/management/_mgmt_import_saved_objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,23 @@ import expect from '@kbn/expect';
import path from 'path';

export default function ({ getService, getPageObjects }) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const PageObjects = getPageObjects(['common', 'settings', 'header', 'savedObjects']);

//in 6.4.0 bug the Saved Search conflict would be resolved and get imported but the visualization
//that referenced the saved search was not imported.( https://github.com/elastic/kibana/issues/22238)

describe('mgmt saved objects', function describeIndexTests() {
beforeEach(async function () {
await esArchiver.emptyKibanaIndex();
await esArchiver.load('test/functional/fixtures/es_archiver/discover');
await PageObjects.settings.navigateTo();
before(async () => {
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover.json');
});

after(async () => {
await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover.json');
});

afterEach(async function () {
await esArchiver.unload('test/functional/fixtures/es_archiver/discover');
beforeEach(async function () {
await PageObjects.settings.navigateTo();
});

it('should import saved objects mgmt', async function () {
Expand Down
4 changes: 2 additions & 2 deletions test/functional/apps/management/_runtime_fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import expect from '@kbn/expect';

export default function ({ getService, getPageObjects }) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const log = getService('log');
const browser = getService('browser');
Expand All @@ -23,13 +22,14 @@ export default function ({ getService, getPageObjects }) {

before(async function () {
await browser.setWindowSize(1200, 800);
await esArchiver.load('test/functional/fixtures/es_archiver/discover');
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover.json');
// delete .kibana index and then wait for Kibana to re-create it
await kibanaServer.uiSettings.replace({});
await kibanaServer.uiSettings.update({});
});

after(async function afterAll() {
await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover.json');
await PageObjects.settings.navigateTo();
await PageObjects.settings.clickKibanaIndexPatterns();
await PageObjects.settings.removeLogstashIndexPatternIfExist();
Expand Down
4 changes: 2 additions & 2 deletions test/functional/apps/management/_scripted_fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import expect from '@kbn/expect';

export default function ({ getService, getPageObjects }) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const log = getService('log');
const browser = getService('browser');
Expand All @@ -46,13 +45,14 @@ export default function ({ getService, getPageObjects }) {

before(async function () {
await browser.setWindowSize(1200, 800);
await esArchiver.load('test/functional/fixtures/es_archiver/discover');
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover.json');
// delete .kibana index and then wait for Kibana to re-create it
await kibanaServer.uiSettings.replace({});
await kibanaServer.uiSettings.update({ 'doc_table:legacy': true });
});

after(async function afterAll() {
await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover.json');
await PageObjects.settings.navigateTo();
await PageObjects.settings.clickKibanaIndexPatterns();
await PageObjects.settings.removeLogstashIndexPatternIfExist();
Expand Down
Loading

0 comments on commit 0546a1c

Please sign in to comment.