1
import { v4 as uuid } from "uuid";
2
import LoginPage from "../support/pages/LoginPage";
6
} from "../support/pages/admin-ui/ListingPage";
7
import CreateClientPage from "../support/pages/admin-ui/manage/clients/CreateClientPage";
8
import adminClient from "../support/util/AdminClient";
9
import { keycloakBefore } from "../support/util/keycloak_hooks";
10
import RoleMappingTab from "../support/pages/admin-ui/manage/RoleMappingTab";
11
import createRealmRolePage from "../support/pages/admin-ui/manage/realm_roles/CreateRealmRolePage";
12
import AssociatedRolesPage from "../support/pages/admin-ui/manage/realm_roles/AssociatedRolesPage";
13
import ClientRolesTab from "../support/pages/admin-ui/manage/clients/ClientRolesTab";
14
import InitialAccessTokenTab from "../support/pages/admin-ui/manage/clients/tabs/InitialAccessTokenTab";
15
import AdvancedTab from "../support/pages/admin-ui/manage/clients/client_details/tabs/AdvancedTab";
16
import ClientDetailsPage, {
18
} from "../support/pages/admin-ui/manage/clients/client_details/ClientDetailsPage";
19
import CommonPage from "../support/pages/CommonPage";
20
import AttributesTab from "../support/pages/admin-ui/manage/AttributesTab";
21
import DedicatedScopesMappersTab from "../support/pages/admin-ui/manage/clients/client_details/DedicatedScopesMappersTab";
22
import { ClientRegistrationPage } from "../support/pages/admin-ui/manage/clients/ClientRegistrationPage";
24
let itemId = "client_crud";
25
const loginPage = new LoginPage();
26
const associatedRolesPage = new AssociatedRolesPage();
27
const createClientPage = new CreateClientPage();
28
const clientDetailsPage = new ClientDetailsPage();
29
const commonPage = new CommonPage();
30
const listingPage = new ListingPage();
31
const attributesTab = new AttributesTab();
32
const dedicatedScopesMappersTab = new DedicatedScopesMappersTab();
34
describe("Clients test", () => {
35
describe("Client details - Client scopes subtab", () => {
36
const clientId = "client-scopes-subtab-test";
37
const clientScopeName = "client-scope-test";
38
const clientScopeNameDefaultType = "client-scope-test-default-type";
39
const clientScopeNameOptionalType = "client-scope-test-optional-type";
41
name: clientScopeName,
43
protocol: "openid-connect",
45
"include.in.token.scope": "true",
46
"display.on.consent.screen": "true",
48
"consent.screen.text": "",
51
const msgScopeMappingRemoved = "Scope mapping successfully removed";
54
adminClient.createClient({
56
protocol: "openid-connect",
59
for (let i = 0; i < 5; i++) {
60
clientScope.name = clientScopeName + i;
61
await adminClient.createClientScope(clientScope);
62
await adminClient.addDefaultClientScopeInClient(
67
clientScope.name = clientScopeNameDefaultType;
68
await adminClient.createClientScope(clientScope);
69
clientScope.name = clientScopeNameOptionalType;
70
await adminClient.createClientScope(clientScope);
76
commonPage.sidebar().goToClients();
77
commonPage.tableToolbarUtils().searchItem(clientId);
78
cy.intercept("/admin/realms/master/clients/*").as("fetchClient");
79
commonPage.tableUtils().clickRowItemLink(clientId);
80
cy.wait("@fetchClient");
81
clientDetailsPage.goToClientScopesTab();
85
adminClient.deleteClient(clientId);
86
for (let i = 0; i < 5; i++) {
87
await adminClient.deleteClientScope(clientScopeName + i);
89
await adminClient.deleteClientScope(clientScopeNameDefaultType);
90
await adminClient.deleteClientScope(clientScopeNameOptionalType);
93
it("Should list client scopes", () => {
96
.checkRowItemsGreaterThan(1)
97
.checkRowItemExists(clientScopeName + 0);
100
it("Should search existing client scope by name", () => {
101
commonPage.tableToolbarUtils().searchItem(clientScopeName + 0, false);
104
.checkRowItemExists(clientScopeName + 0)
105
.checkRowItemsEqualTo(2);
108
it("Should search non-existent client scope by name", () => {
109
commonPage.tableToolbarUtils().searchItem("non-existent-item", false);
110
commonPage.tableUtils().checkIfExists(false);
111
commonPage.emptyState().checkIfExists(true);
114
it("Should search existing client scope by assigned type", () => {
117
.selectSearchType(Filter.AssignedType)
118
.selectSecondarySearchType(FilterAssignedType.Default);
121
.checkRowItemExists(FilterAssignedType.Default)
122
.checkRowItemExists(FilterAssignedType.Optional, false);
125
.selectSecondarySearchType(FilterAssignedType.Optional);
128
.checkRowItemExists(FilterAssignedType.Default, false)
129
.checkRowItemExists(FilterAssignedType.Optional);
132
.selectSecondarySearchType(FilterAssignedType.AllTypes);
135
.checkRowItemExists(FilterAssignedType.Default)
136
.checkRowItemExists(FilterAssignedType.Optional);
139
const newItemsWithExpectedAssignedTypes = [
140
[clientScopeNameOptionalType, FilterAssignedType.Optional],
141
[clientScopeNameDefaultType, FilterAssignedType.Default],
143
newItemsWithExpectedAssignedTypes.forEach(($type) => {
144
const [itemName, assignedType] = $type;
145
it(`Should add client scope ${itemName} with ${assignedType} assigned type`, () => {
146
commonPage.tableToolbarUtils().addClientScope();
149
.checkModalTitle("Add client scopes to " + clientId);
150
commonPage.tableUtils().selectRowItemCheckbox(itemName);
151
commonPage.modalUtils().confirmModalWithItem(assignedType);
152
commonPage.masthead().checkNotificationMessage("Scope mapping updated");
153
commonPage.tableToolbarUtils().searchItem(itemName, false);
156
.checkRowItemExists(itemName)
157
.checkRowItemExists(assignedType);
161
const expectedItemAssignedTypes = [
162
FilterAssignedType.Optional,
163
FilterAssignedType.Default,
165
expectedItemAssignedTypes.forEach(($assignedType) => {
166
const itemName = clientScopeName + 0;
167
it(`Should change item ${itemName} AssignedType to ${$assignedType} from search bar`, () => {
168
commonPage.tableToolbarUtils().searchItem(itemName, false);
169
commonPage.tableUtils().selectRowItemCheckbox(itemName);
170
commonPage.tableToolbarUtils().changeTypeTo($assignedType);
171
commonPage.masthead().checkNotificationMessage("Scope mapping updated");
172
commonPage.tableToolbarUtils().searchItem(itemName, false);
173
commonPage.tableUtils().checkRowItemExists($assignedType);
177
it("Should show items on next page are more than 11", () => {
178
commonPage.sidebar().waitForPageLoad();
179
commonPage.tableToolbarUtils().clickNextPageButton();
180
commonPage.tableUtils().checkRowItemsGreaterThan(1);
183
it("Should remove client scope from item bar", () => {
184
const itemName = clientScopeName + 0;
185
commonPage.tableToolbarUtils().searchItem(itemName, false);
186
commonPage.tableUtils().selectRowItemAction(itemName, "Remove");
187
commonPage.modalUtils().confirmModal();
188
commonPage.masthead().checkNotificationMessage(msgScopeMappingRemoved);
189
commonPage.tableToolbarUtils().searchItem(itemName, false);
190
commonPage.tableUtils().checkRowItemExists(itemName, false);
193
it("Should remove multiple client scopes from search bar", () => {
194
const itemName1 = clientScopeName + 1;
195
const itemName2 = clientScopeName + 2;
196
cy.intercept("/admin/realms/master/client-scopes").as("load");
197
commonPage.tableToolbarUtils().clickSearchButton();
200
commonPage.tableToolbarUtils().checkActionItemIsEnabled("Remove", false);
201
commonPage.tableToolbarUtils().searchItem(clientScopeName, false);
204
.selectRowItemCheckbox(itemName1)
205
.selectRowItemCheckbox(itemName2);
206
cy.intercept("/admin/realms/master/client-scopes").as("load");
207
commonPage.tableToolbarUtils().clickSearchButton();
210
commonPage.tableToolbarUtils().clickActionItem("Remove");
211
commonPage.masthead().checkNotificationMessage(msgScopeMappingRemoved);
212
commonPage.tableToolbarUtils().searchItem(clientScopeName, false);
215
.checkRowItemExists(itemName1, false)
216
.checkRowItemExists(itemName2, false);
217
commonPage.tableToolbarUtils().clickSearchButton();
220
//fails, issue https://github.com/keycloak/keycloak-admin-ui/issues/1874
221
it("Should show initial items after filtering", () => {
224
.selectSearchType(Filter.AssignedType)
225
.selectSecondarySearchType(FilterAssignedType.Optional)
226
.selectSearchType(Filter.Name);
229
.checkRowItemExists(FilterAssignedType.Default, false)
230
.checkRowItemExists(FilterAssignedType.Optional);
234
describe("Client scopes evaluate subtab", () => {
235
const clientName = "testClient";
240
commonPage.sidebar().goToClients();
244
await adminClient.createClient({
245
protocol: "openid-connect",
246
clientId: clientName,
252
await adminClient.deleteClient(clientName);
255
it("check effective protocol mappers list is not empty and find effective protocol mapper locale", () => {
256
commonPage.tableToolbarUtils().searchItem(clientName);
257
commonPage.tableUtils().clickRowItemLink(clientName);
259
clientDetailsPage.goToClientScopesEvaluateTab();
261
cy.findByTestId("effective-protocol-mappers")
263
.should("have.length.gt", 0);
266
it("check role scope mappings list list is not empty and find role scope mapping admin", () => {
267
commonPage.tableToolbarUtils().searchItem(clientName);
268
commonPage.tableUtils().clickRowItemLink(clientName);
270
clientDetailsPage.goToClientScopesEvaluateTab();
271
clientDetailsPage.goToClientScopesEvaluateEffectiveRoleScopeMappingsTab();
273
cy.findByTestId("effective-role-scope-mappings")
275
.should("have.length.gt", 0);
278
it("check generated id token and user info", () => {
279
commonPage.tableToolbarUtils().searchItem(clientName);
280
commonPage.tableUtils().clickRowItemLink(clientName);
282
clientDetailsPage.goToClientScopesEvaluateTab();
283
cy.get("div#generatedAccessToken").contains("No generated access token");
285
clientDetailsPage.goToClientScopesEvaluateGeneratedIdTokenTab();
286
cy.get("div#generatedIdToken").contains("No generated id token");
288
clientDetailsPage.goToClientScopesEvaluateGeneratedUserInfoTab();
289
cy.get("div#generatedUserInfo").contains("No generated user info");
291
cy.get("input#user-select-typeahead").type("admin");
292
cy.get("li[id*=select-option-] > button:first-child").click();
294
clientDetailsPage.goToClientScopesEvaluateGeneratedAccessTokenTab();
295
cy.get("div#generatedAccessToken").contains(
296
'"preferred_username": "admin"',
298
cy.get("div#generatedAccessToken").contains('"scope": "');
300
clientDetailsPage.goToClientScopesEvaluateGeneratedIdTokenTab();
301
cy.get("div#generatedIdToken").contains('"preferred_username": "admin"');
303
clientDetailsPage.goToClientScopesEvaluateGeneratedUserInfoTab();
304
cy.get("div#generatedIdToken").contains('"preferred_username": "admin"');
305
cy.get("div#generatedIdToken").contains('"session_state"');
309
describe("Client creation", () => {
313
commonPage.sidebar().goToClients();
316
it("Should cancel creating client", () => {
317
commonPage.tableToolbarUtils().createClient();
319
createClientPage.continue().checkClientIdRequiredMessage();
323
.selectClientType("openid-connect")
326
cy.url().should("not.include", "/add-client");
329
it("Should check settings elements", () => {
330
commonPage.tableToolbarUtils().clickPrimaryButton();
331
const clientId = "Test settings";
334
.fillClientData(clientId)
336
.checkCapabilityConfigElements()
342
.checkNotificationMessage("Client created successfully");
343
commonPage.sidebar().waitForPageLoad();
346
.checkCapabilityConfigElements()
347
.checkAccessSettingsElements()
348
.checkLoginSettingsElements()
349
.checkLogoutSettingsElements()
350
.deleteClientFromActionDropdown();
352
commonPage.modalUtils().confirmModal();
353
commonPage.tableUtils().checkRowItemExists(clientId, false);
356
it("Should navigate to previous using 'back' button", () => {
357
commonPage.tableToolbarUtils().createClient();
359
createClientPage.continue().checkClientIdRequiredMessage();
362
.fillClientData("test_client")
363
.selectClientType("openid-connect")
366
.checkGeneralSettingsStepActive();
369
it("Should fail creating client", () => {
370
commonPage.tableToolbarUtils().createClient();
372
createClientPage.continue().checkClientIdRequiredMessage();
376
.selectClientType("openid-connect")
378
.checkClientIdRequiredMessage();
380
createClientPage.fillClientData("account").continue().continue().save();
382
// The error should inform about duplicated name/id
385
.checkNotificationMessage(
386
"Could not create client: 'Client account already exists'",
390
it("Client CRUD test", () => {
391
itemId += "_" + uuid();
394
commonPage.tableUtils().checkRowItemExists(itemId, false);
395
commonPage.tableToolbarUtils().clickPrimaryButton();
396
createClientPage.cancel();
397
commonPage.tableUtils().checkRowItemExists(itemId, false);
398
commonPage.tableToolbarUtils().clickPrimaryButton();
401
.selectClientType("openid-connect")
402
.fillClientData(itemId)
404
.switchClientAuthentication()
407
.clickOAuthDeviceAuthorizationGrant()
408
.clickOidcCibaGrant()
409
.clickServiceAccountRoles()
416
.checkNotificationMessage("Client created successfully");
418
commonPage.sidebar().goToClients();
420
commonPage.tableToolbarUtils().searchItem("John Doe", false);
421
commonPage.emptyState().checkIfExists(true);
422
commonPage.tableToolbarUtils().searchItem("");
423
commonPage.tableUtils().checkRowItemExists("account");
424
commonPage.tableToolbarUtils().searchItem(itemId);
425
commonPage.tableUtils().checkRowItemExists(itemId);
428
commonPage.tableUtils().selectRowItemAction(itemId, "Delete");
429
commonPage.sidebar().waitForPageLoad();
432
.checkModalTitle(`Delete ${itemId} ?`)
436
.checkNotificationMessage("The client has been deleted");
437
commonPage.tableUtils().checkRowItemExists(itemId, false);
440
it("Initial access token can't be created with 0 days and count", () => {
441
const initialAccessTokenTab = new InitialAccessTokenTab();
442
initialAccessTokenTab
443
.goToInitialAccessTokenTab()
445
.goToCreateFromEmptyList()
446
.fillNewTokenData(0, 0)
447
.checkExpirationGreaterThanZeroError()
449
.checkSaveButtonIsDisabled();
452
it("Initial access token", () => {
453
const initialAccessTokenTab = new InitialAccessTokenTab();
454
initialAccessTokenTab
455
.goToInitialAccessTokenTab()
457
.goToCreateFromEmptyList()
458
.fillNewTokenData(1, 3)
463
.checkModalTitle("Initial access token details")
468
.checkNotificationMessage("New initial access token has been created");
470
initialAccessTokenTab.shouldNotBeEmpty();
472
commonPage.tableToolbarUtils().searchItem("John Doe", false);
473
commonPage.emptyState().checkIfExists(true);
474
commonPage.tableToolbarUtils().searchItem("", false);
476
initialAccessTokenTab.getFirstId((id) => {
479
.checkRowItemValueByItemName(id, 4, "4")
480
.checkRowItemValueByItemName(id, 5, "4")
481
.checkRowItemExists(id);
484
commonPage.tableToolbarUtils().clickPrimaryButton("Create");
485
initialAccessTokenTab.fillNewTokenData(1, 3).save();
487
commonPage.modalUtils().closeModal();
489
initialAccessTokenTab.getFirstId((id) => {
490
commonPage.tableUtils().selectRowItemAction(id, "Delete");
491
commonPage.sidebar().waitForPageLoad();
494
.checkModalTitle("Delete initial access token?")
500
.checkNotificationMessage("Initial access token deleted successfully");
501
initialAccessTokenTab.shouldNotBeEmpty();
503
initialAccessTokenTab.getFirstId((id) => {
504
commonPage.tableUtils().selectRowItemAction(id, "Delete");
505
commonPage.sidebar().waitForPageLoad();
506
commonPage.modalUtils().confirmModal();
508
initialAccessTokenTab.shouldBeEmpty();
511
it("Should fail to create imported client with empty ID", () => {
512
commonPage.sidebar().goToClients();
513
cy.findByTestId("importClient").click();
514
cy.findByTestId("clientId").click();
515
cy.findByText("Save").click();
516
cy.findByText("Required field");
519
const identicalClientId = "identical";
521
it("Should fail to create client with same ID", () => {
522
commonPage.sidebar().goToClients();
523
commonPage.tableToolbarUtils().createClient();
526
.fillClientData(identicalClientId)
531
commonPage.masthead().closeAllAlertMessages();
532
commonPage.sidebar().goToClients();
533
cy.findByTestId("importClient").click();
534
cy.findByTestId("realm-file").selectFile(
535
"cypress/fixtures/partial-import-test-data/import-identical-client.json",
536
{ action: "drag-drop" },
540
//cy.findByTestId("realm-file").contains('"clientId": "identical"')
541
cy.findByTestId("clientId").click();
542
cy.findByText("Save").click();
545
.checkNotificationMessage(
546
"Could not import client: Client identical already exists",
551
it("should delete 'identical' client id", () => {
552
commonPage.sidebar().goToClients();
553
adminClient.deleteClient(identicalClientId);
557
describe("Roles tab test", () => {
558
const rolesTab = new ClientRolesTab();
559
const client = "client_" + uuid();
562
adminClient.createClient({
564
protocol: "openid-connect",
572
commonPage.sidebar().goToClients();
573
commonPage.tableToolbarUtils().searchItem(client);
574
commonPage.tableUtils().clickRowItemLink(client);
575
rolesTab.goToRolesTab();
579
adminClient.deleteClient(client);
582
it("Should fail to create client role with empty name", () => {
583
rolesTab.goToCreateRoleFromEmptyState();
584
createRealmRolePage.fillRealmRoleData("").save();
585
createRealmRolePage.checkRealmRoleNameRequiredMessage();
588
it("Should create client role", () => {
589
rolesTab.goToCreateRoleFromEmptyState();
590
createRealmRolePage.fillRealmRoleData(itemId).save();
591
commonPage.masthead().checkNotificationMessage("Role created", true);
594
it("Should update client role description", () => {
595
const updateDescription = "updated description";
596
commonPage.tableToolbarUtils().searchItem(itemId, false);
597
commonPage.tableUtils().clickRowItemLink(itemId);
598
createRealmRolePage.updateDescription(updateDescription).save();
601
.checkNotificationMessage("The role has been saved", true);
602
createRealmRolePage.checkDescription(updateDescription);
605
it("Should add attribute to client role", () => {
606
commonPage.tableUtils().clickRowItemLink(itemId);
607
rolesTab.goToAttributesTab();
609
.addAttribute("crud_attribute_key", "crud_attribute_value")
611
attributesTab.assertRowItemsEqualTo(1);
614
.checkNotificationMessage("The role has been saved", true);
617
it("Should delete attribute from client role", () => {
618
commonPage.tableUtils().clickRowItemLink(itemId);
619
rolesTab.goToAttributesTab();
620
attributesTab.deleteAttribute(0);
621
attributesTab.assertEmpty();
624
.checkNotificationMessage("The role has been saved", true);
627
it("Should create client role to be deleted", () => {
628
rolesTab.goToCreateRoleFromToolbar();
629
createRealmRolePage.fillRealmRoleData("client_role_to_be_deleted").save();
630
commonPage.masthead().checkNotificationMessage("Role created", true);
633
it("Should fail to create duplicate client role", () => {
634
rolesTab.goToCreateRoleFromToolbar();
635
createRealmRolePage.fillRealmRoleData(itemId).save();
638
.checkNotificationMessage(
639
`Could not create role: Role with name ${itemId} already exists`,
644
it("Should search existing client role", () => {
645
commonPage.tableToolbarUtils().searchItem(itemId, false);
646
commonPage.tableUtils().checkRowItemExists(itemId);
649
it("Should search non-existing role test", () => {
650
commonPage.tableToolbarUtils().searchItem("role_DNE", false);
651
commonPage.emptyState().checkIfExists(true);
654
it("roles empty search test", () => {
655
commonPage.tableToolbarUtils().searchItem("", false);
656
commonPage.tableUtils().checkIfExists(true);
659
it("Add associated roles test", () => {
660
commonPage.tableToolbarUtils().searchItem(itemId, false);
661
commonPage.tableUtils().clickRowItemLink(itemId);
663
// Add associated realm role
664
associatedRolesPage.addAssociatedRealmRole("create-realm");
667
.checkNotificationMessage("Associated roles have been added", true);
669
// Add associated client role
670
associatedRolesPage.addAssociatedRoleFromSearchBar(
676
.checkNotificationMessage("Associated roles have been added", true);
678
rolesTab.goToAssociatedRolesTab();
680
// Add associated client role
681
associatedRolesPage.addAssociatedRoleFromSearchBar(
687
.checkNotificationMessage("Associated roles have been added", true);
690
it("Should hide inherited roles test", () => {
691
commonPage.tableToolbarUtils().searchItem(itemId, false);
692
commonPage.tableUtils().clickRowItemLink(itemId);
693
rolesTab.goToAssociatedRolesTab().hideInheritedRoles();
696
it("Should delete associated roles test", () => {
697
commonPage.tableToolbarUtils().searchItem(itemId, false);
698
commonPage.tableUtils().clickRowItemLink(itemId);
699
rolesTab.goToAssociatedRolesTab();
700
commonPage.tableUtils().selectRowItemAction("create-realm", "Unassign");
701
commonPage.sidebar().waitForPageLoad();
702
commonPage.modalUtils().checkModalTitle("Remove role?").confirmModal();
703
commonPage.sidebar().waitForPageLoad();
707
.checkNotificationMessage("Scope mapping successfully removed", true);
709
commonPage.tableUtils().selectRowItemAction("manage-consent", "Unassign");
710
commonPage.sidebar().waitForPageLoad();
711
commonPage.modalUtils().checkModalTitle("Remove role?").confirmModal();
714
it("Should delete associated role from search bar test", () => {
715
commonPage.tableToolbarUtils().searchItem(itemId, false);
716
commonPage.tableUtils().clickRowItemLink(itemId);
717
commonPage.sidebar().waitForPageLoad();
718
rolesTab.goToAssociatedRolesTab();
720
cy.get('td[data-label="Name"]')
721
.contains("manage-account")
724
cy.get("input").click();
727
associatedRolesPage.removeAssociatedRoles();
729
commonPage.sidebar().waitForPageLoad();
730
commonPage.modalUtils().checkModalTitle("Remove role?").confirmModal();
731
commonPage.sidebar().waitForPageLoad();
735
.checkNotificationMessage("Scope mapping successfully removed", true);
738
it("Should delete client role test", () => {
739
commonPage.tableUtils().selectRowItemAction(itemId, "Delete");
740
commonPage.sidebar().waitForPageLoad();
741
commonPage.modalUtils().checkModalTitle("Delete role?").confirmModal();
744
it("Should delete client role from role details test", () => {
747
.searchItem("client_role_to_be_deleted", false);
748
commonPage.tableUtils().clickRowItemLink("client_role_to_be_deleted");
749
createRealmRolePage.clickActionMenu("Delete this role");
750
commonPage.modalUtils().confirmModal();
753
.checkNotificationMessage("The role has been deleted", true);
757
describe("Advanced tab test", () => {
758
const advancedTab = new AdvancedTab();
764
commonPage.sidebar().goToClients();
765
client = "client_" + uuid();
766
commonPage.tableToolbarUtils().createClient();
768
.selectClientType("openid-connect")
769
.fillClientData(client)
772
commonPage.sidebar().waitForPageLoad();
774
createClientPage.continue().save();
777
.checkNotificationMessage("Client created successfully");
778
clientDetailsPage.goToAdvancedTab();
782
adminClient.deleteClient(client);
785
it("Clustering", () => {
786
advancedTab.expandClusterNode();
788
advancedTab.checkEmptyClusterNode();
790
advancedTab.registerNodeManually().fillHost("localhost").saveHost();
791
advancedTab.checkTestClusterAvailability(true);
792
commonPage.masthead().checkNotificationMessage("Node successfully added");
793
advancedTab.deleteClusterNode();
794
commonPage.modalUtils().confirmModal();
797
.checkNotificationMessage("Node successfully removed");
798
advancedTab.checkEmptyClusterNode();
801
it("Fine grain OpenID connect configuration", () => {
802
const algorithm = "ES384";
804
.selectAccessTokenSignatureAlgorithm(algorithm)
808
.selectAccessTokenSignatureAlgorithm("HS384")
810
advancedTab.checkAccessTokenSignatureAlgorithm(algorithm);
813
it("OIDC Compatibility Modes configuration", () => {
814
advancedTab.clickAllCompatibilitySwitch();
815
advancedTab.saveCompatibility();
816
advancedTab.jumpToCompatability();
817
advancedTab.clickExcludeSessionStateSwitch();
818
advancedTab.clickUseRefreshTokenForClientCredentialsGrantSwitch();
819
advancedTab.revertCompatibility();
822
it("Advanced settings", () => {
823
advancedTab.jumpToAdvanced();
825
advancedTab.clickAdvancedSwitches();
826
advancedTab.jumpToAdvanced();
827
advancedTab.selectKeyForCodeExchangeInput("S256");
829
advancedTab.saveAdvanced();
830
advancedTab.jumpToAdvanced();
831
advancedTab.checkAdvancedSwitchesOn();
832
advancedTab.checkKeyForCodeExchangeInput("S256");
834
advancedTab.selectKeyForCodeExchangeInput("plain");
835
advancedTab.checkKeyForCodeExchangeInput("plain");
837
advancedTab.jumpToAdvanced();
838
advancedTab.clickAdvancedSwitches();
840
advancedTab.revertAdvanced();
841
advancedTab.jumpToAdvanced();
842
advancedTab.checkKeyForCodeExchangeInput("S256");
843
//uncomment when revert button reverts all switches
844
//and ACR to LoA Mapping + Default ACR Values
845
//advancedTab.checkAdvancedSwitchesOn();
848
it("Authentication flow override", () => {
849
advancedTab.jumpToAuthFlow();
850
advancedTab.selectBrowserFlowInput("browser");
851
advancedTab.selectDirectGrantInput("docker auth");
852
advancedTab.checkBrowserFlowInput("browser");
853
advancedTab.checkDirectGrantInput("docker auth");
855
advancedTab.revertAuthFlowOverride();
856
advancedTab.jumpToAuthFlow();
857
advancedTab.checkBrowserFlowInput("");
858
advancedTab.checkDirectGrantInput("");
859
advancedTab.selectBrowserFlowInput("browser");
860
advancedTab.selectDirectGrantInput("docker auth");
862
advancedTab.saveAuthFlowOverride();
863
advancedTab.selectBrowserFlowInput("first broker login");
864
advancedTab.selectDirectGrantInput("first broker login");
865
advancedTab.revertAuthFlowOverride();
866
//revert doesn't work after saving.
867
//advancedTab.CheckBrowserFlowInput("browser");
868
//advancedTab.CheckDirectGrantInput("docker auth");
872
describe("Service account tab test", () => {
873
const serviceAccountTab = new RoleMappingTab("user");
874
const serviceAccountName = "service-account-client";
877
adminClient.createClient({
878
protocol: "openid-connect",
879
clientId: serviceAccountName,
881
authorizationServicesEnabled: true,
882
serviceAccountsEnabled: true,
883
standardFlowEnabled: true,
890
commonPage.sidebar().goToClients();
894
adminClient.deleteClient(serviceAccountName);
898
commonPage.tableToolbarUtils().searchItem(serviceAccountName);
899
commonPage.tableUtils().clickRowItemLink(serviceAccountName);
901
.goToServiceAccountTab()
902
.checkRoles(["offline_access", "uma_authorization"], false)
903
.checkRoles(["default-roles-master", "uma_protection"])
904
.unhideInheritedRoles();
906
commonPage.sidebar().waitForPageLoad();
910
"default-roles-master",
915
.hideInheritedRoles();
917
commonPage.sidebar().waitForPageLoad();
920
.checkRoles(["offline_access", "uma_authorization"], false)
921
.checkRoles(["default-roles-master", "uma_protection"]);
924
.searchItem("testing", false)
926
.searchItem("", false);
929
.checkRoles(["offline_access", "uma_authorization"], false)
930
.checkRoles(["default-roles-master", "uma_protection"]);
934
commonPage.tableUtils().clickRowItemLink(serviceAccountName);
936
.goToServiceAccountTab()
938
.selectRow("create-realm", true)
940
commonPage.masthead().checkNotificationMessage("Role mapping updated");
942
serviceAccountTab.selectRow("create-realm").unAssign();
944
commonPage.sidebar().waitForPageLoad();
945
commonPage.modalUtils().checkModalTitle("Remove role?").confirmModal();
948
.checkNotificationMessage("Scope mapping successfully removed");
950
//cy.intercept("/admin/realms/master/users").as("assignRoles");
951
serviceAccountTab.checkRoles(["create-realm"], false).assignRole(false);
953
//cy.wait("@assignRoles");
954
commonPage.sidebar().waitForPageLoad();
957
.selectRow("offline_access", true)
958
.selectRow("admin", true)
959
.selectRow("create-realm", true)
962
commonPage.masthead().checkNotificationMessage("Role mapping updated");
963
commonPage.sidebar().waitForPageLoad();
965
serviceAccountTab.unhideInheritedRoles();
967
commonPage.sidebar().waitForPageLoad();
969
serviceAccountTab.hideInheritedRoles();
972
.selectRow("offline_access")
976
commonPage.modalUtils().confirmModal();
979
.checkRoles(["admin"], false)
980
.checkRoles(["create-realm"]);
982
listingPage.clickRowDetails("create-realm");
983
serviceAccountTab.unAssignFromDropdown();
985
commonPage.modalUtils().confirmModal();
987
commonPage.sidebar().waitForPageLoad();
989
serviceAccountTab.unhideInheritedRoles();
992
.checkRoles(["create-realm"], false)
994
"default-roles-master",
1002
describe("Mapping tab", () => {
1003
const mappingClient = "mapping-client";
1008
commonPage.sidebar().goToClients();
1009
commonPage.tableToolbarUtils().searchItem(mappingClient);
1010
commonPage.tableUtils().clickRowItemLink(mappingClient);
1014
adminClient.createClient({
1015
protocol: "openid-connect",
1016
clientId: mappingClient,
1017
publicClient: false,
1022
adminClient.deleteClient(mappingClient);
1025
it("Add mapping to openid client", () => {
1027
.goToClientScopesTab()
1028
.clickDedicatedScope(mappingClient);
1029
dedicatedScopesMappersTab.addPredefinedMapper();
1030
clientDetailsPage.modalUtils().table().clickHeaderItem(1, "input");
1031
clientDetailsPage.modalUtils().confirmModal();
1034
.checkNotificationMessage("Mapping successfully created");
1038
describe("Keys tab test", () => {
1039
const keysName = "keys-client";
1042
adminClient.createClient({
1043
protocol: "openid-connect",
1045
publicClient: false,
1052
commonPage.sidebar().goToClients();
1053
commonPage.tableToolbarUtils().searchItem(keysName);
1054
commonPage.tableUtils().clickRowItemLink(keysName);
1058
adminClient.deleteClient(keysName);
1061
it("Generate new keys", () => {
1062
const keysTab = clientDetailsPage.goToKeysTab();
1063
keysTab.clickGenerate();
1064
keysTab.fillGenerateModal("JKS", "keyname", "123", "1234").clickConfirm();
1068
.checkNotificationMessage(
1069
"New key pair and certificate generated successfully",
1074
describe("Realm client", () => {
1075
const clientName = "master-realm";
1080
commonPage.sidebar().goToClients();
1081
commonPage.tableToolbarUtils().searchItem(clientName);
1082
commonPage.tableUtils().clickRowItemLink(clientName);
1085
it("Displays the correct tabs", () => {
1086
clientDetailsPage.goToSettingsTab();
1089
.checkTabExists(ClientsDetailsTab.Settings, true)
1090
.checkTabExists(ClientsDetailsTab.Roles, true)
1091
.checkTabExists(ClientsDetailsTab.Sessions, true)
1092
.checkTabExists(ClientsDetailsTab.Permissions, true)
1093
.checkTabExists(ClientsDetailsTab.Advanced, true)
1094
.checkNumberOfTabsIsEqual(5);
1097
it("Hides the delete action", () => {
1099
.actionToolbarUtils()
1100
.clickActionToggleButton()
1101
.checkActionItemExists("Delete", false);
1105
describe("Bearer only", () => {
1106
const clientId = "bearer-only";
1109
adminClient.createClient({
1111
protocol: "openid-connect",
1112
publicClient: false,
1121
commonPage.sidebar().goToClients();
1122
cy.intercept("/admin/realms/master/clients/*").as("fetchClient");
1123
commonPage.tableToolbarUtils().searchItem(clientId);
1124
commonPage.tableUtils().clickRowItemLink(clientId);
1125
cy.wait("@fetchClient");
1129
adminClient.deleteClient(clientId);
1132
it("Shows an explainer text for bearer only clients", () => {
1134
.actionToolbarUtils()
1135
.bearerOnlyExplainerLabelElement.trigger("mouseenter");
1137
.actionToolbarUtils()
1138
.bearerOnlyExplainerTooltipElement.should("exist");
1141
it("Hides the capability config section", () => {
1142
cy.findByTestId("capability-config-form").should("not.exist");
1143
cy.findByTestId("jump-link-capability-config").should("not.exist");
1147
describe("Accessibility tests for clients", () => {
1148
const clientId = "a11y-client";
1153
commonPage.sidebar().goToClients();
1157
it("Check a11y violations on load/ clients list tab", () => {
1161
it("Check a11y violations on create client page", () => {
1162
commonPage.sidebar().goToClients();
1163
commonPage.tableToolbarUtils().createClient();
1164
createClientPage.fillClientData(clientId);
1167
cy.findByTestId("next").click();
1170
cy.findByTestId("next").click();
1174
it("Check a11y violations on client details page", () => {
1175
const rolesTab = new ClientRolesTab();
1177
commonPage.sidebar().goToClients();
1178
commonPage.tableToolbarUtils().createClient();
1179
createClientPage.fillClientData(clientId).continue().continue().save();
1182
rolesTab.goToRolesTab();
1185
clientDetailsPage.goToClientScopesTab();
1188
clientDetailsPage.goToClientScopesEvaluateTab();
1191
clientDetailsPage.goToClientScopesEvaluateEffectiveRoleScopeMappingsTab();
1194
clientDetailsPage.goToClientScopesEvaluateGeneratedAccessTokenTab();
1197
clientDetailsPage.goToClientScopesEvaluateGeneratedIdTokenTab();
1200
clientDetailsPage.goToClientScopesEvaluateGeneratedUserInfoTab();
1203
clientDetailsPage.goToAdvancedTab();
1207
it("Check a11y violations in delete dialog", () => {
1208
commonPage.tableToolbarUtils().searchItem(clientId, false);
1209
commonPage.tableUtils().selectRowItemAction(clientId, "Delete");
1211
cy.findAllByTestId("confirm").click();
1214
it("Check a11y violations on import client", () => {
1215
cy.findByTestId("importClient").click();
1219
it("Check a11y violations on initial access token", () => {
1220
const initialAccessTokenTab = new InitialAccessTokenTab();
1221
initialAccessTokenTab.goToInitialAccessTokenTab();
1225
it("Check a11y violations on client registration/ anonymous access policies tab", () => {
1226
const clientRegistration = new ClientRegistrationPage();
1227
clientRegistration.goToClientRegistrationTab();
1231
it("Check a11y violations on client registration/ authenticated access policies tab", () => {
1232
const clientRegistration = new ClientRegistrationPage();
1233
clientRegistration.goToClientRegistrationTab();
1234
cy.findByTestId("authenticated").click();