From 13d17925440a87a46db8490414e3c6acd6edccf7 Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Wed, 25 Oct 2023 16:01:46 +0200 Subject: [PATCH] [ftr] read username from config (#169755) ## Summary Similar to #169639 The tests fail on MKI because username is hardcoded to `elastic_serverless`. Reading value from FTR config should fix it. --- .../functional/test_suites/common/reporting/management.ts | 6 ++++-- .../functional/test_suites/observability/cases/view_case.ts | 4 ++-- .../functional/test_suites/security/ftr/cases/view_case.ts | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/x-pack/test_serverless/functional/test_suites/common/reporting/management.ts b/x-pack/test_serverless/functional/test_suites/common/reporting/management.ts index 70f0037cd17c3..c36000889d481 100644 --- a/x-pack/test_serverless/functional/test_suites/common/reporting/management.ts +++ b/x-pack/test_serverless/functional/test_suites/common/reporting/management.ts @@ -17,6 +17,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { const retry = getService('retry'); const PageObjects = getPageObjects(['common', 'svlCommonPage', 'header']); const reportingAPI = getService('svlReportingApi'); + const config = getService('config'); const navigateToReportingManagement = async () => { log.debug(`navigating to reporting management app`); @@ -47,8 +48,9 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { ], }; - const TEST_USERNAME = 'elastic_serverless'; - const TEST_PASSWORD = 'changeme'; + // Kibana CI and MKI use different users + const TEST_USERNAME = config.get('servers.kibana.username'); + const TEST_PASSWORD = config.get('servers.kibana.password'); before('initialize saved object archive', async () => { // add test saved search object diff --git a/x-pack/test_serverless/functional/test_suites/observability/cases/view_case.ts b/x-pack/test_serverless/functional/test_suites/observability/cases/view_case.ts index c60b7a8ed103c..0e60fa0125234 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/cases/view_case.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/cases/view_case.ts @@ -28,7 +28,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { const cases = getService('cases'); const svlCases = getService('svlCases'); const find = getService('find'); - + const config = getService('config'); const retry = getService('retry'); const comboBox = getService('comboBox'); const svlCommonNavigation = getPageObject('svlCommonNavigation'); @@ -453,7 +453,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { const reporterText = await reporter.getVisibleText(); - expect(reporterText).to.be('elastic_serverless'); + expect(reporterText).to.be(config.get('servers.kibana.username')); }); }); diff --git a/x-pack/test_serverless/functional/test_suites/security/ftr/cases/view_case.ts b/x-pack/test_serverless/functional/test_suites/security/ftr/cases/view_case.ts index c3d8285857634..d9531a4529ee5 100644 --- a/x-pack/test_serverless/functional/test_suites/security/ftr/cases/view_case.ts +++ b/x-pack/test_serverless/functional/test_suites/security/ftr/cases/view_case.ts @@ -28,7 +28,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { const cases = getService('cases'); const svlCases = getService('svlCases'); const find = getService('find'); - + const config = getService('config'); const retry = getService('retry'); const comboBox = getService('comboBox'); const svlCommonNavigation = getPageObject('svlCommonNavigation'); @@ -452,7 +452,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { const reporterText = await reporter.getVisibleText(); - expect(reporterText).to.be('elastic_serverless'); + expect(reporterText).to.be(config.get('servers.kibana.username')); }); });