keycloak-scim/cypress/support/pages/LoginPage.ts
Aboullos 5227115f05
Add Clients tests, fix notification message and stabilize tests (#1999)
* Add Clients tests and fix notification message

* Remove TODO message

* Add waits and refactor

* Refactor and fix tests in realm settings

* Fix lint

* Refactor, fix tests and add stability

* Refactor and stabilize tests

* Stabilize tests

* Fix Realm settings event test and stabilize

* Set confirmModal to always force click

* Add force click and wait

* Fix masthead test

* Modify cypress.json

* Modify realm dropdown selector

* Revert hook changes
2022-02-16 17:34:54 +01:00

47 lines
1.2 KiB
TypeScript

export default class LoginPage {
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";
isLogInPage() {
cy.get(this.userNameInput).should("exist");
cy.url().should("include", "/auth");
return this;
}
logIn(userName = "admin", password = "admin") {
cy.get('[role="progressbar"]').should("not.exist");
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();
}
});
cy.get('[role="progressbar"]').should("not.exist");
}
checkErrorIsDisplayed() {
cy.get(this.userDrpDwn).should("exist");
return this;
}
checkErrorMessage(message: string) {
cy.get(this.errorText).invoke("text").should("contain", message);
return this;
}
}