keycloak-scim/cypress/integration/events_test.spec.ts
agagancarczyk 6d4b11aab2
Admin events auth dialog (#1131)
* admin-events-list: updated keys for Auth modal

* admin-events-list:added cypress test for auth dialog

* admin-events-list:added cypress test for representation dialog

* admin-events-list: fixed keys def

* admin-events-list: fixed keys def

Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com>
2021-09-07 12:38:36 +01:00

119 lines
3.7 KiB
TypeScript

import LoginPage from "../support/pages/LoginPage";
import SidebarPage from "../support/pages/admin_console/SidebarPage";
import UserEventsTab from "../support/pages/admin_console/manage/events/UserEventsTab";
import AdminEventsTab from "../support/pages/admin_console/manage/events/AdminEventsTab";
import RealmSettingsPage from "../support/pages/admin_console/manage/realm_settings/RealmSettingsPage";
import Masthead from "../support/pages/admin_console/Masthead";
import { keycloakBefore } from "../support/util/keycloak_before";
const loginPage = new LoginPage();
const sidebarPage = new SidebarPage();
const userEventsTab = new UserEventsTab();
const adminEventsTab = new AdminEventsTab();
const realmSettingsPage = new RealmSettingsPage();
const masthead = new Masthead();
describe("Events tests", function () {
describe("Search user events", function () {
beforeEach(function () {
keycloakBefore();
loginPage.logIn();
sidebarPage.goToEvents();
});
it("Check search dropdown display", () => {
userEventsTab.shouldDisplay();
});
it("Check user events search form fields display", () => {
userEventsTab.shouldHaveFormFields();
});
it("Check event type dropdown options exist", () => {
userEventsTab.shouldHaveEventTypeOptions();
});
it("Check `search events` button disabled by default", () => {
userEventsTab.shouldHaveSearchBtnDisabled();
});
it("Check user events search and removal work", () => {
sidebarPage.goToRealmSettings();
cy.getId("rs-realm-events-tab").click();
realmSettingsPage
.toggleSwitch(realmSettingsPage.enableEvents)
.save(realmSettingsPage.eventsUserSave);
masthead.signOut();
loginPage.logIn();
sidebarPage.goToEvents();
userEventsTab.shouldDoSearchAndRemoveChips();
});
it("Check for no events logged", () => {
userEventsTab.shouldDoNoResultsSearch();
});
it("Check `search events` button enabled", () => {
userEventsTab.shouldHaveSearchBtnEnabled();
});
});
describe("Search admin events", function () {
beforeEach(function () {
keycloakBefore();
loginPage.logIn();
sidebarPage.goToEvents();
cy.getId("admin-events-tab").click();
});
it("Check admin events search form fields display", () => {
adminEventsTab.shouldHaveFormFields();
});
it("Check `search admin events` button disabled by default", () => {
adminEventsTab.shouldHaveSearchBtnDisabled();
});
it("Check admin events search and removal work", () => {
sidebarPage.goToRealmSettings();
cy.getId("rs-realm-events-tab").click();
cy.getId("rs-admin-events-tab").click();
realmSettingsPage
.toggleSwitch(realmSettingsPage.enableAdminEvents)
.save(realmSettingsPage.eventsAdminSave);
sidebarPage.goToEvents();
cy.getId("admin-events-tab").click();
adminEventsTab.shouldDoAdminEventsSearchAndRemoveChips();
});
it("Check for no events logged", () => {
adminEventsTab.shouldDoNoResultsSearch();
});
it("Check `search admin events` button enabled", () => {
adminEventsTab.shouldHaveSearchBtnEnabled();
});
});
describe("Check more button opens auth and representation dialogs", function () {
beforeEach(function () {
keycloakBefore();
loginPage.logIn();
sidebarPage.goToEvents();
cy.getId("admin-events-tab").click();
});
it("Check auth dialog opens and is not empty", () => {
adminEventsTab.shouldCheckAuthDialogOpensAndIsNotEmpty();
});
it("Check representation dialog opens and is not empty", () => {
adminEventsTab.shouldCheckRepDialogOpensAndIsNotEmpty();
});
});
});