예제 #1
0
  @Test
  public void shouldOpenFileAndShowItsContent() {

    String PATH = "something.txt";

    frame.setProvider(ip);
    collector.decorate = false;

    frame.setModelProcessor(
        new ModelProcessor() {

          @Override
          public String asUrlString(Model model) {
            return "" + model.ocurrencesOf(111) + ";" + model.ocurrencesOf(222);
          }
        });

    window.menuItemWithPath("File", "Open").click().robot.waitForIdle();
    robot().waitForIdle();

    JFileChooserFixture fc = window.fileChooser("open");
    fc.selectFile(new File(PATH));
    fc.approve();
    robot().waitForIdle();

    assertEquals("2.0;1.0", frame.output.getResult());
  }
  public void selectNameSpace(String nameSpace) {
    JTabbedPaneFixture combinedVarPanelTabbedPane = focusedWindow.tabbedPane("CombinedVarPanel");
    combinedVarPanelTabbedPane.selectTab("Name Space");
    JTreeFixture tree = focusedWindow.tree();

    tree.doubleClickPath(nameSpace);
  }
예제 #3
0
 @Test
 @InstallFile("samples/silverpeas/silverpeas.xml")
 public void testSilverpeas() throws Exception {
   languageDialog.initLangPack();
   installerFrameFixture =
       HelperTestMethod.prepareFrameFixture(installerFrame, installerController);
   installerFrameFixture.button(GuiId.BUTTON_NEXT.id).click();
   installerFrameFixture.requireVisible();
 }
예제 #4
0
  @Test
  @InstallFile("samples/substanceLaf/substanceLaf.xml")
  public void testSubstanceLaf() throws Exception {
    languageDialog.initLangPack();
    installerFrameFixture =
        HelperTestMethod.prepareFrameFixture(installerFrame, installerController);

    // Hello panel
    installerFrameFixture.button(GuiId.BUTTON_NEXT.id).click();
    installerFrameFixture.requireVisible();
    // Finish panel
  }
  public void closeAllGraphArrayWindows() {
    while (true) {
      NthGraphArrayWindowMatcher matcher = new NthGraphArrayWindowMatcher(0);
      FrameFixture window = getWindowIfItExists(matcher);
      if (window == null) {
        return;
      }

      window.moveToFront();
      window.focus();
      window.close();
    }
  }
예제 #6
0
 @After
 public void tearBinding() throws NoSuchFieldException, IllegalAccessException {
   if (installerFrameFixture != null) {
     installerFrameFixture.cleanUp();
     installerFrameFixture = null;
   }
 }
 public void focusNthGraphArrayWindow(int n) {
   NthGraphArrayWindowMatcher matcher = new NthGraphArrayWindowMatcher(n);
   FrameFinder findFrame = WindowFinder.findFrame(matcher);
   FrameFixture frameFixture = findFrame.using(focusedWindow.robot);
   focusedWindow = frameFixture;
   focusedWindow.focus();
 }
예제 #8
0
  @Before
  public void setUp() throws PatrimonioException, SQLException {
    robot = BasicRobot.robotWithNewAwtHierarchy();
    robot.settings().delayBetweenEvents(5);

    window = new FrameFixture(robot, new Main2());
    window.show(new Dimension(900, 500)); // shows the frame to test

    sala = new Sala("code", "Sala para testes de aceitacao", "123");
    SalaDAO.getInstance().incluir(sala);

    index = SalaDAO.getInstance().buscarTodos().size() - 1;

    window.button("Sala").click();
    dialog = window.dialog("SalaView");
  }
예제 #9
0
  @Test
  @InstallFile("samples/helloAndFinish.xml")
  public void testHelloAndFinishPanels() throws Exception {
    Image image = icons.get("JFrameIcon").getImage();
    assertThat(image, IsNull.<Object>notNullValue());

    languageDialog.initLangPack();
    installerFrameFixture =
        HelperTestMethod.prepareFrameFixture(installerFrame, installerController);

    // Hello panel
    //        installerFrameFixture.requireSize(new Dimension(640, 480));
    installerFrameFixture.button(GuiId.BUTTON_NEXT.id).click();
    installerFrameFixture.requireVisible();
    // Finish panel
  }
  public void selectVariableInOpenTab(String variableNameEndsWith) {
    JSpinnerNameEndsWithMatcher matcher = new JSpinnerNameEndsWithMatcher(variableNameEndsWith);

    // Focusing the spinner seems to do the trick, though this seems hackish and brittle.

    JSpinnerFixture spinner = focusedWindow.spinner(matcher);
    spinner.focus();
  }
  public void clickOnUnusedEntryBox() {
    JPanelFixture unusedEntryBox = focusedWindow.panel("UNUSED");
    unusedEntryBox.click();

    LabelTextMatcher matcher = new LabelTextMatcher("UNUSED");
    JLabelFixture label = unusedEntryBox.label(matcher);
    label.click();
  }
  private JPanelFixture getPanelIfItExists(GenericTypeMatcher<JPanel> matcher) {
    try {
      return focusedWindow.panel(matcher);
    } catch (ComponentLookupException e) {
    }

    return null;
  }
예제 #13
0
  // @Before
  public void setUp() throws Exception {
    EgoNet client = new EgoNet();

    Frame f = new java.awt.Frame();
    EgoFrame of = client.getFrame();
    of.show();
    f.add(of);
    window = new FrameFixture(f);
    window.show(); // shows the frame to test
  }
  public void removeNthEntryBox(int n) {
    NthEntryBoxMatcher matcher = new NthEntryBoxMatcher(n);
    JPanelFixture entryBoxPanel = focusedWindow.panel(matcher);
    entryBoxPanel.rightClick();

    JPopupMenuFixture popupMenu =
        new JPopupMenuFixture(entryBoxPanel.robot, entryBoxPanel.showPopupMenu().target);
    MenuItemTextTypeMatcher textMatcher = new MenuItemTextTypeMatcher("Delete Entry Box");
    popupMenu.menuItem(textMatcher).click();
  }
  public void selectVariableAndSetValueInSearchTab(String variableNameEndsWith, double value) {
    JPanelFixture searchPanel = focusedWindow.panel("SearchPanel");
    JPanelFixture searchVarListVarPanel = searchPanel.panel("Search");

    JSpinnerNameEndsWithMatcher matcher = new JSpinnerNameEndsWithMatcher(variableNameEndsWith);

    JSpinnerFixture spinner = searchVarListVarPanel.spinner(matcher);

    spinner.click();
    spinner.enterTextAndCommit(String.valueOf(value));
  }
  public void selectVariableInSearchTab(String variableNameEndsWith) {
    JPanelFixture searchPanel = focusedWindow.panel("SearchPanel");
    JPanelFixture searchVarListVarPanel = searchPanel.panel("Search");

    JSpinnerNameEndsWithMatcher matcher = new JSpinnerNameEndsWithMatcher(variableNameEndsWith);

    // Focusing the spinner seems to do the trick, though this seems hackish and brittle.

    JSpinnerFixture spinner = searchVarListVarPanel.spinner(matcher);
    spinner.focus();
  }
  public void removeVariableFromNthGraph(String variableName, int nThToFind) {
    NthYoGraphMatcher matcher = new NthYoGraphMatcher(nThToFind);

    JPanelFixture panel = focusedWindow.panel(matcher);
    panel.rightClick();

    JPopupMenuFixture popupMenu = new JPopupMenuFixture(panel.robot, panel.showPopupMenu().target);

    MenuItemTextTypeMatcher textMatcher = new MenuItemTextTypeMatcher("Remove " + variableName);
    popupMenu.menuItem(textMatcher).click();
  }
예제 #18
0
 @Override
 protected void onSetUp() {
   frame =
       GuiActionRunner.execute(
           new GuiQuery<UI>() {
             @Override
             protected UI executeInEDT() {
               return new UI(collector);
             }
           });
   window = new FrameFixture(robot(), frame);
   window.show();
 }
예제 #19
0
  @Test
  public void fullStudyDesign() throws Exception {
    Assert.assertTrue("Location must exist: " + location, new File(location).exists());

    window.menuItemWithPath("File", "New Study").click();
    JFileChooserFixture fileChooser = JFileChooserFinder.findFileChooser().using(window.robot);
    fileChooser.fileNameTextBox().enterText(location + "/" + studyName);
    fileChooser.approve();

    window.textBox("study_num_alters_field").deleteText().enterText("15");
    window.radioButton("btnAlterModelRandomSubset").click();
    window.textBox("txtAlterModelRandomSubset").deleteText().enterText("5");

    JTabbedPaneFixture tabs = window.tabbedPane();

    // ego questions
    tabs.selectTab("Ego");
    window.robot.waitForIdle(); // there's some funky creation going on here
    AuthoringQuestionPanel egoPanel0 = findQPanel(window.robot.finder(), QuestionType.EGO);
    JPanelFixture egoPanel = new JPanelFixture(window.robot, egoPanel0);

    createPlainQuestion(egoPanel, AnswerType.CATEGORICAL);
    createPlainQuestion(egoPanel, AnswerType.NUMERICAL);
    createPlainQuestion(egoPanel, AnswerType.TEXT);

    // alter prompt
    tabs.selectTab("Alter Prompt");
    PromptPanel alterpromptPanel0 = findPromptPanel(window.robot.finder());
    JPanelFixture altrerpromptPanel = new JPanelFixture(window.robot, alterpromptPanel0);

    createQuestionTitleQuestionCitation(altrerpromptPanel);

    // alter
    tabs.selectTab("Alter");
    AuthoringQuestionPanel alterPanel0 = findQPanel(window.robot.finder(), QuestionType.ALTER);
    JPanelFixture alterPanel = new JPanelFixture(window.robot, alterPanel0);

    createPlainQuestion(alterPanel, AnswerType.CATEGORICAL);
    createPlainQuestion(alterPanel, AnswerType.NUMERICAL);
    createPlainQuestion(alterPanel, AnswerType.TEXT);

    // alter pair
    tabs.selectTab("Alter Pair");
    window.robot.waitForIdle(); // there's some funky creation going on here
    AuthoringQuestionPanel alterPairPanel0 =
        findQPanel(window.robot.finder(), QuestionType.ALTER_PAIR);
    JPanelFixture alterPairPanel = new JPanelFixture(window.robot, alterPairPanel0);

    createPlainQuestion(alterPairPanel, AnswerType.CATEGORICAL, true);

    window.menuItemWithPath("File", "Quit").click();
    DialogFixture dialog =
        WindowFinder.findDialog(DialogByTitleMatcher.withTitle("Save Study Changes"))
            .withTimeout(5000)
            .using(window.robot);
    dialog.button(withText("Yes")).click();
  }
  public void findEntryBoxAndEnterValue(String name, double value) {
    JPanelFixture entryBoxArrayPanel = focusedWindow.panel("EntryBoxArrayPanel");
    JPanelFixture enumEntryBox = entryBoxArrayPanel.panel(name + "_YoEntryBox");
    JTextComponentFixture textBox = enumEntryBox.textBox();

    // For some reason deleting, and then entering doesn't seem to work. It only deletes part of the
    // text!?
    // Instead here we have to call setText.
    // textBox.deleteText();
    // textBox.enterText(Double.toString(value) + "\n");

    textBox.setText(Double.toString(value));
    textBox.enterText("\n");
    ThreadTools.sleep(500);
  }
  public SimulationGUITestFixture(final SimulationConstructionSet scs) {
    FailOnThreadViolationRepaintManager.install();

    this.scs = scs;

    JFrame frame =
        GuiActionRunner.execute(
            new GuiQuery<JFrame>() {
              protected JFrame executeInEDT() throws SimulationExceededMaximumTimeException {
                JFrame jFrame = scs.getJFrame();

                return jFrame;
              }
            });
    focusedWindow = new FrameFixture(frame);

    ThreadTools.sleep(1000);
    focusedWindow.focus();

    mainSCSWindow = focusedWindow;
  }
 @Override
 public JTableCellFixture findFixture(FrameFixture window, RowHandler rowHandler) {
   JTableFixture table = window.table(rowHandler.getText(1));
   return table.cell(
       row(Integer.valueOf(rowHandler.getText(2))).column(Integer.valueOf(rowHandler.getText(3))));
 }
예제 #23
0
 @Test
 public void testBactButton() {
   previewBoardFrame.button("Back").click();
 }
예제 #24
0
 @Test
 public void testDownloadCancelButton() {
   System.out.println("testopenDownloadDialog");
   mFrame.button("btnDownloadData").click().requireEnabled();
   mFrame.dialog("dsDialog").button("canceliButton").click().requireEnabled();
 }
예제 #25
0
 // @After
 public void tearDown() {
   window.cleanUp();
 }
예제 #26
0
 protected void requireInformationMessage(String msg) {
   window.optionPane().requireInformationMessage().requireMessage(msg);
 }
예제 #27
0
 protected void clickYes() {
   window.optionPane().buttonWithText(YES).click();
 }
예제 #28
0
 protected void clickOk() {
   window.optionPane().buttonWithText(OK).click();
 }
예제 #29
0
 protected void clickNo() {
   window.optionPane().buttonWithText(NO).click();
 }
예제 #30
0
 protected void clickCancel() {
   window.optionPane().buttonWithText(CANCEL).click();
 }