From 89eee4653d670b4d0b02777846f67e712ae897ef Mon Sep 17 00:00:00 2001 From: Rashmi Kulkarni Date: Wed, 24 Jun 2020 09:35:11 -0700 Subject: [PATCH 1/7] using test_user with limited read permission to search profiler test --- .../apps/dev_tools/searchprofiler_editor.ts | 6 ++++++ x-pack/test/functional/config.js | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/x-pack/test/functional/apps/dev_tools/searchprofiler_editor.ts b/x-pack/test/functional/apps/dev_tools/searchprofiler_editor.ts index 3483ddf769e5fc..bf2a4192af5437 100644 --- a/x-pack/test/functional/apps/dev_tools/searchprofiler_editor.ts +++ b/x-pack/test/functional/apps/dev_tools/searchprofiler_editor.ts @@ -12,15 +12,21 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const testSubjects = getService('testSubjects'); const aceEditor = getService('aceEditor'); const retry = getService('retry'); + const security = getService('security'); const editorTestSubjectSelector = 'searchProfilerEditor'; describe('Search Profiler Editor', () => { before(async () => { + await security.testUser.setRoles(['global_devtools_read']); await PageObjects.common.navigateToApp('searchProfiler'); expect(await testSubjects.exists('searchProfilerEditor')).to.be(true); }); + after(async () => { + await security.testUser.restoreDefaults(); + }); + it('correctly parses triple quotes in JSON', async () => { // The below inputs are written to work _with_ ace's autocomplete unlike console's unit test // counterparts in src/legacy/core_plugins/console/public/tests/src/editor.test.js diff --git a/x-pack/test/functional/config.js b/x-pack/test/functional/config.js index d5e3f82878d6b5..14e05d21b87535 100644 --- a/x-pack/test/functional/config.js +++ b/x-pack/test/functional/config.js @@ -231,6 +231,17 @@ export default async function ({ readConfigFile }) { ], }, + global_devtools_read: { + kibana: [ + { + feature: { + dev_tools: ['read'], + }, + spaces: ['*'], + }, + ], + }, + //Kibana feature privilege isn't specific to advancedSetting. It can be anything. https://github.com/elastic/kibana/issues/35965 test_api_keys: { elasticsearch: { From b64135ab97008567a34ac0116dd5cc2463f7516a Mon Sep 17 00:00:00 2001 From: Rashmi Kulkarni Date: Wed, 24 Jun 2020 11:14:20 -0700 Subject: [PATCH 2/7] gitcheck --- .../test/functional/apps/dev_tools/searchprofiler_editor.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x-pack/test/functional/apps/dev_tools/searchprofiler_editor.ts b/x-pack/test/functional/apps/dev_tools/searchprofiler_editor.ts index bf2a4192af5437..c4205166d2f74a 100644 --- a/x-pack/test/functional/apps/dev_tools/searchprofiler_editor.ts +++ b/x-pack/test/functional/apps/dev_tools/searchprofiler_editor.ts @@ -23,9 +23,9 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { expect(await testSubjects.exists('searchProfilerEditor')).to.be(true); }); - after(async () => { - await security.testUser.restoreDefaults(); - }); + // after(async () => { + // await security.testUser.restoreDefaults(); + // }); it('correctly parses triple quotes in JSON', async () => { // The below inputs are written to work _with_ ace's autocomplete unlike console's unit test From 3577e732e308e20f9183b86e078dcb14e00f4a82 Mon Sep 17 00:00:00 2001 From: Rashmi Kulkarni Date: Wed, 24 Jun 2020 12:39:55 -0700 Subject: [PATCH 3/7] search profiler test using test_user --- .../test/functional/apps/dev_tools/searchprofiler_editor.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x-pack/test/functional/apps/dev_tools/searchprofiler_editor.ts b/x-pack/test/functional/apps/dev_tools/searchprofiler_editor.ts index c4205166d2f74a..bf2a4192af5437 100644 --- a/x-pack/test/functional/apps/dev_tools/searchprofiler_editor.ts +++ b/x-pack/test/functional/apps/dev_tools/searchprofiler_editor.ts @@ -23,9 +23,9 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { expect(await testSubjects.exists('searchProfilerEditor')).to.be(true); }); - // after(async () => { - // await security.testUser.restoreDefaults(); - // }); + after(async () => { + await security.testUser.restoreDefaults(); + }); it('correctly parses triple quotes in JSON', async () => { // The below inputs are written to work _with_ ace's autocomplete unlike console's unit test From 0a2308aa38d6a2f34f816b8a68de25ac157e1f15 Mon Sep 17 00:00:00 2001 From: Rashmi Kulkarni Date: Thu, 25 Jun 2020 13:56:36 -0700 Subject: [PATCH 4/7] using limited roles and privileges for CCR --- .../cross_cluster_replication/home_page.ts | 8 +++++- x-pack/test/functional/config.js | 25 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/x-pack/test/functional/apps/cross_cluster_replication/home_page.ts b/x-pack/test/functional/apps/cross_cluster_replication/home_page.ts index 883d3ed3388399..24ddac8ba22e7b 100644 --- a/x-pack/test/functional/apps/cross_cluster_replication/home_page.ts +++ b/x-pack/test/functional/apps/cross_cluster_replication/home_page.ts @@ -10,14 +10,20 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default ({ getPageObjects, getService }: FtrProviderContext) => { const pageObjects = getPageObjects(['common', 'crossClusterReplication']); const log = getService('log'); + const security = getService('security'); describe('Home page', function () { before(async () => { + await security.testUser.setRoles(['global_ccr_role']); await pageObjects.common.navigateToApp('crossClusterReplication'); }); + after(async () => { + await security.testUser.restoreDefaults(); + }); + it('Loads the app', async () => { - await log.debug(`Checking for app title to be Cross-Cluster Replication`); + log.debug(`Checking for app title to be Cross-Cluster Replication`); const appTitleText = await pageObjects.crossClusterReplication.appTitleText(); expect(appTitleText).to.be('Cross-Cluster Replication'); diff --git a/x-pack/test/functional/config.js b/x-pack/test/functional/config.js index 14e05d21b87535..ea27b2241ef7d6 100644 --- a/x-pack/test/functional/config.js +++ b/x-pack/test/functional/config.js @@ -242,6 +242,31 @@ export default async function ({ readConfigFile }) { ], }, + global_canvas_role: { + kibana: [ + { + feature: { + canvas: ['read','view_index_metadata'], + }, + spaces: ['*'], + }, + ], + }, + + global_ccr_role: { + elasticsearch: { + cluster: ['manage', 'manage_ccr'], + }, + kibana: [ + { + feature: { + canvas: ['read'], + }, + spaces: ['*'], + }, + ], + }, + //Kibana feature privilege isn't specific to advancedSetting. It can be anything. https://github.com/elastic/kibana/issues/35965 test_api_keys: { elasticsearch: { From 20c388ad6cc428de0bc626d5f8e43a7b4c99a5ed Mon Sep 17 00:00:00 2001 From: Rashmi Kulkarni Date: Thu, 25 Jun 2020 15:15:48 -0700 Subject: [PATCH 5/7] changed the global ccr role kibana section to be consistent with other roles with no feature controls --- x-pack/test/functional/config.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x-pack/test/functional/config.js b/x-pack/test/functional/config.js index ea27b2241ef7d6..543ab35a546c7a 100644 --- a/x-pack/test/functional/config.js +++ b/x-pack/test/functional/config.js @@ -246,7 +246,7 @@ export default async function ({ readConfigFile }) { kibana: [ { feature: { - canvas: ['read','view_index_metadata'], + canvas: ['read'], }, spaces: ['*'], }, @@ -260,13 +260,13 @@ export default async function ({ readConfigFile }) { kibana: [ { feature: { - canvas: ['read'], + discover: ['read'], }, spaces: ['*'], }, ], }, - + //Kibana feature privilege isn't specific to advancedSetting. It can be anything. https://github.com/elastic/kibana/issues/35965 test_api_keys: { elasticsearch: { From dbba4990ad93f793b57ed42ee2e0a1bf49d3b71a Mon Sep 17 00:00:00 2001 From: Rashmi Kulkarni Date: Thu, 25 Jun 2020 15:18:22 -0700 Subject: [PATCH 6/7] removed canvas role --- x-pack/test/functional/config.js | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/x-pack/test/functional/config.js b/x-pack/test/functional/config.js index 543ab35a546c7a..3eef95b42cb7de 100644 --- a/x-pack/test/functional/config.js +++ b/x-pack/test/functional/config.js @@ -242,17 +242,6 @@ export default async function ({ readConfigFile }) { ], }, - global_canvas_role: { - kibana: [ - { - feature: { - canvas: ['read'], - }, - spaces: ['*'], - }, - ], - }, - global_ccr_role: { elasticsearch: { cluster: ['manage', 'manage_ccr'], @@ -266,7 +255,7 @@ export default async function ({ readConfigFile }) { }, ], }, - + //Kibana feature privilege isn't specific to advancedSetting. It can be anything. https://github.com/elastic/kibana/issues/35965 test_api_keys: { elasticsearch: { From b283485eaaa3f1ab3eba89a5d6e481f8617bbe71 Mon Sep 17 00:00:00 2001 From: Rashmi Kulkarni Date: Fri, 26 Jun 2020 17:13:50 -0700 Subject: [PATCH 7/7] changes to include pagination for 100 rows --- x-pack/test/functional/page_objects/security_page.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/x-pack/test/functional/page_objects/security_page.ts b/x-pack/test/functional/page_objects/security_page.ts index 395e41a91f53a4..e3efc8731e6b3d 100644 --- a/x-pack/test/functional/page_objects/security_page.ts +++ b/x-pack/test/functional/page_objects/security_page.ts @@ -315,6 +315,8 @@ export function SecurityPageProvider({ getService, getPageObjects }: FtrProvider async getElasticsearchUsers() { const users = []; + await testSubjects.click('tablePaginationPopoverButton'); + await testSubjects.click('tablePagination-100-rows'); for (const user of await testSubjects.findAll('userRow')) { const fullnameElement = await user.findByTestSubject('userRowFullName'); const usernameElement = await user.findByTestSubject('userRowUserName'); @@ -339,6 +341,8 @@ export function SecurityPageProvider({ getService, getPageObjects }: FtrProvider async getElasticsearchRoles() { const roles = []; + await testSubjects.click('tablePaginationPopoverButton'); + await testSubjects.click('tablePagination-100-rows'); for (const role of await testSubjects.findAll('roleRow')) { const [rolename, reserved, deprecated] = await Promise.all([ role.findByTestSubject('roleRowName').then((el) => el.getVisibleText()),