From eefde1f371c1e0e18bb937b33c40ec16dfd7f376 Mon Sep 17 00:00:00 2001 From: Paul Gooderham Date: Wed, 16 Oct 2024 13:54:28 -0400 Subject: [PATCH 1/5] Pause before trying to open the Project View Signed-off-by: Paul Gooderham --- .../java/io/openliberty/tools/intellij/it/UIBotTestUtils.java | 2 ++ 1 file changed, 2 insertions(+) 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..b3860f03a 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java +++ b/src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java @@ -476,11 +476,13 @@ public static void openProjectView(RemoteRobot remoteRobot) { Exception error = null; for (int i = 0; i < maxRetries; i++) { try { + TestUtils.sleepAndIgnoreException(10); error = null; ProjectFrameFixture projectFrame = remoteRobot.find(ProjectFrameFixture.class, Duration.ofSeconds(10)); projectFrame.getContentComboLabel("Project", "5"); break; } catch (WaitForConditionTimeoutException wfcte) { + TestUtils.sleepAndIgnoreException(5); // The project view is closed. Open it. clickOnWindowPaneStripeButton(remoteRobot, "Project"); break; From 6e0dab91a02b56e4ac2a34bea86c9801dce48988 Mon Sep 17 00:00:00 2001 From: Paul Gooderham Date: Thu, 17 Oct 2024 14:53:46 -0400 Subject: [PATCH 2/5] Rewrite comments Signed-off-by: Paul Gooderham --- .../tools/intellij/it/SingleModJakartaLSTestCommon.java | 2 +- .../tools/intellij/it/SingleModLibertyLSTestCommon.java | 2 +- .../openliberty/tools/intellij/it/SingleModMPLSTestCommon.java | 2 +- .../tools/intellij/it/SingleModMPProjectTestCommon.java | 2 +- .../tools/intellij/it/SingleModNLTRestProjectTestCommon.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) 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); From fc0c07258ab3a284fe932552bb88bf9d575ff547 Mon Sep 17 00:00:00 2001 From: Paul Gooderham Date: Thu, 17 Oct 2024 18:02:07 -0400 Subject: [PATCH 3/5] Pause before trying to open the Liberty Tool Window Signed-off-by: Paul Gooderham --- .../java/io/openliberty/tools/intellij/it/UIBotTestUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 b3860f03a..98555c749 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); error = null; ProjectFrameFixture projectFrame = remoteRobot.find(ProjectFrameFixture.class, Duration.ofSeconds(10)); projectFrame.getBaseLabel("Liberty", "5"); @@ -434,6 +435,7 @@ public static void openLibertyToolWindow(RemoteRobot remoteRobot) { } catch (WaitForConditionTimeoutException wfcte) { // The Liberty tool window is closed. Open it. clickOnWindowPaneStripeButton(remoteRobot, "Liberty"); + TestUtils.sleepAndIgnoreException(5); break; } catch (Exception e) { // The project frame may hang for a bit while loading/processing work. Retry. @@ -482,9 +484,9 @@ public static void openProjectView(RemoteRobot remoteRobot) { projectFrame.getContentComboLabel("Project", "5"); break; } catch (WaitForConditionTimeoutException wfcte) { - TestUtils.sleepAndIgnoreException(5); // The project view is closed. Open it. clickOnWindowPaneStripeButton(remoteRobot, "Project"); + TestUtils.sleepAndIgnoreException(5); break; } catch (Exception e) { // The project frame may hang for a bit while loading/processing work. Retry. From 327869e531387b5c5ed79b3301382802a5d02239 Mon Sep 17 00:00:00 2001 From: Paul Gooderham Date: Fri, 25 Oct 2024 18:15:44 -0400 Subject: [PATCH 4/5] Add comments to explain why delays are needed Signed-off-by: Paul Gooderham --- .../java/io/openliberty/tools/intellij/it/UIBotTestUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 98555c749..72585b745 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java +++ b/src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java @@ -427,7 +427,7 @@ public static void openLibertyToolWindow(RemoteRobot remoteRobot) { Exception error = null; for (int i = 0; i < maxRetries; i++) { try { - TestUtils.sleepAndIgnoreException(10); + 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"); @@ -435,6 +435,8 @@ 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) { From 7f967d18d1cf7c03778b8777a9f9024a45bad247 Mon Sep 17 00:00:00 2001 From: Paul Gooderham Date: Fri, 25 Oct 2024 18:18:09 -0400 Subject: [PATCH 5/5] Add comments to explain why delays are needed for Project View Signed-off-by: Paul Gooderham --- .../java/io/openliberty/tools/intellij/it/UIBotTestUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 72585b745..7e95a7661 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java +++ b/src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java @@ -480,7 +480,7 @@ public static void openProjectView(RemoteRobot remoteRobot) { Exception error = null; for (int i = 0; i < maxRetries; i++) { try { - TestUtils.sleepAndIgnoreException(10); + 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"); @@ -488,6 +488,8 @@ 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) {