@Test public void JunitTest() { JFrameOperator mainFrame = new JFrameOperator(); JTextFieldOperator textField = new JTextFieldOperator(mainFrame, "textIn"); int x = 10; assertEquals(x, textField.getLocationOnScreen().x); }
JFrameOperator mf = new JFrameOperator("Main Frame"); JDialogOperator jd = new JDialogOperator(mf, ""); // dialog that contains JProgressBar has no name JProgressBar pb = JProgressBarOperator.findJProgressBar(jd.getContentPane());
@Test public void testSomething() throws Exception { //GIVEN ClassReference cr = new ClassReference("components.TableFilterDemo"); cr.startApplication(); frame = new JFrameOperator("TableFilterDemo"); //WHEN //doing more steps //THEN //do TestNG assertions }
/** * Displays a new {@link JFrame} with the given {@code component} and * returns an operator for it. * * @param component the component to display in the new frame. * @return An operator for the new frame which shows the given component. */ public static JFrameOperator showFrameWith(final Component component) throws InterruptedException { class Show implements Runnable { JFrame frame; @Override public void run() { frame = new JFrame(); frame.add(component); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } } // Show final Show show = new Show(); runOnEdtNow(show); return new JFrameOperator(show.frame); }
new ClassReference("org.netbeans.jemmy.explorer.GUIBrowser") .startApplication(); JFrameOperator mainFrame = new JFrameOperator("GUI Browser"); new JButtonOperator(mainFrame, "Reload In").push(); new JLabelOperator(mainFrame, "Reloaded"); JTreeOperator tree = new JTreeOperator(mainFrame); //click in the middle of the tree tree.clickMouse(); //collapse node tree.collapsePath(tree.findPath("", "|")); //expand node tree.expandPath(tree.findPath("", "|")); //select node tree.selectPath(tree.findPath("GUI Browser", "|")); JTextFieldOperator testField = new JTextFieldOperator(mainFrame); //type new value in the text field testField.clearText(); testField.typeText("3");
JFrameOperator mainFrame = new JFrameOperator(windowName); JCheckBoxOperator jc = new JCheckBoxOperator(mainFrame, checkBoxName);
throws Exception { JFrameOperator mainFrame = new JFrameOperator(mainWindow); JButtonOperator btn = new JButtonOperator(mainFrame, new TipNameButtonFinder(buttonName));