Timelion tests- migrate to kbnArchiver from esArchiver (#103969) (#104188)

* Timelion tests- migrate to kbnArchiver

* added the logic to handle custom space

* paths and version changed

Co-authored-by: Rashmi Kulkarni <rashmi.kulkarni@elastic.co>
This commit is contained in:
Kibana Machine 2021-07-01 17:14:47 -04:00 committed by GitHub
parent 062b4e044a
commit 694be8feec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 116 additions and 6 deletions

View file

@ -11,6 +11,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const security = getService('security');
const kibanaServer = getService('kibanaServer');
const PageObjects = getPageObjects([
'common',
'error',
@ -24,10 +25,19 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
describe('feature controls security', () => {
before(async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/timelion/feature_controls');
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/timelion/feature_controls.json'
);
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional');
});
after(async () => {
await kibanaServer.importExport.unload(
'x-pack/test/functional/fixtures/kbn_archiver/timelion/feature_controls.json'
);
await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional');
});
describe('global timelion all privileges', () => {
before(async () => {
await security.role.create('global_timelion_all_role', {

View file

@ -13,6 +13,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const spacesService = getService('spaces');
const PageObjects = getPageObjects(['common', 'timelion', 'security', 'spaceSelector']);
const appsMenu = getService('appsMenu');
const kibanaServer = getService('kibanaServer');
describe('timelion', () => {
before(async () => {
@ -23,29 +24,44 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
before(async () => {
// we need to load the following in every situation as deleting
// a space deletes all of the associated saved objects
await esArchiver.load('x-pack/test/functional/es_archives/timelion/feature_controls');
// await esArchiver.load('x-pack/test/functional/es_archives/timelion/feature_controls');
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/timelion/feature_controls.json'
);
await spacesService.create({
id: 'custom_space',
name: 'custom_space',
disabledFeatures: [],
});
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/timelion/timelion_custom_space.json',
{ space: 'custom_space' }
);
});
after(async () => {
await spacesService.delete('custom_space');
await esArchiver.unload('x-pack/test/functional/es_archives/timelion/feature_controls');
await kibanaServer.importExport.unload(
'x-pack/test/functional/fixtures/kbn_archiver/timelion/feature_controls.json'
);
});
it('shows timelion navlink', async () => {
await PageObjects.common.navigateToApp('home', {
basePath: '/s/custom_space',
});
const navLinks = (await appsMenu.readLinks()).map((link) => link.text);
expect(navLinks).to.contain('Timelion');
});
it(`allows a timelion sheet to be created`, async () => {
await PageObjects.common.navigateToApp('timelion');
await PageObjects.common.navigateToApp('timelion', {
basePath: '/s/custom_space',
});
await PageObjects.timelion.saveTimelionSheet();
});
});
@ -54,17 +70,29 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
before(async () => {
// we need to load the following in every situation as deleting
// a space deletes all of the associated saved objects
await esArchiver.load('x-pack/test/functional/es_archives/timelion/feature_controls');
// await esArchiver.load('x-pack/test/functional/es_archives/timelion/feature_controls');
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/timelion/feature_controls.json'
);
await spacesService.create({
id: 'custom_space',
name: 'custom_space',
disabledFeatures: ['timelion'],
});
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/timelion/timelion_custom_space.json',
{ space: 'custom_space' }
);
});
after(async () => {
await spacesService.delete('custom_space');
await esArchiver.unload('x-pack/test/functional/es_archives/timelion/feature_controls');
await kibanaServer.importExport.unload(
'x-pack/test/functional/fixtures/kbn_archiver/timelion/feature_controls.json'
);
});
it(`doesn't show timelion navlink`, async () => {

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,20 @@
{
"attributes": {
"description": "",
"hits": 0,
"timelion_chart_height": 275,
"timelion_columns": 2,
"timelion_interval": "auto",
"timelion_rows": 2,
"timelion_sheet": [
".es(*).label('custom space sheet')"
],
"title": "i-exist",
"version": 1
},
"coreMigrationVersion": "7.14.0",
"id": "i-exist",
"references": [],
"type": "timelion-sheet",
"version": "WzcsMl0="
}