Skip to content

Commit

Permalink
fix sot tests by loading empty kibana archive
Browse files Browse the repository at this point in the history
  • Loading branch information
juliaElastic committed Jul 27, 2022
1 parent 4382894 commit 766ee1a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ import { createTestSpaces, deleteTestSpaces, createTags, deleteTags } from './te
// eslint-disable-next-line import/no-default-export
export default function (ftrContext: FtrProviderContext) {
const supertest = ftrContext.getService('supertestWithoutAuth');
const esArchiver = ftrContext.getService('esArchiver');

describe('GET /api/saved_objects_tagging/tags', () => {
before(async () => {
await esArchiver.load('test/functional/fixtures/es_archiver/empty_kibana');
await createTestSpaces(ftrContext);
});

after(async () => {
await deleteTestSpaces(ftrContext);
await esArchiver.unload('test/functional/fixtures/es_archiver/empty_kibana');
});

beforeEach(async () => {
Expand All @@ -35,20 +38,22 @@ export default function (ftrContext: FtrProviderContext) {
authorized: {
httpCode: 200,
expectResponse: ({ body }) => {
expect(body.tags.slice(0, 2)).to.eql([
{
id: 'default-space-tag-1',
name: 'tag-1',
description: 'Tag 1 in default space',
color: '#FF00FF',
},
{
id: 'default-space-tag-2',
name: 'tag-2',
description: 'Tag 2 in default space',
color: '#77CC11',
},
]);
expect(body).to.eql({
tags: [
{
id: 'default-space-tag-1',
name: 'tag-1',
description: 'Tag 1 in default space',
color: '#FF00FF',
},
{
id: 'default-space-tag-2',
name: 'tag-2',
description: 'Tag 2 in default space',
color: '#77CC11',
},
],
});
},
},
unauthorized: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const kibanaServer = getService('kibanaServer');
const PageObjects = getPageObjects(['common', 'security', 'savedObjects', 'tagManagement']);
const tagManagementPage = PageObjects.tagManagement;
const esArchiver = getService('esArchiver');

describe('table bulk actions', () => {
beforeEach(async () => {
await esArchiver.load('test/functional/fixtures/es_archiver/empty_kibana');
await kibanaServer.importExport.load(
'x-pack/test/saved_object_tagging/common/fixtures/es_archiver/functional_base/data.json'
);
Expand All @@ -25,6 +27,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await kibanaServer.importExport.unload(
'x-pack/test/saved_object_tagging/common/fixtures/es_archiver/functional_base/data.json'
);
await esArchiver.unload('test/functional/fixtures/es_archiver/empty_kibana');
});

describe('bulk delete', () => {
Expand All @@ -38,7 +41,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await tagManagementPage.waitUntilTableIsLoaded();

const displayedTags = await tagManagementPage.getDisplayedTagNames();
expect(displayedTags.length).to.be.greaterThan(2);
expect(displayedTags.length).to.be(3);
expect(displayedTags).to.eql(['my-favorite-tag', 'tag with whitespace', 'tag-2']);
});
});
Expand Down

0 comments on commit 766ee1a

Please sign in to comment.