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-01-07 07:27:58 +00:00
|
|
|
import {
|
|
|
|
keycloakBefore,
|
|
|
|
keycloakBeforeEach,
|
|
|
|
} 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";
|
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-10-04 06:03:19 +00:00
|
|
|
describe("Clients test", () => {
|
2021-12-10 12:24:26 +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
|
|
|
});
|
|
|
|
|
|
|
|
it("should list client scopes", () => {
|
|
|
|
listingPage.itemsGreaterThan(1).itemExist(clientScopeName + 0);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should search existing client scope by name", () => {
|
|
|
|
listingPage
|
|
|
|
.searchItem(clientScopeName + 0, false)
|
|
|
|
.itemExist(clientScopeName + 0)
|
|
|
|
.itemsEqualTo(2);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should search non-existent client scope by name", () => {
|
|
|
|
const itemName = "non-existent-item";
|
|
|
|
listingPage.searchItem(itemName, false).checkTableExists(false);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should search existing client scope by assigned type", () => {
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
|
|
|
|
/*it("should empty search", () => {
|
|
|
|
|
|
|
|
});*/
|
|
|
|
|
|
|
|
const newItemsWithExpectedAssignedTypes = [
|
|
|
|
[clientScopeNameOptionalType, FilterAssignedType.Optional],
|
|
|
|
[clientScopeNameDefaultType, FilterAssignedType.Default],
|
|
|
|
];
|
|
|
|
newItemsWithExpectedAssignedTypes.forEach(($type) => {
|
|
|
|
const [itemName, assignedType] = $type;
|
|
|
|
it(`should add client scope ${itemName} with ${assignedType} assigned type`, () => {
|
|
|
|
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;
|
|
|
|
it(`should change item ${itemName} AssignedType to ${$assignedType} from search bar`, () => {
|
|
|
|
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
|
|
|
});
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
it("should remove client scope from item bar", () => {
|
|
|
|
const itemName = clientScopeName + 0;
|
|
|
|
listingPage.searchItem(itemName, false).removeItem(itemName);
|
|
|
|
masthead.checkNotificationMessage(msgScopeMappingRemoved);
|
|
|
|
listingPage.searchItem(itemName, false).checkTableExists(false);
|
|
|
|
});
|
|
|
|
|
|
|
|
/*it("should remove client scope from search bar", () => {
|
|
|
|
//covered by next test
|
|
|
|
});*/
|
|
|
|
|
|
|
|
// TODO: https://github.com/keycloak/keycloak-admin-ui/issues/1854
|
|
|
|
it("should remove multiple client scopes from search bar", () => {
|
|
|
|
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
|
|
|
|
/* it("should show initial items after filtering", () => {
|
|
|
|
listingPage
|
|
|
|
.selectFilter(Filter.AssignedType)
|
|
|
|
.selectFilterAssignedType(FilterAssignedType.Optional)
|
|
|
|
.selectFilter(Filter.Name)
|
|
|
|
.itemExist(FilterAssignedType.Default)
|
|
|
|
.itemExist(FilterAssignedType.Optional);
|
|
|
|
});*/
|
2021-12-10 12:24:26 +00:00
|
|
|
});
|
|
|
|
|
2021-10-04 06:03:19 +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(() => {
|
|
|
|
keycloakBeforeEach();
|
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");
|
|
|
|
});
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
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-07 17:53:39 +00:00
|
|
|
it.skip("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) => {
|
|
|
|
listingPage
|
|
|
|
.checkRowColumnValue(id, 4, "3")
|
|
|
|
.checkRowColumnValue(id, 5, "3")
|
|
|
|
.itemExist(id);
|
|
|
|
});
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
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(() => {
|
|
|
|
keycloakBeforeEach();
|
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)
|
|
|
|
.continue()
|
2022-03-02 21:59:37 +00:00
|
|
|
.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", () => {
|
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";
|
|
|
|
|
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(() => {
|
|
|
|
keycloakBeforeEach();
|
|
|
|
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-02-16 16:34:54 +00:00
|
|
|
it("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(() => {
|
|
|
|
keycloakBeforeEach();
|
|
|
|
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-01-07 07:27:58 +00:00
|
|
|
beforeEach(() => {
|
|
|
|
keycloakBeforeEach();
|
|
|
|
});
|
|
|
|
|
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
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
2022-01-07 07:27:58 +00:00
|
|
|
keycloakBeforeEach();
|
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
|
|
|
});
|