From 77f4f3e0e05874755b4a4eb62f8c7dca30921550 Mon Sep 17 00:00:00 2001 From: Rashmi Kulkarni Date: Mon, 29 Jun 2020 14:42:49 -0700 Subject: [PATCH] Cross cluster search functional test with minimun privileges assigned to the test_user (#70007) * using test_user with limited read permission to search profiler test * gitcheck * search profiler test using test_user * using limited roles and privileges for CCR * changed the global ccr role kibana section to be consistent with other roles with no feature controls * removed canvas role * changes to include pagination for 100 rows Co-authored-by: Elastic Machine --- .../apps/cross_cluster_replication/home_page.ts | 8 +++++++- x-pack/test/functional/config.js | 14 ++++++++++++++ .../test/functional/page_objects/security_page.ts | 4 ++++ 3 files changed, 25 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..3eef95b42cb7de 100644 --- a/x-pack/test/functional/config.js +++ b/x-pack/test/functional/config.js @@ -242,6 +242,20 @@ export default async function ({ readConfigFile }) { ], }, + global_ccr_role: { + elasticsearch: { + cluster: ['manage', 'manage_ccr'], + }, + kibana: [ + { + feature: { + 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: { 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()),