2021-01-27 12:56:28 +00:00
|
|
|
export default class CreateClientPage {
|
2022-03-02 16:08:01 +00:00
|
|
|
clientTypeDrpDwn = ".pf-c-select__toggle";
|
|
|
|
clientTypeError = ".pf-c-select + div";
|
|
|
|
clientTypeList = ".pf-c-select__toggle + ul";
|
|
|
|
clientIdInput = "#kc-client-id";
|
|
|
|
clientIdError = "#kc-client-id + div";
|
|
|
|
clientNameInput = "#kc-name";
|
|
|
|
clientDescriptionInput = "#kc-description";
|
|
|
|
alwaysDisplayInConsoleSwitch =
|
|
|
|
'[for="kc-always-display-in-console-switch"] .pf-c-switch__toggle';
|
|
|
|
frontchannelLogoutSwitch =
|
|
|
|
'[for="kc-frontchannelLogout-switch"] .pf-c-switch__toggle';
|
|
|
|
clientAuthenticationSwitch = '[for="kc-authentication"] .pf-c-switch__toggle';
|
|
|
|
standardFlowChkBx = "#kc-flow-standard";
|
|
|
|
directAccessChkBx = "#kc-flow-direct";
|
|
|
|
implicitFlowChkBx = "#kc-flow-implicit";
|
|
|
|
serviceAccountRolesChkBx = "#kc-flow-service-account";
|
2021-01-27 12:56:28 +00:00
|
|
|
|
2022-03-02 16:08:01 +00:00
|
|
|
continueBtn = ".pf-c-wizard__footer .pf-m-primary";
|
|
|
|
backBtn = ".pf-c-wizard__footer .pf-m-secondary";
|
|
|
|
cancelBtn = ".pf-c-wizard__footer .pf-m-link";
|
2021-01-27 12:56:28 +00:00
|
|
|
|
|
|
|
//#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();
|
2021-10-01 14:36:36 +00:00
|
|
|
cy.get(this.clientTypeList).findByTestId(`option-${clientType}`).click();
|
2021-01-27 12:56:28 +00:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2022-03-02 16:08:01 +00:00
|
|
|
fillClientData(
|
|
|
|
id: string,
|
|
|
|
name = "",
|
|
|
|
description = "",
|
|
|
|
alwaysDisplay?: boolean,
|
|
|
|
frontchannelLogout?: boolean
|
|
|
|
) {
|
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);
|
|
|
|
}
|
|
|
|
|
2022-03-02 16:08:01 +00:00
|
|
|
if (alwaysDisplay) {
|
|
|
|
cy.get(this.alwaysDisplayInConsoleSwitch).click();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (frontchannelLogout) {
|
|
|
|
cy.get(this.frontchannelLogoutSwitch).click();
|
|
|
|
}
|
|
|
|
|
2021-01-27 12:56:28 +00:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2021-04-01 14:14:19 +00:00
|
|
|
changeSwitches(switches: string[]) {
|
|
|
|
for (const uiSwitch of switches) {
|
2021-09-17 13:23:34 +00:00
|
|
|
cy.findByTestId(uiSwitch).check({ force: true });
|
2021-04-01 14:14:19 +00:00
|
|
|
}
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2021-01-27 12:56:28 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|