-1
这里是我的代码:OPA5测试框架中的消息Toast弹出文本如何验证?
function() {
this.waitFor({
matchers: function() {
console.log(jQuery(".sapMMessageToast").text());
return (jQuery(".sapMMessageToast").text() === "Hello World");
},
success: function() {
Opa5.assert.ok(true, "Pop Message Toast is coming Successfully");
},
errorMessage: "No Toast message detected!"
});
}
输出: -
收到错误为: -
没有吐司消息检测! OPA超时 这是OPA记录:由匹配器 所有结果被过滤出来 - 跳过检查 - sap.ui.test.pipelines.MatcherPipeline 调用堆栈: 处 @ 14574毫秒 fewaitFor 预计:
真正 结果:
假 DIFF:
trufalse
所以这里jQuery(".sapMMessageToast").text()
语句,返回""
,而不是Hello World
(实际弹出消息由应用程序启动),所以控制将出现错误状态。