keycloak-scim/cypress/support/pages/admin_console/manage/clients/CreateClientPage.ts
Erik Jan de Wit 8d72f8a705
Fixing cypress tests (#586)
* upgrade cypress

* fixed delete now has dialog

* also check "unAssign"

* client type no longer required

* providers and group changes

* grp creation working

* moved create realm button ouside the dropdown

* sped up test and added cleanup

* Revert "moved create realm button ouside the dropdown"

This reverts commit e2076a5305808417de910ba8fada8e528e5c356a.

* make test re-runnable

* removed un needed navigation

* Fix misformed Cypress config for GitHub Action

* cleanup after test

* fixed cleanup

* temporary removed this test

* also remove user "new"

* try adding a wait for CI

* get different modal id

* add {force: true} to modal functions

* mv grp search last and ignore 401

* try using cy.get and disable video for testing

* add back video artifacts

Co-authored-by: mfrances <mfrances@redhat.com>
Co-authored-by: Jon Koops <jonkoops@gmail.com>
Co-authored-by: jenny-s51 <jshandel@redhat.com>
2021-05-06 07:31:40 +02:00

130 lines
2.9 KiB
TypeScript

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
selectClientType(clientType: string) {
cy.get(this.clientTypeDrpDwn).click();
cy.get(this.clientTypeList).contains(clientType).click();
return this;
}
fillClientData(id: string, name = "", description = "") {
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;
}
changeSwitches(switches: string[]) {
for (const uiSwitch of switches) {
cy.getId(uiSwitch).check({ force: true });
}
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;
}
}