我在按住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