2021-01-27 12:56:28 +00:00
|
|
|
export default class CreateRealmPage {
|
2022-02-16 16:34:54 +00:00
|
|
|
private clearBtn = ".pf-c-file-upload__file-select button:last-child";
|
2022-04-06 09:21:04 +00:00
|
|
|
private modalClearBtn = "clear-button";
|
2022-02-16 16:34:54 +00:00
|
|
|
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
|
|
|
|
2021-01-28 09:07:12 +00:00
|
|
|
fillRealmName(realmName: string) {
|
2022-01-20 10:20:35 +00:00
|
|
|
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-02-16 16:34:54 +00:00
|
|
|
|
2022-04-06 09:21:04 +00:00
|
|
|
disableRealm() {
|
|
|
|
cy.get(this.enabledSwitch).click();
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
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
|
|
|
}
|