From 7d17a40aeda36929207395c613fde839be1b55c5 Mon Sep 17 00:00:00 2001 From: liza-mae Date: Thu, 11 Aug 2022 15:49:13 -0600 Subject: [PATCH 1/5] Fix console test on cloud --- test/functional/apps/console/_console.ts | 20 ++++++++++++++++++-- test/functional/config.base.js | 15 +++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/test/functional/apps/console/_console.ts b/test/functional/apps/console/_console.ts index 0878442156ab7..9300bbfa49552 100644 --- a/test/functional/apps/console/_console.ts +++ b/test/functional/apps/console/_console.ts @@ -28,6 +28,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const browser = getService('browser'); const PageObjects = getPageObjects(['common', 'console', 'header']); const toasts = getService('toasts'); + const security = getService('security'); + const testSubjects = getService('testSubjects'); describe('console app', function describeIndexTests() { this.tags('includeFirefox'); @@ -151,7 +153,21 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.console.clickPlay(); }; + before(async () => { + await security.testUser.setRoles(['kibana_admin', 'test_index']); + }); + + after(async () => { + + await security.testUser.restoreDefaults(); + }); + beforeEach(async () => { + // Welcome fly out exists sometimes + const flyOutExists = await testSubjects.exists('euiFlyoutCloseButton'); + if (flyOutExists) { + await testSubjects.click('euiFlyoutCloseButton'); + } await PageObjects.console.clearTextArea(); }); @@ -160,8 +176,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await retry.try(async () => { const response = await PageObjects.console.getResponse(); log.debug(response); - expect(response).to.contain('# PUT test-index 200 OK'); - expect(response).to.contain('# DELETE test-index 200 OK'); + expect(response).to.contain('# PUT test-index 200'); + expect(response).to.contain('# DELETE test-index 200'); }); }); diff --git a/test/functional/config.base.js b/test/functional/config.base.js index dd576cbbd4f49..d543f13755cce 100644 --- a/test/functional/config.base.js +++ b/test/functional/config.base.js @@ -249,6 +249,21 @@ export default async function ({ readConfigFile }) { kibana: [], }, + test_index: { + elasticsearch: { + cluster: [], + indices: [ + { + names: ['test-index'], + privileges: ['read', 'view_index_metadata', 'manage', 'create_index', 'index'], + field_security: { grant: ['*'], except: [] }, + }, + ], + run_as: [], + }, + kibana: [], + }, + index_a: { elasticsearch: { cluster: [], From 711eb04d6a47edc5796f9b316acfc5aa9eca00c0 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 11 Aug 2022 21:58:18 +0000 Subject: [PATCH 2/5] [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' --- test/functional/apps/console/_console.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/test/functional/apps/console/_console.ts b/test/functional/apps/console/_console.ts index 9300bbfa49552..57aab9b80bb66 100644 --- a/test/functional/apps/console/_console.ts +++ b/test/functional/apps/console/_console.ts @@ -158,7 +158,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); after(async () => { - await security.testUser.restoreDefaults(); }); From a75d8289fc498be31d393a234b7e99e4fd4507a4 Mon Sep 17 00:00:00 2001 From: liza-mae Date: Thu, 11 Aug 2022 16:17:19 -0600 Subject: [PATCH 3/5] Fix access to sample data --- test/functional/apps/console/_vector_tile.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/functional/apps/console/_vector_tile.ts b/test/functional/apps/console/_vector_tile.ts index 3959877fdf685..35af502f1c744 100644 --- a/test/functional/apps/console/_vector_tile.ts +++ b/test/functional/apps/console/_vector_tile.ts @@ -12,9 +12,11 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const PageObjects = getPageObjects(['common', 'console', 'header', 'home']); const retry = getService('retry'); + const security = getService('security'); describe('console vector tiles response validation', function describeIndexTests() { before(async () => { + await security.testUser.setRoles(['kibana_admin', 'kibana_sample_admin']); await PageObjects.common.navigateToUrl('home', '/tutorial_directory/sampleData', { useActualUrl: true, }); From fa61ec53f9a7e04bc1b59bdc8210f778316797e0 Mon Sep 17 00:00:00 2001 From: liza-mae Date: Thu, 11 Aug 2022 16:28:41 -0600 Subject: [PATCH 4/5] Clean up access after test --- test/functional/apps/console/_vector_tile.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/functional/apps/console/_vector_tile.ts b/test/functional/apps/console/_vector_tile.ts index 35af502f1c744..9a211a9767a8d 100644 --- a/test/functional/apps/console/_vector_tile.ts +++ b/test/functional/apps/console/_vector_tile.ts @@ -28,6 +28,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.console.clearTextArea(); }); + after(async () => { + await security.testUser.restoreDefaults(); + }); + it('should validate response', async () => { await PageObjects.console.enterText(`GET kibana_sample_data_logs/_mvt/geo.coordinates/0/0/0`); await PageObjects.console.clickPlay(); From 9516e7fe978c73d9a0962fa4aa23fb8255794223 Mon Sep 17 00:00:00 2001 From: liza-mae Date: Thu, 11 Aug 2022 16:36:12 -0600 Subject: [PATCH 5/5] Fix restore test --- test/functional/apps/console/_vector_tile.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/functional/apps/console/_vector_tile.ts b/test/functional/apps/console/_vector_tile.ts index 9a211a9767a8d..77b186227ed28 100644 --- a/test/functional/apps/console/_vector_tile.ts +++ b/test/functional/apps/console/_vector_tile.ts @@ -28,10 +28,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.console.clearTextArea(); }); - after(async () => { - await security.testUser.restoreDefaults(); - }); - it('should validate response', async () => { await PageObjects.console.enterText(`GET kibana_sample_data_logs/_mvt/geo.coordinates/0/0/0`); await PageObjects.console.clickPlay(); @@ -47,6 +43,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.home.removeSampleDataSet('logs'); + await security.testUser.restoreDefaults(); }); }); }