OPA matcher for sap.m.MessageToast.show调用?

时间:2015-07-15 08:57:56

标签: sapui5 regression-testing sapui5-opa

sap.m.MessageToast.show来电的OPA匹配模式如何? 我查看了sap.m.MessageToast.show的代码,并假设使用控件为sap.ui.core.Popup。因此我尝试了以下匹配器:

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!"
    });
},

controlType是否正确?匹配器部分怎么样?

1 个答案:

答案 0 :(得分:3)

这应该有效:

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!"
});