Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Automated tests 如何在OPA5测试中调用搜索字段_Automated Tests_Qunit_Sapui5 - Fatal编程技术网

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" }) ]
});