/** * Get ComboBox available values * * @return {@link String} array with all the available values * @throws VerificationException if the element doesn't exist */ @PublicAtsApi public String[] getAvailableValues() { new SwingElementState(this).waitToBecomeExisting(); return ((JComboBoxFixture) SwingElementLocator.findFixture(this)).contents(); }
/** * Set ComboBox value * @param value the ComboBox value to set * @throws VerificationException if the element doesn't exist */ @SuppressWarnings( "unchecked") @Override @PublicAtsApi public void setValue( String value ) { new SwingElementState(this).waitToBecomeExisting(); JComboBoxFixture comboBoxFixture = null; try { comboBoxFixture = ((JComboBoxFixture) SwingElementLocator.findFixture(this)); comboBoxFixture.selectItem(value); } catch (LocationUnavailableException lue) { // an element matching the given text cannot be found // if the element is editable we'll enter the new value if (comboBoxFixture != null && comboBoxFixture.component().isEditable()) { try { comboBoxFixture.component().addItem(value); comboBoxFixture.selectItem(value); } catch (LocationUnavailableException e) { throw new UiElementException(e.getMessage(), this); } } else { throw new UiElementException(lue.getMessage(), this); } } }
@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 @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")); }
/** * Get ComboBox value * @throws VerificationException if the element doesn't exist */ @Override @PublicAtsApi public String getValue() { new SwingElementState(this).waitToBecomeExisting(); return ((JComboBoxFixture) SwingElementLocator.findFixture(this)).component() .getSelectedItem() .toString(); }
} else if (componentClass.equals(JComboBox.class)) { return (ComponentFixture<? extends Component>) new JComboBoxFixture(containerFixture.robot, (JComboBox) findElement(uiElement)); } else if (componentClass.equals(JRadioButton.class)) {
/** * Basic test showing usage of FEST and checking combo box */ @Test public void testChromoBoxContents() throws Exception { String[] chromos = frame.comboBox("chromosomeComboBox").contents(); assertEquals(26, chromos.length); }
/** * Basic test showing usage of FEST and checking combo box * * @throws Exception */ //@Test public void scratchTestFEST() throws Exception { FrameFixture frame = new FrameFixture(IGV.getMainFrame()); JPanelFixture contentFixture = frame.panel("contentPane"); JPanelFixture commandBar = frame.panel("igvCommandBar"); JComboBoxFixture chromoBox = frame.comboBox("chromosomeComboBox"); String[] chromos = commandBar.comboBox("chromosomeComboBox").contents(); Assert.assertEquals(26, chromos.length); }