OPA matcher for sap.m.MessageToast.show call?

若如初见. 提交于 2019-12-25 12:09:41

问题


How does a OPA match pattern for a sap.m.MessageToast.show call looks like? I looked into the Code of sap.m.MessageToast.show and assumed the use control is sap.ui.core.Popup. Therefore I tried the following matcher:

iShouldSeeAToastMessage : function() {
    return this.waitFor({
        controlType : "sap.ui.core.Popup",
        success : function (aDialog) {              
            ok(true, "Found a Toast: " + aDialog[0]);
        },
        errorMessage : "No Toast message detected!"
    });
},

Is the controlType correct? How could the matcher section look like?


回答1:


This should work:

return this.waitFor({
    pollingInterval : 100,
    viewName : "YOUR_VIEW_NAME_HERE",
    check : function () {
        return !!sap.ui.test.Opa5.getJQuery()(".sapMMessageToast").length;
    },
    success : function () {
        ok(true, "Found a Toast");
    },
    errorMessage : "No Toast message detected!"
});


来源:https://stackoverflow.com/questions/31425828/opa-matcher-for-sap-m-messagetoast-show-call

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!