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(); }
@PublicAtsApi public void rightClick( int rowIndex, String... contextMenuItems ) { new SwingElementState(this).waitToBecomeExisting(); JTreeFixture treeFixture = (JTreeFixture) SwingElementLocator.findFixture(this); JPopupMenuFixture popUpMenu = treeFixture.showPopupMenuAt(rowIndex); popUpMenu.menuItemWithPath(contextMenuItems).click(); }
@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(); }
/** * 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); }
@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"); }
/** * * @param contextMenuItems context menu items to select */ @PublicAtsApi public void rightClick( String... contextMenuItems ) { new SwingElementState(this).waitToBecomeExisting(); JListFixture listFixture = ((JListFixture) SwingElementLocator.findFixture(this)); JPopupMenuFixture popUpMenu = listFixture.showPopupMenu(); popUpMenu.menuItemWithPath(contextMenuItems).click(); }
@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"); }
/** * Click {@link MenuItem} pop-up element by text (actually it's the 'label' attribute value) * * @param menuItemText {@link MenuItem} text/label */ @PublicAtsApi public void clickMenuItemByText( String... menuItemText ) { new SwingElementState(this).waitToBecomeExisting(); ((JPopupMenuFixture) SwingElementLocator.findFixture(this)).menuItemWithPath(menuItemText) .click(); }
private boolean findRowByCriteria(JTableFixture tFixture, TableCommandRequest tcommand, int i, int totalFound) { for(TableCommandRequestQueryCriteria criterion: tcommand.query.criteria){ JTableCellFixture cell = tFixture.cell(TableCellByColumnId.row(i).columnId(criterion.lookupCol)); if (cell.value().equals(criterion.lookupValue)) { totalFound++; } if(totalFound == tcommand.query.criteria.size()){ return true; } } return false; }
@Test public void unsupportedParams() throws Exception { createDialog(JOB_WITH_UNSUPPORTED_PARAMS); dialogFixture.label(JLabelMatcher.withName("run")) .requireText("RunParameterDefinition is unsupported."); dialogFixture.button(JButtonMatcher.withText("OK")).requireDisabled(); }
private void createDialog(final Job job) { BuildParamDialog buildParamDialog = GuiActionRunner.execute(new GuiQuery<BuildParamDialog>() { protected BuildParamDialog executeInEDT() { return new BuildParamDialog(job, configuration, requestManager, callbackRun); } }); dialogFixture = new DialogFixture(buildParamDialog); dialogFixture.show(); }
/** * Click {@link MenuItem} pop-up element by its 'name' attribute value * * @param menuItemName {@link MenuItem} name attribute value */ @PublicAtsApi public void clickMenuItemByName( String menuItemName ) { new SwingElementState(this).waitToBecomeExisting(); ((JPopupMenuFixture) SwingElementLocator.findFixture(this)).menuItem(menuItemName).click(); }
/** * Set value in the 'File Name' text field * * @param value the text value to set */ @Override @PublicAtsApi public void setValue( String value ) { new SwingElementState(this).waitToBecomeExisting(); ((JFileChooserFixture) SwingElementLocator.findFixture(this)).fileNameTextBox().setText(value); }
/** * Get the value of the 'File Name' text field * * @return the text value of the 'File Name' text field */ @Override @PublicAtsApi public String getValue() { new SwingElementState(this).waitToBecomeExisting(); return ((JFileChooserFixture) SwingElementLocator.findFixture(this)).fileNameTextBox().text(); }
@Override protected Integer executeInEDT() throws Throwable { return tableFixture.component().getColumnCount(); }
@PublicAtsApi public void rightClick( String[] path, String... contextMenuItems ) { new SwingElementState(this).waitToBecomeExisting(); JTreeFixture treeFixture = (JTreeFixture) SwingElementLocator.findFixture(this); expandTree(treeFixture, path); // sometimes it is necessary JPopupMenuFixture popUpMenu = treeFixture.showPopupMenuAt(buildPath(path)); popUpMenu.menuItemWithPath(contextMenuItems).click(); }
@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 public void unknowParams() throws Exception { createDialog(JOB_WITH_UNKNOWN_PARAMS); dialogFixture.label(JLabelMatcher.withName("run")) .requireText("Unkown parameter"); dialogFixture.button(JButtonMatcher.withText("OK")).requireDisabled(); } }