/** * Finds a {@code Dialog} by name or type. * * @param robot contains the underlying finding to delegate the search to. * @return a {@code DialogFixture} managing the found {@code Dialog}. * @throws org.assertj.swing.exception.WaitTimedOutError if a {@code Dialog} could not be found. */ @Override @Nonnull public DialogFixture using(@Nonnull Robot robot) { return new DialogFixture(robot, findComponentWith(robot)); }
public JButtonFixture refresh() { return me().button("importClipboard.refresh"); }
vfsBrowserDialog.textBox("VfsBrowser.filter").setText(""); vfsBrowserDialog.textBox("VfsBrowser.path").click(); final JTableFixture table = vfsBrowserDialog.table(new GenericTypeMatcher<JTable>(JTable.class) { @Override protected boolean isMatching(@Nonnull JTable component) { if (dir.equalsIgnoreCase("appdata") && System.getProperty("os.name").toLowerCase().contains("win")) { vfsBrowserDialog.textBox("VfsBrowser.path").enterText("/" + dir); vfsBrowserDialog.textBox("VfsBrowser.path").pressAndReleaseKey(KeyPressInfo.keyCode('\n')); } else { LOGGER.info(" clicking on " + dir); vfsBrowserDialog.textBox("VfsBrowser.filter").setText(name); vfsBrowserDialog.button("VfsBrowser.refresh").click(); await().ignoreExceptions().until(() -> table.cell(TableCell.row(1).column(0)).click()); vfsBrowserDialog.button("VfsBrowser.open").click(); LOGGER.info(" file " + file.getAbsolutePath() + " opened");
@Override public boolean matches(Object item) { if (item instanceof DialogFixture) return ((DialogFixture) item).target().isVisible(); if (item instanceof JDialog) return ((JDialog) item).isVisible(); if (item instanceof JFileChooserFixture) return ((JFileChooserFixture) item).target().isVisible(); throw new RuntimeException("Invalid matcher for " + item); }
public JTextComponentFixture processingPattern() { return me().textBox("importClipboard.processingPattern"); }
void show() { fixture.show(); }
public StartSocketListenerDialog setPort(int port) { me().spinner("StartSocketListenerDialog.port").select(Integer.valueOf(port)); return this; }
public StartSocketListenerDialog setLogParser(String logParser) { me().comboBox("StartSocketListenerDialog.importer").selectItem(logParser); return this; }
public JOptionPane errorDialog() { JOptionPaneFixture jOptionPaneFixture = fixture.optionPane(Timeout.timeout(250)); return jOptionPaneFixture.target(); } }
public JTextComponentFixture processedContent() { return me().textBox("importClipboard.processedContent"); }
void show() { fixture.show(); }
@Nonnull private DialogFixture findDialog(@Nonnull ComponentMatcher matcher, @Nonnull Timeout timeout) { String description = "dialog to be found using matcher " + matcher; ComponentFoundCondition condition = new ComponentFoundCondition(description, robot().finder(), matcher); pause(condition, timeout); Dialog dialog = (Dialog) condition.found(); return new DialogFixture(robot(), checkNotNull(dialog)); }
public JButtonFixture cancel() { return me().button(matcherForButtonWithText("Cancel")); }
public JTextComponentFixture clipboardTextAreaContent() { return me().textBox("importClipboard.content"); }
static RemoteServerDialogPageObject setUp(Robot robot, RemoteServer.Test serverTester) { RemoteServerDialog dialog = execute(() -> RemoteServerDialog.empty(serverTester, "Form Manager")); DialogFixture fixture = new DialogFixture(robot, dialog.form); return new RemoteServerDialogPageObject(dialog, fixture); }
public JButtonFixture cancel() { return me().button(matcherForButtonWithText("Cancel")); }
static ConfigurationDialogPageObject setUp(Robot robot, ExportConfiguration initialConf) { ConfigurationDialog dialog = execute(() -> ConfigurationDialog.overridePanel(initialConf, "Test form", true, true)); DialogFixture fixture = new DialogFixture(robot, dialog.form); return new ConfigurationDialogPageObject(dialog, fixture); }
public static void close(Robot robot) { LOGGER.info("Closing confirmation dialog"); final DialogFixture confirmDialog = WindowFinder.findDialog(new GenericTypeMatcher<Dialog>(Dialog.class) { @Override protected boolean isMatching(@Nonnull Dialog component) { return component.getTitle().equals("Are you sure?"); } }).using(robot); final JButtonFixture ok = confirmDialog.button(new GenericTypeMatcher<JButton>(JButton.class) { @Override protected boolean isMatching(@Nonnull JButton component) { return component.getText().equals("OK"); } }); ok.click(); await() .atMost(30, TimeUnit.SECONDS) .ignoreExceptions() .until(confirmDialog::requireNotVisible); LOGGER.info("Confirmation dialog is closed"); } }
public LogViewPanel startListening() { me().button(matcherForButtonWithText("OK")).click(); return new LogViewPanel(new MainFrame(robot).me(),robot); }