Skip to content

Commit

Permalink
Rework this a little to fix the issue that the tests aren't working p…
Browse files Browse the repository at this point in the history
…roperly
  • Loading branch information
chrisronline committed Nov 13, 2019
1 parent 2e6abe3 commit 7b842eb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ 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 @@ -42,7 +36,7 @@ export const getLifecycleMethods = (getService, getPageObjects) => {

async tearDown() {
await PageObjects.security.logout();
await security.user.delete('monitoring_user');
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
23 changes: 16 additions & 7 deletions x-pack/test/functional/page_objects/monitoring_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,24 @@
export function MonitoringPageProvider({ getPageObjects, getService }) {
const PageObjects = getPageObjects(['common', 'header', 'shield', 'spaceSelector']);
const testSubjects = getService('testSubjects');
const security = getService('security');

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');
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

0 comments on commit 7b842eb

Please sign in to comment.