2021-01-27 12:56:28 +00:00
|
|
|
import LoginPage from "../support/pages/LoginPage";
|
|
|
|
import Masthead from "../support/pages/admin_console/Masthead";
|
2022-02-22 12:46:49 +00:00
|
|
|
import ListingPage, {
|
|
|
|
Filter,
|
|
|
|
FilterAssignedType,
|
|
|
|
} from "../support/pages/admin_console/ListingPage";
|
2021-01-27 12:56:28 +00:00
|
|
|
import SidebarPage from "../support/pages/admin_console/SidebarPage";
|
|
|
|
import CreateClientPage from "../support/pages/admin_console/manage/clients/CreateClientPage";
|
2021-02-24 07:59:12 +00:00
|
|
|
import ModalUtils from "../support/util/ModalUtils";
|
2021-02-28 20:02:31 +00:00
|
|
|
import AdvancedTab from "../support/pages/admin_console/manage/clients/AdvancedTab";
|
2022-02-24 10:31:46 +00:00
|
|
|
import adminClient from "../support/util/AdminClient";
|
2021-03-05 13:47:59 +00:00
|
|
|
import InitialAccessTokenTab from "../support/pages/admin_console/manage/clients/InitialAccessTokenTab";
|
2022-03-09 16:42:51 +00:00
|
|
|
import { keycloakBefore } from "../support/util/keycloak_hooks";
|
2021-04-20 12:10:00 +00:00
|
|
|
import RoleMappingTab from "../support/pages/admin_console/manage/RoleMappingTab";
|
2021-05-04 08:11:58 +00:00
|
|
|
import KeysTab from "../support/pages/admin_console/manage/clients/KeysTab";
|
2021-12-10 12:24:26 +00:00
|
|
|
import ClientScopesTab from "../support/pages/admin_console/manage/clients/ClientScopesTab";
|
2022-03-09 16:41:45 +00:00
|
|
|
import CreateRealmRolePage from "../support/pages/admin_console/manage/realm_roles/CreateRealmRolePage";
|
|
|
|
import AssociatedRolesPage from "../support/pages/admin_console/manage/realm_roles/AssociatedRolesPage";
|
|
|
|
import ClientRolesTab from "../support/pages/admin_console/manage/clients/ClientRolesTab";
|
2021-01-21 12:09:50 +00:00
|
|
|
|
2021-01-27 12:47:57 +00:00
|
|
|
let itemId = "client_crud";
|
|
|
|
const loginPage = new LoginPage();
|
2022-03-09 16:41:45 +00:00
|
|
|
const associatedRolesPage = new AssociatedRolesPage();
|
2021-01-27 12:47:57 +00:00
|
|
|
const masthead = new Masthead();
|
|
|
|
const sidebarPage = new SidebarPage();
|
|
|
|
const listingPage = new ListingPage();
|
|
|
|
const createClientPage = new CreateClientPage();
|
2021-02-24 07:59:12 +00:00
|
|
|
const modalUtils = new ModalUtils();
|
2022-03-09 16:41:45 +00:00
|
|
|
const createRealmRolePage = new CreateRealmRolePage();
|
2021-01-27 12:47:57 +00:00
|
|
|
|
2021-10-04 06:03:19 +00:00
|
|
|
describe("Clients test", () => {
|
2022-04-06 09:21:04 +00:00
|
|
|
describe("Client details - Client scopes subtab", () => {
|
2022-02-22 12:46:49 +00:00
|
|
|
const clientScopesTab = new ClientScopesTab();
|
2021-12-10 12:24:26 +00:00
|
|
|
const clientId = "client-scopes-subtab-test";
|
|
|
|
const clientScopeName = "client-scope-test";
|
2022-02-22 12:46:49 +00:00
|
|
|
const clientScopeNameDefaultType = "client-scope-test-default-type";
|
|
|
|
const clientScopeNameOptionalType = "client-scope-test-optional-type";
|
2021-12-10 12:24:26 +00:00
|
|
|
const clientScope = {
|
|
|
|
name: clientScopeName,
|
|
|
|
description: "",
|
|
|
|
protocol: "openid-connect",
|
|
|
|
attributes: {
|
|
|
|
"include.in.token.scope": "true",
|
|
|
|
"display.on.consent.screen": "true",
|
|
|
|
"gui.order": "1",
|
|
|
|
"consent.screen.text": "",
|
|
|
|
},
|
|
|
|
};
|
2022-02-22 12:46:49 +00:00
|
|
|
const msgScopeMappingRemoved = "Scope mapping successfully removed";
|
2021-12-10 12:24:26 +00:00
|
|
|
|
|
|
|
before(async () => {
|
2022-02-24 10:31:46 +00:00
|
|
|
adminClient.createClient({
|
2021-12-10 12:24:26 +00:00
|
|
|
clientId,
|
|
|
|
protocol: "openid-connect",
|
|
|
|
publicClient: false,
|
|
|
|
});
|
|
|
|
for (let i = 0; i < 5; i++) {
|
|
|
|
clientScope.name = clientScopeName + i;
|
2022-02-24 10:31:46 +00:00
|
|
|
await adminClient.createClientScope(clientScope);
|
|
|
|
await adminClient.addDefaultClientScopeInClient(
|
2021-12-10 12:24:26 +00:00
|
|
|
clientScopeName + i,
|
|
|
|
clientId
|
|
|
|
);
|
|
|
|
}
|
2022-02-22 12:46:49 +00:00
|
|
|
clientScope.name = clientScopeNameDefaultType;
|
2022-02-24 10:31:46 +00:00
|
|
|
await adminClient.createClientScope(clientScope);
|
2022-02-22 12:46:49 +00:00
|
|
|
clientScope.name = clientScopeNameOptionalType;
|
2022-02-24 10:31:46 +00:00
|
|
|
await adminClient.createClientScope(clientScope);
|
2021-12-10 12:24:26 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
keycloakBefore();
|
|
|
|
loginPage.logIn();
|
|
|
|
sidebarPage.goToClients();
|
2022-03-06 15:25:37 +00:00
|
|
|
cy.intercept("/admin/realms/master/clients/*").as("fetchClient");
|
2021-12-10 12:24:26 +00:00
|
|
|
listingPage.searchItem(clientId).goToItemDetails(clientId);
|
|
|
|
cy.wait("@fetchClient");
|
2022-01-08 09:27:57 +00:00
|
|
|
clientScopesTab.goToClientScopesTab();
|
2021-12-10 12:24:26 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
after(async () => {
|
2022-02-24 10:31:46 +00:00
|
|
|
adminClient.deleteClient(clientId);
|
2021-12-10 12:24:26 +00:00
|
|
|
for (let i = 0; i < 5; i++) {
|
2022-02-24 10:31:46 +00:00
|
|
|
await adminClient.deleteClientScope(clientScopeName + i);
|
2021-12-10 12:24:26 +00:00
|
|
|
}
|
2022-02-24 10:31:46 +00:00
|
|
|
await adminClient.deleteClientScope(clientScopeNameDefaultType);
|
|
|
|
await adminClient.deleteClientScope(clientScopeNameOptionalType);
|
2022-02-22 12:46:49 +00:00
|
|
|
});
|
|
|
|
|
2022-03-09 16:41:45 +00:00
|
|
|
it("Should list client scopes", () => {
|
2022-02-22 12:46:49 +00:00
|
|
|
listingPage.itemsGreaterThan(1).itemExist(clientScopeName + 0);
|
|
|
|
});
|
|
|
|
|
2022-03-09 16:41:45 +00:00
|
|
|
it("Should search existing client scope by name", () => {
|
2022-02-22 12:46:49 +00:00
|
|
|
listingPage
|
|
|
|
.searchItem(clientScopeName + 0, false)
|
|
|
|
.itemExist(clientScopeName + 0)
|
|
|
|
.itemsEqualTo(2);
|
|
|
|
});
|
|
|
|
|
2022-03-09 16:41:45 +00:00
|
|
|
it("Should search non-existent client scope by name", () => {
|
2022-02-22 12:46:49 +00:00
|
|
|
const itemName = "non-existent-item";
|
|
|
|
listingPage.searchItem(itemName, false).checkTableExists(false);
|
|
|
|
});
|
|
|
|
|
2022-03-09 16:41:45 +00:00
|
|
|
it("Should search existing client scope by assigned type", () => {
|
2022-02-22 12:46:49 +00:00
|
|
|
listingPage
|
|
|
|
.selectFilter(Filter.AssignedType)
|
|
|
|
.selectSecondaryFilterAssignedType(FilterAssignedType.Default)
|
|
|
|
.itemExist(FilterAssignedType.Default)
|
|
|
|
.itemExist(FilterAssignedType.Optional, false)
|
|
|
|
.selectSecondaryFilterAssignedType(FilterAssignedType.Optional)
|
|
|
|
.itemExist(FilterAssignedType.Default, false)
|
|
|
|
.itemExist(FilterAssignedType.Optional)
|
|
|
|
.selectSecondaryFilterAssignedType(FilterAssignedType.AllTypes)
|
|
|
|
.itemExist(FilterAssignedType.Default)
|
|
|
|
.itemExist(FilterAssignedType.Optional);
|
|
|
|
});
|
|
|
|
|
2022-03-09 16:41:45 +00:00
|
|
|
/*it("Should empty search", () => {
|
2022-02-22 12:46:49 +00:00
|
|
|
|
|
|
|
});*/
|
|
|
|
|
|
|
|
const newItemsWithExpectedAssignedTypes = [
|
|
|
|
[clientScopeNameOptionalType, FilterAssignedType.Optional],
|
|
|
|
[clientScopeNameDefaultType, FilterAssignedType.Default],
|
|
|
|
];
|
|
|
|
newItemsWithExpectedAssignedTypes.forEach(($type) => {
|
|
|
|
const [itemName, assignedType] = $type;
|
2022-03-09 16:41:45 +00:00
|
|
|
it(`Should add client scope ${itemName} with ${assignedType} assigned type`, () => {
|
2022-02-22 12:46:49 +00:00
|
|
|
listingPage.clickPrimaryButton();
|
|
|
|
modalUtils.checkModalTitle("Add client scopes to " + clientId);
|
|
|
|
listingPage.clickItemCheckbox(itemName);
|
|
|
|
modalUtils.confirmModalWithItem(assignedType);
|
|
|
|
masthead.checkNotificationMessage("Scope mapping successfully updated");
|
|
|
|
listingPage
|
|
|
|
.searchItem(itemName, false)
|
|
|
|
.itemExist(itemName)
|
|
|
|
.itemExist(assignedType);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
const expectedItemAssignedTypes = [
|
|
|
|
FilterAssignedType.Optional,
|
|
|
|
FilterAssignedType.Default,
|
|
|
|
];
|
|
|
|
expectedItemAssignedTypes.forEach(($assignedType) => {
|
|
|
|
const itemName = clientScopeName + 0;
|
2022-03-09 16:41:45 +00:00
|
|
|
it(`Should change item ${itemName} AssignedType to ${$assignedType} from search bar`, () => {
|
2022-02-22 12:46:49 +00:00
|
|
|
listingPage
|
|
|
|
.searchItem(itemName, false)
|
|
|
|
.clickItemCheckbox(itemName)
|
|
|
|
.changeTypeToOfSelectedItems($assignedType);
|
|
|
|
masthead.checkNotificationMessage("Scope mapping updated");
|
|
|
|
listingPage.searchItem(itemName, false).itemExist($assignedType);
|
|
|
|
});
|
2021-12-10 12:24:26 +00:00
|
|
|
});
|
|
|
|
|
2022-03-09 16:41:45 +00:00
|
|
|
it("Should show items on next page are more than 11", () => {
|
2022-02-22 12:46:49 +00:00
|
|
|
listingPage.showNextPageTableItems().itemsGreaterThan(1);
|
2021-12-10 12:24:26 +00:00
|
|
|
});
|
2022-02-22 12:46:49 +00:00
|
|
|
|
2022-03-09 16:41:45 +00:00
|
|
|
it("Should remove client scope from item bar", () => {
|
2022-02-22 12:46:49 +00:00
|
|
|
const itemName = clientScopeName + 0;
|
|
|
|
listingPage.searchItem(itemName, false).removeItem(itemName);
|
|
|
|
masthead.checkNotificationMessage(msgScopeMappingRemoved);
|
|
|
|
listingPage.searchItem(itemName, false).checkTableExists(false);
|
|
|
|
});
|
|
|
|
|
2022-03-09 16:41:45 +00:00
|
|
|
/*it("Should remove client scope from search bar", () => {
|
2022-02-22 12:46:49 +00:00
|
|
|
//covered by next test
|
|
|
|
});*/
|
|
|
|
|
|
|
|
// TODO: https://github.com/keycloak/keycloak-admin-ui/issues/1854
|
2022-03-09 16:41:45 +00:00
|
|
|
it("Should remove multiple client scopes from search bar", () => {
|
2022-02-22 12:46:49 +00:00
|
|
|
const itemName1 = clientScopeName + 1;
|
|
|
|
const itemName2 = clientScopeName + 2;
|
|
|
|
listingPage
|
|
|
|
.clickSearchBarActionButton()
|
|
|
|
.checkDropdownItemIsDisabled("Remove")
|
|
|
|
.searchItem(clientScopeName, false)
|
|
|
|
.clickItemCheckbox(itemName1)
|
|
|
|
.clickItemCheckbox(itemName2)
|
|
|
|
.clickSearchBarActionButton()
|
|
|
|
.clickSearchBarActionItem("Remove");
|
|
|
|
masthead.checkNotificationMessage(msgScopeMappingRemoved);
|
|
|
|
listingPage
|
|
|
|
.searchItem(clientScopeName, false)
|
|
|
|
.itemExist(itemName1, false)
|
|
|
|
.itemExist(itemName2, false)
|
|
|
|
.clickSearchBarActionButton();
|
|
|
|
//.checkDropdownItemIsDisabled("Remove");
|
|
|
|
});
|
|
|
|
|
|
|
|
//TODO: https://github.com/keycloak/keycloak-admin-ui/issues/1874
|
2022-03-09 16:41:45 +00:00
|
|
|
/* it("Should show initial items after filtering", () => {
|
2022-02-22 12:46:49 +00:00
|
|
|
listingPage
|
|
|
|
.selectFilter(Filter.AssignedType)
|
|
|
|
.selectFilterAssignedType(FilterAssignedType.Optional)
|
|
|
|
.selectFilter(Filter.Name)
|
|
|
|
.itemExist(FilterAssignedType.Default)
|
|
|
|
.itemExist(FilterAssignedType.Optional);
|
|
|
|
});*/
|
2021-12-10 12:24:26 +00:00
|
|
|
});
|
|
|
|
|
2022-04-06 09:21:04 +00:00
|
|
|
describe("Client creation", () => {
|
2022-01-07 07:27:58 +00:00
|
|
|
before(() => {
|
2021-03-18 12:48:14 +00:00
|
|
|
keycloakBefore();
|
2021-01-21 12:09:50 +00:00
|
|
|
loginPage.logIn();
|
2022-01-07 07:27:58 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
2021-01-21 12:09:50 +00:00
|
|
|
sidebarPage.goToClients();
|
2021-01-25 17:17:59 +00:00
|
|
|
});
|
2021-01-21 12:09:50 +00:00
|
|
|
|
2022-03-02 21:59:37 +00:00
|
|
|
it("Should cancel creating client", () => {
|
|
|
|
listingPage.goToCreateItem();
|
|
|
|
|
|
|
|
createClientPage.continue().checkClientIdRequiredMessage();
|
|
|
|
|
|
|
|
createClientPage
|
|
|
|
.fillClientData("")
|
|
|
|
.selectClientType("openid-connect")
|
|
|
|
.cancel();
|
|
|
|
|
|
|
|
cy.url().should("not.include", "/add-client");
|
|
|
|
});
|
|
|
|
|
2022-03-28 13:14:56 +00:00
|
|
|
it("Should check settings elements", () => {
|
|
|
|
listingPage.goToCreateItem();
|
|
|
|
const clientId = "Test settings";
|
|
|
|
|
|
|
|
createClientPage
|
|
|
|
.fillClientData(clientId)
|
|
|
|
.continue()
|
|
|
|
.checkCapabilityConfigElements()
|
|
|
|
.save();
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage("Client created successfully");
|
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
|
|
|
|
createClientPage
|
|
|
|
.checkCapabilityConfigElements()
|
|
|
|
.checkAccessSettingsElements()
|
|
|
|
.checkLoginSettingsElements()
|
|
|
|
.checkLogoutSettingsElements()
|
|
|
|
.deleteClientFromActionDropdown();
|
|
|
|
|
|
|
|
modalUtils.confirmModal();
|
|
|
|
listingPage.itemExist(clientId, false);
|
|
|
|
});
|
|
|
|
|
2022-03-02 21:59:37 +00:00
|
|
|
it("Should navigate to previous using 'back' button", () => {
|
|
|
|
listingPage.goToCreateItem();
|
|
|
|
|
|
|
|
createClientPage.continue().checkClientIdRequiredMessage();
|
|
|
|
|
|
|
|
createClientPage
|
|
|
|
.fillClientData("test_client")
|
|
|
|
.selectClientType("openid-connect")
|
|
|
|
.continue()
|
|
|
|
.back()
|
|
|
|
.checkGeneralSettingsStepActive();
|
|
|
|
});
|
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
it("Should fail creating client", () => {
|
2021-01-21 12:09:50 +00:00
|
|
|
listingPage.goToCreateItem();
|
|
|
|
|
2021-05-06 05:31:40 +00:00
|
|
|
createClientPage.continue().checkClientIdRequiredMessage();
|
2021-01-21 12:09:50 +00:00
|
|
|
|
|
|
|
createClientPage
|
|
|
|
.fillClientData("")
|
|
|
|
.selectClientType("openid-connect")
|
|
|
|
.continue()
|
|
|
|
.checkClientIdRequiredMessage();
|
|
|
|
|
2022-03-02 21:59:37 +00:00
|
|
|
createClientPage.fillClientData("account").continue().save();
|
2021-01-21 12:09:50 +00:00
|
|
|
|
|
|
|
// The error should inform about duplicated name/id
|
|
|
|
masthead.checkNotificationMessage(
|
2021-07-28 12:01:42 +00:00
|
|
|
"Could not create client: 'Client account already exists'"
|
2021-01-21 12:09:50 +00:00
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2021-10-04 06:03:19 +00:00
|
|
|
it("Client CRUD test", () => {
|
2021-01-25 17:17:59 +00:00
|
|
|
itemId += "_" + (Math.random() + 1).toString(36).substring(7);
|
2021-01-27 12:56:28 +00:00
|
|
|
|
2021-01-25 17:17:59 +00:00
|
|
|
// Create
|
2021-01-21 12:09:50 +00:00
|
|
|
listingPage.itemExist(itemId, false).goToCreateItem();
|
2022-03-28 13:14:56 +00:00
|
|
|
createClientPage.cancel();
|
|
|
|
listingPage.itemExist(itemId, false).goToCreateItem();
|
2021-01-21 12:09:50 +00:00
|
|
|
|
|
|
|
createClientPage
|
|
|
|
.selectClientType("openid-connect")
|
|
|
|
.fillClientData(itemId)
|
|
|
|
.continue()
|
2022-03-02 21:59:37 +00:00
|
|
|
.switchClientAuthentication()
|
|
|
|
.clickDirectAccess()
|
|
|
|
.clickImplicitFlow()
|
|
|
|
.clickOAuthDeviceAuthorizationGrant()
|
|
|
|
.clickOidcCibaGrant()
|
|
|
|
.clickServiceAccountRoles()
|
|
|
|
.clickStandardFlow()
|
|
|
|
.save();
|
2021-01-21 12:09:50 +00:00
|
|
|
|
|
|
|
masthead.checkNotificationMessage("Client created successfully");
|
|
|
|
|
|
|
|
sidebarPage.goToClients();
|
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
listingPage.searchItem("John Doe", false).checkEmptyList();
|
|
|
|
listingPage.searchItem("").itemExist("account");
|
2021-01-27 12:56:28 +00:00
|
|
|
listingPage.searchItem(itemId).itemExist(itemId);
|
2021-01-21 12:09:50 +00:00
|
|
|
|
2021-01-25 17:17:59 +00:00
|
|
|
// Delete
|
2021-02-24 07:59:12 +00:00
|
|
|
listingPage.deleteItem(itemId);
|
2022-02-16 16:34:54 +00:00
|
|
|
sidebarPage.waitForPageLoad();
|
2021-02-24 07:59:12 +00:00
|
|
|
modalUtils.checkModalTitle(`Delete ${itemId} ?`).confirmModal();
|
2021-01-21 12:09:50 +00:00
|
|
|
|
|
|
|
masthead.checkNotificationMessage("The client has been deleted");
|
|
|
|
|
|
|
|
listingPage.itemExist(itemId, false);
|
|
|
|
});
|
2021-03-05 13:47:59 +00:00
|
|
|
|
2022-03-28 13:14:56 +00:00
|
|
|
it("Initial access token can't be created with 0 days and count", () => {
|
|
|
|
const initialAccessTokenTab = new InitialAccessTokenTab();
|
|
|
|
initialAccessTokenTab
|
|
|
|
.goToInitialAccessTokenTab()
|
|
|
|
.shouldBeEmpty()
|
|
|
|
.goToCreateFromEmptyList()
|
|
|
|
.fillNewTokenData(0, 0)
|
|
|
|
.checkExpirationGreaterThanZeroError()
|
|
|
|
.checkCountValue(1)
|
|
|
|
.checkSaveButtonIsDisabled();
|
|
|
|
});
|
|
|
|
|
2022-03-29 10:39:32 +00:00
|
|
|
it("Initial access token", () => {
|
2021-03-05 13:47:59 +00:00
|
|
|
const initialAccessTokenTab = new InitialAccessTokenTab();
|
2022-02-16 16:34:54 +00:00
|
|
|
initialAccessTokenTab
|
|
|
|
.goToInitialAccessTokenTab()
|
|
|
|
.shouldBeEmpty()
|
|
|
|
.goToCreateFromEmptyList()
|
|
|
|
.fillNewTokenData(1, 3)
|
|
|
|
.save();
|
2021-03-05 13:47:59 +00:00
|
|
|
|
|
|
|
modalUtils.checkModalTitle("Initial access token details").closeModal();
|
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
masthead.checkNotificationMessage(
|
|
|
|
"New initial access token has been created"
|
|
|
|
);
|
|
|
|
|
2021-03-05 13:47:59 +00:00
|
|
|
initialAccessTokenTab.shouldNotBeEmpty();
|
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
listingPage
|
|
|
|
.searchItem("John Doe", false)
|
|
|
|
.checkEmptyList()
|
|
|
|
.searchItem("", false);
|
|
|
|
|
|
|
|
initialAccessTokenTab.getFirstId((id) => {
|
2022-04-06 09:21:04 +00:00
|
|
|
listingPage.checkRowColumnValue(id, 4, "4").itemExist(id);
|
2022-02-16 16:34:54 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
listingPage.goToCreateItem();
|
|
|
|
initialAccessTokenTab.fillNewTokenData(1, 3).save();
|
|
|
|
|
|
|
|
modalUtils.closeModal();
|
|
|
|
|
|
|
|
initialAccessTokenTab.getFirstId((id) => {
|
2021-03-05 13:47:59 +00:00
|
|
|
listingPage.deleteItem(id);
|
2022-02-16 16:34:54 +00:00
|
|
|
sidebarPage.waitForPageLoad();
|
2021-03-05 13:47:59 +00:00
|
|
|
modalUtils
|
|
|
|
.checkModalTitle("Delete initial access token?")
|
|
|
|
.confirmModal();
|
|
|
|
});
|
2022-02-16 16:34:54 +00:00
|
|
|
|
|
|
|
masthead.checkNotificationMessage(
|
|
|
|
"Initial access token deleted successfully"
|
|
|
|
);
|
|
|
|
initialAccessTokenTab.shouldNotBeEmpty();
|
|
|
|
|
|
|
|
initialAccessTokenTab.getFirstId((id) => {
|
|
|
|
listingPage.deleteItem(id);
|
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
modalUtils.confirmModal();
|
|
|
|
});
|
|
|
|
initialAccessTokenTab.shouldBeEmpty();
|
2021-03-05 13:47:59 +00:00
|
|
|
});
|
2021-01-21 12:09:50 +00:00
|
|
|
});
|
2021-02-28 20:02:31 +00:00
|
|
|
|
2022-03-09 16:41:45 +00:00
|
|
|
describe("Roles tab test", () => {
|
|
|
|
const rolesTab = new ClientRolesTab();
|
|
|
|
let client: string;
|
|
|
|
|
|
|
|
before(() => {
|
|
|
|
keycloakBefore();
|
|
|
|
loginPage.logIn();
|
|
|
|
sidebarPage.goToClients();
|
|
|
|
|
|
|
|
client = "client_" + (Math.random() + 1).toString(36).substring(7);
|
|
|
|
|
|
|
|
listingPage.goToCreateItem();
|
|
|
|
|
|
|
|
createClientPage
|
|
|
|
.selectClientType("openid-connect")
|
|
|
|
.fillClientData(client)
|
|
|
|
.continue()
|
|
|
|
.save();
|
|
|
|
masthead.checkNotificationMessage("Client created successfully", true);
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
keycloakBefore();
|
|
|
|
loginPage.logIn();
|
|
|
|
sidebarPage.goToClients();
|
|
|
|
listingPage.searchItem(client).goToItemDetails(client);
|
|
|
|
rolesTab.goToRolesTab();
|
|
|
|
});
|
|
|
|
|
|
|
|
after(() => {
|
|
|
|
adminClient.deleteClient(client);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should fail to create client role with empty name", () => {
|
|
|
|
rolesTab.goToCreateRoleFromEmptyState();
|
|
|
|
createRealmRolePage.fillRealmRoleData("").save();
|
|
|
|
createRealmRolePage.checkRealmRoleNameRequiredMessage();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should create client role", () => {
|
|
|
|
rolesTab.goToCreateRoleFromEmptyState();
|
|
|
|
createRealmRolePage.fillRealmRoleData(itemId).save();
|
|
|
|
masthead.checkNotificationMessage("Role created", true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should update client role description", () => {
|
|
|
|
listingPage.searchItem(itemId, false).goToItemDetails(itemId);
|
|
|
|
const updateDescription = "updated description";
|
|
|
|
createRealmRolePage.updateDescription(updateDescription).save();
|
|
|
|
masthead.checkNotificationMessage("The role has been saved", true);
|
|
|
|
createRealmRolePage.checkDescription(updateDescription);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should add attribute to client role", () => {
|
|
|
|
cy.intercept("/admin/realms/master/roles-by-id/*").as("load");
|
|
|
|
listingPage.goToItemDetails(itemId);
|
|
|
|
rolesTab.goToAttributesTab();
|
|
|
|
cy.wait(["@load", "@load"]);
|
|
|
|
rolesTab.addAttribute();
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage("The role has been saved", true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should delete attribute from client role", () => {
|
|
|
|
cy.intercept("/admin/realms/master/roles-by-id/*").as("load");
|
|
|
|
listingPage.goToItemDetails(itemId);
|
|
|
|
rolesTab.goToAttributesTab();
|
|
|
|
cy.wait(["@load", "@load"]);
|
|
|
|
rolesTab.deleteAttribute();
|
|
|
|
masthead.checkNotificationMessage("The role has been saved", true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should create client role to be deleted", () => {
|
|
|
|
rolesTab.goToCreateRoleFromToolbar();
|
|
|
|
createRealmRolePage.fillRealmRoleData("client_role_to_be_deleted").save();
|
|
|
|
masthead.checkNotificationMessage("Role created", true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should fail to create duplicate client role", () => {
|
|
|
|
rolesTab.goToCreateRoleFromToolbar();
|
|
|
|
createRealmRolePage.fillRealmRoleData(itemId).save();
|
|
|
|
masthead.checkNotificationMessage(
|
|
|
|
`Could not create role: Role with name ${itemId} already exists`,
|
|
|
|
true
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should search existing client role", () => {
|
|
|
|
listingPage.searchItem(itemId, false).itemExist(itemId);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should search non-existing role test", () => {
|
|
|
|
listingPage.searchItem("role_DNE", false);
|
|
|
|
cy.findByTestId(listingPage.emptyState).should("exist");
|
|
|
|
});
|
|
|
|
|
|
|
|
it("roles empty search test", () => {
|
|
|
|
listingPage.searchItem("", false);
|
|
|
|
cy.get("table:visible");
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Add associated roles test", () => {
|
|
|
|
listingPage.searchItem(itemId, false).goToItemDetails(itemId);
|
|
|
|
|
|
|
|
// Add associated realm role
|
|
|
|
associatedRolesPage.addAssociatedRealmRole("create-realm");
|
|
|
|
masthead.checkNotificationMessage(
|
|
|
|
"Associated roles have been added",
|
|
|
|
true
|
|
|
|
);
|
|
|
|
|
|
|
|
// Add associated client role
|
2022-03-29 10:39:32 +00:00
|
|
|
associatedRolesPage.addAssociatedRoleFromSearchBar("create-client", true);
|
2022-03-09 16:41:45 +00:00
|
|
|
masthead.checkNotificationMessage(
|
|
|
|
"Associated roles have been added",
|
|
|
|
true
|
|
|
|
);
|
|
|
|
|
|
|
|
rolesTab.goToAssociatedRolesTab();
|
|
|
|
|
|
|
|
// Add associated client role
|
2022-03-29 10:39:32 +00:00
|
|
|
associatedRolesPage.addAssociatedRoleFromSearchBar(
|
|
|
|
"manage-consent",
|
|
|
|
true
|
|
|
|
);
|
2022-03-09 16:41:45 +00:00
|
|
|
masthead.checkNotificationMessage(
|
|
|
|
"Associated roles have been added",
|
|
|
|
true
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should hide inherited roles test", () => {
|
|
|
|
listingPage.searchItem(itemId, false).goToItemDetails(itemId);
|
|
|
|
rolesTab.goToAssociatedRolesTab();
|
|
|
|
rolesTab.hideInheritedRoles();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should delete associated roles test", () => {
|
|
|
|
listingPage.searchItem(itemId, false).goToItemDetails(itemId);
|
|
|
|
rolesTab.goToAssociatedRolesTab();
|
|
|
|
listingPage.removeItem("create-realm");
|
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
modalUtils.checkModalTitle("Remove associated role?").confirmModal();
|
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage(
|
|
|
|
"Associated roles have been removed",
|
|
|
|
true
|
|
|
|
);
|
|
|
|
|
|
|
|
listingPage.removeItem("manage-consent");
|
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
modalUtils.checkModalTitle("Remove associated role?").confirmModal();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should delete associated role from search bar test", () => {
|
|
|
|
listingPage.searchItem(itemId, false).goToItemDetails(itemId);
|
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
rolesTab.goToAssociatedRolesTab();
|
|
|
|
|
|
|
|
cy.get('td[data-label="Role name"]')
|
|
|
|
.contains("create-client")
|
|
|
|
.parent()
|
|
|
|
.within(() => {
|
|
|
|
cy.get("input").click();
|
|
|
|
});
|
|
|
|
|
|
|
|
associatedRolesPage.removeAssociatedRoles();
|
|
|
|
|
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
modalUtils.checkModalTitle("Remove associated roles?").confirmModal();
|
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage(
|
|
|
|
"Associated roles have been removed",
|
|
|
|
true
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should delete client role test", () => {
|
|
|
|
listingPage.deleteItem(itemId);
|
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
modalUtils.checkModalTitle("Delete role?").confirmModal();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should delete client role from role details test", () => {
|
|
|
|
listingPage
|
|
|
|
.searchItem("client_role_to_be_deleted", false)
|
|
|
|
.goToItemDetails("client_role_to_be_deleted");
|
|
|
|
createRealmRolePage.clickActionMenu("Delete this role");
|
|
|
|
modalUtils.confirmModal();
|
|
|
|
masthead.checkNotificationMessage("The role has been deleted", true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-02-28 20:02:31 +00:00
|
|
|
describe("Advanced tab test", () => {
|
|
|
|
const advancedTab = new AdvancedTab();
|
|
|
|
let client: string;
|
|
|
|
|
2022-01-07 07:27:58 +00:00
|
|
|
before(() => {
|
2021-03-18 12:48:14 +00:00
|
|
|
keycloakBefore();
|
2021-02-28 20:02:31 +00:00
|
|
|
loginPage.logIn();
|
2022-01-07 07:27:58 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
2021-02-28 20:02:31 +00:00
|
|
|
sidebarPage.goToClients();
|
|
|
|
|
|
|
|
client = "client_" + (Math.random() + 1).toString(36).substring(7);
|
|
|
|
|
|
|
|
listingPage.goToCreateItem();
|
|
|
|
|
|
|
|
createClientPage
|
|
|
|
.selectClientType("openid-connect")
|
|
|
|
.fillClientData(client)
|
2022-03-28 13:14:56 +00:00
|
|
|
.continue();
|
|
|
|
|
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
|
|
|
|
createClientPage.save();
|
2021-02-28 20:02:31 +00:00
|
|
|
|
2022-01-08 09:27:57 +00:00
|
|
|
advancedTab.goToAdvancedTab();
|
2021-02-28 20:02:31 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
2022-02-24 10:31:46 +00:00
|
|
|
adminClient.deleteClient(client);
|
2021-02-28 20:02:31 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Clustering", () => {
|
2021-06-16 11:35:03 +00:00
|
|
|
advancedTab.expandClusterNode();
|
2021-02-28 20:02:31 +00:00
|
|
|
|
2022-01-08 09:27:57 +00:00
|
|
|
advancedTab.registerNodeManually().fillHost("localhost").saveHost();
|
2021-02-28 20:02:31 +00:00
|
|
|
advancedTab.checkTestClusterAvailability(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Fine grain OpenID connect configuration", () => {
|
|
|
|
const algorithm = "ES384";
|
|
|
|
advancedTab
|
|
|
|
.selectAccessTokenSignatureAlgorithm(algorithm)
|
2022-01-08 09:27:57 +00:00
|
|
|
.saveFineGrain();
|
2021-02-28 20:02:31 +00:00
|
|
|
|
|
|
|
advancedTab
|
|
|
|
.selectAccessTokenSignatureAlgorithm("HS384")
|
2022-01-08 09:27:57 +00:00
|
|
|
.revertFineGrain();
|
2021-02-28 20:02:31 +00:00
|
|
|
advancedTab.checkAccessTokenSignatureAlgorithm(algorithm);
|
|
|
|
});
|
|
|
|
});
|
2021-04-01 14:14:19 +00:00
|
|
|
|
|
|
|
describe("Service account tab test", () => {
|
2022-04-05 15:02:27 +00:00
|
|
|
const serviceAccountTab = new RoleMappingTab("user");
|
2021-04-01 14:14:19 +00:00
|
|
|
const serviceAccountName = "service-account-client";
|
|
|
|
|
2022-01-07 07:27:58 +00:00
|
|
|
before(() => {
|
|
|
|
keycloakBefore();
|
|
|
|
loginPage.logIn();
|
2022-02-24 10:31:46 +00:00
|
|
|
adminClient.createClient({
|
2021-04-01 14:14:19 +00:00
|
|
|
protocol: "openid-connect",
|
|
|
|
clientId: serviceAccountName,
|
|
|
|
publicClient: false,
|
|
|
|
authorizationServicesEnabled: true,
|
|
|
|
serviceAccountsEnabled: true,
|
|
|
|
standardFlowEnabled: true,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-01-08 09:27:57 +00:00
|
|
|
beforeEach(() => {
|
|
|
|
sidebarPage.goToClients();
|
|
|
|
});
|
|
|
|
|
2021-04-01 14:14:19 +00:00
|
|
|
after(() => {
|
2022-02-24 10:31:46 +00:00
|
|
|
adminClient.deleteClient(serviceAccountName);
|
2021-04-01 14:14:19 +00:00
|
|
|
});
|
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
it("List", () => {
|
2021-04-01 14:14:19 +00:00
|
|
|
listingPage
|
|
|
|
.searchItem(serviceAccountName)
|
|
|
|
.goToItemDetails(serviceAccountName);
|
|
|
|
serviceAccountTab
|
2021-04-20 12:10:00 +00:00
|
|
|
.goToServiceAccountTab()
|
2021-04-01 14:14:19 +00:00
|
|
|
.checkRoles(["manage-account", "offline_access", "uma_authorization"]);
|
|
|
|
});
|
2021-08-10 12:41:56 +00:00
|
|
|
|
2022-04-05 13:17:35 +00:00
|
|
|
it.skip("Assign", () => {
|
2021-08-10 12:41:56 +00:00
|
|
|
listingPage.goToItemDetails(serviceAccountName);
|
|
|
|
serviceAccountTab
|
|
|
|
.goToServiceAccountTab()
|
2022-01-08 09:27:57 +00:00
|
|
|
.assignRole(false)
|
2021-08-10 12:41:56 +00:00
|
|
|
.selectRow("create-realm")
|
2022-01-08 09:27:57 +00:00
|
|
|
.assign();
|
2021-08-10 12:41:56 +00:00
|
|
|
masthead.checkNotificationMessage("Role mapping updated");
|
2022-01-08 09:27:57 +00:00
|
|
|
serviceAccountTab.selectRow("create-realm").unAssign();
|
2022-02-16 16:34:54 +00:00
|
|
|
sidebarPage.waitForPageLoad();
|
2022-01-08 09:27:57 +00:00
|
|
|
modalUtils.checkModalTitle("Remove mapping?").confirmModal();
|
|
|
|
masthead.checkNotificationMessage("Scope mapping successfully removed");
|
2021-08-10 12:41:56 +00:00
|
|
|
});
|
2021-04-01 14:14:19 +00:00
|
|
|
});
|
2021-05-04 08:11:58 +00:00
|
|
|
|
2021-10-20 14:26:05 +00:00
|
|
|
describe("Mapping tab", () => {
|
2022-02-21 12:14:20 +00:00
|
|
|
const clientScopeTab = new ClientScopesTab();
|
2021-10-20 14:26:05 +00:00
|
|
|
const mappingClient = "mapping-client";
|
|
|
|
beforeEach(() => {
|
|
|
|
keycloakBefore();
|
|
|
|
loginPage.logIn();
|
|
|
|
sidebarPage.goToClients();
|
|
|
|
listingPage.searchItem(mappingClient).goToItemDetails(mappingClient);
|
|
|
|
});
|
|
|
|
|
|
|
|
before(() => {
|
2022-02-24 10:31:46 +00:00
|
|
|
adminClient.createClient({
|
2021-10-20 14:26:05 +00:00
|
|
|
protocol: "openid-connect",
|
|
|
|
clientId: mappingClient,
|
|
|
|
publicClient: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
after(() => {
|
2022-02-24 10:31:46 +00:00
|
|
|
adminClient.deleteClient(mappingClient);
|
2021-10-20 14:26:05 +00:00
|
|
|
});
|
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
it("Add mapping to openid client", () => {
|
2022-02-21 12:14:20 +00:00
|
|
|
clientScopeTab.goToClientScopesTab().clickDedicatedScope(mappingClient);
|
2022-01-31 07:20:35 +00:00
|
|
|
cy.findByTestId("mappersTab").click();
|
2021-10-20 14:26:05 +00:00
|
|
|
cy.findByText("Add predefined mapper").click();
|
|
|
|
cy.get("table input").first().click();
|
2022-02-02 11:44:52 +00:00
|
|
|
cy.findByTestId("confirm").click();
|
2021-10-20 14:26:05 +00:00
|
|
|
masthead.checkNotificationMessage("Mapping successfully created");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-05-04 08:11:58 +00:00
|
|
|
describe("Keys tab test", () => {
|
|
|
|
const keysName = "keys-client";
|
|
|
|
before(() => {
|
2022-01-07 07:27:58 +00:00
|
|
|
keycloakBefore();
|
|
|
|
loginPage.logIn();
|
2022-02-24 10:31:46 +00:00
|
|
|
adminClient.createClient({
|
2021-05-04 08:11:58 +00:00
|
|
|
protocol: "openid-connect",
|
|
|
|
clientId: keysName,
|
|
|
|
publicClient: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
beforeEach(() => {
|
|
|
|
sidebarPage.goToClients();
|
|
|
|
listingPage.searchItem(keysName).goToItemDetails(keysName);
|
|
|
|
});
|
|
|
|
|
2021-05-04 08:11:58 +00:00
|
|
|
after(() => {
|
2022-02-24 10:31:46 +00:00
|
|
|
adminClient.deleteClient(keysName);
|
2021-05-04 08:11:58 +00:00
|
|
|
});
|
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
it("Change use JWKS Url", () => {
|
2021-05-04 08:11:58 +00:00
|
|
|
const keysTab = new KeysTab();
|
|
|
|
keysTab.goToTab().checkSaveDisabled();
|
|
|
|
keysTab.toggleUseJwksUrl().checkSaveDisabled(false);
|
|
|
|
});
|
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
it("Generate new keys", () => {
|
2021-05-04 08:11:58 +00:00
|
|
|
const keysTab = new KeysTab();
|
|
|
|
keysTab.goToTab().clickGenerate();
|
|
|
|
|
|
|
|
keysTab.fillGenerateModal("keyname", "123", "1234").clickConfirm();
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage(
|
|
|
|
"New key pair and certificate generated successfully"
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
2021-09-28 15:14:49 +00:00
|
|
|
|
|
|
|
describe("Realm client", () => {
|
|
|
|
const clientName = "master-realm";
|
|
|
|
|
2022-01-07 07:27:58 +00:00
|
|
|
before(() => {
|
2021-09-28 15:14:49 +00:00
|
|
|
keycloakBefore();
|
|
|
|
loginPage.logIn();
|
|
|
|
sidebarPage.goToClients();
|
|
|
|
listingPage.searchItem(clientName).goToItemDetails(clientName);
|
|
|
|
});
|
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
it("Displays the correct tabs", () => {
|
2021-09-28 15:14:49 +00:00
|
|
|
cy.findByTestId("client-tabs")
|
2022-01-31 07:20:35 +00:00
|
|
|
.findByTestId("clientSettingsTab")
|
2021-09-28 15:14:49 +00:00
|
|
|
.should("exist");
|
|
|
|
|
2022-01-31 07:20:35 +00:00
|
|
|
cy.findByTestId("client-tabs").findByTestId("rolesTab").should("exist");
|
2021-09-28 15:14:49 +00:00
|
|
|
|
|
|
|
cy.findByTestId("client-tabs")
|
2022-01-31 07:20:35 +00:00
|
|
|
.findByTestId("advancedTab")
|
2021-09-28 15:14:49 +00:00
|
|
|
.should("exist");
|
|
|
|
|
|
|
|
cy.findByTestId("client-tabs").find("li").should("have.length", 3);
|
|
|
|
});
|
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
it("Hides the delete action", () => {
|
2021-09-28 15:14:49 +00:00
|
|
|
cy.findByTestId("action-dropdown").click();
|
|
|
|
cy.findByTestId("delete-client").should("not.exist");
|
|
|
|
});
|
|
|
|
});
|
2021-09-30 10:04:50 +00:00
|
|
|
|
|
|
|
describe("Bearer only", () => {
|
|
|
|
const clientId = "bearer-only";
|
|
|
|
|
|
|
|
before(() => {
|
2022-01-07 07:27:58 +00:00
|
|
|
keycloakBefore();
|
|
|
|
loginPage.logIn();
|
2022-02-24 10:31:46 +00:00
|
|
|
adminClient.createClient({
|
2021-09-30 10:04:50 +00:00
|
|
|
clientId,
|
|
|
|
protocol: "openid-connect",
|
|
|
|
publicClient: false,
|
|
|
|
bearerOnly: true,
|
|
|
|
});
|
2022-01-07 07:27:58 +00:00
|
|
|
sidebarPage.goToClients();
|
2022-03-06 15:25:37 +00:00
|
|
|
cy.intercept("/admin/realms/master/clients/*").as("fetchClient");
|
2022-01-07 07:27:58 +00:00
|
|
|
listingPage.searchItem(clientId).goToItemDetails(clientId);
|
|
|
|
cy.wait("@fetchClient");
|
2021-09-30 10:04:50 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
after(() => {
|
2022-02-24 10:31:46 +00:00
|
|
|
adminClient.deleteClient(clientId);
|
2021-09-30 10:04:50 +00:00
|
|
|
});
|
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
it("Shows an explainer text for bearer only clients", () => {
|
2021-09-30 10:04:50 +00:00
|
|
|
cy.findByTestId("bearer-only-explainer-label").trigger("mouseenter");
|
|
|
|
cy.findByTestId("bearer-only-explainer-tooltip").should("exist");
|
|
|
|
});
|
2021-10-06 11:05:27 +00:00
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
it("Hides the capability config section", () => {
|
2021-10-06 11:05:27 +00:00
|
|
|
cy.findByTestId("capability-config-form").should("not.exist");
|
|
|
|
cy.findByTestId("jump-link-capability-config").should("not.exist");
|
|
|
|
});
|
2021-09-30 10:04:50 +00:00
|
|
|
});
|
2021-01-21 12:09:50 +00:00
|
|
|
});
|