events: fixed dropdown selector in events tests (#1066)

Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com>
This commit is contained in:
agagancarczyk 2021-08-25 16:20:49 +01:00 committed by GitHub
parent 09f4279372
commit d71b3a10bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,6 @@
export default class EventsPage { export default class EventsPage {
searchEventDrpDwn = ".pf-c-dropdown__toggle"; searchEventDrpDwn = ".pf-c-dropdown__toggle";
searchEventDrpDwnBtn = searchEventDrpDwnBtn = "userEventsSearchSelectorToggle";
".keycloak__user_events_search_selector_dropdown__toggle";
searchForm = ".pf-c-dropdown__menu"; searchForm = ".pf-c-dropdown__menu";
userIdInputFld = "userId-searchField"; userIdInputFld = "userId-searchField";
eventTypeDrpDwnFld = "event-type-searchField"; eventTypeDrpDwnFld = "event-type-searchField";
@ -20,7 +19,7 @@ export default class EventsPage {
} }
shouldHaveFormFields() { shouldHaveFormFields() {
cy.get(this.searchEventDrpDwnBtn).click(); cy.getId(this.searchEventDrpDwnBtn).click();
cy.get(this.searchForm).contains("User ID"); cy.get(this.searchForm).contains("User ID");
cy.get(this.searchForm).contains("Event type"); cy.get(this.searchForm).contains("Event type");
cy.get(this.searchForm).contains("Client"); cy.get(this.searchForm).contains("Client");
@ -30,23 +29,23 @@ export default class EventsPage {
} }
shouldHaveEventTypeOptions() { shouldHaveEventTypeOptions() {
cy.get(this.searchEventDrpDwnBtn).click(); cy.getId(this.searchEventDrpDwnBtn).click();
cy.get(this.eventTypeList).should("exist"); cy.get(this.eventTypeList).should("exist");
} }
shouldHaveSearchBtnDisabled() { shouldHaveSearchBtnDisabled() {
cy.get(this.searchEventDrpDwnBtn).click(); cy.getId(this.searchEventDrpDwnBtn).click();
cy.getId(this.searchEventsBtn).should("have.attr", "disabled"); cy.getId(this.searchEventsBtn).should("have.attr", "disabled");
} }
shouldHaveSearchBtnEnabled() { shouldHaveSearchBtnEnabled() {
cy.get(this.searchEventDrpDwnBtn).click(); cy.getId(this.searchEventDrpDwnBtn).click();
cy.getId(this.userIdInputFld).type("11111"); cy.getId(this.userIdInputFld).type("11111");
cy.getId(this.searchEventsBtn).should("not.have.attr", "disabled"); cy.getId(this.searchEventsBtn).should("not.have.attr", "disabled");
} }
shouldDoSearchAndRemoveChips() { shouldDoSearchAndRemoveChips() {
cy.get(this.searchEventDrpDwnBtn).click(); cy.getId(this.searchEventDrpDwnBtn).click();
cy.get(this.eventTypeInputFld).type("LOGIN"); cy.get(this.eventTypeInputFld).type("LOGIN");
cy.get(this.eventTypeOption).contains("LOGIN").click(); cy.get(this.eventTypeOption).contains("LOGIN").click();
@ -62,7 +61,7 @@ export default class EventsPage {
cy.get("[id^=remove_pf]").click(); cy.get("[id^=remove_pf]").click();
cy.get(this.searchEventDrpDwnBtn).click(); cy.getId(this.searchEventDrpDwnBtn).click();
cy.getId(this.userIdInputFld).type("11111"); cy.getId(this.userIdInputFld).type("11111");
cy.getId(this.searchEventsBtn).click(); cy.getId(this.searchEventsBtn).click();
cy.get(this.eventsPageTitle).contains("No events logged"); cy.get(this.eventsPageTitle).contains("No events logged");
@ -71,7 +70,7 @@ export default class EventsPage {
} }
shouldDoNoResultsSearch() { shouldDoNoResultsSearch() {
cy.get(this.searchEventDrpDwnBtn).click(); cy.getId(this.searchEventDrpDwnBtn).click();
cy.getId(this.userIdInputFld).type("test"); cy.getId(this.userIdInputFld).type("test");
cy.getId(this.searchEventsBtn).click(); cy.getId(this.searchEventsBtn).click();
cy.get(this.eventsPageTitle).contains("No events logged"); cy.get(this.eventsPageTitle).contains("No events logged");