我的看法包含IconTabBar与各种IconTabFilters。如何在OPA5测试中切换IconTabBar
如何将当前活动标签切换到另一个标签?通常的trigger("tap")
方法似乎不起作用。
我的看法包含IconTabBar与各种IconTabFilters。如何在OPA5测试中切换IconTabBar
如何将当前活动标签切换到另一个标签?通常的trigger("tap")
方法似乎不起作用。
经过一番调试,我发现在IconTabFilter
工程中的图标上触发伪事件saptouchend
。
return this.waitFor({
id: "mySecondTab-icon",
viewName: sViewName,
success: function (control) {
control.$().trigger("saptouchend");
},
errorMessage: "Second IconTabFilter not found in IconTabBar"
});
我喜欢你的解决方案
通常我看QUnit试验控制,并希望他们做了类似的事情
如
// Press SPACE key on second IconTabFilter to expand
sap.ui.test.qunit.triggerKeydown(oControl.$(), jQuery.sap.KeyCodes.SPACE);
UPDATE: 刚刚发现一个在TEST Tutorial解决方案 - 不知道我喜欢它,因为它不模拟用户交互
iPressOnTheTabWithTheKey: function (sKey) {
return this.waitFor({
id: "iconTabBar",
viewName : sViewName,
success: function (oIconTabBar) {
oIconTabBar.setSelectedKey(sKey);
},
errorMessage: "Cannot find the icon tab bar"
});
}
一个简单的方法可以做到这一点,我们可以使用id /图标来选择你想要的iconTab,然后添加一个动作,在你的情况下,这将是一个新闻。
iClickOnSecondIconTabBAr: function() { return this.waitFor({ controlType: "sap.m.IconTabFilter", matchers: new sap.ui.test.matchers.Properties({ icon: "sap-icon://inspection" }), actions: new Press(), errorMessage: "Did not find the IconTabBar Button!" }); }