use of org.assertj.swing.core.GenericTypeMatcher in project jabref by JabRef.
the class ParameterizedDialogNewEntryTest method cancelAddingEntryPlainTextOfGivenType.
@Test
public void cancelAddingEntryPlainTextOfGivenType() {
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 "Cancel".equals(jButton.getText());
}
}).click();
entryTable.requireRowCount(0);
}
use of org.assertj.swing.core.GenericTypeMatcher in project jabref by JabRef.
the class UndoTest method undoRedoUpdatedCorrectly.
@Test
public void undoRedoUpdatedCorrectly() {
newDatabase();
assertFalse(mainFrame.menuItemWithPath("Edit", "Undo").isEnabled());
assertFalse(mainFrame.menuItemWithPath("Edit", "Redo").isEnabled());
JTableFixture entryTable = mainFrame.table();
mainFrame.menuItemWithPath("BibTeX", "New entry...").click();
findDialog(EntryTypeDialog.class).withTimeout(10_000).using(robot()).button(new GenericTypeMatcher<JButton>(JButton.class) {
@Override
protected boolean isMatching(@Nonnull JButton jButton) {
return "Book".equals(jButton.getText());
}
}).click();
assertTrue(mainFrame.menuItemWithPath("Edit", "Undo").isEnabled());
assertFalse(mainFrame.menuItemWithPath("Edit", "Redo").isEnabled());
entryTable.requireRowCount(1);
mainFrame.menuItemWithPath("Edit", "Undo").click();
assertFalse(mainFrame.menuItemWithPath("Edit", "Undo").isEnabled());
assertTrue(mainFrame.menuItemWithPath("Edit", "Redo").isEnabled());
entryTable.requireRowCount(0);
closeDatabase();
exitJabRef();
}
use of org.assertj.swing.core.GenericTypeMatcher in project jabref by JabRef.
the class IdFetcherDialogTest method insertEmptySearchID.
@Test
public void insertEmptySearchID() {
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()).button(new GenericTypeMatcher<JButton>(JButton.class) {
@Override
protected boolean isMatching(@Nonnull JButton jButton) {
return "Generate".equals(jButton.getText());
}
}).click();
GenericTypeMatcher<JDialog> matcherEmptyDialog = new GenericTypeMatcher<JDialog>(JDialog.class) {
@Override
protected boolean isMatching(JDialog dialog) {
return "Empty search ID".equals(dialog.getTitle());
}
};
findDialog(matcherEmptyDialog).withTimeout(10_000).using(robot()).button(new GenericTypeMatcher<JButton>(JButton.class) {
@Override
protected boolean isMatching(@Nonnull JButton jButton) {
return "OK".equals(jButton.getText());
}
}).click();
entryTable.requireRowCount(0);
}
use of org.assertj.swing.core.GenericTypeMatcher in project jabref by JabRef.
the class GUITest method testDatabasePropertiesDialog.
@Test
public void testDatabasePropertiesDialog() throws IOException {
newDatabase();
mainFrame.menuItemWithPath("File", "Library properties").click();
robot().waitForIdle();
DialogFixture databasePropertiesDialog = findDialog(DatabasePropertiesDialog.class).withTimeout(10_000).using(robot());
takeScreenshot(databasePropertiesDialog, "DatabasePropertiesDialog");
databasePropertiesDialog.button(new GenericTypeMatcher<JButton>(JButton.class) {
@Override
protected boolean isMatching(@Nonnull JButton jButton) {
return "OK".equals(jButton.getText());
}
}).click();
closeDatabase();
exitJabRef();
}
use of org.assertj.swing.core.GenericTypeMatcher in project jabref by JabRef.
the class GUITest method testOpenAndSavePreferences.
@Test
public void testOpenAndSavePreferences() throws IOException {
mainFrame.menuItemWithPath("Options", "Preferences").click();
robot().waitForIdle();
DialogFixture preferencesDialog = findDialog(PreferencesDialog.class).withTimeout(10_000).using(robot());
takeScreenshot(preferencesDialog, "PreferencesDialog");
preferencesDialog.button(new GenericTypeMatcher<JButton>(JButton.class) {
@Override
protected boolean isMatching(@Nonnull JButton jButton) {
return "OK".equals(jButton.getText());
}
}).click();
exitJabRef();
}
Aggregations