gpt4 book ai didi

testing - SAPUI5 OPA 测试 - 消息框 - 错误

转载 作者:行者123 更新时间:2023-11-28 21:09:24 26 4
gpt4 key购买 nike

我在 SAPUI5 应用程序的 JavaScript View 上按消息框上的不同按钮时遇到问题。其他项目似乎工作正常,如在文本框中插入文本、按下按钮、选择一行表格等。

我发现每个消息框都有一个类型/类,如 sapMDialogSuccesssapMDialogErrorsapMDialogWarning 等。我们有类似的类型吗/class OKCancelAbort 按钮(显示在 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 error.@ 3623 ms
Source:
:0

最佳答案

它以这种方式为我工作。我们必须执行 firePress() 事件的成功函数:

Then.onTheTranslationPage.ipressOKButton();

ipressOKButton: function () {
var oOrderNowButton = null;
return this.waitFor({
viewName: sViewName,
searchOpenDialogs: true, //mandatory
controlType: "sap.m.Button", //optional
success: function (aButtons) {
return aButtons.filter(function (oButton) {
if(oButton.getText() == "OK") {
oOrderNowButton = oButton;
oButton.firePress();
}
});

Opa5.assert.ok(true, "Form Got Submitted Successfully");
},
actions: new Press(),
errorMessage: "Did not find the dialog control"
});
},

关于testing - SAPUI5 OPA 测试 - 消息框 - 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39344244/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com