Automated tests 如何在OPA5测试中调用搜索字段
我的观点包含了一个错误Automated tests 如何在OPA5测试中调用搜索字段,automated-tests,qunit,sapui5,Automated Tests,Qunit,Sapui5,我的观点包含了一个错误 如何调用该字段中的搜索?通常的trigger(“tap”)方法似乎不起作用。经过一些调试后,我发现搜索字段中放大镜图标中触发的伪事件saptouchstart和saptouchend组合起作用 return this.waitFor({ id: "mySearchField", viewName: sViewName, success: function (control) { var event, searchIcon;
如何调用该字段中的搜索?通常的
trigger(“tap”)
方法似乎不起作用。经过一些调试后,我发现搜索字段中放大镜图标中触发的伪事件saptouchstart
和saptouchend
组合起作用
return this.waitFor({
id: "mySearchField",
viewName: sViewName,
success: function (control) {
var event, searchIcon;
event = jQuery.Event( "saptouchend" );
event.originalEvent = event; // would otherwise cause NPE at some point in SAP code
searchIcon = control.$().find("div[id*=mySearchField-search]");
searchIcon.trigger("saptouchstart").trigger(event);
},
errorMessage: "Search field not found"
});
这也可以通过以下一个衬里()完成:
但这可能只适用于比您使用的版本更新的UI5版本。另一种解决方案是使用,它不仅输入搜索词(“foobar”(以下示例中为“foobar”),而且还会在以后触发搜索:
this.waitFor({
id: "mySearchField",
actions: [ new sap.ui.test.actions.EnterText({ text: "foobar" }) ]
});
this.waitFor({
id: "mySearchField",
actions: [ new sap.ui.test.actions.EnterText({ text: "foobar" }) ]
});