mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[gui-test] add 30sec pause to path()
This commit is contained in:
+20
-1
@@ -65,6 +65,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static com.intellij.ide.projectView.BaseProjectTreeBuilder.getBuilderFor;
|
||||
import static com.intellij.testGuiFramework.framework.GuiTestUtil.SHORT_TIMEOUT;
|
||||
import static com.intellij.testGuiFramework.framework.GuiTestUtil.THIRTY_SEC_TIMEOUT;
|
||||
import static org.fest.assertions.Assertions.assertThat;
|
||||
import static org.fest.reflect.core.Reflection.field;
|
||||
import static org.fest.swing.timing.Pause.pause;
|
||||
@@ -181,6 +182,24 @@ public class ProjectViewFixture extends ToolWindowFixture {
|
||||
*/
|
||||
@NotNull
|
||||
public NodeFixture path(String... pathTo) {
|
||||
Ref<NodeFixture> nodeFixtureRef = new Ref<>();
|
||||
pause(new Condition("Waiting for a node by path: " + pathTo) {
|
||||
@Override
|
||||
public boolean test() {
|
||||
try {
|
||||
nodeFixtureRef.set(getNodeFixtureByPath(pathTo));
|
||||
return true;
|
||||
}
|
||||
catch (ComponentLookupException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}, THIRTY_SEC_TIMEOUT);
|
||||
return nodeFixtureRef.get();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private NodeFixture getNodeFixtureByPath(String[] pathTo) {
|
||||
if (pathTo.length == 1) {
|
||||
if (pathTo[0].contains("/")) {
|
||||
String[] newPath = pathTo[0].split("/");
|
||||
@@ -191,7 +210,7 @@ public class ProjectViewFixture extends ToolWindowFixture {
|
||||
}
|
||||
|
||||
public boolean containsPath(String... pathTo) {
|
||||
return path(pathTo) == null;
|
||||
return getNodeFixtureByPath(pathTo) != null;
|
||||
}
|
||||
|
||||
public class PaneFixture {
|
||||
|
||||
Reference in New Issue
Block a user