2019-11-29 22:16:18 +01:00
|
|
|
const path = require('path');
|
|
|
|
const base = require('../base/base');
|
|
|
|
|
|
|
|
class Login {
|
|
|
|
constructor() {
|
|
|
|
this.loginForm = '.login-form-2';
|
2019-11-29 22:51:45 +01:00
|
|
|
this.emailField = '#id_username';
|
|
|
|
this.passwordField = '#id_password';
|
|
|
|
this.loginButton = '.btnSubmit';
|
|
|
|
this.warringMessage = '.text-warning';
|
2019-11-29 22:16:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
isLoginFormDisplayed() {
|
|
|
|
base.waitForDisplayed(this.loginForm);
|
|
|
|
return base.isDisplayed(this.loginForm);
|
|
|
|
}
|
2019-11-29 22:51:45 +01:00
|
|
|
|
|
|
|
fillCredentials(selector, text) {
|
|
|
|
base.fillIn(selector, text, 'Fill credentials');
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
clickLoginButton() {
|
|
|
|
base.click(this.loginButton, 'Login button');
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
getErrorMessage() {
|
|
|
|
base.waitForDisplayed(this.warringMessage);
|
|
|
|
return base.getAttribute(this.warringMessage, 'textContent', 'Error message text');
|
|
|
|
}
|
|
|
|
|
2019-11-29 22:16:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Login;
|