From b0d31386340b89b5495fbd0f70414f2b3c630b96 Mon Sep 17 00:00:00 2001 From: "rashmi.kulkarni" Date: Mon, 9 Aug 2021 17:04:55 -0700 Subject: [PATCH 1/5] test user with specific roles and permissions --- .../management/create_index_pattern_wizard.js | 20 ++++++++++++++----- x-pack/test/functional/config.js | 11 ++++++++++ 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/x-pack/test/functional/apps/management/create_index_pattern_wizard.js b/x-pack/test/functional/apps/management/create_index_pattern_wizard.js index 445e340d236e6..0b6d2b8b61d1c 100644 --- a/x-pack/test/functional/apps/management/create_index_pattern_wizard.js +++ b/x-pack/test/functional/apps/management/create_index_pattern_wizard.js @@ -8,14 +8,19 @@ export default function ({ getService, getPageObjects }) { const kibanaServer = getService('kibanaServer'); const es = getService('es'); + const security = getService('security'); const PageObjects = getPageObjects(['settings', 'common']); describe('"Create Index Pattern" wizard', function () { before(async function () { + await security.testUser.setRoles([ + 'global_index_pattern_management_all', + 'test_logs_data_reader', + ]); // delete .kibana index and then wait for Kibana to re-create it await kibanaServer.uiSettings.replace({}); await PageObjects.settings.navigateTo(); - await PageObjects.settings.clickKibanaIndexPatterns(); + // await PageObjects.settings.clickKibanaIndexPatterns(); }); describe('data streams', () => { @@ -43,13 +48,18 @@ export default function ({ getService, getPageObjects }) { method: 'PUT', }); + await PageObjects.settings.clickKibanaIndexPatterns(); await PageObjects.settings.createIndexPattern('test_data_stream'); + }); + }); - await es.transport.request({ - path: '/_data_stream/test_data_stream', - method: 'DELETE', - }); + after(async () => { + await es.transport.request({ + path: '/_data_stream/test_data_stream', + method: 'DELETE', }); + await security.testUser.restoreDefaults(); + await kibanaServer.savedObjects.clean({ types: ['index-pattern'] }); }); }); } diff --git a/x-pack/test/functional/config.js b/x-pack/test/functional/config.js index 06e58638922d4..b787461673258 100644 --- a/x-pack/test/functional/config.js +++ b/x-pack/test/functional/config.js @@ -384,6 +384,17 @@ export default async function ({ readConfigFile }) { }, }, + test_logs_data_reader: { + elasticsearch: { + indices: [ + { + names: ['logs-*'], + privileges: ['read', 'view_index_metadata'], + }, + ], + }, + }, + geoall_data_writer: { elasticsearch: { indices: [ From 379d14c65ed257c502b21df229db0909773cdecd Mon Sep 17 00:00:00 2001 From: "rashmi.kulkarni" Date: Tue, 10 Aug 2021 15:17:47 -0700 Subject: [PATCH 2/5] added SO method logging, added test data stream to the role and modified createindexpattern function --- test/functional/page_objects/settings_page.ts | 17 ++++++++++++++++- .../management/create_index_pattern_wizard.js | 8 +++++--- x-pack/test/functional/config.js | 2 +- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/test/functional/page_objects/settings_page.ts b/test/functional/page_objects/settings_page.ts index ab581beeb8b3b..6239c17e29cee 100644 --- a/test/functional/page_objects/settings_page.ts +++ b/test/functional/page_objects/settings_page.ts @@ -177,6 +177,10 @@ export class SettingsPageObject extends FtrService { await this.testSubjects.click('deleteIndexPatternButton'); } + async clickCloseFlyOutButton() { + await this.testSubjects.click('closeFlyoutButton'); + } + async getIndexPageHeading() { return await this.testSubjects.getVisibleText('indexPatternTitle'); } @@ -357,7 +361,12 @@ export class SettingsPageObject extends FtrService { } await this.header.waitUntilLoadingHasFinished(); - await this.clickAddNewIndexPatternButton(); + const flyOut = await this.testSubjects.exists('createAnyway'); + if (flyOut) { + await this.testSubjects.click('createAnyway'); + } else { + await this.clickAddNewIndexPatternButton(); + } await this.header.waitUntilLoadingHasFinished(); if (!isStandardIndexPattern) { await this.selectRollupIndexPatternType(); @@ -741,6 +750,12 @@ export class SettingsPageObject extends FtrService { await this.flyout.ensureClosed('scriptedFieldsHelpFlyout'); } + async closeIndexPatternFlyOut() { + await this.testSubjects.click('createAnyway'); + } + + // createAnyway + async executeScriptedField(script: string, additionalField: string) { this.log.debug('execute Scripted Fields help'); await this.closeScriptedFieldHelp(); // ensure script help is closed so script input is not blocked diff --git a/x-pack/test/functional/apps/management/create_index_pattern_wizard.js b/x-pack/test/functional/apps/management/create_index_pattern_wizard.js index 0b6d2b8b61d1c..9061817bbce79 100644 --- a/x-pack/test/functional/apps/management/create_index_pattern_wizard.js +++ b/x-pack/test/functional/apps/management/create_index_pattern_wizard.js @@ -10,17 +10,18 @@ export default function ({ getService, getPageObjects }) { const es = getService('es'); const security = getService('security'); const PageObjects = getPageObjects(['settings', 'common']); + const soInfo = getService('savedObjectInfo'); + const log = getService('log'); describe('"Create Index Pattern" wizard', function () { before(async function () { + await soInfo.logSoTypes(log); await security.testUser.setRoles([ 'global_index_pattern_management_all', 'test_logs_data_reader', ]); - // delete .kibana index and then wait for Kibana to re-create it await kibanaServer.uiSettings.replace({}); await PageObjects.settings.navigateTo(); - // await PageObjects.settings.clickKibanaIndexPatterns(); }); describe('data streams', () => { @@ -54,12 +55,13 @@ export default function ({ getService, getPageObjects }) { }); after(async () => { + await kibanaServer.savedObjects.clean({ types: ['index-pattern'] }); await es.transport.request({ path: '/_data_stream/test_data_stream', method: 'DELETE', }); await security.testUser.restoreDefaults(); - await kibanaServer.savedObjects.clean({ types: ['index-pattern'] }); + await soInfo.logSoTypes(log); }); }); } diff --git a/x-pack/test/functional/config.js b/x-pack/test/functional/config.js index b787461673258..c79f335f96cb1 100644 --- a/x-pack/test/functional/config.js +++ b/x-pack/test/functional/config.js @@ -388,7 +388,7 @@ export default async function ({ readConfigFile }) { elasticsearch: { indices: [ { - names: ['logs-*'], + names: ['logs-*', 'test_data_stream'], privileges: ['read', 'view_index_metadata'], }, ], From e0c1a75b0aab6b1fdb376a4af744528245cdb040 Mon Sep 17 00:00:00 2001 From: "rashmi.kulkarni" Date: Wed, 11 Aug 2021 12:49:43 -0700 Subject: [PATCH 3/5] removed unused method added in settings page --- test/functional/page_objects/settings_page.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/functional/page_objects/settings_page.ts b/test/functional/page_objects/settings_page.ts index 6239c17e29cee..5154003c079f6 100644 --- a/test/functional/page_objects/settings_page.ts +++ b/test/functional/page_objects/settings_page.ts @@ -177,10 +177,6 @@ export class SettingsPageObject extends FtrService { await this.testSubjects.click('deleteIndexPatternButton'); } - async clickCloseFlyOutButton() { - await this.testSubjects.click('closeFlyoutButton'); - } - async getIndexPageHeading() { return await this.testSubjects.getVisibleText('indexPatternTitle'); } From 7f8b9db42b2124dadd73c2985d32c0da82e53065 Mon Sep 17 00:00:00 2001 From: "rashmi.kulkarni" Date: Wed, 11 Aug 2021 13:36:23 -0700 Subject: [PATCH 4/5] removed unused index name- logs-* --- x-pack/test/functional/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/test/functional/config.js b/x-pack/test/functional/config.js index c79f335f96cb1..704ce819b5b38 100644 --- a/x-pack/test/functional/config.js +++ b/x-pack/test/functional/config.js @@ -388,7 +388,7 @@ export default async function ({ readConfigFile }) { elasticsearch: { indices: [ { - names: ['logs-*', 'test_data_stream'], + names: ['test_data_stream'], privileges: ['read', 'view_index_metadata'], }, ], From 6b1f8573723341868749469841ed8e251db16af0 Mon Sep 17 00:00:00 2001 From: "rashmi.kulkarni" Date: Wed, 11 Aug 2021 16:18:06 -0700 Subject: [PATCH 5/5] remove unused function from settings page --- test/functional/page_objects/settings_page.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test/functional/page_objects/settings_page.ts b/test/functional/page_objects/settings_page.ts index 5154003c079f6..5c51a8e76dcad 100644 --- a/test/functional/page_objects/settings_page.ts +++ b/test/functional/page_objects/settings_page.ts @@ -746,12 +746,6 @@ export class SettingsPageObject extends FtrService { await this.flyout.ensureClosed('scriptedFieldsHelpFlyout'); } - async closeIndexPatternFlyOut() { - await this.testSubjects.click('createAnyway'); - } - - // createAnyway - async executeScriptedField(script: string, additionalField: string) { this.log.debug('execute Scripted Fields help'); await this.closeScriptedFieldHelp(); // ensure script help is closed so script input is not blocked