added tests for editing client profile, creating and deleting executors (#1450)
Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com>
This commit is contained in:
parent
a30b202700
commit
e22b27b471
5 changed files with 170 additions and 4 deletions
|
@ -492,6 +492,49 @@ describe("Realm settings tests", () => {
|
||||||
realmSettingsPage.shouldCompleteAndCreateNewClientProfile();
|
realmSettingsPage.shouldCompleteAndCreateNewClientProfile();
|
||||||
realmSettingsPage.shouldNotCreateDuplicateClientProfile();
|
realmSettingsPage.shouldNotCreateDuplicateClientProfile();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("Should edit client profile", () => {
|
||||||
|
realmSettingsPage.shouldEditClientProfile();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should check that edited client profile is now listed", () => {
|
||||||
|
sidebarPage.goToRealmSettings();
|
||||||
|
cy.findByTestId("rs-clientPolicies-tab").click();
|
||||||
|
cy.findByTestId("rs-policies-clientProfiles-tab").click();
|
||||||
|
realmSettingsPage.shouldCheckEditedClientProfileListed();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should show error when client profile left blank", () => {
|
||||||
|
realmSettingsPage.shouldShowErrorWhenNameBlank();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should revert back to the previous profile name", () => {
|
||||||
|
realmSettingsPage.shouldReloadClientProfileEdits();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should not have executors configured by default", () => {
|
||||||
|
realmSettingsPage.shouldNotHaveExecutorsConfigured();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should cancel adding a new executor to a client profile", () => {
|
||||||
|
realmSettingsPage.shouldCancelAddingExecutor();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should add a new executor to a client profile", () => {
|
||||||
|
realmSettingsPage.shouldAddExecutor();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should cancel deleting executor from a client profile", () => {
|
||||||
|
realmSettingsPage.shouldCancelDeletingExecutor();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should delete executor from a client profile", () => {
|
||||||
|
realmSettingsPage.shouldDeleteExecutor();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should delete edited client profile", () => {
|
||||||
|
realmSettingsPage.shouldDeleteEditedProfile();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe.skip("Realm settings client policies tab tests", () => {
|
describe.skip("Realm settings client policies tab tests", () => {
|
||||||
|
|
|
@ -173,6 +173,14 @@ export default class RealmSettingsPage {
|
||||||
private createClientDrpDwn = ".pf-c-dropdown.pf-m-align-right";
|
private createClientDrpDwn = ".pf-c-dropdown.pf-m-align-right";
|
||||||
private searchFld = "[id^=realm-settings][id$=profilesinput]";
|
private searchFld = "[id^=realm-settings][id$=profilesinput]";
|
||||||
private searchFldPolicies = "[id^=realm-settings][id$=clientPoliciesinput]";
|
private searchFldPolicies = "[id^=realm-settings][id$=clientPoliciesinput]";
|
||||||
|
private clientProfileOne = 'a[href*="realm-settings/clientPolicies/Test"]';
|
||||||
|
private clientProfileTwo = 'a[href*="realm-settings/clientPolicies/Edit"]';
|
||||||
|
private reloadBtn = "reloadProfile";
|
||||||
|
private addExecutor = "addExecutor";
|
||||||
|
private addExecutorDrpDwn = ".pf-c-select__toggle";
|
||||||
|
private addExecutorDrpDwnOption = "executorType-select";
|
||||||
|
private addExecutorCancelBtn = "addExecutor-cancelBtn";
|
||||||
|
private addExecutorSaveBtn = "addExecutor-saveBtn";
|
||||||
|
|
||||||
selectLoginThemeType(themeType: string) {
|
selectLoginThemeType(themeType: string) {
|
||||||
cy.get(this.selectLoginTheme).click();
|
cy.get(this.selectLoginTheme).click();
|
||||||
|
@ -578,6 +586,121 @@ export default class RealmSettingsPage {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shouldEditClientProfile() {
|
||||||
|
cy.get(this.clientProfileOne).click();
|
||||||
|
cy.findByTestId(this.newClientProfileNameInput)
|
||||||
|
.click()
|
||||||
|
.clear()
|
||||||
|
.type("Edit");
|
||||||
|
cy.findByTestId(this.newClientProfileDescriptionInput)
|
||||||
|
.click()
|
||||||
|
.clear()
|
||||||
|
.type("Edit Description");
|
||||||
|
cy.findByTestId(this.saveNewClientProfileBtn).click();
|
||||||
|
cy.get(this.alertMessage).should(
|
||||||
|
"be.visible",
|
||||||
|
"Client profile updated successfully"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
shouldCheckEditedClientProfileListed() {
|
||||||
|
cy.get("table").should("be.visible").contains("td", "Edit");
|
||||||
|
cy.get("table").should("not.have.text", "Test");
|
||||||
|
}
|
||||||
|
|
||||||
|
shouldShowErrorWhenNameBlank() {
|
||||||
|
cy.get(this.clientProfileTwo).click();
|
||||||
|
cy.findByTestId(this.newClientProfileNameInput).click().clear();
|
||||||
|
cy.get("form").should("not.have.text", "Required field");
|
||||||
|
}
|
||||||
|
|
||||||
|
shouldReloadClientProfileEdits() {
|
||||||
|
cy.get(this.clientProfileTwo).click();
|
||||||
|
cy.findByTestId(this.newClientProfileNameInput).type("Reloading");
|
||||||
|
cy.findByTestId(this.reloadBtn).click();
|
||||||
|
cy.findByTestId(this.newClientProfileNameInput).should(
|
||||||
|
"have.value",
|
||||||
|
"Edit"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
shouldNotHaveExecutorsConfigured() {
|
||||||
|
cy.get(this.clientProfileTwo).click();
|
||||||
|
cy.get('h6[class*="kc-emptyExecutors"]').should(
|
||||||
|
"have.text",
|
||||||
|
"No executors configured"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
shouldCancelAddingExecutor() {
|
||||||
|
cy.get(this.clientProfileTwo).click();
|
||||||
|
cy.findByTestId(this.addExecutor).click();
|
||||||
|
cy.get(this.addExecutorDrpDwn).click();
|
||||||
|
cy.findByTestId(this.addExecutorDrpDwnOption)
|
||||||
|
.contains("confidential-client")
|
||||||
|
.click();
|
||||||
|
cy.findByTestId(this.addExecutorCancelBtn).click();
|
||||||
|
cy.get('h6[class*="kc-emptyExecutors"]').should(
|
||||||
|
"have.text",
|
||||||
|
"No executors configured"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
shouldAddExecutor() {
|
||||||
|
cy.get(this.clientProfileTwo).click();
|
||||||
|
cy.findByTestId(this.addExecutor).click();
|
||||||
|
cy.get(this.addExecutorDrpDwn).click();
|
||||||
|
cy.findByTestId(this.addExecutorDrpDwnOption)
|
||||||
|
.contains("confidential-client")
|
||||||
|
.click();
|
||||||
|
cy.findByTestId(this.addExecutorSaveBtn).click();
|
||||||
|
cy.get(this.alertMessage).should(
|
||||||
|
"be.visible",
|
||||||
|
"Success! Executor created successfully"
|
||||||
|
);
|
||||||
|
cy.get('ul[class*="pf-c-data-list"]').should(
|
||||||
|
"have.text",
|
||||||
|
"confidential-client"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
shouldCancelDeletingExecutor() {
|
||||||
|
cy.get(this.clientProfileTwo).click();
|
||||||
|
cy.get('svg[class*="kc-executor-trash-icon"]').click();
|
||||||
|
cy.get(this.deleteDialogTitle).contains("Delete executor?");
|
||||||
|
cy.get(this.deleteDialogBodyText).contains(
|
||||||
|
"The action will permanently delete confidential-client. This cannot be undone."
|
||||||
|
);
|
||||||
|
cy.findByTestId("modalConfirm").contains("Delete");
|
||||||
|
cy.get(this.deleteDialogCancelBtn).contains("Cancel").click();
|
||||||
|
cy.get('ul[class*="pf-c-data-list"]').should(
|
||||||
|
"have.text",
|
||||||
|
"confidential-client"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
shouldDeleteExecutor() {
|
||||||
|
cy.get(this.clientProfileTwo).click();
|
||||||
|
cy.get('svg[class*="kc-executor-trash-icon"]').click();
|
||||||
|
cy.get(this.deleteDialogTitle).contains("Delete executor?");
|
||||||
|
cy.get(this.deleteDialogBodyText).contains(
|
||||||
|
"The action will permanently delete confidential-client. This cannot be undone."
|
||||||
|
);
|
||||||
|
cy.findByTestId("modalConfirm").contains("Delete").click();
|
||||||
|
cy.get('h6[class*="kc-emptyExecutors"]').should(
|
||||||
|
"have.text",
|
||||||
|
"No executors configured"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
shouldDeleteEditedProfile() {
|
||||||
|
cy.get(this.moreDrpDwn).last().click();
|
||||||
|
cy.get(this.moreDrpDwnItems).click();
|
||||||
|
cy.findByTestId("modalConfirm").contains("Delete").click();
|
||||||
|
cy.get(this.alertMessage).should("be.visible", "Client profile deleted");
|
||||||
|
cy.get("table").should("not.have.text", "Edit");
|
||||||
|
}
|
||||||
|
|
||||||
shouldNotCreateDuplicateClientPolicy() {
|
shouldNotCreateDuplicateClientPolicy() {
|
||||||
cy.get(this.alertMessage).should(
|
cy.get(this.alertMessage).should(
|
||||||
"be.visible",
|
"be.visible",
|
||||||
|
|
|
@ -321,7 +321,7 @@ export default function ClientProfileForm() {
|
||||||
)}
|
)}
|
||||||
variant="link"
|
variant="link"
|
||||||
className="kc-addExecutor"
|
className="kc-addExecutor"
|
||||||
data-testid="cancelCreateProfile"
|
data-testid="addExecutor"
|
||||||
icon={<PlusCircleIcon />}
|
icon={<PlusCircleIcon />}
|
||||||
>
|
>
|
||||||
{t("realm-settings:addExecutor")}
|
{t("realm-settings:addExecutor")}
|
||||||
|
|
|
@ -183,7 +183,7 @@ export default function ExecutorForm() {
|
||||||
<Button
|
<Button
|
||||||
variant="primary"
|
variant="primary"
|
||||||
onClick={save}
|
onClick={save}
|
||||||
data-testid="realm-settings-add-executor-save-button"
|
data-testid="addExecutor-saveBtn"
|
||||||
>
|
>
|
||||||
{t("common:add")}
|
{t("common:add")}
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -195,7 +195,7 @@ export default function ExecutorForm() {
|
||||||
to={`/${realm}/realm-settings/clientPolicies/${profileName}`}
|
to={`/${realm}/realm-settings/clientPolicies/${profileName}`}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
data-testid="realm-settings-add-executor-cancel-button"
|
data-testid="addExecutor-cancelBtn"
|
||||||
>
|
>
|
||||||
{t("common:cancel")}
|
{t("common:cancel")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
@ -9,7 +9,7 @@ export type ClientProfileParams = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ClientProfileRoute: RouteDef = {
|
export const ClientProfileRoute: RouteDef = {
|
||||||
path: "/:realm/realm-settings/clientPolicies/:profileName/edit-profile",
|
path: "/:realm/realm-settings/clientPolicies/:profileName",
|
||||||
component: lazy(() => import("../ClientProfileForm")),
|
component: lazy(() => import("../ClientProfileForm")),
|
||||||
breadcrumb: (t) => t("realm-settings:clientProfile"),
|
breadcrumb: (t) => t("realm-settings:clientProfile"),
|
||||||
access: ["view-realm", "view-users"],
|
access: ["view-realm", "view-users"],
|
||||||
|
|
Loading…
Reference in a new issue