Wait for request when testing session revocation (#24048)

This commit is contained in:
Jon Koops 2023-10-17 11:43:41 +02:00 committed by GitHub
parent fab5622582
commit 0844b57f64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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");
}
logoutAllSessions() {
cy.findByTestId(this.actionDropdown).should("exist").click();
cy.findByTestId(this.logoutAll).should("exist").click();
cy.findByTestId(this.logoutAllConfirm).should("exist").click();
this.#openRevocationDialog();
cy.findByTestId(this.#notBeforeInput).should("have.value", "None");
}
pushRevocation() {
cy.findByTestId(this.actionDropdown).should("exist").click();
cy.findByTestId(this.revocationActionItem).should("exist").click();
cy.findByTestId(this.pushButton).should("exist").click();
this.#openRevocationDialog();
cy.findByTestId(this.#pushButton).click();
}
#openRevocationDialog() {
cy.findByTestId(this.#actionDropdown).click();
cy.intercept("/admin/realms/master").as("fetchRealm");
cy.findByTestId(this.#revocationActionItem).click();
cy.wait("@fetchRealm");
}
}