return;
}
- SWTBotTable table = editor.bot().table();
bot.waitUntil(new DefaultCondition() {
@Override
public boolean test() throws Exception {
+ SWTBotTable table = editor.bot().table();
return table.rowCount() > 1;
}
return "No items in table";
}
});
+ SWTBotTable table = editor.bot().table();
// Select first event (skip filter/search row)
table.getTableItem(1).select();
editor.bot().waitUntil(new DefaultCondition() {
@Override
public boolean test() throws Exception {
- boolean ret = table.selection().rowCount() == 1 && table.selection().get(0).toString().contains(firstEventStr);
+ // Get the table again since it can get re-created
+ SWTBotTable curTable = editor.bot().table();
+ boolean ret = curTable.selection().rowCount() == 1 && curTable.selection().get(0).toString().contains(firstEventStr);
if (!ret) {
// FIXME: Not sure why, sometimes the first select() ends up
// selecting an empty item. Retry selecting here.
- table.getTableItem(1).select();
+ curTable.getTableItem(1).select();
}
return ret;
}
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTxtTraceDefinition;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
+import org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests.SWTBotImportWizardUtils;
import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers;
import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
import org.eclipse.tracecompass.tmf.ui.tests.shared.WaitUtils;
SWTBotTreeItem traceItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME), TRACE_NAME);
traceItem.contextMenu().menu("Open").click();
- testEventsTable(TRACE_NAME);
+ SWTBotImportWizardUtils.testEventsTable(fBot, TRACE_NAME, CUSTOM_TEXT_LOG.getNbEvents(), CUSTOM_TEXT_LOG.getFirstEventTimestamp());
testStatisticsView();
fBot.closeAllEditors();
}
fBot.closeAllEditors();
SWTBotTreeItem copiedItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME), RENAMED_TRACE_NAME);
copiedItem.contextMenu().menu("Open").click();
- testEventsTable(RENAMED_TRACE_NAME);
+ SWTBotImportWizardUtils.testEventsTable(fBot, RENAMED_TRACE_NAME, CUSTOM_TEXT_LOG.getNbEvents(), CUSTOM_TEXT_LOG.getFirstEventTimestamp());
fBot.closeAllEditors();
SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME);
}
SWTBotTreeItem copiedItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME), RENAMED_TRACE_NAME);
copiedItem.contextMenu().menu("Open").click();
- testEventsTable(RENAMED_TRACE_NAME);
+ SWTBotImportWizardUtils.testEventsTable(fBot, RENAMED_TRACE_NAME, CUSTOM_TEXT_LOG.getNbEvents(), CUSTOM_TEXT_LOG.getFirstEventTimestamp());
fBot.closeAllEditors();
SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME);
}
traceItem.select();
fBot.activeShell().pressShortcut(Keystrokes.CR);
- testEventsTable(TRACE_NAME);
+ SWTBotImportWizardUtils.testEventsTable(fBot, TRACE_NAME, CUSTOM_TEXT_LOG.getNbEvents(), CUSTOM_TEXT_LOG.getFirstEventTimestamp());
testStatisticsView();
fBot.closeAllEditors();
}
SWTBotTreeItem traceItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME), TRACE_NAME);
traceItem.doubleClick();
- testEventsTable(TRACE_NAME);
+ SWTBotImportWizardUtils.testEventsTable(fBot, TRACE_NAME, CUSTOM_TEXT_LOG.getNbEvents(), CUSTOM_TEXT_LOG.getFirstEventTimestamp());
testStatisticsView();
fBot.closeAllEditors();
}
fBot.waitUntil(Conditions.shellCloses(shell));
}
- private static void testEventsTable(String editorName) {
- SWTBotEditor editor = SWTBotUtils.activeEventsEditor(fBot, editorName);
- fBot.waitUntil(ConditionHelpers.numberOfEventsInTrace(TmfTraceManager.getInstance().getActiveTrace(), CUSTOM_TEXT_LOG.getNbEvents()));
-
- SWTBotTable table = editor.bot().table();
- fBot.waitUntil(new DefaultCondition() {
- @Override
- public boolean test() throws Exception {
- return table.rowCount() > 1;
- }
-
- @Override
- public String getFailureMessage() {
- return "No items in table";
- }
- });
- // Select first event (skip filter/search row)
- table.getTableItem(1).select();
-
- editor.bot().waitUntil(new DefaultCondition() {
- @Override
- public boolean test() throws Exception {
- return table.selection().rowCount() == 1 && table.selection().get(0).toString().contains(CUSTOM_TEXT_LOG.getFirstEventTimestamp());
- }
-
- @Override
- public String getFailureMessage() {
- return "First event not selected";
- }
- });
- }
-
private static void testStatisticsView() {
SWTBotUtils.openView(TmfStatisticsView.ID);
SWTBotView view = fBot.viewById(TmfStatisticsView.ID);