keycloak-scim/cypress/support/util/ModalUtils.ts
Aboullos 5227115f05
Add Clients tests, fix notification message and stabilize tests (#1999)
* Add Clients tests and fix notification message

* Remove TODO message

* Add waits and refactor

* Refactor and fix tests in realm settings

* Fix lint

* Refactor, fix tests and add stability

* Refactor and stabilize tests

* Stabilize tests

* Fix Realm settings event test and stabilize

* Set confirmModal to always force click

* Add force click and wait

* Fix masthead test

* Modify cypress.json

* Modify realm dropdown selector

* Revert hook changes
2022-02-16 17:34:54 +01:00

57 lines
1.2 KiB
TypeScript

export default class ModalUtils {
private modalTitle = ".pf-c-modal-box .pf-c-modal-box__title-text";
private modalMessage = ".pf-c-modal-box .pf-c-modal-box__body";
private confirmModalBtn = "confirm";
private cancelModalBtn = "cancel";
private closeModalBtn = ".pf-c-modal-box .pf-m-plain";
private copyToClipboardBtn = '[id*="copy-button"]';
confirmModal() {
cy.findByTestId(this.confirmModalBtn).click({ force: true });
return this;
}
checkConfirmButtonText(text: string) {
cy.findByTestId(this.confirmModalBtn).contains(text);
return this;
}
cancelModal() {
cy.findByTestId(this.cancelModalBtn).click({ force: true });
return this;
}
cancelButtonContains(text: string) {
cy.findByTestId(this.cancelModalBtn).contains(text);
return this;
}
copyToClipboard() {
cy.get(this.copyToClipboardBtn).click();
return this;
}
closeModal() {
cy.get(this.closeModalBtn).click({ force: true });
return this;
}
checkModalTitle(title: string) {
cy.get(this.modalTitle).invoke("text").should("eq", title);
return this;
}
checkModalMessage(message: string) {
cy.get(this.modalMessage).invoke("text").should("eq", message);
return this;
}
}