From 1b150aaa04099eb777dce06ee37ebe2580d2006e Mon Sep 17 00:00:00 2001 From: bhavyarm Date: Thu, 2 Jul 2020 14:10:24 -0400 Subject: [PATCH 1/2] removing super user and adding test user role to maps test --- x-pack/test/functional/apps/maps/discover.js | 12 ++++++ x-pack/test/functional/apps/maps/index.js | 2 +- .../apps/maps/visualize_create_menu.js | 14 ++++++- x-pack/test/functional/config.js | 42 +++++++++++++++++++ 4 files changed, 68 insertions(+), 2 deletions(-) diff --git a/x-pack/test/functional/apps/maps/discover.js b/x-pack/test/functional/apps/maps/discover.js index 5f488d917c182c..8dbd98ed3af2fa 100644 --- a/x-pack/test/functional/apps/maps/discover.js +++ b/x-pack/test/functional/apps/maps/discover.js @@ -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'); diff --git a/x-pack/test/functional/apps/maps/index.js b/x-pack/test/functional/apps/maps/index.js index 94c7587decf15e..15928170972d94 100644 --- a/x-pack/test/functional/apps/maps/index.js +++ b/x-pack/test/functional/apps/maps/index.js @@ -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); }); diff --git a/x-pack/test/functional/apps/maps/visualize_create_menu.js b/x-pack/test/functional/apps/maps/visualize_create_menu.js index 5a53d3d8b571d9..08cc0cf151b052 100644 --- a/x-pack/test/functional/apps/maps/visualize_create_menu.js +++ b/x-pack/test/functional/apps/maps/visualize_create_menu.js @@ -6,14 +6,26 @@ 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', + ]); 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); diff --git a/x-pack/test/functional/config.js b/x-pack/test/functional/config.js index 14e05d21b87535..2a297d96567dfc 100644 --- a/x-pack/test/functional/config.js +++ b/x-pack/test/functional/config.js @@ -230,6 +230,26 @@ export default async function ({ readConfigFile }) { }, ], }, + global_visualize_read: { + kibana: [ + { + feature: { + visualize: ['read'], + }, + spaces: ['*'], + }, + ], + }, + global_visualize_all: { + kibana: [ + { + feature: { + visualize: ['all'], + }, + spaces: ['*'], + }, + ], + }, global_devtools_read: { kibana: [ @@ -242,6 +262,28 @@ export default async function ({ readConfigFile }) { ], }, + global_maps_all: { + kibana: [ + { + feature: { + maps: ['all'], + }, + spaces: ['*'], + }, + ], + }, + + geoshape_data_reader: { + elasticsearch: { + indices: [ + { + names: ['geo_shapes*'], + privileges: ['read', 'view_index_metadata'], + }, + ], + }, + }, + //Kibana feature privilege isn't specific to advancedSetting. It can be anything. https://github.com/elastic/kibana/issues/35965 test_api_keys: { elasticsearch: { From 22bd150e1891398c98edbde33917c81dffd93693 Mon Sep 17 00:00:00 2001 From: bhavyarm Date: Fri, 3 Jul 2020 12:18:02 -0400 Subject: [PATCH 2/2] adding false to setRoles call --- .../functional/apps/maps/visualize_create_menu.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/x-pack/test/functional/apps/maps/visualize_create_menu.js b/x-pack/test/functional/apps/maps/visualize_create_menu.js index 08cc0cf151b052..ef39771d6be075 100644 --- a/x-pack/test/functional/apps/maps/visualize_create_menu.js +++ b/x-pack/test/functional/apps/maps/visualize_create_menu.js @@ -13,12 +13,11 @@ export default function ({ getService, getPageObjects }) { describe('visualize create menu', () => { before(async () => { - await security.testUser.setRoles([ - 'test_logstash_reader', - 'global_maps_all', - 'geoshape_data_reader', - 'global_visualize_all', - ]); + await security.testUser.setRoles( + ['test_logstash_reader', 'global_maps_all', 'geoshape_data_reader', 'global_visualize_all'], + false + ); + await PageObjects.visualize.navigateToNewVisualization(); });