当前位置: 首页>>代码示例>>Java>>正文


Java JButtonFixture.click方法代码示例

本文整理汇总了Java中org.fest.swing.fixture.JButtonFixture.click方法的典型用法代码示例。如果您正苦于以下问题:Java JButtonFixture.click方法的具体用法?Java JButtonFixture.click怎么用?Java JButtonFixture.click使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.fest.swing.fixture.JButtonFixture的用法示例。


在下文中一共展示了JButtonFixture.click方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: popdownButtonTortureTest

import org.fest.swing.fixture.JButtonFixture; //导入方法依赖的package包/类
@GUITest
@Test
public void popdownButtonTortureTest() {
  window.textBox("searchField").enterText("calf");
  window.button("searchButton").click();
  window.label("statusLabel").requireText(overviewFor("calf"));
  // triggers Noun RelationTypeComboBox to show JPopupMenu
  final JButtonFixture nounButton = window.button("RelationTypeComboBox::Noun");
  nounButton.click();
  final JPopupMenu popupMenu = nounButton.component().getComponentPopupMenu();
  final JPopupMenuFixture popup = new JPopupMenuFixture(window.robot, popupMenu);
  popup.requireVisible();
  nounButton.click();
  popup.requireNotVisible();
  nounButton.pressAndReleaseKeys(KeyEvent.VK_ENTER);
  popup.requireVisible();
  nounButton.click(); // 1
  nounButton.pressAndReleaseKeys(KeyEvent.VK_SPACE); // 2
  nounButton.click(); // 3
  nounButton.pressAndReleaseKeys(KeyEvent.VK_ENTER); // 4
  nounButton.click(); // 5
  // odd number of "clicks" should leave popup not visible
  popup.requireNotVisible();
}
 
开发者ID:nezda,项目名称:yawni,代码行数:25,代码来源:BrowserFESTTest.java

示例2: hyponymsThenNoMatchTest

import org.fest.swing.fixture.JButtonFixture; //导入方法依赖的package包/类
@GUITest
  @Test
  public void hyponymsThenNoMatchTest() {
    final JTextComponentFixture searchField = window.textBox("searchField");
    searchField.enterText("kid").pressAndReleaseKeys(KeyEvent.VK_ENTER);
    final JButtonFixture nounButton = window.button("RelationTypeComboBox::Noun");
    nounButton.click();
    final JPopupMenu popupMenu = nounButton.component().getComponentPopupMenu();
    final JPopupMenuFixture popup = new JPopupMenuFixture(window.robot, popupMenu);
//    popup.menuItemWithPath("Hypernyms (kid is a kind of...)").click();

    // key stroke goes to popup
    window.robot.type('h');
    window.robot.type('y');
    window.robot.type('p');
    window.robot.type('e');
    window.robot.pressAndReleaseKeys(KeyEvent.VK_ENTER);
    
    searchField.enterText("performant").pressAndReleaseKeys(KeyEvent.VK_ENTER);
    window.label("statusLabel").requireText("No matches found.");
    searchField.enterText("").pressAndReleaseKeys(KeyEvent.VK_ENTER);
//    searchField.enterText(" ").pressAndReleaseKeys(KeyEvent.VK_ENTER);
    window.label("statusLabel").requireText("No matches found.");
//    window.label("statusLabel").requireText("Enter search word and press return");
  }
 
开发者ID:nezda,项目名称:yawni,代码行数:26,代码来源:BrowserFESTTest.java

示例3: createNew

