keycloak-scim/js/apps/admin-ui/cypress/support/pages/admin-ui/CreateRealmPage.ts
Jon Koops d3c2475041
Upgrade admin and account console to PatternFly 5 (#28196)
Closes #21345
Closes #21344

Signed-off-by: Jon Koops <jonkoops@gmail.com>
Co-authored-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Co-authored-by: Mark Franceschelli <mfrances@redhat.com>
Co-authored-by: Hynek Mlnařík <hmlnarik@redhat.com>
Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com>
2024-04-05 16:37:05 +02:00

57 lines
1.2 KiB
TypeScript

import FormValidation from "../../forms/FormValidation";
export default class CreateRealmPage {
#modalClearBtn = "clear-button";
#realmNameInput = "realm";
#enabledSwitch = ".pf-v5-c-toolbar .pf-v5-c-switch__toggle";
#createBtn = '.pf-v5-c-form__group:last-child button[type="submit"]';
#cancelBtn = '.pf-v5-c-form__group:last-child button[type="button"]';
#codeEditor = ".pf-v5-c-code-editor__code";
#getClearBtn() {
return cy.findByText("Clear");
}
fillRealmName(realmName: string) {
cy.findByTestId(this.#realmNameInput).clear().type(realmName);
return this;
}
fillCodeEditor() {
cy.get(this.#codeEditor).click().type("clear this field");
return this;
}
createRealm() {
cy.get(this.#createBtn).click();
return this;
}
disableRealm() {
cy.get(this.#enabledSwitch).click();
return this;
}
cancelRealmCreation() {
cy.get(this.#cancelBtn).click();
return this;
}
clearTextField() {
this.#getClearBtn().click();
cy.findByTestId(this.#modalClearBtn).click();
return this;
}
verifyRealmNameFieldInvalid() {
FormValidation.assertRequired(cy.findByTestId(this.#realmNameInput));
return this;
}
}