use of org.assertj.swing.fixture.JTableFixture 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);
}
use of org.assertj.swing.fixture.JTableFixture in project jabref by JabRef.
the class ParameterizedDialogNewEntryTest method addEntryOfGivenType.
@Test
public void addEntryOfGivenType() {
mainFrame.menuItemWithPath("File", "New " + databaseMode + " database").click();
JTableFixture entryTable = mainFrame.table();
entryTable.requireRowCount(0);
mainFrame.menuItemWithPath("BibTeX", "New entry...").click();
selectEntryType();
entryTable.requireRowCount(1);
}
use of org.assertj.swing.fixture.JTableFixture in project jabref by JabRef.
the class ParameterizedDialogNewEntryTest method addEntryPlainTextOfGivenType.
@Test
public void addEntryPlainTextOfGivenType() {
mainFrame.menuItemWithPath("File", "New " + databaseMode + " database").click();
JTableFixture entryTable = mainFrame.table();
entryTable.requireRowCount(0);
mainFrame.menuItemWithPath("BibTeX", "New entry from plain text...").click();
selectEntryType();
GenericTypeMatcher<JDialog> matcher2 = plainTextMatcher();
findDialog(matcher2).withTimeout(10_000).using(robot()).button(new GenericTypeMatcher<JButton>(JButton.class) {
@Override
protected boolean isMatching(@Nonnull JButton jButton) {
return "Accept".equals(jButton.getText());
}
}).click();
entryTable.requireRowCount(1);
}
use of org.assertj.swing.fixture.JTableFixture in project jabref by JabRef.
the class ParameterizedDialogNewEntryTest method closeAddingEntryPlainTextOfGivenType.
@Test
public void closeAddingEntryPlainTextOfGivenType() {
mainFrame.menuItemWithPath("File", "New " + databaseMode + " database").click();
JTableFixture entryTable = mainFrame.table();
entryTable.requireRowCount(0);
mainFrame.menuItemWithPath("BibTeX", "New entry from plain text...").click();
selectEntryType();
GenericTypeMatcher<JDialog> matcher2 = plainTextMatcher();
findDialog(matcher2).withTimeout(10_000).using(robot()).close();
entryTable.requireRowCount(0);
}
use of org.assertj.swing.fixture.JTableFixture in project jabref by JabRef.
the class EntryTableTest method scrollThroughEntryList.
@Test
public void scrollThroughEntryList() {
String path = getAbsolutePath(TEST_FILE_NAME);
importBibIntoNewDatabase(path);
JTableFixture entryTable = mainFrame.table();
//use a pattern from the first row to select it since it seems to be the best way to get the cell object
Pattern pattern = Pattern.compile("256.*");
JTableCellFixture firstCell = entryTable.cell(pattern);
entryTable.selectRows(0).doubleClick();
//delay has to be shortened so that double click is recognized
robot().settings().delayBetweenEvents(0);
firstCell.doubleClick();
robot().settings().delayBetweenEvents(SPEED_NORMAL);
firstCell.click();
//is the first table entry selected?
assertColumnValue(entryTable, 0, TITLE_COLUMN_INDEX, entryTable.selectionValue());
//go throught the table and check if the entry with the correct index is selected
for (int i = 0; i < SCROLL_ACTION_EXECUTION; i++) {
robot().pressAndReleaseKey(DOWN);
Assert.assertTrue(entryTable.selectionValue() != null);
assertColumnValue(entryTable, i + 1, TITLE_COLUMN_INDEX, entryTable.selectionValue());
}
//do the same going up again
for (int i = SCROLL_ACTION_EXECUTION; i > 0; i--) {
robot().pressAndReleaseKey(UP);
Assert.assertTrue(entryTable.selectionValue() != null);
assertColumnValue(entryTable, i - 1, TITLE_COLUMN_INDEX, entryTable.selectionValue());
}
closeDatabase();
exitJabRef();
}
Aggregations