From 2e6abe38d80dca763c94fcf330c09e3c484a7853 Mon Sep 17 00:00:00 2001 From: chrisronline Date: Thu, 10 Oct 2019 12:56:42 -0400 Subject: [PATCH] Use a basic monitoring user for tests --- .../apps/monitoring/_get_lifecycle_methods.js | 13 +++++++++++-- .../test/functional/page_objects/monitoring_page.js | 8 +++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/x-pack/test/functional/apps/monitoring/_get_lifecycle_methods.js b/x-pack/test/functional/apps/monitoring/_get_lifecycle_methods.js index 6e2f0e2f00bcc..63c859bd3f05e 100644 --- a/x-pack/test/functional/apps/monitoring/_get_lifecycle_methods.js +++ b/x-pack/test/functional/apps/monitoring/_get_lifecycle_methods.js @@ -6,7 +6,8 @@ export const getLifecycleMethods = (getService, getPageObjects) => { const esArchiver = getService('esArchiver'); - const PageObjects = getPageObjects(['monitoring', 'timePicker']); + const security = getService('security'); + const PageObjects = getPageObjects(['monitoring', 'timePicker', 'security']); const noData = getService('monitoringNoData'); let _archive; @@ -17,6 +18,12 @@ export const getLifecycleMethods = (getService, getPageObjects) => { const kibanaServer = getService('kibanaServer'); const browser = getService('browser'); + await security.user.create('monitoring_user', { + password: 'monitoring_user-password', + roles: ['monitoring_user', 'kibana_user'], + full_name: 'monitoring all', + }); + // provide extra height for the page and avoid clusters sending telemetry during tests await browser.setWindowSize(1600, 1000); @@ -33,7 +40,9 @@ export const getLifecycleMethods = (getService, getPageObjects) => { await PageObjects.timePicker.setAbsoluteRange(from, to); }, - tearDown() { + async tearDown() { + await PageObjects.security.logout(); + await security.user.delete('monitoring_user'); return esArchiver.unload(_archive); } }; diff --git a/x-pack/test/functional/page_objects/monitoring_page.js b/x-pack/test/functional/page_objects/monitoring_page.js index 933962c160bc9..db3456f643b97 100644 --- a/x-pack/test/functional/page_objects/monitoring_page.js +++ b/x-pack/test/functional/page_objects/monitoring_page.js @@ -5,11 +5,17 @@ */ export function MonitoringPageProvider({ getPageObjects, getService }) { - const PageObjects = getPageObjects(['common', 'header']); + const PageObjects = getPageObjects(['common', 'header', 'shield', 'spaceSelector']); const testSubjects = getService('testSubjects'); return new class MonitoringPage { async navigateTo() { + await PageObjects.common.navigateToApp('login'); + await PageObjects.shield.login( + 'monitoring_user', + 'monitoring_user-password' + ); + await PageObjects.spaceSelector.clickSpaceAvatar('default'); await PageObjects.common.navigateToApp('monitoring'); }