2021-01-27 12:56:28 +00:00
|
|
|
import LoginPage from "../support/pages/LoginPage";
|
2022-11-18 16:13:39 +00:00
|
|
|
import ListingPage, {
|
2022-02-22 12:46:49 +00:00
|
|
|
Filter,
|
|
|
|
FilterAssignedType,
|
2022-12-07 15:28:28 +00:00
|
|
|
} from "../support/pages/admin-ui/ListingPage";
|
|
|
|
import CreateClientPage from "../support/pages/admin-ui/manage/clients/CreateClientPage";
|
2022-02-24 10:31:46 +00:00
|
|
|
import adminClient from "../support/util/AdminClient";
|
2022-03-09 16:42:51 +00:00
|
|
|
import { keycloakBefore } from "../support/util/keycloak_hooks";
|
2022-12-07 15:28:28 +00:00
|
|
|
import RoleMappingTab from "../support/pages/admin-ui/manage/RoleMappingTab";
|
|
|
|
import createRealmRolePage from "../support/pages/admin-ui/manage/realm_roles/CreateRealmRolePage";
|
|
|
|
import AssociatedRolesPage from "../support/pages/admin-ui/manage/realm_roles/AssociatedRolesPage";
|
|
|
|
import ClientRolesTab from "../support/pages/admin-ui/manage/clients/ClientRolesTab";
|
|
|
|
import InitialAccessTokenTab from "../support/pages/admin-ui/manage/clients/tabs/InitialAccessTokenTab";
|
|
|
|
import AdvancedTab from "../support/pages/admin-ui/manage/clients/client_details/tabs/AdvancedTab";
|
2022-04-19 12:25:57 +00:00
|
|
|
import ClientDetailsPage, {
|
|
|
|
ClientsDetailsTab,
|
2022-12-07 15:28:28 +00:00
|
|
|
} from "../support/pages/admin-ui/manage/clients/client_details/ClientDetailsPage";
|
2022-04-19 12:25:57 +00:00
|
|
|
import CommonPage from "../support/pages/CommonPage";
|
2022-12-07 15:28:28 +00:00
|
|
|
import AttributesTab from "../support/pages/admin-ui/manage/AttributesTab";
|
|
|
|
import DedicatedScopesMappersTab from "../support/pages/admin-ui/manage/clients/client_details/DedicatedScopesMappersTab";
|
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 createClientPage = new CreateClientPage();
|
2022-04-19 12:25:57 +00:00
|
|
|
const clientDetailsPage = new ClientDetailsPage();
|
|
|
|
const commonPage = new CommonPage();
|
2022-05-12 13:45:50 +00:00
|
|
|
const listingPage = new ListingPage();
|
2022-06-27 08:47:41 +00:00
|
|
|
const attributesTab = new AttributesTab();
|
2022-10-06 14:18:33 +00:00
|
|
|
const dedicatedScopesMappersTab = new DedicatedScopesMappersTab();
|
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", () => {
|
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();
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.sidebar().goToClients();
|
|
|
|
commonPage.tableToolbarUtils().searchItem(clientId);
|
2022-10-06 14:18:33 +00:00
|
|
|
cy.intercept("/admin/realms/master/clients/*").as("fetchClient");
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableUtils().clickRowItemLink(clientId);
|
2021-12-10 12:24:26 +00:00
|
|
|
cy.wait("@fetchClient");
|
2022-04-19 12:25:57 +00:00
|
|
|
clientDetailsPage.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-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.tableUtils()
|
|
|
|
.checkRowItemsGreaterThan(1)
|
|
|
|
.checkRowItemExists(clientScopeName + 0);
|
2022-02-22 12:46:49 +00:00
|
|
|
});
|
|
|
|
|
2022-03-09 16:41:45 +00:00
|
|
|
it("Should search existing client scope by name", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().searchItem(clientScopeName + 0, false);
|
|
|
|
commonPage
|
|
|
|
.tableUtils()
|
|
|
|
.checkRowItemExists(clientScopeName + 0)
|
|
|
|
.checkRowItemsEqualTo(2);
|
2022-02-22 12:46:49 +00:00
|
|
|
});
|
|
|
|
|
2022-03-09 16:41:45 +00:00
|
|
|
it("Should search non-existent client scope by name", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().searchItem("non-existent-item", false);
|
|
|
|
commonPage.tableUtils().checkIfExists(false);
|
|
|
|
commonPage.emptyState().checkIfExists(true);
|
2022-02-22 12:46:49 +00:00
|
|
|
});
|
|
|
|
|
2022-03-09 16:41:45 +00:00
|
|
|
it("Should search existing client scope by assigned type", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.tableToolbarUtils()
|
|
|
|
.selectSearchType(Filter.AssignedType)
|
|
|
|
.selectSecondarySearchType(FilterAssignedType.Default);
|
|
|
|
commonPage
|
|
|
|
.tableUtils()
|
|
|
|
.checkRowItemExists(FilterAssignedType.Default)
|
|
|
|
.checkRowItemExists(FilterAssignedType.Optional, false);
|
|
|
|
commonPage
|
|
|
|
.tableToolbarUtils()
|
|
|
|
.selectSecondarySearchType(FilterAssignedType.Optional);
|
|
|
|
commonPage
|
|
|
|
.tableUtils()
|
|
|
|
.checkRowItemExists(FilterAssignedType.Default, false)
|
|
|
|
.checkRowItemExists(FilterAssignedType.Optional);
|
|
|
|
commonPage
|
|
|
|
.tableToolbarUtils()
|
|
|
|
.selectSecondarySearchType(FilterAssignedType.AllTypes);
|
|
|
|
commonPage
|
|
|
|
.tableUtils()
|
|
|
|
.checkRowItemExists(FilterAssignedType.Default)
|
|
|
|
.checkRowItemExists(FilterAssignedType.Optional);
|
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-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().addClientScope();
|
|
|
|
commonPage
|
|
|
|
.modalUtils()
|
|
|
|
.checkModalTitle("Add client scopes to " + clientId);
|
|
|
|
commonPage.tableUtils().selectRowItemCheckbox(itemName);
|
|
|
|
commonPage.modalUtils().confirmModalWithItem(assignedType);
|
|
|
|
commonPage
|
|
|
|
.masthead()
|
|
|
|
.checkNotificationMessage("Scope mapping successfully updated");
|
|
|
|
commonPage.tableToolbarUtils().searchItem(itemName, false);
|
|
|
|
commonPage
|
|
|
|
.tableUtils()
|
|
|
|
.checkRowItemExists(itemName)
|
|
|
|
.checkRowItemExists(assignedType);
|
2022-02-22 12:46:49 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
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-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().searchItem(itemName, false);
|
|
|
|
commonPage.tableUtils().selectRowItemCheckbox(itemName);
|
|
|
|
commonPage.tableToolbarUtils().changeTypeTo($assignedType);
|
|
|
|
commonPage.masthead().checkNotificationMessage("Scope mapping updated");
|
|
|
|
commonPage.tableToolbarUtils().searchItem(itemName, false);
|
|
|
|
commonPage.tableUtils().checkRowItemExists($assignedType);
|
2022-02-22 12:46:49 +00:00
|
|
|
});
|
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-04-19 12:25:57 +00:00
|
|
|
commonPage.sidebar().waitForPageLoad();
|
|
|
|
commonPage.tableToolbarUtils().clickNextPageButton();
|
|
|
|
commonPage.tableUtils().checkRowItemsGreaterThan(1);
|
2021-12-10 12:24:26 +00:00
|
|
|
});
|
2022-02-22 12:46:49 +00:00
|
|
|
|
2022-09-13 11:58:25 +00:00
|
|
|
it("Should remove client scope from item bar", () => {
|
2022-02-22 12:46:49 +00:00
|
|
|
const itemName = clientScopeName + 0;
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().searchItem(itemName, false);
|
|
|
|
commonPage.tableUtils().selectRowItemAction(itemName, "Remove");
|
2022-09-13 11:58:25 +00:00
|
|
|
commonPage.modalUtils().confirmModal();
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.masthead().checkNotificationMessage(msgScopeMappingRemoved);
|
|
|
|
commonPage.tableToolbarUtils().searchItem(itemName, false);
|
|
|
|
commonPage.tableUtils().checkRowItemExists(itemName, false);
|
2022-02-22 12:46:49 +00:00
|
|
|
});
|
|
|
|
|
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;
|
2022-09-12 09:05:27 +00:00
|
|
|
cy.intercept("/admin/realms/master/client-scopes").as("load");
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().clickSearchButton();
|
2022-09-12 09:05:27 +00:00
|
|
|
cy.wait("@load");
|
|
|
|
cy.wait(1000);
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().checkActionItemIsEnabled("Remove", false);
|
|
|
|
commonPage.tableToolbarUtils().searchItem(clientScopeName, false);
|
|
|
|
commonPage
|
|
|
|
.tableUtils()
|
|
|
|
.selectRowItemCheckbox(itemName1)
|
|
|
|
.selectRowItemCheckbox(itemName2);
|
2022-09-12 09:05:27 +00:00
|
|
|
cy.intercept("/admin/realms/master/client-scopes").as("load");
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().clickSearchButton();
|
2022-09-12 09:05:27 +00:00
|
|
|
cy.wait("@load");
|
|
|
|
cy.wait(1000);
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().clickActionItem("Remove");
|
|
|
|
commonPage.masthead().checkNotificationMessage(msgScopeMappingRemoved);
|
|
|
|
commonPage.tableToolbarUtils().searchItem(clientScopeName, false);
|
|
|
|
commonPage
|
|
|
|
.tableUtils()
|
|
|
|
.checkRowItemExists(itemName1, false)
|
|
|
|
.checkRowItemExists(itemName2, false);
|
|
|
|
commonPage.tableToolbarUtils().clickSearchButton();
|
|
|
|
});
|
|
|
|
|
|
|
|
//fails, issue https://github.com/keycloak/keycloak-admin-ui/issues/1874
|
2022-09-13 11:58:25 +00:00
|
|
|
it("Should show initial items after filtering", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.tableToolbarUtils()
|
|
|
|
.selectSearchType(Filter.AssignedType)
|
|
|
|
.selectSecondarySearchType(FilterAssignedType.Optional)
|
|
|
|
.selectSearchType(Filter.Name);
|
|
|
|
commonPage
|
|
|
|
.tableUtils()
|
2022-09-13 11:58:25 +00:00
|
|
|
.checkRowItemExists(FilterAssignedType.Default, false)
|
2022-04-19 12:25:57 +00:00
|
|
|
.checkRowItemExists(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(() => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.sidebar().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", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().createClient();
|
2022-03-02 21:59:37 +00:00
|
|
|
|
|
|
|
createClientPage.continue().checkClientIdRequiredMessage();
|
|
|
|
|
|
|
|
createClientPage
|
|
|
|
.fillClientData("")
|
|
|
|
.selectClientType("openid-connect")
|
|
|
|
.cancel();
|
|
|
|
|
|
|
|
cy.url().should("not.include", "/add-client");
|
|
|
|
});
|
|
|
|
|
2022-09-13 11:58:25 +00:00
|
|
|
it("Should check settings elements", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().clickPrimaryButton();
|
2022-03-28 13:14:56 +00:00
|
|
|
const clientId = "Test settings";
|
|
|
|
|
|
|
|
createClientPage
|
|
|
|
.fillClientData(clientId)
|
|
|
|
.continue()
|
|
|
|
.checkCapabilityConfigElements()
|
|
|
|
.save();
|
|
|
|
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.masthead()
|
|
|
|
.checkNotificationMessage("Client created successfully");
|
|
|
|
commonPage.sidebar().waitForPageLoad();
|
2022-03-28 13:14:56 +00:00
|
|
|
|
|
|
|
createClientPage
|
|
|
|
.checkCapabilityConfigElements()
|
|
|
|
.checkAccessSettingsElements()
|
|
|
|
.checkLoginSettingsElements()
|
|
|
|
.checkLogoutSettingsElements()
|
|
|
|
.deleteClientFromActionDropdown();
|
|
|
|
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.modalUtils().confirmModal();
|
|
|
|
commonPage.tableUtils().checkRowItemExists(clientId, false);
|
2022-03-28 13:14:56 +00:00
|
|
|
});
|
|
|
|
|
2022-03-02 21:59:37 +00:00
|
|
|
it("Should navigate to previous using 'back' button", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().createClient();
|
2022-03-02 21:59:37 +00:00
|
|
|
|
|
|
|
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", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().createClient();
|
2021-01-21 12:09:50 +00:00
|
|
|
|
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
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.masthead()
|
|
|
|
.checkNotificationMessage(
|
|
|
|
"Could not create client: 'Client account already exists'"
|
|
|
|
);
|
2021-01-21 12:09:50 +00:00
|
|
|
});
|
|
|
|
|
2022-09-13 11:58:25 +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
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableUtils().checkRowItemExists(itemId, false);
|
|
|
|
commonPage.tableToolbarUtils().clickPrimaryButton();
|
2022-03-28 13:14:56 +00:00
|
|
|
createClientPage.cancel();
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableUtils().checkRowItemExists(itemId, false);
|
|
|
|
commonPage.tableToolbarUtils().clickPrimaryButton();
|
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
|
|
|
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.masthead()
|
|
|
|
.checkNotificationMessage("Client created successfully");
|
2021-01-21 12:09:50 +00:00
|
|
|
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.sidebar().goToClients();
|
2021-01-21 12:09:50 +00:00
|
|
|
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().searchItem("John Doe", false);
|
|
|
|
commonPage.emptyState().checkIfExists(true);
|
|
|
|
commonPage.tableToolbarUtils().searchItem("");
|
|
|
|
commonPage.tableUtils().checkRowItemExists("account");
|
|
|
|
commonPage.tableToolbarUtils().searchItem(itemId);
|
|
|
|
commonPage.tableUtils().checkRowItemExists(itemId);
|
2021-01-21 12:09:50 +00:00
|
|
|
|
2021-01-25 17:17:59 +00:00
|
|
|
// Delete
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableUtils().selectRowItemAction(itemId, "Delete");
|
|
|
|
commonPage.sidebar().waitForPageLoad();
|
|
|
|
commonPage
|
|
|
|
.modalUtils()
|
|
|
|
.checkModalTitle(`Delete ${itemId} ?`)
|
|
|
|
.confirmModal();
|
|
|
|
commonPage
|
|
|
|
.masthead()
|
|
|
|
.checkNotificationMessage("The client has been deleted");
|
|
|
|
commonPage.tableUtils().checkRowItemExists(itemId, false);
|
2021-01-21 12:09:50 +00:00
|
|
|
});
|
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-09-13 11:58:25 +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
|
|
|
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.modalUtils()
|
|
|
|
.checkModalTitle("Initial access token details")
|
|
|
|
.closeModal();
|
2021-03-05 13:47:59 +00:00
|
|
|
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.masthead()
|
|
|
|
.checkNotificationMessage("New initial access token has been created");
|
2022-02-16 16:34:54 +00:00
|
|
|
|
2021-03-05 13:47:59 +00:00
|
|
|
initialAccessTokenTab.shouldNotBeEmpty();
|
|
|
|
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().searchItem("John Doe", false);
|
|
|
|
commonPage.emptyState().checkIfExists(true);
|
|
|
|
commonPage.tableToolbarUtils().searchItem("", false);
|
2022-02-16 16:34:54 +00:00
|
|
|
|
|
|
|
initialAccessTokenTab.getFirstId((id) => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.tableUtils()
|
|
|
|
.checkRowItemValueByItemName(id, 4, "4")
|
|
|
|
.checkRowItemValueByItemName(id, 5, "4")
|
|
|
|
.checkRowItemExists(id);
|
2022-02-16 16:34:54 +00:00
|
|
|
});
|
|
|
|
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().clickPrimaryButton("Create");
|
2022-02-16 16:34:54 +00:00
|
|
|
initialAccessTokenTab.fillNewTokenData(1, 3).save();
|
|
|
|
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.modalUtils().closeModal();
|
2022-02-16 16:34:54 +00:00
|
|
|
|
|
|
|
initialAccessTokenTab.getFirstId((id) => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableUtils().selectRowItemAction(id, "Delete");
|
|
|
|
commonPage.sidebar().waitForPageLoad();
|
|
|
|
commonPage
|
|
|
|
.modalUtils()
|
2021-03-05 13:47:59 +00:00
|
|
|
.checkModalTitle("Delete initial access token?")
|
|
|
|
.confirmModal();
|
|
|
|
});
|
2022-02-16 16:34:54 +00:00
|
|
|
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.masthead()
|
|
|
|
.checkNotificationMessage("Initial access token deleted successfully");
|
2022-02-16 16:34:54 +00:00
|
|
|
initialAccessTokenTab.shouldNotBeEmpty();
|
|
|
|
|
|
|
|
initialAccessTokenTab.getFirstId((id) => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableUtils().selectRowItemAction(id, "Delete");
|
|
|
|
commonPage.sidebar().waitForPageLoad();
|
|
|
|
commonPage.modalUtils().confirmModal();
|
2022-02-16 16:34:54 +00:00
|
|
|
});
|
|
|
|
initialAccessTokenTab.shouldBeEmpty();
|
2021-03-05 13:47:59 +00:00
|
|
|
});
|
2022-10-03 11:00:26 +00:00
|
|
|
|
|
|
|
it("Should fail to create imported client with empty ID", () => {
|
|
|
|
commonPage.sidebar().goToClients();
|
|
|
|
commonPage.masthead().closeAllAlertMessages();
|
|
|
|
cy.findByTestId("importClient").click();
|
|
|
|
cy.findByTestId("kc-client-id").click();
|
|
|
|
cy.findByText("Save").click();
|
|
|
|
cy.findByText("Required field");
|
|
|
|
});
|
|
|
|
|
|
|
|
const identicalClientId = "identical";
|
|
|
|
it("Should fail to create client with same ID", () => {
|
|
|
|
commonPage.sidebar().goToClients();
|
|
|
|
commonPage.tableToolbarUtils().createClient();
|
|
|
|
|
|
|
|
createClientPage.fillClientData(identicalClientId).continue().save();
|
|
|
|
|
|
|
|
commonPage.masthead().closeAllAlertMessages();
|
|
|
|
commonPage.sidebar().goToClients();
|
|
|
|
cy.findByTestId("importClient").click();
|
|
|
|
cy.findByTestId("realm-file").selectFile(
|
|
|
|
"cypress/fixtures/partial-import-test-data/import-identical-client.json",
|
|
|
|
{ action: "drag-drop" }
|
|
|
|
);
|
|
|
|
|
|
|
|
cy.wait(1000);
|
|
|
|
//cy.findByTestId("realm-file").contains('"clientId": "identical"')
|
|
|
|
cy.findByTestId("kc-client-id").click();
|
|
|
|
cy.findByText("Save").click();
|
|
|
|
commonPage
|
|
|
|
.masthead()
|
|
|
|
.checkNotificationMessage(
|
|
|
|
"Could not import client: Client identical already exists",
|
|
|
|
true
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should delete 'identical' client id", () => {
|
|
|
|
commonPage.sidebar().goToClients();
|
|
|
|
adminClient.deleteClient(identicalClientId);
|
|
|
|
});
|
2021-01-21 12:09:50 +00:00
|
|
|
});
|
2021-02-28 20:02:31 +00:00
|
|
|
|
2022-08-23 14:30:52 +00:00
|
|
|
describe("Roles tab test", () => {
|
2022-03-09 16:41:45 +00:00
|
|
|
const rolesTab = new ClientRolesTab();
|
|
|
|
let client: string;
|
|
|
|
|
|
|
|
before(() => {
|
|
|
|
keycloakBefore();
|
|
|
|
loginPage.logIn();
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.sidebar().goToClients();
|
2022-03-09 16:41:45 +00:00
|
|
|
|
|
|
|
client = "client_" + (Math.random() + 1).toString(36).substring(7);
|
|
|
|
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().createClient();
|
2022-03-09 16:41:45 +00:00
|
|
|
|
|
|
|
createClientPage
|
|
|
|
.selectClientType("openid-connect")
|
|
|
|
.fillClientData(client)
|
|
|
|
.continue()
|
|
|
|
.save();
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.masthead()
|
|
|
|
.checkNotificationMessage("Client created successfully", true);
|
2022-03-09 16:41:45 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
loginPage.logIn();
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.sidebar().goToClients();
|
|
|
|
commonPage.tableToolbarUtils().searchItem(client);
|
|
|
|
commonPage.tableUtils().clickRowItemLink(client);
|
2022-03-09 16:41:45 +00:00
|
|
|
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();
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.masthead().checkNotificationMessage("Role created", true);
|
2022-03-09 16:41:45 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Should update client role description", () => {
|
|
|
|
const updateDescription = "updated description";
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().searchItem(itemId, false);
|
|
|
|
commonPage.tableUtils().clickRowItemLink(itemId);
|
2022-03-09 16:41:45 +00:00
|
|
|
createRealmRolePage.updateDescription(updateDescription).save();
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.masthead()
|
|
|
|
.checkNotificationMessage("The role has been saved", true);
|
2022-03-09 16:41:45 +00:00
|
|
|
createRealmRolePage.checkDescription(updateDescription);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should add attribute to client role", () => {
|
|
|
|
cy.intercept("/admin/realms/master/roles-by-id/*").as("load");
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableUtils().clickRowItemLink(itemId);
|
2022-10-06 14:18:33 +00:00
|
|
|
cy.wait("@load");
|
2022-03-09 16:41:45 +00:00
|
|
|
rolesTab.goToAttributesTab();
|
2022-06-27 08:47:41 +00:00
|
|
|
attributesTab
|
|
|
|
.addAttribute("crud_attribute_key", "crud_attribute_value")
|
|
|
|
.save();
|
2022-12-07 09:04:20 +00:00
|
|
|
attributesTab.assertRowItemsEqualTo(1);
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.masthead()
|
|
|
|
.checkNotificationMessage("The role has been saved", true);
|
2022-03-09 16:41:45 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Should delete attribute from client role", () => {
|
|
|
|
cy.intercept("/admin/realms/master/roles-by-id/*").as("load");
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableUtils().clickRowItemLink(itemId);
|
2022-10-06 14:18:33 +00:00
|
|
|
cy.wait("@load");
|
2022-03-09 16:41:45 +00:00
|
|
|
rolesTab.goToAttributesTab();
|
2022-06-27 08:47:41 +00:00
|
|
|
attributesTab.deleteAttribute(1);
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.masthead()
|
|
|
|
.checkNotificationMessage("The role has been saved", true);
|
2022-03-09 16:41:45 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Should create client role to be deleted", () => {
|
|
|
|
rolesTab.goToCreateRoleFromToolbar();
|
|
|
|
createRealmRolePage.fillRealmRoleData("client_role_to_be_deleted").save();
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.masthead().checkNotificationMessage("Role created", true);
|
2022-03-09 16:41:45 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Should fail to create duplicate client role", () => {
|
|
|
|
rolesTab.goToCreateRoleFromToolbar();
|
|
|
|
createRealmRolePage.fillRealmRoleData(itemId).save();
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.masthead()
|
|
|
|
.checkNotificationMessage(
|
|
|
|
`Could not create role: Role with name ${itemId} already exists`,
|
|
|
|
true
|
|
|
|
);
|
2022-03-09 16:41:45 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Should search existing client role", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().searchItem(itemId, false);
|
|
|
|
commonPage.tableUtils().checkRowItemExists(itemId);
|
2022-03-09 16:41:45 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Should search non-existing role test", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().searchItem("role_DNE", false);
|
|
|
|
commonPage.emptyState().checkIfExists(true);
|
2022-03-09 16:41:45 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("roles empty search test", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().searchItem("", false);
|
|
|
|
commonPage.tableUtils().checkIfExists(true);
|
2022-03-09 16:41:45 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Add associated roles test", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().searchItem(itemId, false);
|
|
|
|
commonPage.tableUtils().clickRowItemLink(itemId);
|
2022-03-09 16:41:45 +00:00
|
|
|
|
|
|
|
// Add associated realm role
|
|
|
|
associatedRolesPage.addAssociatedRealmRole("create-realm");
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.masthead()
|
|
|
|
.checkNotificationMessage("Associated roles have been added", true);
|
2022-03-09 16:41:45 +00:00
|
|
|
|
|
|
|
// Add associated client role
|
2022-08-20 08:10:36 +00:00
|
|
|
associatedRolesPage.addAssociatedRoleFromSearchBar(
|
|
|
|
"manage-account",
|
|
|
|
true
|
|
|
|
);
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.masthead()
|
|
|
|
.checkNotificationMessage("Associated roles have been added", true);
|
2022-03-09 16:41:45 +00:00
|
|
|
|
|
|
|
rolesTab.goToAssociatedRolesTab();
|
|
|
|
|
|
|
|
// Add associated client role
|
2022-03-29 10:39:32 +00:00
|
|
|
associatedRolesPage.addAssociatedRoleFromSearchBar(
|
|
|
|
"manage-consent",
|
|
|
|
true
|
|
|
|
);
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.masthead()
|
|
|
|
.checkNotificationMessage("Associated roles have been added", true);
|
2022-03-09 16:41:45 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Should hide inherited roles test", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().searchItem(itemId, false);
|
|
|
|
commonPage.tableUtils().clickRowItemLink(itemId);
|
|
|
|
rolesTab.goToAssociatedRolesTab().hideInheritedRoles();
|
2022-03-09 16:41:45 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Should delete associated roles test", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().searchItem(itemId, false);
|
|
|
|
commonPage.tableUtils().clickRowItemLink(itemId);
|
2022-03-09 16:41:45 +00:00
|
|
|
rolesTab.goToAssociatedRolesTab();
|
2022-09-16 08:58:43 +00:00
|
|
|
commonPage.tableUtils().selectRowItemAction("create-realm", "Unassign");
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.sidebar().waitForPageLoad();
|
2022-12-02 09:41:30 +00:00
|
|
|
commonPage.modalUtils().checkModalTitle("Remove role?").confirmModal();
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.sidebar().waitForPageLoad();
|
|
|
|
|
|
|
|
commonPage
|
|
|
|
.masthead()
|
2022-09-16 08:58:43 +00:00
|
|
|
.checkNotificationMessage("Scope mapping successfully removed", true);
|
2022-04-19 12:25:57 +00:00
|
|
|
|
2022-09-16 08:58:43 +00:00
|
|
|
commonPage.tableUtils().selectRowItemAction("manage-consent", "Unassign");
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.sidebar().waitForPageLoad();
|
2022-12-02 09:41:30 +00:00
|
|
|
commonPage.modalUtils().checkModalTitle("Remove role?").confirmModal();
|
2022-03-09 16:41:45 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Should delete associated role from search bar test", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().searchItem(itemId, false);
|
|
|
|
commonPage.tableUtils().clickRowItemLink(itemId);
|
|
|
|
commonPage.sidebar().waitForPageLoad();
|
2022-03-09 16:41:45 +00:00
|
|
|
rolesTab.goToAssociatedRolesTab();
|
|
|
|
|
2022-09-16 08:58:43 +00:00
|
|
|
cy.get('td[data-label="Name"]')
|
2022-08-20 08:10:36 +00:00
|
|
|
.contains("manage-account")
|
2022-03-09 16:41:45 +00:00
|
|
|
.parent()
|
|
|
|
.within(() => {
|
|
|
|
cy.get("input").click();
|
|
|
|
});
|
|
|
|
|
|
|
|
associatedRolesPage.removeAssociatedRoles();
|
|
|
|
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.sidebar().waitForPageLoad();
|
2022-12-02 09:41:30 +00:00
|
|
|
commonPage.modalUtils().checkModalTitle("Remove role?").confirmModal();
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.sidebar().waitForPageLoad();
|
2022-03-09 16:41:45 +00:00
|
|
|
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.masthead()
|
2022-09-16 08:58:43 +00:00
|
|
|
.checkNotificationMessage("Scope mapping successfully removed", true);
|
2022-03-09 16:41:45 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Should delete client role test", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableUtils().selectRowItemAction(itemId, "Delete");
|
|
|
|
commonPage.sidebar().waitForPageLoad();
|
|
|
|
commonPage.modalUtils().checkModalTitle("Delete role?").confirmModal();
|
2022-03-09 16:41:45 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Should delete client role from role details test", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.tableToolbarUtils()
|
|
|
|
.searchItem("client_role_to_be_deleted", false);
|
|
|
|
commonPage.tableUtils().clickRowItemLink("client_role_to_be_deleted");
|
2022-03-09 16:41:45 +00:00
|
|
|
createRealmRolePage.clickActionMenu("Delete this role");
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.modalUtils().confirmModal();
|
|
|
|
commonPage
|
|
|
|
.masthead()
|
|
|
|
.checkNotificationMessage("The role has been deleted", true);
|
2022-03-09 16:41:45 +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(() => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.sidebar().goToClients();
|
2021-02-28 20:02:31 +00:00
|
|
|
client = "client_" + (Math.random() + 1).toString(36).substring(7);
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().createClient();
|
2021-02-28 20:02:31 +00:00
|
|
|
createClientPage
|
|
|
|
.selectClientType("openid-connect")
|
|
|
|
.fillClientData(client)
|
2022-03-28 13:14:56 +00:00
|
|
|
.continue();
|
|
|
|
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.sidebar().waitForPageLoad();
|
2022-03-28 13:14:56 +00:00
|
|
|
|
|
|
|
createClientPage.save();
|
2022-10-10 17:52:44 +00:00
|
|
|
commonPage
|
|
|
|
.masthead()
|
|
|
|
.checkNotificationMessage("Client created successfully");
|
2022-04-19 12:25:57 +00:00
|
|
|
clientDetailsPage.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-07-27 15:10:26 +00:00
|
|
|
advancedTab.checkEmptyClusterNode();
|
|
|
|
|
2022-01-08 09:27:57 +00:00
|
|
|
advancedTab.registerNodeManually().fillHost("localhost").saveHost();
|
2021-02-28 20:02:31 +00:00
|
|
|
advancedTab.checkTestClusterAvailability(true);
|
2022-10-10 17:52:44 +00:00
|
|
|
commonPage.masthead().checkNotificationMessage("Node successfully added");
|
2022-07-27 15:10:26 +00:00
|
|
|
advancedTab.deleteClusterNode();
|
|
|
|
commonPage.modalUtils().confirmModal();
|
|
|
|
commonPage
|
|
|
|
.masthead()
|
|
|
|
.checkNotificationMessage("Node successfully removed");
|
|
|
|
advancedTab.checkEmptyClusterNode();
|
2021-02-28 20:02:31 +00:00
|
|
|
});
|
|
|
|
|
2022-09-14 09:55:25 +00:00
|
|
|
it("Fine grain OpenID connect configuration", () => {
|
2021-02-28 20:02:31 +00:00
|
|
|
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);
|
|
|
|
});
|
2022-10-10 17:52:44 +00:00
|
|
|
|
|
|
|
it("OIDC Compatibility Modes configuration", () => {
|
|
|
|
advancedTab.clickAllCompatibilitySwitch();
|
|
|
|
advancedTab.saveCompatibility();
|
|
|
|
advancedTab.jumpToCompatability();
|
|
|
|
advancedTab.clickExcludeSessionStateSwitch();
|
|
|
|
advancedTab.clickUseRefreshTokenForClientCredentialsGrantSwitch();
|
|
|
|
advancedTab.revertCompatibility();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Advanced settings", () => {
|
|
|
|
advancedTab.jumpToAdvanced();
|
|
|
|
|
|
|
|
advancedTab.clickAdvancedSwitches();
|
|
|
|
advancedTab.jumpToAdvanced();
|
2022-10-26 09:46:44 +00:00
|
|
|
advancedTab.selectKeyForCodeExchangeInput("S256");
|
2022-10-10 17:52:44 +00:00
|
|
|
|
|
|
|
advancedTab.saveAdvanced();
|
|
|
|
advancedTab.jumpToAdvanced();
|
|
|
|
advancedTab.checkAdvancedSwitchesOn();
|
2022-10-26 09:46:44 +00:00
|
|
|
advancedTab.checkKeyForCodeExchangeInput("S256");
|
2022-10-10 17:52:44 +00:00
|
|
|
|
2022-10-26 09:46:44 +00:00
|
|
|
advancedTab.selectKeyForCodeExchangeInput("plain");
|
|
|
|
advancedTab.checkKeyForCodeExchangeInput("plain");
|
2022-10-10 17:52:44 +00:00
|
|
|
|
|
|
|
advancedTab.jumpToAdvanced();
|
|
|
|
advancedTab.clickAdvancedSwitches();
|
|
|
|
|
|
|
|
advancedTab.revertAdvanced();
|
|
|
|
advancedTab.jumpToAdvanced();
|
2022-10-26 09:46:44 +00:00
|
|
|
advancedTab.checkKeyForCodeExchangeInput("S256");
|
2022-10-10 17:52:44 +00:00
|
|
|
//uncomment when revert button reverts all switches
|
|
|
|
//and ACR to LoA Mapping + Default ACR Values
|
|
|
|
//advancedTab.checkAdvancedSwitchesOn();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Authentication flow override", () => {
|
|
|
|
advancedTab.jumpToAuthFlow();
|
2022-10-26 09:46:44 +00:00
|
|
|
advancedTab.selectBrowserFlowInput("browser");
|
|
|
|
advancedTab.selectDirectGrantInput("docker auth");
|
|
|
|
advancedTab.checkBrowserFlowInput("browser");
|
|
|
|
advancedTab.checkDirectGrantInput("docker auth");
|
2022-10-10 17:52:44 +00:00
|
|
|
|
|
|
|
advancedTab.revertAuthFlowOverride();
|
|
|
|
advancedTab.jumpToAuthFlow();
|
2022-10-26 09:46:44 +00:00
|
|
|
advancedTab.checkBrowserFlowInput("");
|
|
|
|
advancedTab.checkDirectGrantInput("");
|
|
|
|
advancedTab.selectBrowserFlowInput("browser");
|
|
|
|
advancedTab.selectDirectGrantInput("docker auth");
|
2022-10-10 17:52:44 +00:00
|
|
|
|
|
|
|
advancedTab.saveAuthFlowOverride();
|
2022-10-26 09:46:44 +00:00
|
|
|
advancedTab.selectBrowserFlowInput("first broker login");
|
|
|
|
advancedTab.selectDirectGrantInput("first broker login");
|
2022-10-10 17:52:44 +00:00
|
|
|
advancedTab.revertAuthFlowOverride();
|
|
|
|
//revert doesn't work after saving.
|
|
|
|
//advancedTab.CheckBrowserFlowInput("browser");
|
|
|
|
//advancedTab.CheckDirectGrantInput("docker auth");
|
|
|
|
});
|
2021-02-28 20:02:31 +00:00
|
|
|
});
|
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(() => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.sidebar().goToClients();
|
2022-01-08 09:27:57 +00:00
|
|
|
});
|
|
|
|
|
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-09-13 11:58:25 +00:00
|
|
|
it("List", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().searchItem(serviceAccountName);
|
|
|
|
commonPage.tableUtils().clickRowItemLink(serviceAccountName);
|
2021-04-01 14:14:19 +00:00
|
|
|
serviceAccountTab
|
2021-04-20 12:10:00 +00:00
|
|
|
.goToServiceAccountTab()
|
2022-09-13 11:58:25 +00:00
|
|
|
.checkRoles(["offline_access", "uma_authorization"], false)
|
|
|
|
.checkRoles(["default-roles-master", "uma_protection"])
|
|
|
|
.unhideInheritedRoles();
|
|
|
|
|
|
|
|
commonPage.sidebar().waitForPageLoad();
|
|
|
|
|
|
|
|
serviceAccountTab
|
2022-05-12 13:45:50 +00:00
|
|
|
.checkRoles([
|
|
|
|
"default-roles-master",
|
|
|
|
"offline_access",
|
|
|
|
"uma_authorization",
|
|
|
|
"uma_protection",
|
|
|
|
])
|
|
|
|
.hideInheritedRoles();
|
|
|
|
|
|
|
|
commonPage.sidebar().waitForPageLoad();
|
|
|
|
|
|
|
|
serviceAccountTab
|
2022-09-13 11:58:25 +00:00
|
|
|
.checkRoles(["offline_access", "uma_authorization"], false)
|
|
|
|
.checkRoles(["default-roles-master", "uma_protection"]);
|
2022-05-12 13:45:50 +00:00
|
|
|
|
|
|
|
listingPage
|
|
|
|
.searchItem("testing", false)
|
|
|
|
.checkEmptyList()
|
|
|
|
.searchItem("", false);
|
|
|
|
|
2022-09-13 11:58:25 +00:00
|
|
|
serviceAccountTab
|
|
|
|
.checkRoles(["offline_access", "uma_authorization"], false)
|
|
|
|
.checkRoles(["default-roles-master", "uma_protection"]);
|
2022-05-12 13:45:50 +00:00
|
|
|
});
|
|
|
|
|
2022-09-13 11:58:25 +00:00
|
|
|
it("Assign", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableUtils().clickRowItemLink(serviceAccountName);
|
2021-08-10 12:41:56 +00:00
|
|
|
serviceAccountTab
|
|
|
|
.goToServiceAccountTab()
|
2022-01-08 09:27:57 +00:00
|
|
|
.assignRole(false)
|
2022-05-12 13:45:50 +00:00
|
|
|
.selectRow("create-realm", true)
|
2022-01-08 09:27:57 +00:00
|
|
|
.assign();
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.masthead().checkNotificationMessage("Role mapping updated");
|
2022-05-12 13:45:50 +00:00
|
|
|
|
2022-01-08 09:27:57 +00:00
|
|
|
serviceAccountTab.selectRow("create-realm").unAssign();
|
2022-05-12 13:45:50 +00:00
|
|
|
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.sidebar().waitForPageLoad();
|
2022-12-02 09:41:30 +00:00
|
|
|
commonPage.modalUtils().checkModalTitle("Remove role?").confirmModal();
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.masthead()
|
|
|
|
.checkNotificationMessage("Scope mapping successfully removed");
|
2022-05-12 13:45:50 +00:00
|
|
|
|
2022-09-13 11:58:25 +00:00
|
|
|
//cy.intercept("/admin/realms/master/users").as("assignRoles");
|
2022-05-12 13:45:50 +00:00
|
|
|
serviceAccountTab.checkRoles(["create-realm"], false).assignRole(false);
|
|
|
|
|
2022-09-13 11:58:25 +00:00
|
|
|
//cy.wait("@assignRoles");
|
2022-05-12 13:45:50 +00:00
|
|
|
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();
|
|
|
|
|
2022-09-13 11:58:25 +00:00
|
|
|
serviceAccountTab.unhideInheritedRoles();
|
|
|
|
|
|
|
|
commonPage.sidebar().waitForPageLoad();
|
|
|
|
|
2022-11-10 15:38:08 +00:00
|
|
|
serviceAccountTab.hideInheritedRoles();
|
|
|
|
|
2022-05-12 13:45:50 +00:00
|
|
|
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();
|
|
|
|
|
2022-11-10 15:38:08 +00:00
|
|
|
serviceAccountTab.unhideInheritedRoles();
|
|
|
|
|
2022-05-12 13:45:50 +00:00
|
|
|
serviceAccountTab
|
|
|
|
.checkRoles(["create-realm"], false)
|
|
|
|
.checkRoles([
|
|
|
|
"default-roles-master",
|
|
|
|
"offline_access",
|
|
|
|
"uma_authorization",
|
|
|
|
"uma_protection",
|
|
|
|
]);
|
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", () => {
|
|
|
|
const mappingClient = "mapping-client";
|
|
|
|
beforeEach(() => {
|
|
|
|
keycloakBefore();
|
|
|
|
loginPage.logIn();
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.sidebar().goToClients();
|
|
|
|
commonPage.tableToolbarUtils().searchItem(mappingClient);
|
|
|
|
commonPage.tableUtils().clickRowItemLink(mappingClient);
|
2021-10-20 14:26:05 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
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-09-13 11:58:25 +00:00
|
|
|
it("Add mapping to openid client", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
clientDetailsPage
|
|
|
|
.goToClientScopesTab()
|
2022-10-06 14:18:33 +00:00
|
|
|
.clickDedicatedScope(mappingClient);
|
|
|
|
dedicatedScopesMappersTab.addPredefinedMapper();
|
2022-04-19 12:25:57 +00:00
|
|
|
clientDetailsPage.modalUtils().table().clickHeaderItem(1, "input");
|
2022-09-13 11:58:25 +00:00
|
|
|
clientDetailsPage.modalUtils().confirmModal();
|
2022-04-19 12:25:57 +00:00
|
|
|
clientDetailsPage
|
|
|
|
.masthead()
|
|
|
|
.checkNotificationMessage("Mapping successfully created");
|
2021-10-20 14:26:05 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-05-04 08:11:58 +00:00
|
|
|
describe("Keys tab test", () => {
|
|
|
|
const keysName = "keys-client";
|
2022-04-19 12:25:57 +00:00
|
|
|
|
2021-05-04 08:11:58 +00:00
|
|
|
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(() => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.sidebar().goToClients();
|
|
|
|
commonPage.tableToolbarUtils().searchItem(keysName);
|
|
|
|
commonPage.tableUtils().clickRowItemLink(keysName);
|
2022-02-16 16:34:54 +00:00
|
|
|
});
|
|
|
|
|
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", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
const keysTab = clientDetailsPage.goToKeysTab();
|
|
|
|
keysTab.formUtils().checkSaveButtonIsDisabled(true);
|
|
|
|
keysTab.toggleUseJwksUrl().formUtils().checkSaveButtonIsDisabled(false);
|
2021-05-04 08:11:58 +00:00
|
|
|
});
|
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
it("Generate new keys", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
const keysTab = clientDetailsPage.goToKeysTab();
|
|
|
|
keysTab.clickGenerate();
|
2023-01-02 15:34:51 +00:00
|
|
|
keysTab.fillGenerateModal("JKS", "keyname", "123", "1234").clickConfirm();
|
2021-05-04 08:11:58 +00:00
|
|
|
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.masthead()
|
|
|
|
.checkNotificationMessage(
|
|
|
|
"New key pair and certificate generated successfully"
|
|
|
|
);
|
2021-05-04 08:11:58 +00:00
|
|
|
});
|
|
|
|
});
|
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();
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.sidebar().goToClients();
|
|
|
|
commonPage.tableToolbarUtils().searchItem(clientName);
|
|
|
|
commonPage.tableUtils().clickRowItemLink(clientName);
|
2021-09-28 15:14:49 +00:00
|
|
|
});
|
|
|
|
|
2022-09-13 11:58:25 +00:00
|
|
|
it("Displays the correct tabs", () => {
|
2022-11-10 13:40:37 +00:00
|
|
|
clientDetailsPage.goToSettingsTab();
|
2022-04-19 12:25:57 +00:00
|
|
|
clientDetailsPage
|
|
|
|
.tabUtils()
|
|
|
|
.checkTabExists(ClientsDetailsTab.Settings, true)
|
|
|
|
.checkTabExists(ClientsDetailsTab.Roles, true)
|
2022-09-13 11:58:25 +00:00
|
|
|
.checkTabExists(ClientsDetailsTab.Sessions, true)
|
|
|
|
.checkTabExists(ClientsDetailsTab.Permissions, true)
|
2022-04-19 12:25:57 +00:00
|
|
|
.checkTabExists(ClientsDetailsTab.Advanced, true)
|
2022-09-13 11:58:25 +00:00
|
|
|
.checkNumberOfTabsIsEqual(5);
|
2021-09-28 15:14:49 +00:00
|
|
|
});
|
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
it("Hides the delete action", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.actionToolbarUtils()
|
|
|
|
.clickActionToggleButton()
|
|
|
|
.checkActionItemExists("Delete", false);
|
2021-09-28 15:14:49 +00:00
|
|
|
});
|
|
|
|
});
|
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-04-19 12:25:57 +00:00
|
|
|
commonPage.sidebar().goToClients();
|
2022-03-06 15:25:37 +00:00
|
|
|
cy.intercept("/admin/realms/master/clients/*").as("fetchClient");
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage.tableToolbarUtils().searchItem(clientId);
|
|
|
|
commonPage.tableUtils().clickRowItemLink(clientId);
|
2022-01-07 07:27:58 +00:00
|
|
|
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", () => {
|
2022-04-19 12:25:57 +00:00
|
|
|
commonPage
|
|
|
|
.actionToolbarUtils()
|
|
|
|
.bearerOnlyExplainerLabelElement.trigger("mouseenter");
|
|
|
|
commonPage
|
|
|
|
.actionToolbarUtils()
|
|
|
|
.bearerOnlyExplainerTooltipElement.should("exist");
|
2021-09-30 10:04:50 +00:00
|
|
|
});
|
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
|
|
|
});
|