Skip to content

Commit

Permalink
Test user assignment to maps tests - 2 (#75890) (#76535)
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavyarm authored Sep 2, 2020
1 parent 2403b53 commit c9c30e3
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 3 deletions.
6 changes: 6 additions & 0 deletions x-pack/test/functional/apps/maps/add_layer_panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,23 @@ import expect from '@kbn/expect';
export default function ({ getService, getPageObjects }) {
const testSubjects = getService('testSubjects');
const PageObjects = getPageObjects(['maps']);
const security = getService('security');

describe('Add layer panel', () => {
const LAYER_NAME = 'World Countries';

before(async () => {
await security.testUser.setRoles(['global_maps_all']);
await PageObjects.maps.openNewMap();
await PageObjects.maps.clickAddLayer();
await PageObjects.maps.selectEMSBoundariesSource();
await PageObjects.maps.selectVectorLayer(LAYER_NAME);
});

after(async () => {
await security.testUser.restoreDefaults();
});

it('should show unsaved layer in layer TOC', async () => {
const vectorLayerExists = await PageObjects.maps.doesLayerExist(LAYER_NAME);
expect(vectorLayerExists).to.be(true);
Expand Down
10 changes: 10 additions & 0 deletions x-pack/test/functional/apps/maps/blended_vector_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,22 @@ import expect from '@kbn/expect';
export default function ({ getPageObjects, getService }) {
const PageObjects = getPageObjects(['maps']);
const inspector = getService('inspector');
const security = getService('security');

describe('blended vector layer', () => {
before(async () => {
await security.testUser.setRoles(['test_logstash_reader', 'global_maps_all']);
await PageObjects.maps.loadSavedMap('blended document example');
});

afterEach(async () => {
await inspector.close();
});

after(async () => {
await security.testUser.restoreDefaults();
});

it('should request documents when zoomed to smaller regions showing less data', async () => {
const hits = await PageObjects.maps.getHits();
expect(hits).to.equal('33');
Expand Down
7 changes: 5 additions & 2 deletions x-pack/test/functional/apps/maps/full_screen_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ import expect from '@kbn/expect';
export default function ({ getService, getPageObjects }) {
const PageObjects = getPageObjects(['maps', 'common']);
const retry = getService('retry');
const esArchiver = getService('esArchiver');
const security = getService('security');

describe('maps full screen mode', () => {
before(async () => {
await esArchiver.loadIfNeeded('maps/data');
await security.testUser.setRoles(['global_maps_all']);
await PageObjects.maps.openNewMap();
});
after(async () => {
await security.testUser.restoreDefaults();
});

it('full screen button should exist', async () => {
const exists = await PageObjects.maps.fullScreenModeMenuItemExists();
Expand Down
3 changes: 3 additions & 0 deletions x-pack/test/functional/apps/maps/layer_visibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ import expect from '@kbn/expect';
export default function ({ getPageObjects, getService }) {
const PageObjects = getPageObjects(['maps']);
const inspector = getService('inspector');
const security = getService('security');

describe('layer visibility', () => {
before(async () => {
await security.testUser.setRoles(['test_logstash_reader', 'global_maps_all']);
await PageObjects.maps.loadSavedMap('document example hidden');
});

afterEach(async () => {
await inspector.close();
await security.testUser.restoreDefaults();
});

it('should not make any requests when layer is hidden', async () => {
Expand Down
9 changes: 9 additions & 0 deletions x-pack/test/functional/apps/maps/saved_object_management.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default function ({ getPageObjects, getService }) {
const filterBar = getService('filterBar');
const browser = getService('browser');
const inspector = getService('inspector');
const security = getService('security');

describe('map saved object management', () => {
const MAP_NAME_PREFIX = 'saved_object_management_test_';
Expand All @@ -20,8 +21,16 @@ export default function ({ getPageObjects, getService }) {

describe('read', () => {
before(async () => {
await security.testUser.setRoles([
'global_maps_all',
'geoshape_data_reader',
'test_logstash_reader',
]);
await PageObjects.maps.loadSavedMap('join example');
});
after(async () => {
await security.testUser.restoreDefaults();
});

it('should update global Kibana time to value stored with map', async () => {
const timeConfig = await PageObjects.timePicker.getTimeConfig();
Expand Down
7 changes: 6 additions & 1 deletion x-pack/test/functional/apps/maps/vector_styling.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@

import expect from '@kbn/expect';

export default function ({ getPageObjects }) {
export default function ({ getService, getPageObjects }) {
const PageObjects = getPageObjects(['maps']);
const security = getService('security');

describe('vector styling', () => {
before(async () => {
await security.testUser.setRoles(['test_logstash_reader', 'global_maps_all']);
await PageObjects.maps.loadSavedMap('document example');
});
after(async () => {
await security.testUser.restoreDefaults();
});

describe('categorical styling', () => {
before(async () => {
Expand Down

0 comments on commit c9c30e3

Please sign in to comment.