1
import ListingPage from "../support/pages/admin-ui/ListingPage";
2
import { ClientRegistrationPage } from "../support/pages/admin-ui/manage/clients/ClientRegistrationPage";
3
import Masthead from "../support/pages/admin-ui/Masthead";
4
import SidebarPage from "../support/pages/admin-ui/SidebarPage";
5
import LoginPage from "../support/pages/LoginPage";
6
import { keycloakBefore } from "../support/util/keycloak_hooks";
8
const loginPage = new LoginPage();
9
const listingPage = new ListingPage();
10
const masthead = new Masthead();
11
const sidebarPage = new SidebarPage();
12
const clientRegistrationPage = new ClientRegistrationPage();
14
describe("Client registration policies tab", () => {
18
sidebarPage.goToClients();
19
clientRegistrationPage.goToClientRegistrationTab();
20
sidebarPage.waitForPageLoad();
23
describe("Anonymous client policies subtab", () => {
24
it("check anonymous clients list is not empty", () => {
25
cy.findByTestId("clientRegistration-anonymous")
27
.should("have.length.gt", 0);
30
it("add anonymous client registration policy", () => {
31
clientRegistrationPage
32
.createAnonymousPolicy()
33
.selectRow("max-clients")
35
name: "newAnonymPolicy1",
40
masthead.checkNotificationMessage(
41
"New client policy created successfully",
43
clientRegistrationPage.formUtils().cancel();
44
listingPage.itemExist("newAnonymPolicy1");
47
it("edit anonymous client registration policy", () => {
48
const policy = "newAnonymPolicy1";
49
clientRegistrationPage.findAndSelectInAnonymousPoliciesTable(policy);
50
cy.findByTestId("name").clear();
51
clientRegistrationPage
58
masthead.checkNotificationMessage("Client policy updated successfully");
59
clientRegistrationPage.formUtils().cancel();
60
listingPage.itemExist("policy2");
63
it("delete anonymous client registration policy", () => {
64
const policy = "policy2";
65
listingPage.deleteItem(policy);
66
cy.findByTestId("confirm").click();
68
masthead.checkNotificationMessage(
69
"Client registration policy deleted successfully",
74
describe("Authenticated client policies subtab", () => {
76
clientRegistrationPage.goToAuthenticatedSubTab();
77
sidebarPage.waitForPageLoad();
80
it("check authenticated clients list is not empty", () => {
81
cy.findByTestId("clientRegistration-authenticated")
83
.should("have.length.gt", 0);
86
it("add authenticated client registration policy", () => {
87
clientRegistrationPage
88
.createAuthenticatedPolicy()
91
name: "newAuthPolicy1",
96
masthead.checkNotificationMessage(
97
"New client policy created successfully",
99
clientRegistrationPage.formUtils().cancel();
100
listingPage.itemExist("newAuthPolicy1");
103
it("edit authenticated client registration policy", () => {
104
const policy = "newAuthPolicy1";
105
clientRegistrationPage.findAndSelectInAuthenticatedPoliciesTable(policy);
106
cy.findByTestId("name").clear();
107
clientRegistrationPage
114
masthead.checkNotificationMessage("Client policy updated successfully");
115
clientRegistrationPage.formUtils().cancel();
116
listingPage.itemExist("policy3");
119
it("delete authenticated client registration policy", () => {
120
const policy = "policy3";
121
listingPage.deleteItem(policy);
122
cy.findByTestId("confirm").click();
124
masthead.checkNotificationMessage(
125
"Client registration policy deleted successfully",
131
describe("Accessibility tests for client registration policies", () => {
135
sidebarPage.goToClients();
136
clientRegistrationPage.goToClientRegistrationTab();
137
sidebarPage.waitForPageLoad();
141
it("Check a11y violations on load/ client registration policies", () => {