Add Service Account Tests (#2624)
This commit is contained in:
parent
bb853874d8
commit
5fd94d12b8
5 changed files with 134 additions and 13 deletions
|
@ -16,6 +16,7 @@ import ClientDetailsPage, {
|
|||
ClientsDetailsTab,
|
||||
} from "../support/pages/admin_console/manage/clients/client_details/ClientDetailsPage";
|
||||
import CommonPage from "../support/pages/CommonPage";
|
||||
import ListingPage from "../support/pages/admin_console/ListingPage";
|
||||
|
||||
let itemId = "client_crud";
|
||||
const loginPage = new LoginPage();
|
||||
|
@ -23,6 +24,7 @@ const associatedRolesPage = new AssociatedRolesPage();
|
|||
const createClientPage = new CreateClientPage();
|
||||
const clientDetailsPage = new ClientDetailsPage();
|
||||
const commonPage = new CommonPage();
|
||||
const listingPage = new ListingPage();
|
||||
|
||||
describe("Clients test", () => {
|
||||
describe("Client details - Client scopes subtab", () => {
|
||||
|
@ -721,23 +723,122 @@ describe("Clients test", () => {
|
|||
commonPage.tableUtils().clickRowItemLink(serviceAccountName);
|
||||
serviceAccountTab
|
||||
.goToServiceAccountTab()
|
||||
.checkRoles(["manage-account", "offline_access", "uma_authorization"]);
|
||||
.checkRoles([
|
||||
"default-roles-master",
|
||||
"offline_access",
|
||||
"uma_authorization",
|
||||
"manage-account",
|
||||
"view-profile",
|
||||
"manage-account-links",
|
||||
"uma_protection",
|
||||
])
|
||||
.hideInheritedRoles();
|
||||
|
||||
commonPage.sidebar().waitForPageLoad();
|
||||
|
||||
serviceAccountTab
|
||||
.checkRoles(
|
||||
[
|
||||
"offline_access",
|
||||
"uma_authorization",
|
||||
"manage-account",
|
||||
"view-profile",
|
||||
"manage-account-links",
|
||||
],
|
||||
false
|
||||
)
|
||||
.checkRoles(["default-roles-master", "uma_protection"])
|
||||
.unhideInheritedRoles();
|
||||
|
||||
commonPage.sidebar().waitForPageLoad();
|
||||
|
||||
serviceAccountTab.checkRoles([
|
||||
"default-roles-master",
|
||||
"offline_access",
|
||||
"uma_authorization",
|
||||
"manage-account",
|
||||
"view-profile",
|
||||
"manage-account-links",
|
||||
"uma_protection",
|
||||
]);
|
||||
|
||||
listingPage
|
||||
.searchItem("testing", false)
|
||||
.checkEmptyList()
|
||||
.searchItem("", false);
|
||||
|
||||
serviceAccountTab.checkRoles([
|
||||
"default-roles-master",
|
||||
"offline_access",
|
||||
"uma_authorization",
|
||||
"manage-account",
|
||||
"view-profile",
|
||||
"manage-account-links",
|
||||
"uma_protection",
|
||||
]);
|
||||
});
|
||||
|
||||
it.skip("Assign", () => {
|
||||
it("Assign", () => {
|
||||
commonPage.tableUtils().clickRowItemLink(serviceAccountName);
|
||||
serviceAccountTab
|
||||
.goToServiceAccountTab()
|
||||
.assignRole(false)
|
||||
.selectRow("create-realm")
|
||||
.selectRow("create-realm", true)
|
||||
.assign();
|
||||
commonPage.masthead().checkNotificationMessage("Role mapping updated");
|
||||
|
||||
serviceAccountTab.selectRow("create-realm").unAssign();
|
||||
|
||||
commonPage.sidebar().waitForPageLoad();
|
||||
commonPage.modalUtils().checkModalTitle("Remove mapping?").confirmModal();
|
||||
commonPage
|
||||
.masthead()
|
||||
.checkNotificationMessage("Scope mapping successfully removed");
|
||||
|
||||
cy.intercept("/admin/realms/master/clients").as("assignRoles");
|
||||
serviceAccountTab.checkRoles(["create-realm"], false).assignRole(false);
|
||||
|
||||
cy.wait("@assignRoles");
|
||||
commonPage.sidebar().waitForPageLoad();
|
||||
|
||||
serviceAccountTab
|
||||
.selectRow("offline_access", true)
|
||||
.selectRow("admin", true)
|
||||
.selectRow("create-realm", true)
|
||||
.assign();
|
||||
|
||||
commonPage.masthead().checkNotificationMessage("Role mapping updated");
|
||||
commonPage.sidebar().waitForPageLoad();
|
||||
|
||||
serviceAccountTab
|
||||
.selectRow("offline_access")
|
||||
.selectRow("admin")
|
||||
.unAssign();
|
||||
|
||||
commonPage.modalUtils().confirmModal();
|
||||
|
||||
serviceAccountTab
|
||||
.checkRoles(["admin"], false)
|
||||
.checkRoles(["create-realm"]);
|
||||
|
||||
listingPage.clickRowDetails("create-realm");
|
||||
serviceAccountTab.unAssignFromDropdown();
|
||||
|
||||
commonPage.modalUtils().confirmModal();
|
||||
|
||||
commonPage.sidebar().waitForPageLoad();
|
||||
|
||||
serviceAccountTab
|
||||
.checkRoles(["create-realm"], false)
|
||||
.checkRoles([
|
||||
"default-roles-master",
|
||||
"offline_access",
|
||||
"uma_authorization",
|
||||
"manage-account",
|
||||
"view-profile",
|
||||
"manage-account-links",
|
||||
"uma_protection",
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -174,10 +174,10 @@ describe("Realm settings client policies tab tests", () => {
|
|||
"Test again",
|
||||
"Test Again Description"
|
||||
);
|
||||
masthead.checkNotificationMessage("New policy created");
|
||||
masthead.checkNotificationMessage("New policy created", true);
|
||||
sidebarPage.waitForPageLoad();
|
||||
cy.wait("@save");
|
||||
masthead.closeLastAlertMessage();
|
||||
masthead.closeAllAlertMessages();
|
||||
realmSettingsPage.deleteClientPolicyFromDetails();
|
||||
modalUtils.confirmModal();
|
||||
masthead.checkNotificationMessage("Client policy deleted");
|
||||
|
|
|
@ -56,7 +56,7 @@ export default class Masthead extends CommonElements {
|
|||
cy.get(this.alertMessage).should("contain.text", message);
|
||||
|
||||
if (closeNotification) {
|
||||
cy.get(`button[title="${message}"]`).click();
|
||||
cy.get(`button[title="${message}"]`).last().click({ force: true });
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ export default class Masthead extends CommonElements {
|
|||
}
|
||||
|
||||
closeAllAlertMessages() {
|
||||
cy.get(this.closeAlertMessageBtn).click({ multiple: true });
|
||||
cy.get(this.closeAlertMessageBtn).click({ force: true, multiple: true });
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,10 +7,12 @@ export default class RoleMappingTab {
|
|||
`no-roles-for-this-${type}-empty-action`;
|
||||
private assignRoleBtn = "assignRole";
|
||||
private unAssignBtn = "unAssignRole";
|
||||
private unAssignDrpDwnBtn = '.pf-c-table__action li[role="menuitem"] button';
|
||||
private assignBtn = "assign";
|
||||
private hideInheritedRolesBtn = "#hideInheritedRoles";
|
||||
private assignedRolesTable = "assigned-roles";
|
||||
private namesColumn = 'td[data-label="Name"]:visible';
|
||||
private actionBtn = 'button[aria-label="Actions"]';
|
||||
|
||||
constructor(type: string) {
|
||||
this.type = type;
|
||||
|
@ -43,13 +45,23 @@ export default class RoleMappingTab {
|
|||
return this;
|
||||
}
|
||||
|
||||
unAssignFromDropdown() {
|
||||
cy.get(this.unAssignDrpDwnBtn).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
hideInheritedRoles() {
|
||||
cy.get(this.hideInheritedRolesBtn).check();
|
||||
return this;
|
||||
}
|
||||
|
||||
selectRow(name: string) {
|
||||
cy.get(this.namesColumn)
|
||||
unhideInheritedRoles() {
|
||||
cy.get(this.hideInheritedRolesBtn).uncheck();
|
||||
return this;
|
||||
}
|
||||
|
||||
selectRow(name: string, modal = false) {
|
||||
cy.get(modal ? ".pf-c-modal-box " : "" + this.namesColumn)
|
||||
.contains(name)
|
||||
.parent()
|
||||
.within(() => {
|
||||
|
@ -58,14 +70,19 @@ export default class RoleMappingTab {
|
|||
return this;
|
||||
}
|
||||
|
||||
checkRoles(roleNames: string[]) {
|
||||
checkRoles(roleNames: string[], exist = true) {
|
||||
if (roleNames.length) {
|
||||
cy.findByTestId(this.assignedRolesTable)
|
||||
.get(this.namesColumn)
|
||||
.should((roles) => {
|
||||
for (let index = 0; index < roleNames.length; index++) {
|
||||
const roleName = roleNames[index];
|
||||
expect(roles).to.contain(roleName);
|
||||
|
||||
if (exist) {
|
||||
expect(roles).to.contain(roleName);
|
||||
} else {
|
||||
expect(roles).not.to.contain(roleName);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
|
|
@ -258,7 +258,7 @@ export const ClientScopes = ({
|
|||
|
||||
setKebabOpen(false);
|
||||
addAlert(
|
||||
t("clientScopeRemoveSuccess"),
|
||||
t("clients:clientScopeRemoveSuccess"),
|
||||
AlertVariant.success
|
||||
);
|
||||
refresh();
|
||||
|
@ -307,7 +307,10 @@ export const ClientScopes = ({
|
|||
row,
|
||||
row.type as ClientScope
|
||||
);
|
||||
addAlert(t("clientScopeRemoveSuccess"), AlertVariant.success);
|
||||
addAlert(
|
||||
t("clients:clientScopeRemoveSuccess"),
|
||||
AlertVariant.success
|
||||
);
|
||||
refresh();
|
||||
} catch (error) {
|
||||
addError("clients:clientScopeRemoveError", error);
|
||||
|
|
Loading…
Reference in a new issue