Skip to content

Commit

Permalink
Wait for request when testing session revocation (keycloak#24048)
Browse files Browse the repository at this point in the history
Signed-off-by: Jon Koops <jonkoops@gmail.com>
  • Loading branch information
jonkoops committed Nov 28, 2023
1 parent 002f1a7 commit ad3a45d
Showing 1 changed file with 22 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,54 +1,41 @@
export default class SessionsPage {
sessionTypeList = ".pf-c-select__toggle + ul";
allSessionTypesOption = "all-sessions-option";
regularSSOOption = "regular-sso-option";
offlineOption = "offline-option";
directGrantOption = "direct-grant-option";
serviceAccountOption = "service-account-option";
selectedType = ".pf-c-select__toggle-text";
revocationActionItem = "revocation";
setToNowButton = "set-to-now-button";
actionDropdown = "action-dropdown";
clearNotBeforeButton = "clear-not-before-button";
pushButton = "modal-test-connection-button";
notBeforeInput = "not-before-input";
logoutAll = "logout-all";
logoutAllConfirm = "confirm";
#revocationActionItem = "revocation";
#setToNowButton = "set-to-now-button";
#actionDropdown = "action-dropdown";
#clearNotBeforeButton = "clear-not-before-button";
#pushButton = "modal-test-connection-button";
#notBeforeInput = "not-before-input";

setToNow() {
cy.findByTestId(this.actionDropdown).should("exist").click();
cy.findByTestId(this.revocationActionItem).should("exist").click();
cy.findByTestId(this.setToNowButton).should("exist").click();
this.#openRevocationDialog();
cy.findByTestId(this.#setToNowButton).click();
Cypress.session.clearAllSavedSessions();
}

checkNotBeforeValueExists() {
cy.findByTestId(this.actionDropdown).should("exist").click();
cy.findByTestId(this.revocationActionItem).should("exist").click();
cy.findByTestId(this.notBeforeInput).should("not.have.value", "None");
this.#openRevocationDialog();
cy.findByTestId(this.#notBeforeInput).should("not.have.value", "None");
}

clearNotBefore() {
cy.findByTestId(this.actionDropdown).should("exist").click();
cy.findByTestId(this.revocationActionItem).should("exist").click();
cy.findByTestId(this.clearNotBeforeButton).should("exist").click();
this.#openRevocationDialog();
cy.findByTestId(this.#clearNotBeforeButton).click();
}

checkNotBeforeCleared() {
cy.findByTestId(this.actionDropdown).should("exist").click();
cy.findByTestId(this.revocationActionItem).should("exist").click();
cy.findByTestId(this.notBeforeInput).should("have.value", "None");
this.#openRevocationDialog();
cy.findByTestId(this.#notBeforeInput).should("have.value", "None");
}

logoutAllSessions() {
cy.findByTestId(this.actionDropdown).should("exist").click();
cy.findByTestId(this.logoutAll).should("exist").click();
cy.findByTestId(this.logoutAllConfirm).should("exist").click();
pushRevocation() {
this.#openRevocationDialog();
cy.findByTestId(this.#pushButton).click();
}

pushRevocation() {
cy.findByTestId(this.actionDropdown).should("exist").click();
cy.findByTestId(this.revocationActionItem).should("exist").click();
cy.findByTestId(this.pushButton).should("exist").click();
#openRevocationDialog() {
cy.findByTestId(this.#actionDropdown).click();
cy.intercept("/admin/realms/master").as("fetchRealm");
cy.findByTestId(this.#revocationActionItem).click();
cy.wait("@fetchRealm");
}
}

0 comments on commit ad3a45d

Please sign in to comment.