diff --git a/src/test/java/io/openliberty/tools/intellij/it/SingleModJakartaLSTestCommon.java b/src/test/java/io/openliberty/tools/intellij/it/SingleModJakartaLSTestCommon.java index 7768d5c47..edd6caf12 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/SingleModJakartaLSTestCommon.java +++ b/src/test/java/io/openliberty/tools/intellij/it/SingleModJakartaLSTestCommon.java @@ -179,7 +179,7 @@ public static void prepareEnv(String projectPath, String projectName) { UIBotTestUtils.importProject(remoteRobot, projectPath, projectName); UIBotTestUtils.openProjectView(remoteRobot); - // IntelliJ does not start building and indexing until the project is open in the UI + // IntelliJ does not start building and indexing until the Project View is open UIBotTestUtils.waitForIndexing(remoteRobot); UIBotTestUtils.openAndValidateLibertyToolWindow(remoteRobot, projectName); UIBotTestUtils.closeLibertyToolWindow(remoteRobot); diff --git a/src/test/java/io/openliberty/tools/intellij/it/SingleModLibertyLSTestCommon.java b/src/test/java/io/openliberty/tools/intellij/it/SingleModLibertyLSTestCommon.java index 906afc9ed..7bf790d09 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/SingleModLibertyLSTestCommon.java +++ b/src/test/java/io/openliberty/tools/intellij/it/SingleModLibertyLSTestCommon.java @@ -391,7 +391,7 @@ public static void prepareEnv(String projectPath, String projectName) { UIBotTestUtils.importProject(remoteRobot, projectPath, projectName); UIBotTestUtils.openProjectView(remoteRobot); - // IntelliJ does not start building and indexing until the project is open in the UI + // IntelliJ does not start building and indexing until the Project View is open UIBotTestUtils.waitForIndexing(remoteRobot); UIBotTestUtils.openAndValidateLibertyToolWindow(remoteRobot, projectName); UIBotTestUtils.closeLibertyToolWindow(remoteRobot); diff --git a/src/test/java/io/openliberty/tools/intellij/it/SingleModMPLSTestCommon.java b/src/test/java/io/openliberty/tools/intellij/it/SingleModMPLSTestCommon.java index ae83dbe34..50066dc6b 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/SingleModMPLSTestCommon.java +++ b/src/test/java/io/openliberty/tools/intellij/it/SingleModMPLSTestCommon.java @@ -313,7 +313,7 @@ public static void prepareEnv(String projectPath, String projectName) { UIBotTestUtils.importProject(remoteRobot, projectPath, projectName); UIBotTestUtils.openProjectView(remoteRobot); - // IntelliJ does not start building and indexing until the project is open in the UI + // IntelliJ does not start building and indexing until the Project View is open UIBotTestUtils.waitForIndexing(remoteRobot); UIBotTestUtils.openAndValidateLibertyToolWindow(remoteRobot, projectName); UIBotTestUtils.closeLibertyToolWindow(remoteRobot); diff --git a/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java b/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java index b81c26b6b..df6a0b5c6 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java +++ b/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java @@ -915,7 +915,7 @@ public static void prepareEnv(String projectPath, String projectName) { remoteRobot.find(WelcomeFrameFixture.class, Duration.ofMinutes(2)); UIBotTestUtils.importProject(remoteRobot, projectPath, projectName); UIBotTestUtils.openProjectView(remoteRobot); - // IntelliJ does not start building and indexing until the project is open in the UI + // IntelliJ does not start building and indexing until the Project View is open UIBotTestUtils.waitForIndexing(remoteRobot); UIBotTestUtils.openAndValidateLibertyToolWindow(remoteRobot, projectName); UIBotTestUtils.expandLibertyToolWindowProjectTree(remoteRobot, projectName); diff --git a/src/test/java/io/openliberty/tools/intellij/it/SingleModNLTRestProjectTestCommon.java b/src/test/java/io/openliberty/tools/intellij/it/SingleModNLTRestProjectTestCommon.java index e0f812aee..dd429f743 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/SingleModNLTRestProjectTestCommon.java +++ b/src/test/java/io/openliberty/tools/intellij/it/SingleModNLTRestProjectTestCommon.java @@ -226,7 +226,7 @@ public static void prepareEnv(String projectPath, String projectName) { remoteRobot.find(WelcomeFrameFixture.class, Duration.ofMinutes(2)); UIBotTestUtils.importProject(remoteRobot, projectPath, projectName); UIBotTestUtils.openProjectView(remoteRobot); - // IntelliJ does not start building and indexing until the project is open in the UI + // IntelliJ does not start building and indexing until the Project View is open UIBotTestUtils.waitForIndexing(remoteRobot); UIBotTestUtils.openLibertyToolWindow(remoteRobot); diff --git a/src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java b/src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java index 0e4d07615..7e95a7661 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java +++ b/src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java @@ -427,6 +427,7 @@ public static void openLibertyToolWindow(RemoteRobot remoteRobot) { Exception error = null; for (int i = 0; i < maxRetries; i++) { try { + TestUtils.sleepAndIgnoreException(10); // wait for UI to be rendered before searching for a button error = null; ProjectFrameFixture projectFrame = remoteRobot.find(ProjectFrameFixture.class, Duration.ofSeconds(10)); projectFrame.getBaseLabel("Liberty", "5"); @@ -434,6 +435,9 @@ public static void openLibertyToolWindow(RemoteRobot remoteRobot) { } catch (WaitForConditionTimeoutException wfcte) { // The Liberty tool window is closed. Open it. clickOnWindowPaneStripeButton(remoteRobot, "Liberty"); + // After clicking it can take seconds for the window to open on a slow cloud machine. + // Important since this is in a loop and you may click twice if there is no sleep. + TestUtils.sleepAndIgnoreException(5); break; } catch (Exception e) { // The project frame may hang for a bit while loading/processing work. Retry. @@ -476,6 +480,7 @@ public static void openProjectView(RemoteRobot remoteRobot) { Exception error = null; for (int i = 0; i < maxRetries; i++) { try { + TestUtils.sleepAndIgnoreException(10); // wait for UI to be rendered before searching for a button error = null; ProjectFrameFixture projectFrame = remoteRobot.find(ProjectFrameFixture.class, Duration.ofSeconds(10)); projectFrame.getContentComboLabel("Project", "5"); @@ -483,6 +488,9 @@ public static void openProjectView(RemoteRobot remoteRobot) { } catch (WaitForConditionTimeoutException wfcte) { // The project view is closed. Open it. clickOnWindowPaneStripeButton(remoteRobot, "Project"); + // After clicking it can take seconds for the window to open on a slow cloud machine. + // Important since this is in a loop and you may click twice if there is no sleep. + TestUtils.sleepAndIgnoreException(5); break; } catch (Exception e) { // The project frame may hang for a bit while loading/processing work. Retry.