fixed realm role test (#962)
This commit is contained in:
parent
55c0e5766f
commit
9eedd13a6b
3 changed files with 27 additions and 35 deletions
|
@ -1,43 +1,30 @@
|
||||||
export default class AssociatedRolesPage {
|
export default class AssociatedRolesPage {
|
||||||
actionDropdown: string;
|
private actionDropdown = "action-dropdown";
|
||||||
addRolesDropdownItem: string;
|
private addRolesDropdownItem = "add-roles";
|
||||||
addRoleToolbarButton: string;
|
private addRoleToolbarButton = "add-role-button";
|
||||||
checkbox: string;
|
private checkbox = "[type=checkbox]";
|
||||||
addAssociatedRolesModalButton: string;
|
private addAssociatedRolesModalButton = "add-associated-roles-button";
|
||||||
compositeRoleBadge: string;
|
private compositeRoleBadge = "composite-role-badge";
|
||||||
filterTypeDropdown: string;
|
private filterTypeDropdown = "filter-type-dropdown";
|
||||||
filterTypeDropdownItem: string;
|
private filterTypeDropdownItem = "filter-type-dropdown-item";
|
||||||
usersPage: string;
|
private usersPage = "users-page";
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this.actionDropdown = "[data-testid=action-dropdown]";
|
|
||||||
this.addRolesDropdownItem = "[data-testid=add-roles]";
|
|
||||||
this.addRoleToolbarButton = "[data-testid=add-role-button]";
|
|
||||||
this.checkbox = "[type=checkbox]";
|
|
||||||
this.addAssociatedRolesModalButton =
|
|
||||||
"[data-testid=add-associated-roles-button]";
|
|
||||||
this.compositeRoleBadge = "[data-testid=composite-role-badge]";
|
|
||||||
this.filterTypeDropdown = "[data-testid=filter-type-dropdown]";
|
|
||||||
this.filterTypeDropdownItem = "[data-testid=filter-type-dropdown-item]";
|
|
||||||
this.usersPage = "[data-testid=users-page]";
|
|
||||||
}
|
|
||||||
|
|
||||||
addAssociatedRealmRole() {
|
addAssociatedRealmRole() {
|
||||||
cy.get(this.actionDropdown).last().click();
|
cy.getId(this.actionDropdown).last().click();
|
||||||
|
|
||||||
const load = "/auth/admin/realms/master/clients";
|
const load = "/auth/admin/realms/master/clients";
|
||||||
cy.intercept(load).as("load");
|
cy.intercept(load).as("load");
|
||||||
|
|
||||||
cy.get(this.addRolesDropdownItem).click();
|
cy.getId(this.addRolesDropdownItem).click();
|
||||||
|
|
||||||
cy.wait(["@load"]);
|
cy.wait(["@load"]);
|
||||||
cy.get(this.checkbox).eq(2).check();
|
cy.get(this.checkbox).eq(2).check();
|
||||||
|
|
||||||
cy.get(this.addAssociatedRolesModalButton).contains("Add").click();
|
cy.getId(this.addAssociatedRolesModalButton).contains("Add").click();
|
||||||
|
|
||||||
cy.url().should("include", "/AssociatedRoles");
|
cy.url().should("include", "/AssociatedRoles");
|
||||||
|
|
||||||
cy.get(this.compositeRoleBadge).should("contain.text", "Composite");
|
cy.getId(this.compositeRoleBadge).should("contain.text", "Composite");
|
||||||
|
|
||||||
cy.wait(["@load"]);
|
cy.wait(["@load"]);
|
||||||
|
|
||||||
|
@ -45,20 +32,23 @@ export default class AssociatedRolesPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
addAssociatedClientRole() {
|
addAssociatedClientRole() {
|
||||||
cy.get(this.addRoleToolbarButton).click();
|
cy.getId(this.addRoleToolbarButton).click();
|
||||||
|
|
||||||
cy.get(this.filterTypeDropdown).click();
|
cy.getId(this.filterTypeDropdown).click();
|
||||||
|
|
||||||
cy.get(this.filterTypeDropdownItem).click();
|
cy.getId(this.filterTypeDropdownItem).click();
|
||||||
|
|
||||||
cy.get(".pf-c-spinner__tail-ball").should("not.exist");
|
cy.getId(".pf-c-spinner__tail-ball").should("not.exist");
|
||||||
|
|
||||||
cy.get(this.checkbox).eq(12).check({ force: true });
|
cy.get('[data-testid="addAssociatedRole"] td[data-label="Role name"]')
|
||||||
|
.contains("manage-account")
|
||||||
|
.parent()
|
||||||
|
.within(() => {
|
||||||
|
cy.get("input").click();
|
||||||
|
});
|
||||||
|
|
||||||
cy.get(this.addAssociatedRolesModalButton).contains("Add").click();
|
cy.getId(this.addAssociatedRolesModalButton).contains("Add").click();
|
||||||
|
|
||||||
cy.get(".pf-c-spinner__tail-ball").should("not.exist");
|
cy.contains("Users in role").click().getId(this.usersPage).should("exist");
|
||||||
|
|
||||||
cy.contains("Users in role").click().get(this.usersPage).should("exist");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,6 +157,7 @@ export const AssociatedRolesModal = (props: AssociatedRolesModalProps) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
|
data-testid="addAssociatedRole"
|
||||||
title={t("roles:associatedRolesModalTitle", { name })}
|
title={t("roles:associatedRolesModalTitle", { name })}
|
||||||
isOpen={props.open}
|
isOpen={props.open}
|
||||||
onClose={props.toggleDialog}
|
onClose={props.toggleDialog}
|
||||||
|
|
|
@ -316,6 +316,7 @@ export const RealmRoleTabs = () => {
|
||||||
titleKey={role?.name || t("createRole")}
|
titleKey={role?.name || t("createRole")}
|
||||||
badges={[
|
badges={[
|
||||||
{
|
{
|
||||||
|
id: "composite-role-badge",
|
||||||
text: additionalRoles.length > 0 ? t("composite") : "",
|
text: additionalRoles.length > 0 ? t("composite") : "",
|
||||||
readonly: true,
|
readonly: true,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue