src/page_objects/web/profile/password.page.js
/* TODO: WORK IN PROGRESS*/
import BasePage from "../../base.page.js";
/**
* PasswordPage
* @extends BasePage
*/
class PasswordPage extends BasePage {
/**
* @param {args} args Args from controller
*/
constructor(args) {
super(args);
}
// PAGE ELEMENTS
/* eslint-disable require-jsdoc */
currentPasswordField() {
return this.element("input#currentPwd");
}
newPasswordField() {
return this.element("input#resetPwd");
}
confirmPasswordField() {
return this.element("input#confirmPwd");
}
updateButton() {
return this.element(
"button[class^=btn ladda-button ls-purple ng-scope ng-pristine ng-valid]"
);
}
/* eslint-enable require-jsdoc */
// PAGE FUNCTIONS
/** Fill in fields on password page, and update.
* @param {String} currentPassword Current password of user to be changed
* @param {String} newPassword Requested new password of user
* @param {String} confirmPassword Confirmation of requested new password
*/
async changePassword(currentPassword, newPassword, confirmPassword) {
await this.currentPasswordField().setValue(currentPassword);
await this.newPasswordField().setValue(newPassword);
await this.confirmPasswordField().setValue(confirmPassword);
await this.updateButton().click();
}
}
export default PasswordPage;