/** * Uncheck the CheckBox * @throws VerificationException if the element doesn't exist */ @Override @PublicAtsApi public void unCheck() { new SwingElementState(this).waitToBecomeExisting(); ((JCheckBoxFixture) SwingElementLocator.findFixture(this)).uncheck(); }
private String handle(JCheckBox checkbox, CommandRequest command) { switch (command.action) { case CLICK: JCheckBoxFixture bFixture = new JCheckBoxFixture(FestRobotInstance.getRobot(), checkbox); bFixture.click(); break; case GET: return String.valueOf(checkbox.isSelected()); default: throw new IllegalArgumentException("Unsupported command for JCheckBox: " + command.action.name()); } return null; }
/** * Check the CheckBox * @throws VerificationException if the element doesn't exist */ @Override @PublicAtsApi public void check() { new SwingElementState(this).waitToBecomeExisting(); ((JCheckBoxFixture) SwingElementLocator.findFixture(this)).check(); }
@Test public void checkShowHideRows() throws Exception { checkExample(ShowHideRowsRealWorldExample1.class); // Hide Address frame().checkBox("Address").uncheck(); checkSnapshot("after-1-hide-address"); // Hide Preferences frame().checkBox("Preferences").uncheck(); checkSnapshot("after-2-hide-preferences"); // Show Address frame().checkBox("Address").check(); checkSnapshot("after-3-show-address"); // Show Preferences frame().checkBox("Preferences").check(); checkSnapshot("after-4-show-preferences"); }
} else if (componentClass.equals(JCheckBox.class)) { return (ComponentFixture<? extends Component>) new JCheckBoxFixture(containerFixture.robot, (JCheckBox) findElement(uiElement)); } else if (componentClass.equals(JToggleButton.class)) {
/** * @return if the ChechBox is checked or not * @throws VerificationException if the element doesn't exist */ @Override @PublicAtsApi public boolean isChecked() { new SwingElementState(this).waitToBecomeExisting(); return ((JCheckBoxFixture) SwingElementLocator.findFixture(this)).component().isSelected(); }
@Test @Ignore(value = "Issue in maven compilation :(") public void displaySimpleJob() throws Exception { createDialog(JOB_WITH_GOOD_PARAMS); // assertEquals("This build requires parameters", uispecDialog.getTitle()); dialogFixture.checkBox("integrationTest").requireSelected(); String[] contents = dialogFixture.comboBox() .requireItemCount(4) .requireSelection("development") .contents(); assertTrue(Arrays.equals(new String[]{"development", "integration", "acceptance", "production"}, contents)); dialogFixture.textBox(JTextComponentMatcher.any()).requireText(""); dialogFixture.button(JButtonMatcher.withText("OK")).requireEnabled(); }
@Test public void checkShowHideRowGroups() throws Exception { checkExample(ShowHideRowsRealWorldExample2.class); // Hide Address frame().checkBox("Address").uncheck(); checkSnapshot("after-1-hide-address"); // Hide Preferences frame().checkBox("Preferences").uncheck(); checkSnapshot("after-2-hide-preferences"); // Show Address frame().checkBox("Address").check(); checkSnapshot("after-3-show-address"); // Show Preferences frame().checkBox("Preferences").check(); checkSnapshot("after-4-show-preferences"); }
@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")); }