import org.fest.swing.fixture.JButtonFixture; //导入方法依赖的package包/类
public AvdEditWizardFixture createNew() {
  JButton newAvdButton = findButtonByText("Create Virtual Device...");
  final JButtonFixture button = new JButtonFixture(robot(), newAvdButton);
  button.requireEnabled();
  button.requireVisible();
  button.click();
  return AvdEditWizardFixture.find(robot());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:AvdManagerDialogFixture.java

示例4: click

import org.fest.swing.fixture.JButtonFixture; //导入方法依赖的package包/类
private void click() throws ClassNotFoundException {
  final Class<?> comboBoxButtonClass = getClass().getClassLoader().loadClass(ComboBoxAction.class.getCanonicalName() + "$ComboBoxButton");
  final ActionButtonFixture runButton = projectFrame.findRunApplicationButton();

  Container actionToolbarContainer = execute(new GuiQuery<Container>() {
    @Override
    protected Container executeInEDT() throws Throwable {
      return runButton.target().getParent();
    }
  });
  assertNotNull(actionToolbarContainer);

  JButton comboBoxButton = robot.finder().find(actionToolbarContainer, new GenericTypeMatcher<JButton>(JButton.class) {
    @Override
    protected boolean isMatching(@NotNull JButton component) {
      return comboBoxButtonClass.isInstance(component);
    }
  });

  final JButtonFixture comboBoxButtonFixture = new JButtonFixture(robot, comboBoxButton);
  pause(new Condition("Wait until comboBoxButton is enabled") {
    @Override
    public boolean test() {
      //noinspection ConstantConditions
      return execute(new GuiQuery<Boolean>() {
        @Override
        protected Boolean executeInEDT() throws Throwable {
          return comboBoxButtonFixture.target().isEnabled();
        }
      });
    }
  }, SHORT_TIMEOUT);
  comboBoxButtonFixture.click();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:ComboBoxActionFixture.java

示例5: testShowHideLog

import org.fest.swing.fixture.JButtonFixture; //导入方法依赖的package包/类
@Test
public void testShowHideLog() {
    FrameFixture console = createConsole(true);
    try {
        JButtonFixture showHideButton = console.button(LogShowHideComponent.class.getSimpleName());
        try {
            console.scrollPane(LogDisplayComponent.class.getSimpleName());
            showHideButton.click();
            try {
                console.scrollPane(LogDisplayComponent.class.getSimpleName());
                fail("ShowHide scroll pane should now be hidden.");
            } catch (ComponentLookupException e3) {
                showHideButton.click();
                try {
                    console.scrollPane(LogDisplayComponent.class.getSimpleName());
                    assertTrue("Successfully toggling visibility", true);
                } catch (ComponentLookupException e4) {
                    fail("ShowHide scroll pane should now be visible.");
                }
            }
        } catch (ComponentLookupException e2) {
            fail("ShowHide scroll pane should not be hidden at first.");
        }
    } catch (ComponentLookupException e1) {
        fail("ShowHide button is missing.");
    }
}
 
开发者ID:Elegie,项目名称:luchess,代码行数:28,代码来源:ConsoleTest.java

示例6: testStartStopServer

import org.fest.swing.fixture.JButtonFixture; //导入方法依赖的package包/类
@Test
public void testStartStopServer() {
    FrameFixture console = createConsole(true);
    JButtonFixture startStopButton = console.button(WebAppStartStopComponent.class.getSimpleName());
    JScrollPaneFixture logViewContainer = console.scrollPane(LogDisplayComponent.class.getSimpleName());
    JTextArea logViewArea = (JTextArea) logViewContainer.component().getViewport().getView();
    assertFalse(serverService.isStarted());
    assertTrue(serverService.isStopped());
    assertTrue(logViewArea.getText().isEmpty());
    startStopButton.click();
    assertTrue(serverService.isStarted());
    assertFalse(serverService.isStopped());
    assertTrue(logViewArea.getText().contains(ServerServiceHelper.STARTED));
    assertTrue(logViewArea.getText().contains(WebAppServiceHelper.CONTEXT_PATH));
    startStopButton.click();
    assertFalse(serverService.isStarted());
    assertTrue(serverService.isStopped());
    assertTrue(logViewArea.getText().contains(ServerServiceHelper.STOPPED));

    serverService.setExceptionOnStart(true);
    String textStopped = startStopButton.component().getText();
    startStopButton.click();
    assertFalse(serverService.isStarted());
    assertTrue(serverService.isStopped());
    assertEquals(textStopped, startStopButton.component().getText());
    serverService.setExceptionOnStart(false);

    serverService.setExceptionOnStop(true);
    startStopButton.click();
    String textStarted = startStopButton.component().getText();
    startStopButton.click();
    assertTrue(serverService.isStarted());
    assertFalse(serverService.isStopped());
    assertEquals(textStarted, startStopButton.component().getText());
    serverService.setExceptionOnStop(false);
    startStopButton.click();
    assertEquals(textStopped, startStopButton.component().getText());
}
 
开发者ID:Elegie,项目名称:luchess,代码行数:39,代码来源:ConsoleTest.java

示例7: testSyncMissingAppCompat

import org.fest.swing.fixture.JButtonFixture; //导入方法依赖的package包/类
@Test @IdeGuiTest
public void testSyncMissingAppCompat() throws IOException {
  if (myAndroidRepoPath.isDirectory()) {
    // Instead of deleting the Android repo folder, we rename it and later on restore it in a @SetUp method, so if this fails, the SDK
    // will be in good state.
    delete(myAndroidRepoTempPath);
    rename(myAndroidRepoPath, myAndroidRepoTempPath);
  }
  assertThat(myAndroidRepoPath).doesNotExist();

  IdeFrameFixture projectFrame = importSimpleApplication();

  projectFrame.requestProjectSync().waitForGradleProjectSyncToFinish();

  MessageFixture message =
    projectFrame.getMessagesToolWindow().getGradleSyncContent().findMessage(ERROR, firstLineStartingWith("Failed to resolve:"));

  HyperlinkFixture hyperlink = message.findHyperlink("Install Repository and sync project");
  hyperlink.clickAndContinue();

  // TODO implement a proper "SDK Quick Fix wizard" fixture that wraps a SdkQuickfixWizard
  DialogFixture quickFixDialog = findDialog(new GenericTypeMatcher<Dialog>(Dialog.class) {
    @Override
    protected boolean isMatching(@NotNull Dialog dialog) {
      return "Install Missing Components".equals(dialog.getTitle());
    }
  }).withTimeout(SHORT_TIMEOUT.duration()).using(myRobot);

  final JButtonFixture finish = quickFixDialog.button(withText("Finish"));

  // Wait until installation is finished. By then the "Finish" button will be enabled.
  pause(new Condition("Android Support Repository is installed") {
    @Override
    public boolean test() {
      //noinspection ConstantConditions
      return execute(new GuiQuery<Boolean>() {
        @Override
        protected Boolean executeInEDT() {
          return finish.target().isEnabled();
        }
      });
    }
  }, LONG_TIMEOUT);

  // Installation finished. Click finish to resync project.
  finish.click();

  projectFrame.waitForGradleProjectSyncToFinish().waitForBackgroundTasksToFinish();

  assertThat(myAndroidRepoPath).as("Android Support Repository must have been reinstalled").isDirectory();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:52,代码来源:GradleSyncTest.java

示例8: testDownloadSdkSource

import org.fest.swing.fixture.JButtonFixture; //导入方法依赖的package包/类
@Test @IdeGuiTest
public void testDownloadSdkSource() throws IOException {
  if (mySdk == null) {
    printPlatformNotFound();
    skip("testDownloadSdkSource");
    return;
  }

  if (mySdkSourcePath.isDirectory()) {
    delete(mySdkSourceTmpPath);
    rename(mySdkSourcePath, mySdkSourceTmpPath);
  }
  updateSdkSourceRoot(mySdk);

  IdeFrameFixture projectFrame = importSimpleApplication();
  final EditorFixture editor = projectFrame.getEditor();

  final VirtualFile classFile = findActivityClassFile();
  editor.open(classFile, EditorFixture.Tab.EDITOR);

  acceptLegalNoticeIfNeeded();

  // Download the source.
  findNotificationPanel(projectFrame).performAction("Download");

  DialogFixture downloadDialog = findDialog(withTitle("SDK Quickfix Installation")).withTimeout(SHORT_TIMEOUT.duration()).using(myRobot);
  final JButtonFixture finish = downloadDialog.button(withText("Finish"));

  // Wait until installation is finished. By then the "Finish" button will be enabled.
  pause(new Condition("Android source is installed") {
    @Override
    public boolean test() {
      return finish.isEnabled();
    }
  });
  finish.click();

  pause(new Condition("Source file is opened") {
    @Override
    public boolean test() {
      return !classFile.equals(editor.getCurrentFile());
    }
  }, SHORT_TIMEOUT);

  VirtualFile sourceFile = editor.getCurrentFile();
  assertNotNull(sourceFile);
  assertIsActivityJavaFile(sourceFile);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:49,代码来源:AndroidSdkSourceAttachTest.java


注:本文中的org.fest.swing.fixture.JButtonFixture.click方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。