/** * Click button * @throws VerificationException if the element doesn't exist */ @Override @PublicAtsApi public void click() { new SwingElementState(this).waitToBecomeExisting(); ((JButtonFixture) SwingElementLocator.findFixture(this)).click(); }
/** * Click button by its text * * @param text the text of button to click */ @PublicAtsApi public void clickButtonByText( String text ) { new SwingElementState(this).waitToBecomeExisting(); try { ((JOptionPaneFixture) SwingElementLocator.findFixture(this)).buttonWithText(text).click(); } catch (ComponentLookupException cle) { throw new ElementNotFoundException(cle.getMessage()); } }
@Test @Ignore(value = "Intellij component dependency, need to mock it") public void testLaunchBuild() throws Exception { createDialog(JOB_WITH_GOOD_PARAMS); dialogFixture.checkBox("integrationTest").uncheck(); dialogFixture.comboBox("environment").selectItem("acceptance"); dialogFixture.button(JButtonMatcher.withText("OK")).click(); ArgumentCaptor<Map> paramMap = ArgumentCaptor.forClass(Map.class); verify(requestManager, times(1)).runParameterizedBuild(any(Job.class), any(JenkinsAppSettings.class), paramMap.capture()); Map expectedParamMapValue = paramMap.getValue(); assertEquals(3, expectedParamMapValue.size()); assertEquals("false", expectedParamMapValue.get("integrationTest")); assertEquals("acceptance", expectedParamMapValue.get("environment")); assertEquals("", expectedParamMapValue.get("message")); }
@Test public void checkBug32ProblemWithJTextPane() throws Exception { // First problem: bad initial baseline checkExample(Bug32ProblemWithJTextPane.class); // Second problem: very bad baseline after appending a lot of text frame().button("append").click(); frame().resizeWidthTo(frame().component().getWidth() + 1); checkSnapshot("after-append"); }
private void tstChromoNav(String chromoText) throws Exception { JTextComponentFixture searchFixture = frame.textBox("searchTextField"); searchFixture.deleteText(); this.enterText = chromoText; //Make sure search box has focus searchFixture.focus(); searchFixture.requireFocused(); searchFixture.requireEmpty(); searchFixture.enterText(chromoText); frame.button("goButton").click(); }
@Ignore //Never seems to work on our testrunner for reasons unrelated to the code @Test public void testHome() throws Exception { IGV igv = IGV.getInstance(); ReferenceFrame frame = FrameManager.getDefaultFrame(); String chr = "chr1"; int start = 5; int end = 5000; int limit = 2; frame.jumpTo(chr, start, end); Assert.assertEquals(chr, frame.getChrName()); assertTrue(Math.abs(frame.getCurrentRange().getStart() - start) < limit); assertTrue(Math.abs(frame.getCurrentRange().getEnd() - end) < limit); FrameFixture frameFixture = new FrameFixture(IGV.getMainFrame()); //Make sure frame has focus, or else homeButton won't work JButtonFixture homeButton = frameFixture.button("homeButton"); homeButton.focus(); homeButton.click(); homeButton.focus(); homeButton.click(); igv.waitForNotify(500); Assert.assertEquals(Globals.CHR_ALL, frame.getChrName()); //In all genome view these should be the same assertEquals(frame.getChromosomeLength(), frame.getCurrentRange().getEnd()); Assert.assertEquals(0.0, frame.getOrigin()); }