Keycloak

Форк
0
/
client_registration_policies.spec.ts 
144 строки · 4.4 Кб
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";
7

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();
13

14
describe("Client registration policies tab", () => {
15
  beforeEach(() => {
16
    loginPage.logIn();
17
    keycloakBefore();
18
    sidebarPage.goToClients();
19
    clientRegistrationPage.goToClientRegistrationTab();
20
    sidebarPage.waitForPageLoad();
21
  });
22

23
  describe("Anonymous client policies subtab", () => {
24
    it("check anonymous clients list is not empty", () => {
25
      cy.findByTestId("clientRegistration-anonymous")
26
        .find("tr")
27
        .should("have.length.gt", 0);
28
    });
29

30
    it("add anonymous client registration policy", () => {
31
      clientRegistrationPage
32
        .createAnonymousPolicy()
33
        .selectRow("max-clients")
34
        .fillPolicyForm({
35
          name: "newAnonymPolicy1",
36
        })
37
        .formUtils()
38
        .save();
39

40
      masthead.checkNotificationMessage(
41
        "New client policy created successfully",
42
      );
43
      clientRegistrationPage.formUtils().cancel();
44
      listingPage.itemExist("newAnonymPolicy1");
45
    });
46

47
    it("edit anonymous client registration policy", () => {
48
      const policy = "newAnonymPolicy1";
49
      clientRegistrationPage.findAndSelectInAnonymousPoliciesTable(policy);
50
      cy.findByTestId("name").clear();
51
      clientRegistrationPage
52
        .fillPolicyForm({
53
          name: "policy2",
54
        })
55
        .formUtils()
56
        .save();
57

58
      masthead.checkNotificationMessage("Client policy updated successfully");
59
      clientRegistrationPage.formUtils().cancel();
60
      listingPage.itemExist("policy2");
61
    });
62

63
    it("delete anonymous client registration policy", () => {
64
      const policy = "policy2";
65
      listingPage.deleteItem(policy);
66
      cy.findByTestId("confirm").click();
67

68
      masthead.checkNotificationMessage(
69
        "Client registration policy deleted successfully",
70
      );
71
    });
72
  });
73

74
  describe("Authenticated client policies subtab", () => {
75
    beforeEach(() => {
76
      clientRegistrationPage.goToAuthenticatedSubTab();
77
      sidebarPage.waitForPageLoad();
78
    });
79

80
    it("check authenticated clients list is not empty", () => {
81
      cy.findByTestId("clientRegistration-authenticated")
82
        .find("tr")
83
        .should("have.length.gt", 0);
84
    });
85

86
    it("add authenticated client registration policy", () => {
87
      clientRegistrationPage
88
        .createAuthenticatedPolicy()
89
        .selectRow("scope")
90
        .fillPolicyForm({
91
          name: "newAuthPolicy1",
92
        })
93
        .formUtils()
94
        .save();
95

96
      masthead.checkNotificationMessage(
97
        "New client policy created successfully",
98
      );
99
      clientRegistrationPage.formUtils().cancel();
100
      listingPage.itemExist("newAuthPolicy1");
101
    });
102

103
    it("edit authenticated client registration policy", () => {
104
      const policy = "newAuthPolicy1";
105
      clientRegistrationPage.findAndSelectInAuthenticatedPoliciesTable(policy);
106
      cy.findByTestId("name").clear();
107
      clientRegistrationPage
108
        .fillPolicyForm({
109
          name: "policy3",
110
        })
111
        .formUtils()
112
        .save();
113

114
      masthead.checkNotificationMessage("Client policy updated successfully");
115
      clientRegistrationPage.formUtils().cancel();
116
      listingPage.itemExist("policy3");
117
    });
118

119
    it("delete authenticated client registration policy", () => {
120
      const policy = "policy3";
121
      listingPage.deleteItem(policy);
122
      cy.findByTestId("confirm").click();
123

124
      masthead.checkNotificationMessage(
125
        "Client registration policy deleted successfully",
126
      );
127
    });
128
  });
129
});
130

131
describe("Accessibility tests for client registration policies", () => {
132
  beforeEach(() => {
133
    loginPage.logIn();
134
    keycloakBefore();
135
    sidebarPage.goToClients();
136
    clientRegistrationPage.goToClientRegistrationTab();
137
    sidebarPage.waitForPageLoad();
138
    cy.injectAxe();
139
  });
140

141
  it("Check a11y violations on load/ client registration policies", () => {
142
    cy.checkA11y();
143
  });
144
});
145

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.