2021-01-21 12:09:50 +00:00
|
|
|
export default class ModalUtils {
|
2021-05-06 08:38:45 +00:00
|
|
|
private modalTitle = ".pf-c-modal-box .pf-c-modal-box__title-text";
|
|
|
|
private modalMessage = ".pf-c-modal-box .pf-c-modal-box__body";
|
|
|
|
|
2022-02-02 11:44:52 +00:00
|
|
|
private confirmModalBtn = "confirm";
|
|
|
|
private cancelModalBtn = "cancel";
|
2021-05-06 08:38:45 +00:00
|
|
|
private closeModalBtn = ".pf-c-modal-box .pf-m-plain";
|
2021-01-21 12:09:50 +00:00
|
|
|
|
2022-01-17 10:39:48 +00:00
|
|
|
confirmModal(force = false) {
|
2022-02-02 11:44:52 +00:00
|
|
|
cy.findByTestId(this.confirmModalBtn).click({ force });
|
2021-01-21 12:09:50 +00:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
cancelModal() {
|
2022-02-02 11:44:52 +00:00
|
|
|
cy.findByTestId(this.cancelModalBtn).click();
|
2021-01-21 12:09:50 +00:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
closeModal() {
|
|
|
|
cy.get(this.closeModalBtn).click();
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2021-01-28 09:07:12 +00:00
|
|
|
checkModalTitle(title: string) {
|
2021-01-21 12:09:50 +00:00
|
|
|
cy.get(this.modalTitle).invoke("text").should("eq", title);
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2021-01-28 09:07:12 +00:00
|
|
|
checkModalMessage(message: string) {
|
2021-01-21 12:09:50 +00:00
|
|
|
cy.get(this.modalMessage).invoke("text").should("eq", message);
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|