keycloak-scim/apps/admin-ui/cypress/support/pages/admin_console/CreateRealmPage.ts

57 lines
1.2 KiB
TypeScript
Raw Normal View History

2021-01-27 12:56:28 +00:00
export default class CreateRealmPage {
private clearBtn = ".pf-c-file-upload__file-select button:last-child";
2022-04-06 09:21:04 +00:00
private modalClearBtn = "clear-button";
private realmNameInput = "#kc-realm-name";
private enabledSwitch =
'[for="kc-realm-enabled-switch"] span.pf-c-switch__toggle';
private createBtn = '.pf-c-form__group:last-child button[type="submit"]';
private cancelBtn = '.pf-c-form__group:last-child button[type="button"]';
2022-04-06 09:21:04 +00:00
private codeEditor = ".pf-c-code-editor__code";
2021-01-27 12:56:28 +00:00
fillRealmName(realmName: string) {
cy.get(this.realmNameInput).clear().type(realmName);
2021-01-27 12:56:28 +00:00
return this;
}
2022-04-06 09:21:04 +00:00
fillCodeEditor() {
cy.get(this.codeEditor).click().type("clear this field");
return this;
}
2021-01-27 12:56:28 +00:00
createRealm() {
cy.get(this.createBtn).click();
return this;
}
2022-04-06 09:21:04 +00:00
disableRealm() {
cy.get(this.enabledSwitch).click();
return this;
}
cancelRealmCreation() {
cy.get(this.cancelBtn).click();
return this;
}
2022-04-06 09:21:04 +00:00
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;
}
2021-01-27 12:56:28 +00:00
}