Skip to content

Commit

Permalink
Adding test user to maps functional tests - PR 1 (#70649) (#70887)
Browse files Browse the repository at this point in the history
adding test user maps functional tests - PR1
  • Loading branch information
bhavyarm authored Jul 7, 2020
1 parent 0af0890 commit 9d96334
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 2 deletions.
12 changes: 12 additions & 0 deletions x-pack/test/functional/apps/maps/discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,24 @@ import expect from '@kbn/expect';
export default function ({ getService, getPageObjects }) {
const queryBar = getService('queryBar');
const PageObjects = getPageObjects(['common', 'discover', 'header', 'maps', 'timePicker']);
const security = getService('security');

describe('discover visualize button', () => {
beforeEach(async () => {
await security.testUser.setRoles([
'test_logstash_reader',
'global_maps_all',
'geoshape_data_reader',
'global_discover_read',
'global_visualize_read',
]);
await PageObjects.common.navigateToApp('discover');
});

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

it('should link geo_shape fields to Maps application', async () => {
await PageObjects.discover.selectIndexPattern('geo_shapes*');
await PageObjects.discover.clickFieldListItemVisualize('geometry');
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/functional/apps/maps/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function ({ loadTestFile, getService }) {
await esArchiver.load('maps/data');
await esArchiver.load('maps/kibana');
await kibanaServer.uiSettings.replace({
defaultIndex: 'logstash-*',
defaultIndex: 'c698b940-e149-11e8-a35a-370a8516603a',
});
await browser.setWindowSize(1600, 1000);
});
Expand Down
13 changes: 12 additions & 1 deletion x-pack/test/functional/apps/maps/visualize_create_menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,25 @@

import expect from '@kbn/expect';

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

const security = getService('security');

describe('visualize create menu', () => {
before(async () => {
await security.testUser.setRoles(
['test_logstash_reader', 'global_maps_all', 'geoshape_data_reader', 'global_visualize_all'],
false
);

await PageObjects.visualize.navigateToNewVisualization();
});

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

it('should show maps application in create menu', async () => {
const hasMapsApp = await PageObjects.visualize.hasMapsApp();
expect(hasMapsApp).to.equal(true);
Expand Down
41 changes: 41 additions & 0 deletions x-pack/test/functional/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,47 @@ export default async function ({ readConfigFile }) {
},
],
},
global_visualize_read: {
kibana: [
{
feature: {
visualize: ['read'],
},
spaces: ['*'],
},
],
},
global_visualize_all: {
kibana: [
{
feature: {
visualize: ['all'],
},
spaces: ['*'],
},
],
},
global_maps_all: {
kibana: [
{
feature: {
maps: ['all'],
},
spaces: ['*'],
},
],
},

geoshape_data_reader: {
elasticsearch: {
indices: [
{
names: ['geo_shapes*'],
privileges: ['read', 'view_index_metadata'],
},
],
},
},

global_devtools_read: {
kibana: [
Expand Down

0 comments on commit 9d96334

Please sign in to comment.