我想在 SWTBot 中编写测试。测试应该按下表添加新行,然后按下 DateCombo 按钮并将值插入单元格。(来自日历的值)
这是我的代码:
public SWTBotTable AppExp_getGridTable(SWTBotView appExpView) {
return appExpView.bot().tableWithId("GridViewer.Table"); //$NON-NLS-1$
}
public List<Widget> getWidgetListOfType(java.lang.Class type) {
Matcher matcher = allOf(widgetOfType(type));
List<Widget> widgets = bot.getFinder().findControls(matcher);
return widgets;
}
SWTBotTable swtbotTable = utilsList.AppExp_getGridTable(view);
//Put the foucs on the cell
swtbotTable.doubleClick(0, 1);
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
List<Widget> widgetListOfType = utilsList.getWidgetListOfType(DateCombo.class);
DateCombo dateCombo = (DateCombo) widgetListOfType.get(0);
List<Widget> widgetListOfType = utilsList.getWidgetListOfType(Button.class);
Button bt = (Button) widgetListOfType.get(0);
}
});
如何触发按钮或 dateCombo 上的单击?
然后我如何从日历中选择值?