Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test user assignment to maps tests - 2 #75890

Merged
merged 10 commits into from
Aug 27, 2020
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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙇 for cleaning up this cruft!

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