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..c1faa25ed9c70 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; @@ -33,7 +34,9 @@ export const getLifecycleMethods = (getService, getPageObjects) => { await PageObjects.timePicker.setAbsoluteRange(from, to); }, - tearDown() { + async tearDown() { + await PageObjects.security.logout(); + await security.user.delete('basic_monitoring_user'); return esArchiver.unload(_archive); } }; diff --git a/x-pack/test/functional/apps/monitoring/enable_monitoring/index.js b/x-pack/test/functional/apps/monitoring/enable_monitoring/index.js index 2cdecc58266a6..aa96d71228799 100644 --- a/x-pack/test/functional/apps/monitoring/enable_monitoring/index.js +++ b/x-pack/test/functional/apps/monitoring/enable_monitoring/index.js @@ -17,7 +17,7 @@ export default function ({ getService, getPageObjects }) { before(async () => { const browser = getService('browser'); await browser.setWindowSize(1600, 1000); - await PageObjects.monitoring.navigateTo(); + await PageObjects.monitoring.navigateTo(true); await noData.isOnNoDataPage(); }); diff --git a/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_security.ts b/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_security.ts index 2d645d161c134..84a4a2697a278 100644 --- a/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_security.ts +++ b/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_security.ts @@ -13,7 +13,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { const appsMenu = getService('appsMenu'); const PageObjects = getPageObjects(['common', 'security']); - describe('securty', () => { + describe('security', () => { before(async () => { await esArchiver.load('empty_kibana'); diff --git a/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_spaces.ts b/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_spaces.ts index 94714f7b0ca34..4508d6a8e5a18 100644 --- a/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_spaces.ts +++ b/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_spaces.ts @@ -19,6 +19,12 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await esArchiver.load('empty_kibana'); }); + after(async () => { + await esArchiver.unload('empty_kibana'); + await PageObjects.common.navigateToApp('home'); + await PageObjects.security.logout(); + }); + describe('space with no features disabled', () => { before(async () => { await spacesService.create({ diff --git a/x-pack/test/functional/apps/monitoring/index.js b/x-pack/test/functional/apps/monitoring/index.js index 06c8dc292869e..77ca4087da13a 100644 --- a/x-pack/test/functional/apps/monitoring/index.js +++ b/x-pack/test/functional/apps/monitoring/index.js @@ -13,7 +13,6 @@ export default function ({ loadTestFile }) { loadTestFile(require.resolve('./cluster/list')); loadTestFile(require.resolve('./cluster/overview')); loadTestFile(require.resolve('./cluster/alerts')); - loadTestFile(require.resolve('./enable_monitoring')); // loadTestFile(require.resolve('./cluster/license')); loadTestFile(require.resolve('./elasticsearch/overview')); @@ -40,5 +39,6 @@ export default function ({ loadTestFile }) { loadTestFile(require.resolve('./beats/beat_detail')); loadTestFile(require.resolve('./time_filter')); + loadTestFile(require.resolve('./enable_monitoring')); }); } diff --git a/x-pack/test/functional/page_objects/monitoring_page.js b/x-pack/test/functional/page_objects/monitoring_page.js index 933962c160bc9..58214f17f4ff0 100644 --- a/x-pack/test/functional/page_objects/monitoring_page.js +++ b/x-pack/test/functional/page_objects/monitoring_page.js @@ -5,11 +5,26 @@ */ export function MonitoringPageProvider({ getPageObjects, getService }) { - const PageObjects = getPageObjects(['common', 'header']); + const PageObjects = getPageObjects(['common', 'header', 'shield', 'spaceSelector']); const testSubjects = getService('testSubjects'); + const security = getService('security'); return new class MonitoringPage { - async navigateTo() { + async navigateTo(useSuperUser = false) { + // always create this because our tear down tries to delete it + await security.user.create('basic_monitoring_user', { + password: 'monitoring_user_password', + roles: ['monitoring_user', 'kibana_user'], + full_name: 'basic monitoring', + }); + + if (!useSuperUser) { + await PageObjects.common.navigateToApp('login'); + await PageObjects.shield.login( + 'basic_monitoring_user', + 'monitoring_user_password' + ); + } await PageObjects.common.navigateToApp('monitoring'); }