/** * Finds a {@code Frame} by name or type. * * @param robot contains the underlying finding to delegate the search to. * @return a {@code FrameFixture} managing the found {@code Frame}. * @throws org.assertj.swing.exception.WaitTimedOutError if a {@code Frame} could not be found. */ @Override @Nonnull public FrameFixture using(@Nonnull Robot robot) { return new FrameFixture(robot, findComponentWith(robot)); }
/** * Creates a new {@code JFrame} and uses the given {@code Container} as its content pane. The created {@code JFrame} * is wrapped by a {@link FrameFixture}. Unlike {@link #showInFrame(Container)}, this method does <strong>not</strong> * display the created {@code JFrame}. It uses the given {@code Robot}, if you've created your own {@code Robot} this * method is best for you, if not use {@code #frameFixtureFor(Container)}. * * @param robot performs user events on the given window and verifies expected output. * @param contentPane the {@code Container} to use as content pane for the {@code JFrame} to create. * @return the created {@code FrameFixture}. * @see #frameFor(Container) */ @RunsInEDT @Nonnull public static FrameFixture frameFixtureFor(@Nonnull Robot robot, @Nonnull Container contentPane) { return new FrameFixture(robot, frameFor(contentPane)); }
/** * Creates a new {@code JFrame} and uses the given {@code Container} as its content pane. The created {@code JFrame} * is wrapped by a {@link FrameFixture}. Unlike {@link #showInFrame(Container)}, this method does <strong>not</strong> * display the created {@code JFrame}. * <p> * <strong>Note:</strong>This method creates a new {@link Robot}. When using this method, please do not create any * additional instances of {@code Robot}. Only one instance of {@code Robot} can exist per test class. If you've * created your own {@code Robot} e.g. by extending the base test class, use * {@code #frameFixtureFor(Robot, Container)}. * </p> * * @param contentPane the {@code Container} to use as content pane for the {@code JFrame} to create. * @return the created {@code FrameFixture}. * @see #frameFor(Container) */ @RunsInEDT @Nonnull public static FrameFixture frameFixtureFor(@Nonnull Container contentPane) { return new FrameFixture(frameFor(contentPane)); }
static CustomConfBooleanPageObject setUp(Robot robot, Optional<TriStateBoolean> initialValue) { CustomConfBooleanForm component = execute(() -> new CustomConfBooleanForm(initialValue)); JFrame frame = execute(() -> { JFrame f = new JFrame(); f.add(component.$$$getRootComponent$$$()); return f; }); FrameFixture fixture = new FrameFixture(robot, frame); return new CustomConfBooleanPageObject(component, fixture); }
static ConfigurationPanelPageObject setUpOverridePanel(Robot robot, ExportConfiguration initialConfiguration, boolean savePasswordsConsent, boolean hasTransferSettings) { return execute(() -> { ConfigurationPanel configurationPanel = ConfigurationPanel.overridePanel(initialConfiguration, savePasswordsConsent, hasTransferSettings); JFrame testFrame = new JFrame(); testFrame.add(configurationPanel.getForm().$$$getRootComponent$$$()); FrameFixture window = new FrameFixture(robot, testFrame); return new ConfigurationPanelPageObject(configurationPanel, window); }); }
static ConfigurationPanelPageObject setUpDefaultPanel(Robot robot, ExportConfiguration initialConfiguration, boolean savePasswordsConsent, boolean hasTransferSettings) { return execute(() -> { ConfigurationPanel configurationPanel = ConfigurationPanel.defaultPanel(initialConfiguration, savePasswordsConsent); JFrame testFrame = new JFrame(); testFrame.add(configurationPanel.getForm().$$$getRootComponent$$$()); FrameFixture window = new FrameFixture(robot, testFrame); return new ConfigurationPanelPageObject(configurationPanel, window); }); }
static ExportPanelPageObject setUp(Robot robot) { ExportPanel exportPanel = GuiActionRunner.execute(() -> { ExportPanel ep = ExportPanel.from( new BriefcasePreferences(InMemoryPreferences.empty()), new BriefcasePreferences(InMemoryPreferences.empty()), new NoOpAnalytics(), FormCache.empty() ); ep.updateForms(); return ep; }); JFrame testFrame = GuiActionRunner.execute(() -> { JFrame f = new JFrame(); f.add(exportPanel.getForm().getContainer()); return f; }); FrameFixture window = new FrameFixture(robot, testFrame); return new ExportPanelPageObject(exportPanel, window); }