use of org.fest.swing.timing.Condition in project intellij-community by JetBrains.
the class JBPopupFixture method findContextMenu.
public static JBPopupFixture findContextMenu(Robot robot) {
pause(new Condition("Find context menu") {
@Override
public boolean test() {
final JBPopupMenu contextMenu = robot.finder().findByType(JBPopupMenu.class);
return contextMenu != null;
}
}, SHORT_TIMEOUT);
final JBPopupMenu contextMenu = robot.finder().findByType(JBPopupMenu.class);
assertNotNull(contextMenu);
return new JBPopupFixture(contextMenu, robot);
}
use of org.fest.swing.timing.Condition in project intellij-community by JetBrains.
the class JDialogFixture method find.
@NotNull
public static JDialogFixture find(@NotNull Robot robot, String title, Timeout timeout) {
GenericTypeMatcher<JDialog> matcher = new GenericTypeMatcher<JDialog>(JDialog.class) {
@Override
protected boolean isMatching(@NotNull JDialog dialog) {
return title.equals(dialog.getTitle()) && dialog.isShowing();
}
};
Pause.pause(new Condition("Finding for JDialogFixture with title \"" + title + "\"") {
@Override
public boolean test() {
Collection<JDialog> dialogs = robot.finder().findAll(matcher);
return !dialogs.isEmpty();
}
}, timeout);
JDialog dialog = robot.finder().find(matcher);
return new JDialogFixture(robot, dialog);
}
use of org.fest.swing.timing.Condition in project intellij-community by JetBrains.
the class MenuFixture method findShowingPopupMenus.
@NotNull
private List<JPopupMenu> findShowingPopupMenus(final int expectedCount) {
final Ref<List<JPopupMenu>> ref = new Ref<List<JPopupMenu>>();
Pause.pause(new Condition("waiting for " + expectedCount + " JPopupMenus to show up") {
@Override
public boolean test() {
List<JPopupMenu> popupMenus = newArrayList(myRobot.finder().findAll(new GenericTypeMatcher<JPopupMenu>(JPopupMenu.class) {
@Override
protected boolean isMatching(@NotNull JPopupMenu popupMenu) {
return popupMenu.isShowing();
}
}));
boolean allFound = popupMenus.size() == expectedCount;
if (allFound) {
ref.set(popupMenus);
}
return allFound;
}
});
List<JPopupMenu> popupMenus = ref.get();
assertThat(popupMenus).isNotNull().hasSize(expectedCount);
return popupMenus;
}
use of org.fest.swing.timing.Condition in project intellij-community by JetBrains.
the class FileFixture method requireOpenAndSelected.
@NotNull
public FileFixture requireOpenAndSelected() {
requireVirtualFile();
pause(new Condition("File " + quote(myPath.getPath()) + " to be opened") {
@Override
public boolean test() {
//noinspection ConstantConditions
return execute(new GuiQuery<Boolean>() {
@Override
protected Boolean executeInEDT() throws Throwable {
return isOpenAndSelected();
}
});
}
}, SHORT_TIMEOUT);
return this;
}
use of org.fest.swing.timing.Condition in project intellij-community by JetBrains.
the class IdeFrameFixture method verifyVariablesAtBreakpoint.
public boolean verifyVariablesAtBreakpoint(String[] expectedVariablePatterns, String debugConfigName, long tryUntilMillis) {
DebugToolWindowFixture debugToolWindowFixture = new DebugToolWindowFixture(this);
final ExecutionToolWindowFixture.ContentFixture contentFixture = debugToolWindowFixture.findContent(debugConfigName);
contentFixture.clickDebuggerTreeRoot();
// Wait for the debugger tree to appear.
pause(new Condition("Looking for debugger tree.") {
@Override
public boolean test() {
return contentFixture.getDebuggerTreeRoot() != null;
}
}, Timeout.timeout(tryUntilMillis));
// Get the debugger tree and print it.
XDebuggerTreeNode debuggerTreeRoot = contentFixture.getDebuggerTreeRoot();
if (debuggerTreeRoot == null) {
return false;
}
List<String> unmatchedPatterns = getUnmatchedTerminalVariableValues(expectedVariablePatterns, debuggerTreeRoot);
return unmatchedPatterns.isEmpty();
}
Aggregations