diff --git a/platform/testGuiFramework/src/com/intellij/testGuiFramework/fixtures/ProjectViewFixture.java b/platform/testGuiFramework/src/com/intellij/testGuiFramework/fixtures/ProjectViewFixture.java index 29a2dc190f6b..a04ff1bce7e4 100644 --- a/platform/testGuiFramework/src/com/intellij/testGuiFramework/fixtures/ProjectViewFixture.java +++ b/platform/testGuiFramework/src/com/intellij/testGuiFramework/fixtures/ProjectViewFixture.java @@ -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 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 {