1
import LoginPage from "../support/pages/LoginPage";
2
import Masthead from "../support/pages/admin-ui/Masthead";
3
import ListingPage from "../support/pages/admin-ui/ListingPage";
4
import SidebarPage from "../support/pages/admin-ui/SidebarPage";
5
import ModalUtils from "../support/util/ModalUtils";
6
import adminClient from "../support/util/AdminClient";
7
import { keycloakBefore } from "../support/util/keycloak_hooks";
8
import SettingsTab from "../support/pages/admin-ui/manage/clients/client_details/tabs/SettingsTab";
10
const loginPage = new LoginPage();
11
const masthead = new Masthead();
12
const sidebarPage = new SidebarPage();
13
const listingPage = new ListingPage();
14
const modalUtils = new ModalUtils();
16
describe("Clients SAML tests", () => {
17
describe("SAML test", () => {
18
const samlClientName = "saml";
21
adminClient.createClient({
23
clientId: samlClientName,
29
adminClient.deleteClient(samlClientName);
35
sidebarPage.goToClients();
36
listingPage.searchItem(samlClientName).goToItemDetails(samlClientName);
39
it("should display the saml sections on details screen", () => {
40
cy.get(".pf-c-jump-links__list").should(($ul) => {
42
.to.contain("SAML capabilities")
43
.to.contain("Signature and Encryption");
47
it("should save force name id format", () => {
48
cy.get(".pf-c-jump-links__list").contains("SAML capabilities").click();
50
cy.findByTestId("forceNameIdFormat").click({
53
cy.findByTestId("settings-save").click();
54
masthead.checkNotificationMessage("Client successfully updated");
58
describe("SAML keys tab", () => {
59
const clientId = "saml-keys";
62
adminClient.createClient({
69
adminClient.deleteClient(clientId);
75
sidebarPage.goToClients();
76
listingPage.searchItem(clientId).goToItemDetails(clientId);
77
cy.findByTestId("keysTab").click();
80
it("should doesn't disable signature when cancel", () => {
81
cy.findByTestId("clientSignature").click({ force: true });
84
.checkModalTitle('Disable "Client signature required"')
87
cy.findAllByTestId("certificate").should("have.length", 1);
90
it("should disable client signature", () => {
92
"admin/realms/master/clients/*/certificates/saml.signing",
94
cy.findByTestId("clientSignature").click({ force: true });
97
.checkModalTitle('Disable "Client signature required"')
100
masthead.checkNotificationMessage("Client successfully updated");
101
cy.findAllByTestId("certificate").should("have.length", 0);
104
it("should enable Encryption keys config", () => {
105
cy.findByTestId("encryptAssertions").click({ force: true });
107
cy.findByTestId("generate").click();
108
masthead.checkNotificationMessage(
109
"New key pair and certificate generated successfully",
112
modalUtils.confirmModal();
113
cy.findAllByTestId("certificate").should("have.length", 1);
117
describe("SAML settings tab", () => {
118
const clientId = "saml-settings";
119
const settingsTab = new SettingsTab();
122
adminClient.createClient({
129
adminClient.deleteClient(clientId);
135
sidebarPage.goToClients();
136
listingPage.searchItem(clientId).goToItemDetails(clientId);
139
it("should check SAML capabilities", () => {
140
cy.get(".pf-c-jump-links__list").contains("SAML capabilities").click();
142
settingsTab.assertNameIdFormatDropdown();
143
settingsTab.assertSAMLCapabilitiesSwitches();
146
it("should check signature and encryption", () => {
147
cy.get(".pf-c-jump-links__list")
148
.contains("Signature and Encryption")
151
settingsTab.assertSignatureAlgorithmDropdown();
152
settingsTab.assertSignatureKeyNameDropdown();
153
settingsTab.assertCanonicalizationDropdown();
155
settingsTab.assertSignatureEncryptionSwitches();
158
it("should check access settings", () => {
159
cy.get(".pf-c-jump-links__list").contains("Access settings").click();
162
"http://localhost:8180/realms/master/protocol/" +
166
"Client could not be updated: Root URL is not a valid URL";
168
"Client could not be updated: Base URL is not a valid URL";
170
cy.get("#kc-root-url").type("Invalid URL");
171
settingsTab.clickSaveBtn();
172
masthead.checkNotificationMessage(rootUrlError);
173
cy.get("#kc-root-url").clear();
175
cy.get("#kc-home-url").type("Invalid URL");
176
settingsTab.clickSaveBtn();
177
masthead.checkNotificationMessage(homeUrlError);
178
cy.get("#kc-home-url").clear();
180
cy.get("#kc-root-url").type(validUrl);
181
cy.get("#kc-home-url").type(validUrl);
182
settingsTab.clickSaveBtn();
183
masthead.checkNotificationMessage("Client successfully updated");
185
settingsTab.assertAccessSettings();
188
it("should check login settings", () => {
189
cy.get(".pf-c-jump-links__list").contains("Login settings").click();
191
settingsTab.assertLoginThemeDropdown();
192
settingsTab.assertLoginSettings();