kibana/x-pack/test/functional/page_objects/accountsetting_page.js
Spencer 76cc216aa0
[@kbn/expect] "fork" expect.js into repo (#33761) (#33799)
* [@kbn/expect] "fork" expect.js into repo

* [eslint] autofix references to expect.js

* [tslint] autofix all expect.js imports

* now that expect.js is in strict mode, avoid reassigning fn.length
2019-03-25 13:13:12 -07:00

37 lines
1.4 KiB
JavaScript

/*
* 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 '@kbn/expect';
export function AccountSettingProvider({ getService }) {
const testSubjects = getService('testSubjects');
const userMenu = getService('userMenu');
class AccountSettingsPage {
async verifyAccountSettings(expectedEmail, expectedUserName) {
await userMenu.clickProvileLink();
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();
}