Skip to content

Commit 20af0a6

Browse files
Resolved UI test cases issue
1 parent db621c4 commit 20af0a6

1 file changed

Lines changed: 23 additions & 15 deletions

File tree

  • checkmarx-ast-eclipse-plugin-tests/src/test/java/checkmarx/ast/eclipse/plugin/tests/ui

checkmarx-ast-eclipse-plugin-tests/src/test/java/checkmarx/ast/eclipse/plugin/tests/ui/BaseUITest.java

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -303,23 +303,31 @@ protected static void waitUntilBranchComboIsEnabled() throws TimeoutException {
303303
* Wait for connection response
304304
*/
305305
protected static void waitForConnectionResponse() throws TimeoutException {
306-
boolean found = false;
307-
int retryIdx = 0;
308-
//check for the success message in the shell's decorations (where info messages are shown in Eclipse)
309-
while (!found) {
310-
for (var text : _bot.text()) {
311-
if (((Decorations) text).getText().contains(INFO_SUCCESSFUL_CONNECTION)) {
312-
found=true;
306+
int retryIdx = 0;
307+
while (retryIdx < 10) {
308+
boolean found = false;
309+
int index = 0;
310+
while (true) {
311+
try {
312+
String textValue = _bot.text(index).getText();
313+
314+
if (textValue.contains(INFO_SUCCESSFUL_CONNECTION)) {
315+
found = true;
316+
break;
317+
}
318+
index++;
319+
} catch (Exception e) {
320+
// No more text widgets available
321+
break;
313322
}
314323
}
315-
if (found) break;
316-
if (retryIdx == 10) break;
317-
_bot.sleep(1000);
318-
retryIdx++;
319-
}
320-
if (!found) {
321-
throw new TimeoutException("Connection validation timeout after 10000ms.");
322-
}
324+
if (found) {
325+
return;
326+
}
327+
_bot.sleep(1000);
328+
retryIdx++;
329+
}
330+
throw new TimeoutException("Connection validation timeout after 10000ms.");
323331
}
324332

325333
/**

0 commit comments

Comments
 (0)