kibana/test/functional/apps/management/_mgmt_import_saved_objects.js
Tre 50eb5d9828
[Archive Migration][Partial] discover apps-management (#110444)
* [Archive Migration][Partial] discover apps-management

Comes from https://github.com/elastic/kibana/pull/102827

Helps with https://github.com/elastic/kibana/pull/108503

Only include the changes under the
test/functional/apps/management folder.

* Remove the index pattern, that the test
creates.

* Drop beforeEach(), in favour of before(),
since there's only one test.

* Drop outdated comment,
drop these three cleanup lines
as the unload should handle it.

* Just keep one cleanup.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-15 10:48:16 +01:00

49 lines
2.1 KiB
JavaScript

/*
* 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 path from 'path';
export default function ({ getService, getPageObjects }) {
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() {
before(async () => {
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover');
await PageObjects.settings.navigateTo();
});
after(async () => {
await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover');
await kibanaServer.savedObjects.clean({ types: ['search', 'visualization'] });
});
it('should import saved objects mgmt', async function () {
await PageObjects.settings.clickKibanaSavedObjects();
await PageObjects.savedObjects.importFile(
path.join(__dirname, 'exports', 'mgmt_import_objects.ndjson')
);
await PageObjects.settings.associateIndexPattern(
'4c3f3c30-ac94-11e8-a651-614b2788174a',
'logstash-*'
);
await PageObjects.savedObjects.clickConfirmChanges();
await PageObjects.savedObjects.clickImportDone();
await PageObjects.savedObjects.waitTableIsLoaded();
//instead of asserting on count- am asserting on the titles- which is more accurate than count.
const objects = await PageObjects.savedObjects.getRowTitles();
expect(objects.includes('mysavedsearch')).to.be(true);
expect(objects.includes('mysavedviz')).to.be(true);
});
});
}