2023-02-03 11:56:20 +00:00
|
|
|
import ListingPage from "../support/pages/admin-ui/ListingPage";
|
|
|
|
import { ClientRegistrationPage } from "../support/pages/admin-ui/manage/clients/ClientRegistrationPage";
|
|
|
|
import Masthead from "../support/pages/admin-ui/Masthead";
|
|
|
|
import SidebarPage from "../support/pages/admin-ui/SidebarPage";
|
|
|
|
import LoginPage from "../support/pages/LoginPage";
|
|
|
|
import { keycloakBefore } from "../support/util/keycloak_hooks";
|
|
|
|
|
2023-12-07 11:17:51 +00:00
|
|
|
const loginPage = new LoginPage();
|
|
|
|
const listingPage = new ListingPage();
|
|
|
|
const masthead = new Masthead();
|
|
|
|
const sidebarPage = new SidebarPage();
|
|
|
|
const clientRegistrationPage = new ClientRegistrationPage();
|
2023-02-03 11:56:20 +00:00
|
|
|
|
2023-12-07 11:17:51 +00:00
|
|
|
describe("Client registration policies tab", () => {
|
2023-02-10 10:10:35 +00:00
|
|
|
beforeEach(() => {
|
2023-02-03 11:56:20 +00:00
|
|
|
loginPage.logIn();
|
2023-02-10 10:10:35 +00:00
|
|
|
keycloakBefore();
|
2023-02-03 11:56:20 +00:00
|
|
|
sidebarPage.goToClients();
|
|
|
|
clientRegistrationPage.goToClientRegistrationTab();
|
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
});
|
|
|
|
|
2023-12-07 11:17:51 +00:00
|
|
|
describe("Anonymous client policies subtab", () => {
|
|
|
|
it("check anonymous clients list is not empty", () => {
|
|
|
|
cy.findByTestId("clientRegistration-anonymous")
|
|
|
|
.find("tr")
|
|
|
|
.should("have.length.gt", 0);
|
|
|
|
});
|
2023-02-03 11:56:20 +00:00
|
|
|
|
2023-12-07 11:17:51 +00:00
|
|
|
it("add anonymous client registration policy", () => {
|
|
|
|
clientRegistrationPage
|
2023-12-12 10:42:39 +00:00
|
|
|
.createAnonymousPolicy()
|
2023-12-07 11:17:51 +00:00
|
|
|
.selectRow("max-clients")
|
|
|
|
.fillPolicyForm({
|
2023-12-12 10:42:39 +00:00
|
|
|
name: "newAnonymPolicy1",
|
2023-12-07 11:17:51 +00:00
|
|
|
})
|
|
|
|
.formUtils()
|
|
|
|
.save();
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage(
|
|
|
|
"New client policy created successfully",
|
|
|
|
);
|
|
|
|
clientRegistrationPage.formUtils().cancel();
|
2023-12-12 10:42:39 +00:00
|
|
|
listingPage.itemExist("newAnonymPolicy1");
|
2023-12-07 11:17:51 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("edit anonymous client registration policy", () => {
|
2023-12-12 10:42:39 +00:00
|
|
|
const policy = "newAnonymPolicy1";
|
|
|
|
clientRegistrationPage.findAndSelectInAnonymousPoliciesTable(policy);
|
2023-12-07 11:17:51 +00:00
|
|
|
cy.findByTestId("name").clear();
|
|
|
|
clientRegistrationPage
|
|
|
|
.fillPolicyForm({
|
2023-12-12 10:42:39 +00:00
|
|
|
name: "policy2",
|
2023-12-07 11:17:51 +00:00
|
|
|
})
|
|
|
|
.formUtils()
|
|
|
|
.save();
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage("Client policy updated successfully");
|
|
|
|
clientRegistrationPage.formUtils().cancel();
|
2023-12-12 10:42:39 +00:00
|
|
|
listingPage.itemExist("policy2");
|
2023-12-07 11:17:51 +00:00
|
|
|
});
|
2023-02-03 11:56:20 +00:00
|
|
|
|
2023-12-07 11:17:51 +00:00
|
|
|
it("delete anonymous client registration policy", () => {
|
2023-12-12 10:42:39 +00:00
|
|
|
const policy = "policy2";
|
|
|
|
listingPage.deleteItem(policy);
|
|
|
|
cy.findByTestId("confirm").click();
|
2023-02-03 11:56:20 +00:00
|
|
|
|
2023-12-07 11:17:51 +00:00
|
|
|
masthead.checkNotificationMessage(
|
|
|
|
"Client registration policy deleted successfully",
|
|
|
|
);
|
|
|
|
});
|
2023-02-03 11:56:20 +00:00
|
|
|
});
|
2023-03-22 16:14:53 +00:00
|
|
|
|
2023-12-07 11:17:51 +00:00
|
|
|
describe("Authenticated client policies subtab", () => {
|
2023-03-22 16:14:53 +00:00
|
|
|
beforeEach(() => {
|
2023-12-07 11:17:51 +00:00
|
|
|
clientRegistrationPage.goToAuthenticatedSubTab();
|
2023-03-22 16:14:53 +00:00
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
});
|
|
|
|
|
2023-12-07 11:17:51 +00:00
|
|
|
it("check authenticated clients list is not empty", () => {
|
|
|
|
cy.findByTestId("clientRegistration-authenticated")
|
|
|
|
.find("tr")
|
|
|
|
.should("have.length.gt", 0);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("add authenticated client registration policy", () => {
|
|
|
|
clientRegistrationPage
|
2023-12-12 10:42:39 +00:00
|
|
|
.createAuthenticatedPolicy()
|
2023-12-07 11:17:51 +00:00
|
|
|
.selectRow("scope")
|
|
|
|
.fillPolicyForm({
|
2023-12-12 10:42:39 +00:00
|
|
|
name: "newAuthPolicy1",
|
2023-12-07 11:17:51 +00:00
|
|
|
})
|
|
|
|
.formUtils()
|
|
|
|
.save();
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage(
|
|
|
|
"New client policy created successfully",
|
|
|
|
);
|
|
|
|
clientRegistrationPage.formUtils().cancel();
|
2023-12-12 10:42:39 +00:00
|
|
|
listingPage.itemExist("newAuthPolicy1");
|
2023-12-07 11:17:51 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("edit authenticated client registration policy", () => {
|
2023-12-12 10:42:39 +00:00
|
|
|
const policy = "newAuthPolicy1";
|
|
|
|
clientRegistrationPage.findAndSelectInAuthenticatedPoliciesTable(policy);
|
2023-12-07 11:17:51 +00:00
|
|
|
cy.findByTestId("name").clear();
|
|
|
|
clientRegistrationPage
|
|
|
|
.fillPolicyForm({
|
2023-12-12 10:42:39 +00:00
|
|
|
name: "policy3",
|
2023-12-07 11:17:51 +00:00
|
|
|
})
|
|
|
|
.formUtils()
|
|
|
|
.save();
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage("Client policy updated successfully");
|
|
|
|
clientRegistrationPage.formUtils().cancel();
|
2023-12-12 10:42:39 +00:00
|
|
|
listingPage.itemExist("policy3");
|
2023-03-22 16:14:53 +00:00
|
|
|
});
|
2023-12-07 11:17:51 +00:00
|
|
|
|
|
|
|
it("delete authenticated client registration policy", () => {
|
2023-12-12 10:42:39 +00:00
|
|
|
const policy = "policy3";
|
|
|
|
listingPage.deleteItem(policy);
|
|
|
|
cy.findByTestId("confirm").click();
|
2023-12-07 11:17:51 +00:00
|
|
|
|
|
|
|
masthead.checkNotificationMessage(
|
|
|
|
"Client registration policy deleted successfully",
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("Accessibility tests for client registration policies", () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
loginPage.logIn();
|
|
|
|
keycloakBefore();
|
|
|
|
sidebarPage.goToClients();
|
|
|
|
clientRegistrationPage.goToClientRegistrationTab();
|
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
cy.injectAxe();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Check a11y violations on load/ client registration policies", () => {
|
|
|
|
cy.checkA11y();
|
2023-03-22 16:14:53 +00:00
|
|
|
});
|
2023-02-03 11:56:20 +00:00
|
|
|
});
|