This is an automated email from the ASF dual-hosted git repository.
benw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git
The following commit(s) were added to refs/heads/master by this push:
new 9d6cc7071 TAP5-2819: SeleniumTestCase remove implicit waiting, make
wait time configurable
9d6cc7071 is described below
commit 9d6cc70719299ef47de4e50bde3d400fe40264f9
Author: Ben Weidig <[email protected]>
AuthorDate: Wed Mar 18 17:07:11 2026 +0100
TAP5-2819: SeleniumTestCase remove implicit waiting, make wait time
configurable
The driver itself was waiting implictly, in addition to utilizing
WebDriverWait. That might not work well together and could be
responsible for the flakiness of the element lookup sometimes.
Therefore, we only rely on WebDriverWait, but make it easier to
configure via system properties.
---
.../src/main/groovy/tapestry.testing-base-convention.gradle | 3 ++-
.../main/java/org/apache/tapestry5/test/SeleniumTestCase.java | 10 ++++++----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/buildSrc/src/main/groovy/tapestry.testing-base-convention.gradle
b/buildSrc/src/main/groovy/tapestry.testing-base-convention.gradle
index f04cdf529..35dd0f937 100644
--- a/buildSrc/src/main/groovy/tapestry.testing-base-convention.gradle
+++ b/buildSrc/src/main/groovy/tapestry.testing-base-convention.gradle
@@ -14,7 +14,8 @@ tasks.withType(Test).configureEach { testTask ->
'java.io.tmpdir': temporaryDir.absolutePath,
'file.encoding': 'UTF-8',
'user.language': 'en', // TAP5-2722
- 'ci': System.getProperty('ci', 'false') // TAP5-2819: Propagate 'ci'
from possible GRADLE_OPTS to forked test workers
+ 'ci': System.getProperty('ci', 'false'), // TAP5-2819: Propagate 'ci'
from possible GRADLE_OPTS to forked test workers
+ 'selenium.wait.timeout': System.getProperty('selenium.wait.timeout',
'15')
)
environment.LANG = 'en_US.UTF-8'
diff --git
a/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
b/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
index 129dc8d62..d9d1f0bf4 100644
---
a/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
+++
b/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
@@ -19,7 +19,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.TimeUnit;
import org.apache.tapestry5.test.constants.TapestryRunnerConstants;
import org.openqa.selenium.By;
@@ -66,6 +65,8 @@ public abstract class SeleniumTestCase extends Assert
implements Selenium
{
public final static Logger LOGGER =
LoggerFactory.getLogger(SeleniumTestCase.class);
+ public static final long WAIT_TIMEOUT =
Long.getLong("selenium.wait.timeout", 15L);
+
/**
* 15 seconds
*/
@@ -256,8 +257,9 @@ public abstract class SeleniumTestCase extends Assert
implements Selenium
FirefoxDriver driver = profileRoot != null
? new FirefoxDriver(createGeckoDriverService(profileRoot),
options)
: new FirefoxDriver(options);
-
- driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
+
+ // Implicit waiting can interfere with WebDriverWait
+ // driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10L));
CommandProcessor webDriverCommandProcessor = new
WebDriverCommandProcessor(baseURL, driver);
@@ -1410,7 +1412,7 @@ public abstract class SeleniumTestCase extends Assert
implements Selenium
protected void waitForCondition(ExpectedCondition condition)
{
- waitForCondition(condition, 10l);
+ waitForCondition(condition, WAIT_TIMEOUT);
}
protected void waitForCondition(ExpectedCondition condition, long
timeoutSeconds)