-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added automation for a support-dev-help ticket - user email validation https://github.com/elastic/support-dev-help/issues/4571
- Loading branch information
1 parent
c5d475f
commit 594d447
Showing
10 changed files
with
110 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import expect from 'expect.js'; | ||
import { indexBy } from 'lodash'; | ||
export default function ({ getService, getPageObjects }) { | ||
|
||
const PageObjects = getPageObjects(['security', 'settings', 'common', 'accountSetting']); | ||
const log = getService('log'); | ||
const esArchiver = getService('esArchiver'); | ||
|
||
describe('useremail', function () { | ||
before(async () => { | ||
await esArchiver.load('discover'); | ||
await PageObjects.settings.navigateTo(); | ||
await PageObjects.security.clickElasticsearchUsers(); | ||
}); | ||
|
||
it('should add new user', async function () { | ||
await PageObjects.security.addUser({ username: 'newuser', password: 'changeme', | ||
confirmPassword: 'changeme', fullname: 'newuserFirst newuserLast', email: '[email protected]', | ||
save: true, roles: ['kibana_user', 'superuser'] }); | ||
const users = indexBy(await PageObjects.security.getElasticsearchUsers(), 'username'); | ||
log.debug('actualUsers = %j', users); | ||
expect(users.newuser.roles).to.eql(['kibana_user', 'superuser']); | ||
expect(users.newuser.fullname).to.eql('newuserFirst newuserLast'); | ||
expect(users.newuser.email).to.eql('[email protected]'); | ||
expect(users.newuser.reserved).to.be(false); | ||
await PageObjects.security.logout(); | ||
}); | ||
|
||
it('login as new user and verify email', async function () { | ||
await PageObjects.security.login('newuser', 'changeme'); | ||
await PageObjects.accountSetting.verifyAccountSettings('[email protected]', 'newuser'); | ||
}); | ||
|
||
it('click changepassword link, change the password and re-login', async function () { | ||
await PageObjects.accountSetting.verifyAccountSettings('[email protected]', 'newuser'); | ||
await PageObjects.accountSetting.changePassword('changeme', 'mechange'); | ||
await PageObjects.security.logout(); | ||
}); | ||
|
||
|
||
it('login as new user with changed password', async function () { | ||
await PageObjects.security.login('newuser', 'mechange'); | ||
await PageObjects.accountSetting.verifyAccountSettings('[email protected]', 'newuser'); | ||
}); | ||
|
||
after(async function () { | ||
await PageObjects.security.logout(); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
x-pack/test/functional/page_objects/accountsetting_page.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
//import { map as mapAsync } from 'bluebird'; | ||
import expect from 'expect.js'; | ||
|
||
export function AccountSettingProvider({ getService }) { | ||
const testSubjects = getService('testSubjects'); | ||
|
||
class AccountSettingsPage { | ||
async verifyAccountSettings(expectedEmail, expectedUserName) { | ||
await testSubjects.click('loggedInUser'); | ||
const usernameField = await testSubjects.find('usernameField'); | ||
const userName = await usernameField.getVisibleText(); | ||
expect(userName).to.be(expectedUserName); | ||
const emailIdField = await testSubjects.find('emailIdField'); | ||
const emailField = await emailIdField.getVisibleText(); | ||
expect(emailField).to.be(expectedEmail); | ||
} | ||
|
||
async changePassword(currentPassword, newPassword) { | ||
await testSubjects.click('changePasswordLink'); | ||
await testSubjects.setValue('newPasswordInput', newPassword); | ||
await testSubjects.setValue('currentPasswordInput', currentPassword); | ||
await testSubjects.setValue('confirmPasswordInput', newPassword); | ||
await testSubjects.click('saveChangesButton'); | ||
await testSubjects.existOrFail('passwordUpdateSuccess'); | ||
} | ||
} | ||
return new AccountSettingsPage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters