Search in sources :

Example 21 with JTabbedPaneFixture

use of org.fest.swing.fixture.JTabbedPaneFixture in project beast2 by CompEvol.

the class LinkUnlinkTest method linkSiteModelsAndDeleteTest.

@Test
public void linkSiteModelsAndDeleteTest() throws Exception {
    warning("Load gopher data 26.nex, 47.nex, 59.nex");
    importAlignment("examples/nexus", new File("26.nex"), new File("47.nex"), new File("59.nex"));
    JTabbedPaneFixture f = beautiFrame.tabbedPane();
    printBeautiState(f);
    assertStateEquals("Tree.t:26", "birthRate.t:26", "Tree.t:47", "clockRate.c:47", "birthRate.t:47", "Tree.t:59", "clockRate.c:59", "birthRate.t:59");
    assertOperatorsEqual("YuleBirthRateScaler.t:26", "YuleModelTreeScaler.t:26", "YuleModelTreeRootScaler.t:26", "YuleModelUniformOperator.t:26", "YuleModelSubtreeSlide.t:26", "YuleModelNarrow.t:26", "YuleModelWide.t:26", "YuleModelWilsonBalding.t:26", "StrictClockRateScaler.c:47", "YuleBirthRateScaler.t:47", "YuleModelTreeScaler.t:47", "YuleModelTreeRootScaler.t:47", "YuleModelUniformOperator.t:47", "YuleModelSubtreeSlide.t:47", "YuleModelNarrow.t:47", "YuleModelWide.t:47", "YuleModelWilsonBalding.t:47", "strictClockUpDownOperator.c:47", "StrictClockRateScaler.c:59", "YuleBirthRateScaler.t:59", "YuleModelTreeScaler.t:59", "YuleModelTreeRootScaler.t:59", "YuleModelUniformOperator.t:59", "YuleModelSubtreeSlide.t:59", "YuleModelNarrow.t:59", "YuleModelWide.t:59", "YuleModelWilsonBalding.t:59", "strictClockUpDownOperator.c:59");
    assertPriorsEqual("YuleModel.t:26", "YuleBirthRatePrior.t:26", "YuleModel.t:47", "ClockPrior.c:47", "YuleBirthRatePrior.t:47", "YuleModel.t:59", "ClockPrior.c:59", "YuleBirthRatePrior.t:59");
    assertTraceLogEqual("posterior", "likelihood", "prior", "treeLikelihood.26", "TreeHeight.t:26", "YuleModel.t:26", "birthRate.t:26", "treeLikelihood.47", "TreeHeight.t:47", "clockRate.c:47", "YuleModel.t:47", "birthRate.t:47", "treeLikelihood.59", "TreeHeight.t:59", "clockRate.c:59", "YuleModel.t:59", "birthRate.t:59");
    assertParameterCountInPriorIs(5);
    selectRows(0, 1, 2);
    warning("Link trees");
    f.selectTab("Partitions");
    beautiFrame.button("Link Trees").click();
    printBeautiState(f);
    assertParameterCountInPriorIs(3);
    f.selectTab("Site Model");
    JComboBoxFixture substModel = beautiFrame.comboBox("substModel");
    substModel.selectItem("HKY");
    assertParameterCountInPriorIs(6);
    f.selectTab("Partitions");
    warning("Link site models");
    selectRows(0, 1, 2);
    beautiFrame.button("Link Site Models").click();
    printBeautiState(f);
    assertParameterCountInPriorIs(6);
    beautiFrame.button("Unlink Site Models").click();
    assertParameterCountInPriorIs(12);
    warning("Delete second partition");
    f.selectTab("Partitions");
    selectRows(1);
    beautiFrame.button("-").click();
    printBeautiState(f);
    assertParameterCountInPriorIs(8);
    warning("Delete first partition");
    f.selectTab("Partitions");
    selectRows(0, 1);
    beautiFrame.button("Link Clock Models").click();
    beautiFrame.table().selectCell(TableCell.row(0).column(1));
    beautiFrame.button("-").click();
    printBeautiState(f);
    assertPriorsEqual("YuleModel.t:26", "YuleBirthRatePrior.t:26", "KappaPrior.s:59");
    assertParameterCountInPriorIs(4);
    makeSureXMLParses();
}
Also used : JComboBoxFixture(org.fest.swing.fixture.JComboBoxFixture) File(java.io.File) JTabbedPaneFixture(org.fest.swing.fixture.JTabbedPaneFixture) Test(org.junit.Test)

Example 22 with JTabbedPaneFixture

use of org.fest.swing.fixture.JTabbedPaneFixture in project beast2 by CompEvol.

the class LinkUnlinkTest method linkTreesAndDeleteTest2b.

@Test
public void linkTreesAndDeleteTest2b() throws Exception {
    warning("Load gopher data 26.nex, 47.nex");
    importAlignment("examples/nexus", new File("26.nex"), new File("47.nex"));
    JTabbedPaneFixture f = beautiFrame.tabbedPane();
    printBeautiState(f);
    selectRows(1, 0);
    warning("Link trees");
    f.selectTab("Partitions");
    beautiFrame.button("Link Trees").click();
    printBeautiState(f);
    assertPriorsEqual("YuleModel.t:26", "YuleBirthRatePrior.t:26", "ClockPrior.c:47");
    warning("Delete first partition");
    f.selectTab("Partitions");
    beautiFrame.table().selectCell(TableCell.row(0).column(1));
    beautiFrame.button("-").click();
    printBeautiState(f);
    assertPriorsEqual("YuleModel.t:26", "YuleBirthRatePrior.t:26");
    makeSureXMLParses();
}
Also used : File(java.io.File) JTabbedPaneFixture(org.fest.swing.fixture.JTabbedPaneFixture) Test(org.junit.Test)

Example 23 with JTabbedPaneFixture

use of org.fest.swing.fixture.JTabbedPaneFixture in project beast2 by CompEvol.

the class LinkUnlinkTest method linkClocksSitesAndDeleteTest.

@Test
public void linkClocksSitesAndDeleteTest() throws Exception {
    warning("Load gopher data 26.nex, 47.nex, 59.nex");
    importAlignment("examples/nexus", new File("26.nex"), new File("47.nex"), new File("59.nex"));
    JTabbedPaneFixture f = beautiFrame.tabbedPane();
    printBeautiState(f);
    selectRows(0, 1, 2);
    warning("Link clocks");
    f.selectTab("Partitions");
    beautiFrame.button("Link Clock Models").click();
    warning("Link site models");
    f.selectTab("Partitions");
    beautiFrame.button("Link Site Models").click();
    printBeautiState(f);
    warning("Delete second partition");
    f.selectTab("Partitions");
    selectRows(1);
    beautiFrame.button("-").click();
    printBeautiState(f);
    assertPriorsEqual("YuleModel.t:26", "YuleBirthRatePrior.t:26", "YuleModel.t:59", "YuleBirthRatePrior.t:59");
    JTableFixture t = beautiFrame.table();
    Assertions.assertThat(t.target.getRowCount()).isEqualTo(2);
    makeSureXMLParses();
}
Also used : JTableFixture(org.fest.swing.fixture.JTableFixture) File(java.io.File) JTabbedPaneFixture(org.fest.swing.fixture.JTabbedPaneFixture) Test(org.junit.Test)

Example 24 with JTabbedPaneFixture

use of org.fest.swing.fixture.JTabbedPaneFixture in project beast2 by CompEvol.

the class SimpleTreePriorTest method simpleTreePriorTest.

/**
 * check the standard tree priors are there and result in correct behaviour *
 */
@Test
public void simpleTreePriorTest() throws Exception {
    warning("Load anolis.nex");
    importAlignment("examples/nexus", new File("anolis.nex"));
    JTabbedPaneFixture f = beautiFrame.tabbedPane();
    f.selectTab("Priors");
    warning("Change to Coalescent - constant population");
    beautiFrame.comboBox("TreeDistribution").selectItem("Coalescent Constant Population");
    printBeautiState(f);
    assertStateEquals("Tree.t:anolis", "popSize.t:anolis");
    assertOperatorsEqual("CoalescentConstantTreeScaler.t:anolis", "CoalescentConstantTreeRootScaler.t:anolis", "CoalescentConstantUniformOperator.t:anolis", "CoalescentConstantSubtreeSlide.t:anolis", "CoalescentConstantNarrow.t:anolis", "CoalescentConstantWide.t:anolis", "CoalescentConstantWilsonBalding.t:anolis", "PopSizeScaler.t:anolis");
    assertPriorsEqual("CoalescentConstant.t:anolis", "PopSizePrior.t:anolis");
    assertTraceLogEqual("posterior", "likelihood", "prior", "treeLikelihood.anolis", "TreeHeight.t:anolis", "popSize.t:anolis", "CoalescentConstant.t:anolis");
    warning("Change to Coalescent - exponential population");
    beautiFrame.comboBox("TreeDistribution").selectItem("Coalescent Exponential Population");
    printBeautiState(f);
    assertStateEquals("Tree.t:anolis", "ePopSize.t:anolis", "growthRate.t:anolis");
    assertOperatorsEqual("CoalescentExponentialTreeScaler.t:anolis", "CoalescentExponentialTreeRootScaler.t:anolis", "CoalescentExponentialUniformOperator.t:anolis", "CoalescentExponentialSubtreeSlide.t:anolis", "CoalescentExponentialNarrow.t:anolis", "CoalescentExponentialWide.t:anolis", "CoalescentExponentialWilsonBalding.t:anolis", "ePopSizeScaler.t:anolis", "GrowthRateRandomWalk.t:anolis");
    assertPriorsEqual("CoalescentExponential.t:anolis", "ePopSizePrior.t:anolis", "GrowthRatePrior.t:anolis");
    assertTraceLogEqual("posterior", "likelihood", "prior", "treeLikelihood.anolis", "TreeHeight.t:anolis", "CoalescentExponential.t:anolis", "ePopSize.t:anolis", "growthRate.t:anolis");
    warning("Change to Coalescent - BPS");
    beautiFrame.comboBox("TreeDistribution").selectItem("Coalescent Bayesian Skyline");
    printBeautiState(f);
    assertStateEquals("Tree.t:anolis", "bPopSizes.t:anolis", "bGroupSizes.t:anolis");
    assertOperatorsEqual("BayesianSkylineTreeScaler.t:anolis", "BayesianSkylineTreeRootScaler.t:anolis", "BayesianSkylineUniformOperator.t:anolis", "BayesianSkylineSubtreeSlide.t:anolis", "BayesianSkylineNarrow.t:anolis", "BayesianSkylineWide.t:anolis", "BayesianSkylineWilsonBalding.t:anolis", "popSizesScaler.t:anolis", "groupSizesDelta.t:anolis");
    assertPriorsEqual("BayesianSkyline.t:anolis", "MarkovChainedPopSizes.t:anolis");
    assertTraceLogEqual("posterior", "likelihood", "prior", "treeLikelihood.anolis", "TreeHeight.t:anolis", "BayesianSkyline.t:anolis", "bPopSizes.t:anolis", "bGroupSizes.t:anolis");
    warning("Change to Yule");
    beautiFrame.comboBox("TreeDistribution").selectItem("Yule Model");
    printBeautiState(f);
    assertStateEquals("Tree.t:anolis", "birthRate.t:anolis");
    assertOperatorsEqual("YuleModelTreeScaler.t:anolis", "YuleModelTreeRootScaler.t:anolis", "YuleModelUniformOperator.t:anolis", "YuleModelSubtreeSlide.t:anolis", "YuleModelNarrow.t:anolis", "YuleModelWide.t:anolis", "YuleModelWilsonBalding.t:anolis", "YuleBirthRateScaler.t:anolis");
    assertPriorsEqual("YuleModel.t:anolis", "YuleBirthRatePrior.t:anolis");
    assertTraceLogEqual("posterior", "likelihood", "prior", "treeLikelihood.anolis", "TreeHeight.t:anolis", "YuleModel.t:anolis", "birthRate.t:anolis");
    warning("Change to Birth-Death");
    beautiFrame.comboBox("TreeDistribution").selectItem("Birth Death Model");
    printBeautiState(f);
    assertStateEquals("Tree.t:anolis", "BDBirthRate.t:anolis", "BDDeathRate.t:anolis");
    assertOperatorsEqual("BirthDeathTreeScaler.t:anolis", "BirthDeathTreeRootScaler.t:anolis", "BirthDeathUniformOperator.t:anolis", "BirthDeathSubtreeSlide.t:anolis", "BirthDeathNarrow.t:anolis", "BirthDeathWide.t:anolis", "BirthDeathWilsonBalding.t:anolis", "BirthRateScaler.t:anolis", "DeathRateScaler.t:anolis");
    assertPriorsEqual("BirthDeath.t:anolis", "BirthRatePrior.t:anolis", "DeathRatePrior.t:anolis");
    assertTraceLogEqual("posterior", "likelihood", "prior", "treeLikelihood.anolis", "TreeHeight.t:anolis", "BirthDeath.t:anolis", "BDBirthRate.t:anolis", "BDDeathRate.t:anolis");
    makeSureXMLParses();
}
Also used : File(java.io.File) JTabbedPaneFixture(org.fest.swing.fixture.JTabbedPaneFixture) Test(org.junit.Test)

Example 25 with JTabbedPaneFixture

use of org.fest.swing.fixture.JTabbedPaneFixture in project ats-framework by Axway.

the class SwingElementLocator method findFixture.

public static ComponentFixture<? extends Component> findFixture(UiElement uiElement) {
    SwingDriverInternal driver = (SwingDriverInternal) uiElement.getUiDriver();
    ContainerFixture<?> containerFixture = (ContainerFixture<?>) driver.getActiveContainerFixture();
    Class<? extends Component> componentClass = componentsMap.get(uiElement.getClass());
    try {
        if (componentClass.equals(JButton.class)) {
            return (ComponentFixture<? extends Component>) new JButtonFixture(containerFixture.robot, (JButton) findElement(uiElement));
        } else if (componentClass.equals(JTextComponent.class)) {
            return (ComponentFixture<? extends Component>) new JTextComponentFixture(containerFixture.robot, (JTextComponent) findElement(uiElement));
        } else if (componentClass.equals(JMenuItem.class)) {
            if (uiElement.getElementProperty("path") != null) {
                return containerFixture.menuItemWithPath(uiElement.getElementProperty("path").split("[\\,\\/]+"));
            } else {
                return (ComponentFixture<? extends Component>) new JMenuItemFixture(containerFixture.robot, (JMenuItem) findElement(uiElement));
            }
        } else if (componentClass.equals(JPopupMenu.class)) {
            return (ComponentFixture<? extends Component>) new JPopupMenuFixture(containerFixture.robot, (JPopupMenu) findElement(uiElement));
        } else if (componentClass.equals(JTree.class)) {
            return (ComponentFixture<? extends Component>) new JTreeFixture(containerFixture.robot, (JTree) findElement(uiElement));
        } else if (componentClass.equals(JList.class)) {
            return (ComponentFixture<? extends Component>) new JListFixture(containerFixture.robot, (JList) findElement(uiElement));
        } else if (componentClass.equals(JCheckBox.class)) {
            return (ComponentFixture<? extends Component>) new JCheckBoxFixture(containerFixture.robot, (JCheckBox) findElement(uiElement));
        } else if (componentClass.equals(JToggleButton.class)) {
            return (ComponentFixture<? extends Component>) new JToggleButtonFixture(containerFixture.robot, (JToggleButton) findElement(uiElement));
        } else if (componentClass.equals(JComboBox.class)) {
            return (ComponentFixture<? extends Component>) new JComboBoxFixture(containerFixture.robot, (JComboBox) findElement(uiElement));
        } else if (componentClass.equals(JRadioButton.class)) {
            return (ComponentFixture<? extends Component>) new JRadioButtonFixture(containerFixture.robot, (JRadioButton) findElement(uiElement));
        } else if (componentClass.equals(JTable.class)) {
            return (ComponentFixture<? extends Component>) new JTableFixture(containerFixture.robot, (JTable) findElement(uiElement));
        } else if (componentClass.equals(JSpinner.class)) {
            return (ComponentFixture<? extends Component>) new JSpinnerFixture(containerFixture.robot, (JSpinner) findElement(uiElement));
        } else if (componentClass.equals(JTabbedPane.class)) {
            return (ComponentFixture<? extends Component>) new JTabbedPaneFixture(containerFixture.robot, (JTabbedPane) findElement(uiElement));
        } else if (componentClass.equals(JOptionPane.class)) {
            return (ComponentFixture<? extends Component>) containerFixture.optionPane();
        } else if (componentClass.equals(JLabel.class)) {
            return (ComponentFixture<? extends Component>) new JLabelFixture(containerFixture.robot, (JLabel) findElement(uiElement));
        } else if (componentClass.equals(Component.class)) {
            return new ComponentFixture<Component>(containerFixture.robot, findElement(uiElement)) {
            };
        } else if (componentClass.equals(JFileChooser.class)) {
            // TODO - might be searched by name too
            return containerFixture.fileChooser(Timeout.timeout(UiEngineConfigurator.getInstance().getElementStateChangeDelay()));
        } else {
            throw new ElementNotFoundException(uiElement.toString() + " not found. No such Fixture");
        }
    } catch (ComponentLookupException cle) {
        throw new ElementNotFoundException(uiElement.toString() + " not found.", cle);
    } catch (WaitTimedOutError exc) {
        // thrown for OptionPane search, wait for Window (BasicRobot.waitForWindow), AbstractJTableCellWriter, JTreeDriver.waitForChildrenToShowUp, each Pause wait
        throw new ElementNotFoundException(uiElement.toString() + " not found.", exc);
    }
}
Also used : JTreeFixture(org.fest.swing.fixture.JTreeFixture) JRadioButton(javax.swing.JRadioButton) SwingDriverInternal(com.axway.ats.uiengine.internal.driver.SwingDriverInternal) JTabbedPane(javax.swing.JTabbedPane) JButton(javax.swing.JButton) JTextComponent(javax.swing.text.JTextComponent) JSpinnerFixture(org.fest.swing.fixture.JSpinnerFixture) ElementNotFoundException(com.axway.ats.uiengine.exceptions.ElementNotFoundException) ComponentLookupException(org.fest.swing.exception.ComponentLookupException) WaitTimedOutError(org.fest.swing.exception.WaitTimedOutError) JLabelFixture(org.fest.swing.fixture.JLabelFixture) JTabbedPaneFixture(org.fest.swing.fixture.JTabbedPaneFixture) JButtonFixture(org.fest.swing.fixture.JButtonFixture) JToggleButtonFixture(org.fest.swing.fixture.JToggleButtonFixture) JComboBoxFixture(org.fest.swing.fixture.JComboBoxFixture) JTableFixture(org.fest.swing.fixture.JTableFixture) JToggleButton(javax.swing.JToggleButton) JTextComponentFixture(org.fest.swing.fixture.JTextComponentFixture) ComponentFixture(org.fest.swing.fixture.ComponentFixture) JMenuItemFixture(org.fest.swing.fixture.JMenuItemFixture) Component(java.awt.Component) JTextComponent(javax.swing.text.JTextComponent) JMenuItem(javax.swing.JMenuItem) JTextComponentFixture(org.fest.swing.fixture.JTextComponentFixture) JRadioButtonFixture(org.fest.swing.fixture.JRadioButtonFixture) JComboBox(javax.swing.JComboBox) JLabel(javax.swing.JLabel) JOptionPane(javax.swing.JOptionPane) JPopupMenu(javax.swing.JPopupMenu) JCheckBox(javax.swing.JCheckBox) JTree(javax.swing.JTree) JPopupMenuFixture(org.fest.swing.fixture.JPopupMenuFixture) JListFixture(org.fest.swing.fixture.JListFixture) ContainerFixture(org.fest.swing.fixture.ContainerFixture) JTable(javax.swing.JTable) JSpinner(javax.swing.JSpinner) JCheckBoxFixture(org.fest.swing.fixture.JCheckBoxFixture) JList(javax.swing.JList)

