2021-01-27 12:56:28 +00:00
|
|
|
import LoginPage from "../support/pages/LoginPage";
|
|
|
|
import Masthead from "../support/pages/admin_console/Masthead";
|
|
|
|
import ListingPage from "../support/pages/admin_console/ListingPage";
|
|
|
|
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";
|
|
|
|
import AdminClient from "../support/util/AdminClient";
|
2021-03-05 13:47:59 +00:00
|
|
|
import InitialAccessTokenTab from "../support/pages/admin_console/manage/clients/InitialAccessTokenTab";
|
2021-03-18 12:48:14 +00:00
|
|
|
import { keycloakBefore } from "../support/util/keycloak_before";
|
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-01-21 12:09:50 +00:00
|
|
|
|
2021-01-27 12:47:57 +00:00
|
|
|
let itemId = "client_crud";
|
|
|
|
const loginPage = new LoginPage();
|
|
|
|
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();
|
2021-01-27 12:47:57 +00:00
|
|
|
|
2021-01-21 12:09:50 +00:00
|
|
|
describe("Clients test", function () {
|
|
|
|
describe("Client creation", function () {
|
|
|
|
beforeEach(function () {
|
2021-03-18 12:48:14 +00:00
|
|
|
keycloakBefore();
|
2021-01-21 12:09:50 +00:00
|
|
|
loginPage.logIn();
|
|
|
|
sidebarPage.goToClients();
|
2021-01-25 17:17:59 +00:00
|
|
|
});
|
2021-01-21 12:09:50 +00:00
|
|
|
|
2021-01-25 17:17:59 +00:00
|
|
|
it("should fail creating client", function () {
|
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();
|
|
|
|
|
|
|
|
createClientPage.fillClientData("account").continue().continue();
|
|
|
|
|
|
|
|
// 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-01-25 17:17:59 +00:00
|
|
|
it("Client CRUD test", function () {
|
|
|
|
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();
|
|
|
|
|
|
|
|
createClientPage
|
|
|
|
.selectClientType("openid-connect")
|
|
|
|
.fillClientData(itemId)
|
|
|
|
.continue()
|
|
|
|
.continue();
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage("Client created successfully");
|
|
|
|
|
|
|
|
sidebarPage.goToClients();
|
|
|
|
|
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);
|
|
|
|
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
|
|
|
|
|
|
|
it("Initial access token", () => {
|
|
|
|
const initialAccessTokenTab = new InitialAccessTokenTab();
|
2021-03-24 14:07:49 +00:00
|
|
|
initialAccessTokenTab.goToInitialAccessTokenTab().shouldBeEmpty();
|
2021-03-05 13:47:59 +00:00
|
|
|
initialAccessTokenTab.createNewToken(1, 1).save();
|
|
|
|
|
|
|
|
modalUtils.checkModalTitle("Initial access token details").closeModal();
|
|
|
|
|
|
|
|
initialAccessTokenTab.shouldNotBeEmpty();
|
|
|
|
|
|
|
|
initialAccessTokenTab.getFistId((id) => {
|
|
|
|
listingPage.deleteItem(id);
|
|
|
|
modalUtils
|
|
|
|
.checkModalTitle("Delete initial access token?")
|
|
|
|
.confirmModal();
|
|
|
|
masthead.checkNotificationMessage(
|
|
|
|
"initial access token created successfully"
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
2021-01-21 12:09:50 +00:00
|
|
|
});
|
2021-02-28 20:02:31 +00:00
|
|
|
|
|
|
|
describe("Advanced tab test", () => {
|
|
|
|
const advancedTab = new AdvancedTab();
|
|
|
|
let client: string;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
2021-03-18 12:48:14 +00:00
|
|
|
keycloakBefore();
|
2021-02-28 20:02:31 +00:00
|
|
|
loginPage.logIn();
|
|
|
|
sidebarPage.goToClients();
|
|
|
|
|
|
|
|
client = "client_" + (Math.random() + 1).toString(36).substring(7);
|
|
|
|
|
|
|
|
listingPage.goToCreateItem();
|
|
|
|
|
|
|
|
createClientPage
|
|
|
|
.selectClientType("openid-connect")
|
|
|
|
.fillClientData(client)
|
|
|
|
.continue()
|
|
|
|
.continue();
|
|
|
|
|
|
|
|
advancedTab.goToTab();
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
new AdminClient().deleteClient(client);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Clustering", () => {
|
2021-06-16 11:35:03 +00:00
|
|
|
advancedTab.expandClusterNode();
|
2021-02-28 20:02:31 +00:00
|
|
|
|
|
|
|
advancedTab
|
|
|
|
.clickRegisterNodeManually()
|
|
|
|
.fillHost("localhost")
|
|
|
|
.clickSaveHost();
|
|
|
|
advancedTab.checkTestClusterAvailability(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Fine grain OpenID connect configuration", () => {
|
|
|
|
const algorithm = "ES384";
|
|
|
|
advancedTab
|
|
|
|
.selectAccessTokenSignatureAlgorithm(algorithm)
|
|
|
|
.clickSaveFineGrain();
|
|
|
|
|
|
|
|
advancedTab
|
|
|
|
.selectAccessTokenSignatureAlgorithm("HS384")
|
2021-03-12 16:30:14 +00:00
|
|
|
.clickRevertFineGrain();
|
2021-02-28 20:02:31 +00:00
|
|
|
advancedTab.checkAccessTokenSignatureAlgorithm(algorithm);
|
|
|
|
});
|
|
|
|
});
|
2021-04-01 14:14:19 +00:00
|
|
|
|
|
|
|
describe("Service account tab test", () => {
|
2021-04-20 12:10:00 +00:00
|
|
|
const serviceAccountTab = new RoleMappingTab();
|
2021-04-01 14:14:19 +00:00
|
|
|
const serviceAccountName = "service-account-client";
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
keycloakBefore();
|
|
|
|
loginPage.logIn();
|
|
|
|
sidebarPage.goToClients();
|
|
|
|
});
|
|
|
|
|
|
|
|
before(async () => {
|
|
|
|
await new AdminClient().createClient({
|
|
|
|
protocol: "openid-connect",
|
|
|
|
clientId: serviceAccountName,
|
|
|
|
publicClient: false,
|
|
|
|
authorizationServicesEnabled: true,
|
|
|
|
serviceAccountsEnabled: true,
|
|
|
|
standardFlowEnabled: true,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
after(() => {
|
|
|
|
new AdminClient().deleteClient(serviceAccountName);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("list", () => {
|
|
|
|
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
|
|
|
|
|
|
|
it("assign", () => {
|
|
|
|
listingPage.goToItemDetails(serviceAccountName);
|
|
|
|
serviceAccountTab
|
|
|
|
.goToServiceAccountTab()
|
|
|
|
.clickAssignRole(false)
|
|
|
|
.selectRow("create-realm")
|
|
|
|
.clickAssign();
|
|
|
|
masthead.checkNotificationMessage("Role mapping updated");
|
|
|
|
});
|
2021-04-01 14:14:19 +00:00
|
|
|
});
|
2021-05-04 08:11:58 +00:00
|
|
|
|
|
|
|
describe("Keys tab test", () => {
|
|
|
|
const keysName = "keys-client";
|
|
|
|
beforeEach(() => {
|
|
|
|
keycloakBefore();
|
|
|
|
loginPage.logIn();
|
|
|
|
sidebarPage.goToClients();
|
|
|
|
listingPage.searchItem(keysName).goToItemDetails(keysName);
|
|
|
|
});
|
|
|
|
|
|
|
|
before(() => {
|
|
|
|
new AdminClient().createClient({
|
|
|
|
protocol: "openid-connect",
|
|
|
|
clientId: keysName,
|
|
|
|
publicClient: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
after(() => {
|
|
|
|
new AdminClient().deleteClient(keysName);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("change use JWKS Url", () => {
|
|
|
|
const keysTab = new KeysTab();
|
|
|
|
keysTab.goToTab().checkSaveDisabled();
|
|
|
|
keysTab.toggleUseJwksUrl().checkSaveDisabled(false);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("generate new keys", () => {
|
|
|
|
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";
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
keycloakBefore();
|
|
|
|
loginPage.logIn();
|
|
|
|
sidebarPage.goToClients();
|
|
|
|
listingPage.searchItem(clientName).goToItemDetails(clientName);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("displays the correct tabs", () => {
|
|
|
|
cy.findByTestId("client-tabs")
|
|
|
|
.find("#pf-tab-settings-settings")
|
|
|
|
.should("exist");
|
|
|
|
|
|
|
|
cy.findByTestId("client-tabs")
|
|
|
|
.find("#pf-tab-roles-roles")
|
|
|
|
.should("exist");
|
|
|
|
|
|
|
|
cy.findByTestId("client-tabs")
|
|
|
|
.find("#pf-tab-advanced-advanced")
|
|
|
|
.should("exist");
|
|
|
|
|
|
|
|
cy.findByTestId("client-tabs").find("li").should("have.length", 3);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("hides the delete action", () => {
|
|
|
|
cy.findByTestId("action-dropdown").click();
|
|
|
|
cy.findByTestId("delete-client").should("not.exist");
|
|
|
|
});
|
|
|
|
});
|
2021-01-21 12:09:50 +00:00
|
|
|
});
|