Skip to content

Commit 254052b

Browse files
author
Craig Mc Carthy
committed
Added support for GitHub Actions / Bumped Dependencies
1 parent c62b074 commit 254052b

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

wikipedia/src/test/java/com/cmccarthy/ui/utils/DriverManager.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.openqa.selenium.remote.RemoteWebDriver;
1818
import org.openqa.selenium.safari.SafariDriver;
1919
import org.openqa.selenium.safari.SafariOptions;
20+
import org.openqa.selenium.support.ui.WebDriverWait;
2021
import org.slf4j.Logger;
2122
import org.slf4j.LoggerFactory;
2223
import org.springframework.beans.factory.annotation.Autowired;
@@ -28,6 +29,7 @@
2829
import java.io.IOException;
2930
import java.io.InputStreamReader;
3031
import java.net.URL;
32+
import java.time.Duration;
3133
import java.util.Arrays;
3234
import java.util.Locale;
3335
import java.util.NoSuchElementException;
@@ -102,8 +104,8 @@ public void setLocalWebDriver() throws IOException {
102104
default ->
103105
throw new NoSuchElementException("Failed to create an instance of WebDriver for: " + applicationProperties.getBrowser());
104106
}
105-
// driverWait.getDriverWaitThreadLocal()
106-
// .set(new WebDriverWait(driverThreadLocal.get(), Duration.ofSeconds(Constants.timeoutShort), Duration.ofSeconds(Constants.pollingShort)));
107+
driverWait.getDriverWaitThreadLocal()
108+
.set(new WebDriverWait(driverThreadLocal.get(), Duration.ofSeconds(Constants.timeoutShort), Duration.ofSeconds(Constants.pollingShort)));
107109
}
108110

109111
private void setRemoteDriver(URL hubUrl) {
@@ -135,8 +137,8 @@ private void setRemoteDriver(URL hubUrl) {
135137
default ->
136138
throw new NoSuchElementException("Failed to create an instance of RemoteWebDriver for: " + applicationProperties.getBrowser());
137139
}
138-
// driverWait.getDriverWaitThreadLocal()
139-
// .set(new WebDriverWait(driverThreadLocal.get(), Duration.ofSeconds(Constants.timeoutShort), Duration.ofSeconds(Constants.pollingShort)));
140+
driverWait.getDriverWaitThreadLocal()
141+
.set(new WebDriverWait(driverThreadLocal.get(), Duration.ofSeconds(Constants.timeoutShort), Duration.ofSeconds(Constants.pollingShort)));
140142
}
141143

142144
public WebDriver getDriver() {

wikipedia/src/test/java/com/cmccarthy/ui/utils/DriverWait.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020
public class DriverWait {
2121

2222
private final Logger logger = LoggerFactory.getLogger(DriverWait.class);
23+
private static final ThreadLocal<Wait<WebDriver>> driverWaitThreadLocal = new ThreadLocal<>();
2324

25+
public ThreadLocal<Wait<WebDriver>> getDriverWaitThreadLocal() {
26+
return driverWaitThreadLocal;
27+
}
2428
private final DriverManager driverManager;
2529

2630
@Autowired
@@ -29,6 +33,8 @@ public DriverWait(DriverManager driverManager) {
2933
this.driverManager = driverManager;
3034
}
3135

36+
37+
3238
public void waitForAngular() {
3339
waitUntilAngularReady();
3440
}

0 commit comments

Comments
 (0)