Aggregations

JTabbedPaneFixture (org.fest.swing.fixture.JTabbedPaneFixture)27 File (java.io.File)23 Test (org.junit.Test)23 JTableFixture (org.fest.swing.fixture.JTableFixture)8 JComboBoxFixture (org.fest.swing.fixture.JComboBoxFixture)5 DeltaExchangeOperator (beast.evolution.operators.DeltaExchangeOperator)2 PublicAtsApi (com.axway.ats.common.PublicAtsApi)2 UiElementException (com.axway.ats.uiengine.exceptions.UiElementException)2 VerificationException (com.axway.ats.uiengine.exceptions.VerificationException)2 SwingElementState (com.axway.ats.uiengine.utilities.swing.SwingElementState)2 Component (java.awt.Component)2 JButtonFixture (org.fest.swing.fixture.JButtonFixture)2 JCheckBoxFixture (org.fest.swing.fixture.JCheckBoxFixture)2 JListFixture (org.fest.swing.fixture.JListFixture)2 JMenuItemFixture (org.fest.swing.fixture.JMenuItemFixture)2 JTextComponentFixture (org.fest.swing.fixture.JTextComponentFixture)2 UiElementProperties (com.axway.ats.uiengine.elements.UiElementProperties)1 ElementNotFoundException (com.axway.ats.uiengine.exceptions.ElementNotFoundException)1 SwingDriverInternal (com.axway.ats.uiengine.internal.driver.SwingDriverInternal)1 Dimension (java.awt.Dimension)1