Skip to content

Commit dbfdc11

Browse files
authored
Merge pull request #1033 from turkeylurkey/issue-971
Wait after clicking button to open window
2 parents dc562cc + 7f967d1 commit dbfdc11

File tree

6 files changed

+13
-5
lines changed

6 files changed

+13
-5
lines changed

src/test/java/io/openliberty/tools/intellij/it/SingleModJakartaLSTestCommon.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public static void prepareEnv(String projectPath, String projectName) {
179179

180180
UIBotTestUtils.importProject(remoteRobot, projectPath, projectName);
181181
UIBotTestUtils.openProjectView(remoteRobot);
182-
// IntelliJ does not start building and indexing until the project is open in the UI
182+
// IntelliJ does not start building and indexing until the Project View is open
183183
UIBotTestUtils.waitForIndexing(remoteRobot);
184184
UIBotTestUtils.openAndValidateLibertyToolWindow(remoteRobot, projectName);
185185
UIBotTestUtils.closeLibertyToolWindow(remoteRobot);

src/test/java/io/openliberty/tools/intellij/it/SingleModLibertyLSTestCommon.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ public static void prepareEnv(String projectPath, String projectName) {
391391

392392
UIBotTestUtils.importProject(remoteRobot, projectPath, projectName);
393393
UIBotTestUtils.openProjectView(remoteRobot);
394-
// IntelliJ does not start building and indexing until the project is open in the UI
394+
// IntelliJ does not start building and indexing until the Project View is open
395395
UIBotTestUtils.waitForIndexing(remoteRobot);
396396
UIBotTestUtils.openAndValidateLibertyToolWindow(remoteRobot, projectName);
397397
UIBotTestUtils.closeLibertyToolWindow(remoteRobot);

src/test/java/io/openliberty/tools/intellij/it/SingleModMPLSTestCommon.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ public static void prepareEnv(String projectPath, String projectName) {
322322

323323
UIBotTestUtils.importProject(remoteRobot, projectPath, projectName);
324324
UIBotTestUtils.openProjectView(remoteRobot);
325-
// IntelliJ does not start building and indexing until the project is open in the UI
325+
// IntelliJ does not start building and indexing until the Project View is open
326326
UIBotTestUtils.waitForIndexing(remoteRobot);
327327
UIBotTestUtils.openAndValidateLibertyToolWindow(remoteRobot, projectName);
328328
UIBotTestUtils.closeLibertyToolWindow(remoteRobot);

src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ public static void prepareEnv(String projectPath, String projectName) {
915915
remoteRobot.find(WelcomeFrameFixture.class, Duration.ofMinutes(2));
916916
UIBotTestUtils.importProject(remoteRobot, projectPath, projectName);
917917
UIBotTestUtils.openProjectView(remoteRobot);
918-
// IntelliJ does not start building and indexing until the project is open in the UI
918+
// IntelliJ does not start building and indexing until the Project View is open
919919
UIBotTestUtils.waitForIndexing(remoteRobot);
920920
UIBotTestUtils.openAndValidateLibertyToolWindow(remoteRobot, projectName);
921921
UIBotTestUtils.expandLibertyToolWindowProjectTree(remoteRobot, projectName);

src/test/java/io/openliberty/tools/intellij/it/SingleModNLTRestProjectTestCommon.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public static void prepareEnv(String projectPath, String projectName) {
226226
remoteRobot.find(WelcomeFrameFixture.class, Duration.ofMinutes(2));
227227
UIBotTestUtils.importProject(remoteRobot, projectPath, projectName);
228228
UIBotTestUtils.openProjectView(remoteRobot);
229-
// IntelliJ does not start building and indexing until the project is open in the UI
229+
// IntelliJ does not start building and indexing until the Project View is open
230230
UIBotTestUtils.waitForIndexing(remoteRobot);
231231
UIBotTestUtils.openLibertyToolWindow(remoteRobot);
232232

src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,13 +427,17 @@ public static void openLibertyToolWindow(RemoteRobot remoteRobot) {
427427
Exception error = null;
428428
for (int i = 0; i < maxRetries; i++) {
429429
try {
430+
TestUtils.sleepAndIgnoreException(10); // wait for UI to be rendered before searching for a button
430431
error = null;
431432
ProjectFrameFixture projectFrame = remoteRobot.find(ProjectFrameFixture.class, Duration.ofSeconds(10));
432433
projectFrame.getBaseLabel("Liberty", "5");
433434
break;
434435
} catch (WaitForConditionTimeoutException wfcte) {
435436
// The Liberty tool window is closed. Open it.
436437
clickOnWindowPaneStripeButton(remoteRobot, "Liberty");
438+
// After clicking it can take seconds for the window to open on a slow cloud machine.
439+
// Important since this is in a loop and you may click twice if there is no sleep.
440+
TestUtils.sleepAndIgnoreException(5);
437441
break;
438442
} catch (Exception e) {
439443
// The project frame may hang for a bit while loading/processing work. Retry.
@@ -476,13 +480,17 @@ public static void openProjectView(RemoteRobot remoteRobot) {
476480
Exception error = null;
477481
for (int i = 0; i < maxRetries; i++) {
478482
try {
483+
TestUtils.sleepAndIgnoreException(10); // wait for UI to be rendered before searching for a button
479484
error = null;
480485
ProjectFrameFixture projectFrame = remoteRobot.find(ProjectFrameFixture.class, Duration.ofSeconds(10));
481486
projectFrame.getContentComboLabel("Project", "5");
482487
break;
483488
} catch (WaitForConditionTimeoutException wfcte) {
484489
// The project view is closed. Open it.
485490
clickOnWindowPaneStripeButton(remoteRobot, "Project");
491+
// After clicking it can take seconds for the window to open on a slow cloud machine.
492+
// Important since this is in a loop and you may click twice if there is no sleep.
493+
TestUtils.sleepAndIgnoreException(5);
486494
break;
487495
} catch (Exception e) {
488496
// The project frame may hang for a bit while loading/processing work. Retry.

0 commit comments

Comments
 (0)