Skip to content

Commit

Permalink
Use a basic monitoring user for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisronline committed Nov 13, 2019
1 parent 1010f28 commit 2e6abe3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
13 changes: 11 additions & 2 deletions x-pack/test/functional/apps/monitoring/_get_lifecycle_methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);

Expand All @@ -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);
}
};
Expand Down
8 changes: 7 additions & 1 deletion x-pack/test/functional/page_objects/monitoring_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down

0 comments on commit 2e6abe3

Please sign in to comment.