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 { export default class SessionsPage {
sessionTypeList = ".pf-c-select__toggle + ul"; #revocationActionItem = "revocation";
allSessionTypesOption = "all-sessions-option"; #setToNowButton = "set-to-now-button";
regularSSOOption = "regular-sso-option"; #actionDropdown = "action-dropdown";
offlineOption = "offline-option"; #clearNotBeforeButton = "clear-not-before-button";
directGrantOption = "direct-grant-option"; #pushButton = "modal-test-connection-button";
serviceAccountOption = "service-account-option"; #notBeforeInput = "not-before-input";
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";
setToNow() { setToNow() {
cy.findByTestId(this.actionDropdown).should("exist").click(); this.#openRevocationDialog();
cy.findByTestId(this.revocationActionItem).should("exist").click(); cy.findByTestId(this.#setToNowButton).click();
cy.findByTestId(this.setToNowButton).should("exist").click();
Cypress.session.clearAllSavedSessions(); Cypress.session.clearAllSavedSessions();
} }
checkNotBeforeValueExists() { checkNotBeforeValueExists() {
cy.findByTestId(this.actionDropdown).should("exist").click(); this.#openRevocationDialog();
cy.findByTestId(this.revocationActionItem).should("exist").click(); cy.findByTestId(this.#notBeforeInput).should("not.have.value", "None");
cy.findByTestId(this.notBeforeInput).should("not.have.value", "None");
} }
clearNotBefore() { clearNotBefore() {
cy.findByTestId(this.actionDropdown).should("exist").click(); this.#openRevocationDialog();
cy.findByTestId(this.revocationActionItem).should("exist").click(); cy.findByTestId(this.#clearNotBeforeButton).click();
cy.findByTestId(this.clearNotBeforeButton).should("exist").click();
} }
checkNotBeforeCleared() { checkNotBeforeCleared() {
cy.findByTestId(this.actionDropdown).should("exist").click(); this.#openRevocationDialog();
cy.findByTestId(this.revocationActionItem).should("exist").click(); cy.findByTestId(this.#notBeforeInput).should("have.value", "None");
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() { pushRevocation() {
cy.findByTestId(this.actionDropdown).should("exist").click(); this.#openRevocationDialog();
cy.findByTestId(this.revocationActionItem).should("exist").click(); cy.findByTestId(this.#pushButton).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");
} }
} }