2021-01-27 12:56:28 +00:00
|
|
|
export default class LoginPage {
|
2021-05-06 08:38:45 +00:00
|
|
|
private userNameInput = "#username";
|
|
|
|
private passwordInput = "#password";
|
|
|
|
private submitBtn = "#kc-login";
|
|
|
|
private userDrpDwn = "#user-dropdown";
|
|
|
|
|
|
|
|
private errorText = ".kc-feedback-text";
|
|
|
|
private oldLoadContainer = "#loading";
|
|
|
|
private loadContainer = "div.keycloak__loading-container";
|
2021-01-27 12:56:28 +00:00
|
|
|
|
|
|
|
isLogInPage() {
|
|
|
|
cy.get(this.userNameInput).should("exist");
|
|
|
|
cy.url().should("include", "/auth");
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
logIn(userName = "admin", password = "admin") {
|
2022-02-16 16:34:54 +00:00
|
|
|
cy.get('[role="progressbar"]').should("not.exist");
|
2021-01-28 09:07:12 +00:00
|
|
|
cy.get(this.oldLoadContainer).should("not.exist");
|
|
|
|
cy.get(this.loadContainer).should("not.exist");
|
|
|
|
|
|
|
|
cy.get("body")
|
|
|
|
.children()
|
|
|
|
.then((children) => {
|
|
|
|
if (children.length == 1) {
|
|
|
|
cy.get(this.userNameInput).type(userName);
|
|
|
|
cy.get(this.passwordInput).type(password);
|
|
|
|
|
|
|
|
cy.get(this.submitBtn).click();
|
|
|
|
}
|
|
|
|
});
|
2022-02-16 16:34:54 +00:00
|
|
|
cy.get('[role="progressbar"]').should("not.exist");
|
2021-01-27 12:56:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
checkErrorIsDisplayed() {
|
|
|
|
cy.get(this.userDrpDwn).should("exist");
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
checkErrorMessage(message: string) {
|
|
|
|
cy.get(this.errorText).invoke("text").should("contain", message);
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|