keycloak-scim/js/apps/admin-ui/cypress/support/pages/admin-ui/CreateRealmPage.ts
Jon Koops fefe2f57ae
Use JavaScript private class features (#24054)
Uses JavaScript [private class features](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields) over TypeScript's `private` keyword. Also introduces some ESLint configuration to enforce this rule throughout the project.
2023-10-23 14:12:55 -04:00

55 lines
1.2 KiB
TypeScript

export default class CreateRealmPage {
#clearBtn = ".pf-c-file-upload__file-select button:last-child";
#modalClearBtn = "clear-button";
#realmNameInput = "#kc-realm-name";
#enabledSwitch = '[for="kc-realm-enabled-switch"] span.pf-c-switch__toggle';
#createBtn = '.pf-c-form__group:last-child button[type="submit"]';
#cancelBtn = '.pf-c-form__group:last-child button[type="button"]';
#codeEditor = ".pf-c-code-editor__code";
fillRealmName(realmName: string) {
cy.get(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() {
cy.get(this.#clearBtn).click();
cy.findByTestId(this.#modalClearBtn).click();
return this;
}
verifyRealmNameFieldInvalid() {
cy.get(this.#realmNameInput)
.next("div")
.contains("Required field")
.should("have.class", "pf-m-error");
return this;
}
}