diff options
author | 2018-08-12 14:51:28 +0300 | |
---|---|---|
committer | 2018-08-12 15:02:57 +0300 | |
commit | 4a4dcc5185f8ba5a28c7f9fef509f32c0c2389e6 (patch) | |
tree | 23e55ee7e1ad9b91bcc3ef1dbe1fb7b183f8b2b6 /vid-automation/src/main/java/vid/automation/test/infra/Wait.java | |
parent | 661a24fd57de02869a9771761e0fcba7eb77d121 (diff) |
vid-automation selenium tests
Change-Id: I6c1b0a0cf3bbfa4314c81f0cc72507db805ec632
Issue-ID: VID-281
Signed-off-by: Sonsino, Ofir (os0695) <os0695@intl.att.com>
Diffstat (limited to 'vid-automation/src/main/java/vid/automation/test/infra/Wait.java')
-rw-r--r-- | vid-automation/src/main/java/vid/automation/test/infra/Wait.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/vid-automation/src/main/java/vid/automation/test/infra/Wait.java b/vid-automation/src/main/java/vid/automation/test/infra/Wait.java index fa6ce4f3..848107c8 100644 --- a/vid-automation/src/main/java/vid/automation/test/infra/Wait.java +++ b/vid-automation/src/main/java/vid/automation/test/infra/Wait.java @@ -1,5 +1,6 @@ package vid.automation.test.infra; +import org.apache.commons.collections.CollectionUtils; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.NoSuchElementException; @@ -21,7 +22,7 @@ public class Wait { } } catch (Throwable t) { - System.out.println("a retry failed duo to:" +t.getMessage()); + System.out.println(String.format("a retry failed due to: %s %s", t, t.getMessage())); } try { intervalUnit.sleep(interval); @@ -37,7 +38,20 @@ public class Wait { } public static boolean waitByClassAndText(String className, String text, int timeoutInSeconds) { - return waitFor((x->Get.byClassAndText(className,text)!=null),null, timeoutInSeconds, 1); + return waitFor((x->Get.byClassAndText(className, text, 1)!=null), null, timeoutInSeconds, 1); + } + + public static boolean waitByClassAndTextXpathOnly(String className, String text, int timeoutInSeconds) { + try { + return CollectionUtils.isNotEmpty( + GeneralUIUtils.getWebElementsListByContainsClassNameAndText(className, text, timeoutInSeconds)); + } + catch (RuntimeException exception) { + System.out.println( + String.format("Failed to waitByClassAndText, after %d seconds. Class name: %s, Text: %s. Cause: %s", + timeoutInSeconds, className, text, exception.toString())); + return false; + } } public static boolean waitByTestId(String dataTestId, int timeoutInSeconds) { |