keycloak-scim/js/apps/admin-ui/cypress/support/pages/LoginPage.ts
Hynek Mlnařík 5ec3d759d9
Randomize Cypress TS and fix tests failing after this change (#29350)
* Fix user_fed_ldap_test

Signed-off-by: Hynek Mlnarik <hmlnarik@redhat.com>

* Fix clients_test

Signed-off-by: Hynek Mlnarik <hmlnarik@redhat.com>

* Generate random seed to shuffle tests

Signed-off-by: Jon Koops <jonkoops@gmail.com>

* Remove async / await

Signed-off-by: Hynek Mlnarik <hmlnarik@redhat.com>

* Fix async test

Signed-off-by: Hynek Mlnarik <hmlnarik@redhat.com>

---------

Signed-off-by: Hynek Mlnarik <hmlnarik@redhat.com>
Signed-off-by: Jon Koops <jonkoops@gmail.com>
Co-authored-by: Jon Koops <jonkoops@gmail.com>
2024-05-08 09:33:21 -04:00

38 lines
935 B
TypeScript

export default class LoginPage {
#userNameInput = "#username";
#passwordInput = "#password";
#submitBtn = "#kc-login";
#oldLoadContainer = "#loading";
#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.session(
[userName, password],
() => {
cy.visit("/");
cy.get('[role="progressbar"]').should("not.exist");
cy.get(this.#oldLoadContainer).should("not.exist");
cy.get(this.#loadContainer).should("not.exist");
cy.get(this.#userNameInput).type(userName);
cy.get(this.#passwordInput).type(password);
cy.get(this.#submitBtn).click();
},
{
validate() {
cy.get('[role="progressbar"]').should("not.exist");
},
},
);
}
}