2021-01-27 12:56:28 +00:00
|
|
|
export default class CreateClientPage {
|
|
|
|
clientTypeDrpDwn: string;
|
|
|
|
clientTypeError: string;
|
|
|
|
clientTypeList: string;
|
|
|
|
clientIdInput: string;
|
|
|
|
clientIdError: string;
|
|
|
|
clientDescriptionInput: string;
|
|
|
|
clientAuthenticationSwitch: string;
|
|
|
|
standardFlowChkBx: string;
|
|
|
|
directAccessChkBx: string;
|
|
|
|
implicitFlowChkBx: string;
|
|
|
|
serviceAccountRolesChkBx: string;
|
|
|
|
continueBtn: string;
|
|
|
|
backBtn: string;
|
|
|
|
cancelBtn: string;
|
|
|
|
clientNameInput: string;
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
this.clientTypeDrpDwn = ".pf-c-select__toggle";
|
|
|
|
this.clientTypeError = ".pf-c-select + div";
|
|
|
|
this.clientTypeList = ".pf-c-select__toggle + ul";
|
|
|
|
this.clientIdInput = "#kc-client-id";
|
|
|
|
this.clientIdError = "#kc-client-id + div";
|
|
|
|
this.clientNameInput = "#kc-name";
|
|
|
|
this.clientDescriptionInput = "#kc-description";
|
|
|
|
|
|
|
|
this.clientAuthenticationSwitch =
|
|
|
|
'[for="kc-authentication"] .pf-c-switch__toggle';
|
|
|
|
this.clientAuthenticationSwitch =
|
|
|
|
'[for="kc-authorization"] .pf-c-switch__toggle';
|
|
|
|
this.standardFlowChkBx = "#kc-flow-standard";
|
|
|
|
this.directAccessChkBx = "#kc-flow-direct";
|
|
|
|
this.implicitFlowChkBx = "#kc-flow-implicit";
|
|
|
|
this.serviceAccountRolesChkBx = "#kc-flow-service-account";
|
|
|
|
|
|
|
|
this.continueBtn = ".pf-c-wizard__footer .pf-m-primary";
|
|
|
|
this.backBtn = ".pf-c-wizard__footer .pf-m-secondary";
|
|
|
|
this.cancelBtn = ".pf-c-wizard__footer .pf-m-link";
|
|
|
|
}
|
|
|
|
|
|
|
|
//#region General Settings
|
2021-01-28 09:07:12 +00:00
|
|
|
selectClientType(clientType: string) {
|
2021-01-27 12:56:28 +00:00
|
|
|
cy.get(this.clientTypeDrpDwn).click();
|
|
|
|
cy.get(this.clientTypeList).contains(clientType).click();
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2021-01-28 09:07:12 +00:00
|
|
|
fillClientData(id: string, name = "", description = "") {
|
2021-01-27 12:56:28 +00:00
|
|
|
cy.get(this.clientIdInput).clear();
|
|
|
|
|
|
|
|
if (id) {
|
|
|
|
cy.get(this.clientIdInput).type(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (name) {
|
|
|
|
cy.get(this.clientNameInput).type(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (description) {
|
|
|
|
cy.get(this.clientDescriptionInput).type(description);
|
|
|
|
}
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2021-04-01 14:14:19 +00:00
|
|
|
changeSwitches(switches: string[]) {
|
|
|
|
for (const uiSwitch of switches) {
|
|
|
|
cy.getId(uiSwitch).check({ force: true });
|
|
|
|
}
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2021-01-27 12:56:28 +00:00
|
|
|
checkClientTypeRequiredMessage(exist = true) {
|
|
|
|
cy.get(this.clientTypeError).should((!exist ? "not." : "") + "exist");
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
checkClientIdRequiredMessage(exist = true) {
|
|
|
|
cy.get(this.clientIdError).should((!exist ? "not." : "") + "exist");
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
//#region Capability config
|
|
|
|
switchClientAuthentication() {
|
|
|
|
cy.get(this.clientAuthenticationSwitch).click();
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
clickStandardFlow() {
|
|
|
|
cy.get(this.standardFlowChkBx).click();
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
clickDirectAccess() {
|
|
|
|
cy.get(this.directAccessChkBx).click();
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
clickImplicitFlow() {
|
|
|
|
cy.get(this.implicitFlowChkBx).click();
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
clickServiceAccountRoles() {
|
|
|
|
cy.get(this.serviceAccountRolesChkBx).click();
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
continue() {
|
|
|
|
cy.get(this.continueBtn).click();
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
back() {
|
|
|
|
cy.get(this.backBtn).click();
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
cancel() {
|
|
|
|
cy.get(this.cancelBtn).click();
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|