diff --git a/bb-core/src/main/java/com/cognifide/qa/bb/wait/BobcatWait.java b/bb-core/src/main/java/com/cognifide/qa/bb/wait/BobcatWait.java index 7ae71aab..82f6194f 100644 --- a/bb-core/src/main/java/com/cognifide/qa/bb/wait/BobcatWait.java +++ b/bb-core/src/main/java/com/cognifide/qa/bb/wait/BobcatWait.java @@ -89,8 +89,7 @@ public BobcatWait ignoring(List> exceptions) { * * @param condition Selenium's condition object that is queried cyclically inside the wait loop. * @param The function's expected return type. - * @return The ExpectedCondition's return value if the function returned something different. - * from null or false before the timeout expired. + * @return The ExpectedCondition's return value if the function returned something different from null or false before the timeout expired. * @see WebDriverWait#until(Function) */ public T until(ExpectedCondition condition) { @@ -101,6 +100,7 @@ public T until(ExpectedCondition condition) { .until(condition); } finally { ignoredExceptions = new ArrayList<>(); + timings = new TimingsBuilder().build(); restoreImplicitTimeout(); } } diff --git a/bb-core/src/main/java/com/cognifide/qa/bb/wait/TimingsBuilder.java b/bb-core/src/main/java/com/cognifide/qa/bb/wait/TimingsBuilder.java index 221ea344..94659251 100644 --- a/bb-core/src/main/java/com/cognifide/qa/bb/wait/TimingsBuilder.java +++ b/bb-core/src/main/java/com/cognifide/qa/bb/wait/TimingsBuilder.java @@ -34,13 +34,13 @@ public class TimingsBuilder { private long pollingInterval = - Long.valueOf(System.getProperty(ConfigKeys.TIMINGS_POLLING_INTERVAL, "500")); + Long.valueOf(System.getProperty(ConfigKeys.TIMINGS_POLLING_INTERVAL)); private long explicitTimeout = - Long.valueOf(System.getProperty(ConfigKeys.TIMINGS_EXPLICIT_TIMEOUT, "10")); + Long.valueOf(System.getProperty(ConfigKeys.TIMINGS_EXPLICIT_TIMEOUT)); private long implicitTimeout = - Long.valueOf(System.getProperty(ConfigKeys.TIMINGS_IMPLICIT_TIMEOUT, "10")); + Long.valueOf(System.getProperty(ConfigKeys.TIMINGS_IMPLICIT_TIMEOUT)); /** * Set the explicit timeout diff --git a/bb-core/src/main/resources/default.properties b/bb-core/src/main/resources/default.properties index 460541d2..188e6c8b 100644 --- a/bb-core/src/main/resources/default.properties +++ b/bb-core/src/main/resources/default.properties @@ -16,5 +16,5 @@ cookies.loadAutomatically = true modifiers.implicitTimeout=true timings.explicitTimeout=10 -timings.implicitTimeout=10 +timings.implicitTimeout=1 timings.pollingInterval=500 diff --git a/bb-core/src/main/resources/default.yaml b/bb-core/src/main/resources/default.yaml index afd4120c..80469eca 100644 --- a/bb-core/src/main/resources/default.yaml +++ b/bb-core/src/main/resources/default.yaml @@ -25,5 +25,5 @@ default: modifiers.implicitTimeout: true timings.explicitTimeout: 10 - timings.implicitTimeout: 10 + timings.implicitTimeout: 1 timings.pollingInterval: 500 diff --git a/docs/_data/navigation.yml b/docs/_data/navigation.yml index 9bb641f5..b0410580 100644 --- a/docs/_data/navigation.yml +++ b/docs/_data/navigation.yml @@ -24,6 +24,8 @@ docs: children: - title: "Overview" url: /docs/modules/core/ + - title: "Explicit and implicit waiting" + url: /docs/modules/core/waiting - title: "Setting cookies" url: /docs/modules/core/cookies - title: "Other modules" @@ -36,7 +38,9 @@ docs: url: /docs/modules/traffic/ - title: "Email" url: /docs/modules/email/ - - title: "AEM modules (new API incoming!)" + - title: "AEM modules" + children: + - title: "New API incoming in 2.0!" - title: "EOL Modules" children: - title: "AEM Common" diff --git a/docs/_docs/modules/core/waiting.md b/docs/_docs/modules/core/waiting.md new file mode 100644 index 00000000..3e7e9154 --- /dev/null +++ b/docs/_docs/modules/core/waiting.md @@ -0,0 +1,96 @@ +--- +title: "Waiting" +--- + +Available in `bb-core` since version `1.6.0`. Mechanism from previous versions: [link](https://github.com/Cognifide/bobcat/wiki/Explicit-Waits) +{: .notice--info} + +## Overview +One of the fundamental problems when automating GUI is handling dynamic elements on a website: pop-ups, carousels, menus, lazy-loaded data in various places, etc. + +Bobcat utilizes Selenium's out-of-the-box mechanisms: implicit and explicit waiting. More information about them can be found in [official docs](https://www.seleniumhq.org/docs/04_webdriver_advanced.jsp). + +## Implicit waiting + +Implicit waiting happens before any lookup of a `WebElement` is being executed during your tests. When searching for an element it waits for a specific period of time to actually report the issue in case of the element not being present on the page. +This implicit timeout can be set manually using: `webDriver.manage().timeouts().implicitlyWait(,