2021-09-03 10:50:45 +00:00
|
|
|
export default class UserEventsTab {
|
2021-08-20 09:13:47 +00:00
|
|
|
searchEventDrpDwn = ".pf-c-dropdown__toggle";
|
2021-08-25 15:20:49 +00:00
|
|
|
searchEventDrpDwnBtn = "userEventsSearchSelectorToggle";
|
2021-08-20 09:13:47 +00:00
|
|
|
searchForm = ".pf-c-dropdown__menu";
|
|
|
|
userIdInputFld = "userId-searchField";
|
|
|
|
eventTypeDrpDwnFld = "event-type-searchField";
|
|
|
|
clientInputFld = "client-searchField";
|
|
|
|
dateFromInputFld = "dateFrom-searchField";
|
|
|
|
dateToInputFld = "dateTo-searchField";
|
|
|
|
searchEventsBtn = "search-events-btn";
|
|
|
|
eventTypeList = ".pf-c-form-control";
|
|
|
|
eventTypeOption = ".pf-c-select__menu-item";
|
|
|
|
eventTypeInputFld = ".pf-c-form-control.pf-c-select__toggle-typeahead";
|
|
|
|
eventTypeBtn = ".pf-c-button.pf-c-select__toggle-button.pf-m-plain";
|
2021-09-03 10:50:45 +00:00
|
|
|
userEventsTabTitle = ".pf-c-title";
|
2021-08-20 09:13:47 +00:00
|
|
|
|
|
|
|
shouldDisplay() {
|
|
|
|
cy.get(this.searchEventDrpDwn).should("exist");
|
|
|
|
}
|
|
|
|
|
|
|
|
shouldHaveFormFields() {
|
2021-09-17 13:23:34 +00:00
|
|
|
cy.findByTestId(this.searchEventDrpDwnBtn).click();
|
2021-08-20 09:13:47 +00:00
|
|
|
cy.get(this.searchForm).contains("User ID");
|
|
|
|
cy.get(this.searchForm).contains("Event type");
|
|
|
|
cy.get(this.searchForm).contains("Client");
|
|
|
|
cy.get(this.searchForm).contains("Date(from)");
|
|
|
|
cy.get(this.searchForm).contains("Date(to)");
|
|
|
|
cy.get(this.searchForm).contains("Search events");
|
|
|
|
}
|
|
|
|
|
|
|
|
shouldHaveEventTypeOptions() {
|
2021-09-17 13:23:34 +00:00
|
|
|
cy.findByTestId(this.searchEventDrpDwnBtn).click();
|
2021-08-20 09:13:47 +00:00
|
|
|
cy.get(this.eventTypeList).should("exist");
|
|
|
|
}
|
|
|
|
|
|
|
|
shouldHaveSearchBtnDisabled() {
|
2021-09-17 13:23:34 +00:00
|
|
|
cy.findByTestId(this.searchEventDrpDwnBtn).click();
|
|
|
|
cy.findByTestId(this.searchEventsBtn).should("have.attr", "disabled");
|
2021-08-20 09:13:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
shouldDoSearchAndRemoveChips() {
|
2021-09-17 13:23:34 +00:00
|
|
|
cy.findByTestId(this.searchEventDrpDwnBtn).click();
|
2021-08-20 09:13:47 +00:00
|
|
|
cy.get(this.eventTypeInputFld).type("LOGIN");
|
|
|
|
cy.get(this.eventTypeOption).contains("LOGIN").click();
|
|
|
|
|
|
|
|
cy.intercept("/auth/admin/realms/master/events*").as("eventsFetch");
|
2021-09-17 13:23:34 +00:00
|
|
|
cy.findByTestId(this.searchEventsBtn).click();
|
2021-08-20 09:13:47 +00:00
|
|
|
cy.wait("@eventsFetch");
|
|
|
|
|
|
|
|
cy.get("table").contains("td", "LOGIN");
|
|
|
|
cy.get("table").should("not.have.text", "CODE_TO_TOKEN");
|
|
|
|
cy.get("table").should("not.have.text", "CODE_TO_TOKEN_ERROR");
|
|
|
|
cy.get("table").should("not.have.text", "LOGIN_ERROR");
|
|
|
|
cy.get("table").should("not.have.text", "LOGOUT");
|
|
|
|
|
2021-09-03 10:50:45 +00:00
|
|
|
cy.get("[id^=remove_group]").click();
|
|
|
|
cy.wait("@eventsFetch");
|
|
|
|
cy.get("table").should("be.visible").contains("td", "LOGIN");
|
|
|
|
}
|
2021-08-20 09:13:47 +00:00
|
|
|
|
2021-09-03 10:50:45 +00:00
|
|
|
shouldHaveSearchBtnEnabled() {
|
2021-09-17 13:23:34 +00:00
|
|
|
cy.findByTestId(this.searchEventDrpDwnBtn).click();
|
|
|
|
cy.findByTestId(this.userIdInputFld).type("11111");
|
|
|
|
cy.findByTestId(this.searchEventsBtn).should("not.have.attr", "disabled");
|
2021-08-20 09:13:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
shouldDoNoResultsSearch() {
|
2021-09-17 13:23:34 +00:00
|
|
|
cy.findByTestId(this.searchEventDrpDwnBtn).click();
|
|
|
|
cy.findByTestId(this.userIdInputFld).type("test");
|
|
|
|
cy.findByTestId(this.searchEventsBtn).click();
|
2021-09-03 10:50:45 +00:00
|
|
|
cy.get(this.userEventsTabTitle).contains("No events logged");
|
2021-08-20 09:13:47 +00:00
|
|
|
}
|
|
|
|
}
|