use of org.assertj.swing.timing.Condition in project jabref by JabRef.
the class IdFetcherDialogTest method testFetcherDialog.
@Test
public void testFetcherDialog() {
mainFrame.menuItemWithPath("File", "New " + databaseMode + " database").click();
JTableFixture entryTable = mainFrame.table();
entryTable.requireRowCount(0);
mainFrame.menuItemWithPath("BibTeX", "New entry...").click();
GenericTypeMatcher<JDialog> matcher = new GenericTypeMatcher<JDialog>(JDialog.class) {
@Override
protected boolean isMatching(JDialog dialog) {
return "Select entry type".equals(dialog.getTitle());
}
};
findDialog(matcher).withTimeout(10_000).using(robot()).comboBox(new GenericTypeMatcher<JComboBox>(JComboBox.class) {
@Override
protected boolean isMatching(@Nonnull JComboBox component) {
return true;
}
}).selectItem(fetcherType);
findDialog(matcher).withTimeout(10_000).using(robot()).textBox(new GenericTypeMatcher<JTextComponent>(JTextComponent.class) {
@Override
protected boolean isMatching(@Nonnull JTextComponent component) {
return true;
}
}).enterText(fetchID);
findDialog(matcher).withTimeout(10_000).using(robot()).button(new GenericTypeMatcher<JButton>(JButton.class) {
@Override
protected boolean isMatching(@Nonnull JButton jButton) {
return "Generate".equals(jButton.getText());
}
}).click();
pause(new Condition("entrySize") {
@Override
public boolean test() {
return entryTable.rowCount() == 1;
}
}, 10_000);
entryTable.requireRowCount(1);
}
Aggregations