I have a similar question as this
But, how can I check the content of sap.m.MessageToast
is correct or not?
iShouldSeeAToastMessage : function(sText) {
return this.waitFor({
pollingInterval : 100,
check : function() {
return !!sap.ui.test.Opa5.getJQuery()(".sapMMessageToast").length;
},
success : function (oMessage) {
strictEqual(oMessage[0].getText(), sText, "The message display correctly");
},
errorMessage : "No Toast message detected!"
});
}
I tried the above code. But, maybe, the success
callback returns no object. So, I got the error message: Cannot read property '0' of null
=======================================
I tried the following code. The testcase is passed. But, I am not sure it is a correct test code.
success : function () {
strictEqual(sap.ui.test.Opa5.getJQuery()(".sapMMessageToast")[0].innerHTML, sText, "The message display correctly");
}