2021-01-21 12:09:50 +00:00
|
|
|
export default class ModalUtils {
|
2021-01-27 12:56:28 +00:00
|
|
|
modalTitle: string;
|
|
|
|
modalMessage: string;
|
|
|
|
confirmModalBtn: string;
|
|
|
|
cancelModalBtn: string;
|
|
|
|
closeModalBtn: string;
|
2021-01-21 12:09:50 +00:00
|
|
|
constructor() {
|
|
|
|
this.modalTitle = ".pf-c-modal-box .pf-c-modal-box__title-text";
|
|
|
|
this.modalMessage = ".pf-c-modal-box .pf-c-modal-box__body";
|
|
|
|
|
|
|
|
this.confirmModalBtn = "#modal-confirm";
|
|
|
|
this.cancelModalBtn = "#modal-cancel";
|
|
|
|
this.closeModalBtn = ".pf-c-modal-box .pf-m-plain";
|
|
|
|
}
|
|
|
|
|
|
|
|
confirmModal() {
|
|
|
|
cy.get(this.confirmModalBtn).click();
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
cancelModal() {
|
|
|
|
cy.get(this.cancelModalBtn).click();
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|