Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.5] [Monitoring] Use a basic monitoring user for tests (#47865) #50929

Merged
merged 1 commit into from
Nov 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/functional/apps/monitoring/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand All @@ -40,5 +39,6 @@ export default function ({ loadTestFile }) {
loadTestFile(require.resolve('./beats/beat_detail'));

loadTestFile(require.resolve('./time_filter'));
loadTestFile(require.resolve('./enable_monitoring'));
});
}
19 changes: 17 additions & 2 deletions x-pack/test/functional/page_objects/monitoring_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down