我在按住SAPUI5应用程序的JavaScript视图上的消息框上的不同按钮时遇到问题。其他项目似乎工作就像在文本框中插入文本,按下按钮,选择表中的行等精细SAPUI5 OPA测试 - 消息框 - 错误
我发现每一个消息框都有一个类型/类像sapMDialogSuccess
或sapMDialogError
或sapMDialogWarning
,等我们做OK
,Cancel
,Abort
按钮(在MessageBox
上显示)有类似/类别?
我能够得到这对我MessageBox
出现使用确切的文本:
ok(true, "This success message is displayed:- " +
sap.ui.test.Opa5.getJQuery()(".sapMDialogSuccess").
find(".sapMText").text());
但是当我尝试下面的代码选择(然后按)OK按钮,这是行不通的。这里是我使用的代码:
//OK Button - Find & Press OK button
Then.waitFor({
pollingInterval: 5,
searchOpenDialogs: true,
controlType: "sap.m.Button",
check: function(aButton) {
if (aButton.text() === "OK") {
return !!sap.ui.test.Opa5.getJQuery()(".sapMDialogSuccess").length;
}
},
success: function() {
ok(true, "OK button found - SUCCESS");
},
errorMessage: "OK Button not found - ERROR"
});
这里是我得到的错误:
OK Button not found - ERROR
Callstack:
at Object.<anonymous> (http: //<<server>>:50000/XMII/CM/Opa-LineGroupMaintenance.html:152:22)
at Object.f (https:// sapui5.hana.ondemand.com/sdk/resources/sap/ui/test/opaQunit.js:6:331)
at Object.run (https:// sapui5.hana.ondemand.com/sdk/resources/sap/ui/thirdparty/qunit.js:11:9294)
at eval (https:// sapui5.hana.ondemand.com/sdk/resources/sap/ui/thirdparty/qunit.js:11:11222)
at C (https:// sapui5.hana.ondemand.com/sdk/resources/sap/ui/thirdparty/qunit.js:11:5918)
at E (https:// sapui5.hana.ondemand.com/sdk/resources/sap/ui/thirdparty/qunit.js:11:6299)
at eval (https:// sapui5.hana.ondemand.com/sdk/resources/sap/ui/thirdparty/qunit.js:11:6431)@ 3618 ms
Expected:
true
Result:
false
Diff:
trufalse
Source:
at Object.eval [as ok] (https:// sapui5.hana.ondemand.com/sdk/resources/sap/ui/thirdparty/qunit.js:11:20688)
Script [email protected] 3623 ms
Source:
:0