Skip to content

Commit a6be582

Browse files
Merge pull request #68 from aquality-automation/support/update-libraries-version
[Logging][Selenium] Update libraries versions
2 parents 74cf98a + 20171d6 commit a6be582

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

pom.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,24 +86,24 @@
8686
<dependency>
8787
<groupId>org.apache.logging.log4j</groupId>
8888
<artifactId>log4j</artifactId>
89-
<version>2.17.0</version>
89+
<version>2.18.0</version>
9090
<type>pom</type>
9191
</dependency>
9292
<dependency>
9393
<groupId>org.apache.logging.log4j</groupId>
9494
<artifactId>log4j-api</artifactId>
95-
<version>2.17.0</version>
95+
<version>2.18.0</version>
9696
</dependency>
9797
<dependency>
9898
<groupId>org.testng</groupId>
9999
<artifactId>testng</artifactId>
100-
<version>7.0.0</version>
100+
<version>7.5</version>
101101
<scope>test</scope>
102102
</dependency>
103103
<dependency>
104104
<groupId>com.google.inject</groupId>
105105
<artifactId>guice</artifactId>
106-
<version>5.0.1</version>
106+
<version>5.1.0</version>
107107
<exclusions>
108108
<exclusion>
109109
<groupId>com.google.guava</groupId>
@@ -114,29 +114,29 @@
114114
<dependency>
115115
<groupId>com.fasterxml.jackson.core</groupId>
116116
<artifactId>jackson-databind</artifactId>
117-
<version>2.13.1</version>
117+
<version>2.13.3</version>
118118
</dependency>
119119
<dependency>
120120
<groupId>org.seleniumhq.selenium</groupId>
121121
<artifactId>selenium-java</artifactId>
122-
<version>4.1.1</version>
122+
<version>4.3.0</version>
123123
</dependency>
124124
<dependency>
125125
<groupId>io.github.bonigarcia</groupId>
126126
<artifactId>webdrivermanager</artifactId>
127-
<version>5.0.2</version>
127+
<version>5.2.2</version>
128128
<scope>test</scope>
129129
</dependency>
130130
<dependency>
131131
<groupId>io.appium</groupId>
132132
<artifactId>java-client</artifactId>
133-
<version>8.0.0-beta2</version>
133+
<version>8.1.1</version>
134134
<scope>test</scope>
135135
</dependency>
136136
<dependency>
137137
<groupId>org.apache.logging.log4j</groupId>
138138
<artifactId>log4j-core</artifactId>
139-
<version>2.17.0</version>
139+
<version>2.18.0</version>
140140
</dependency>
141141
</dependencies>
142142

src/main/java/aquality/selenium/core/elements/ElementFactory.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ protected By generateXpathLocator(By multipleElementsLocator, WebElement webElem
153153
* @return extracted XPath.
154154
*/
155155
protected String extractXPathFromLocator(By locator) {
156-
Class supportedLocatorType = ByXPath.class;
156+
Class<ByXPath> supportedLocatorType = ByXPath.class;
157157
if (locator.getClass().equals(supportedLocatorType)) {
158158
return locator.toString().substring(XPATH_SUBSTRING_BEGIN_INDEX);
159159
}
@@ -162,7 +162,7 @@ protected String extractXPathFromLocator(By locator) {
162162
}
163163
throw new InvalidArgumentException(String.format(
164164
"Cannot define xpath from locator %1$s. Locator type %2$s is not %3$s, and is not supported yet",
165-
locator.toString(), locator.getClass(), supportedLocatorType));
165+
locator, locator.getClass(), supportedLocatorType));
166166
}
167167

168168
/**
@@ -210,6 +210,7 @@ protected <T extends IElement> Class<T> resolveElementClass(Class<T> clazz) {
210210
String.format("Interface %1$s is not found in getElementTypesMap()", clazz));
211211
}
212212

213+
//noinspection unchecked
213214
return clazz.isInterface() ? (Class<T>) getElementTypesMap().get(clazz) : clazz;
214215
}
215216

src/main/java/aquality/selenium/core/waitings/ConditionalWait.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public boolean waitFor(BooleanSupplier condition, Duration timeout, Duration pol
4040
@Override
4141
public void waitForTrue(BooleanSupplier condition, Duration timeout, Duration pollingInterval, String message, Collection<Class<? extends Throwable>> exceptionsToIgnore) throws TimeoutException {
4242
BooleanSupplier supplier = Optional.ofNullable(condition).orElseThrow(() -> new IllegalArgumentException("Condition cannot be null"));
43-
long timeoutInSeconds = resolveConditionTimeoutInSeconds(timeout);
43+
Duration currentTimeout = resolveConditionTimeout(timeout);
4444
long pollingIntervalInMilliseconds = resolvePollingInterval(pollingInterval).toMillis();
4545
String exMessage = resolveMessage(message);
4646
double startTime = getCurrentTime();
@@ -50,8 +50,8 @@ public void waitForTrue(BooleanSupplier condition, Duration timeout, Duration po
5050
}
5151

5252
double currentTime = getCurrentTime();
53-
if ((currentTime - startTime) > timeoutInSeconds) {
54-
String exceptionMessage = String.format("Timed out after %1$s seconds during wait for condition '%2$s'", timeoutInSeconds, exMessage);
53+
if ((currentTime - startTime) > currentTimeout.getSeconds()) {
54+
String exceptionMessage = String.format("Timed out after %1$s seconds during wait for condition '%2$s'", currentTimeout, exMessage);
5555
throw new TimeoutException(exceptionMessage);
5656
}
5757

@@ -67,10 +67,10 @@ public void waitForTrue(BooleanSupplier condition, Duration timeout, Duration po
6767
public <T> T waitFor(ExpectedCondition<T> condition, Duration timeout, Duration pollingInterval, String message, Collection<Class<? extends Throwable>> exceptionsToIgnore) {
6868
IApplication app = applicationProvider.get();
6969
app.setImplicitWaitTimeout(Duration.ZERO);
70-
long timeoutInSeconds = resolveConditionTimeoutInSeconds(timeout);
70+
Duration currentTimeout = resolveConditionTimeout(timeout);
7171
Duration actualPollingInterval = resolvePollingInterval(pollingInterval);
7272
String exMessage = resolveMessage(message);
73-
WebDriverWait wait = new WebDriverWait(app.getDriver(), timeoutInSeconds);
73+
WebDriverWait wait = new WebDriverWait(app.getDriver(), currentTimeout);
7474
wait.pollingEvery(actualPollingInterval);
7575
wait.withMessage(exMessage);
7676
wait.ignoreAll(exceptionsToIgnore == null ? Collections.singleton(StaleElementReferenceException.class) : exceptionsToIgnore);
@@ -97,8 +97,8 @@ private boolean isConditionSatisfied(BooleanSupplier condition, Collection<Class
9797
}
9898
}
9999

100-
private long resolveConditionTimeoutInSeconds(Duration timeout) {
101-
return Optional.ofNullable(timeout).orElse(timeoutConfiguration.getCondition()).getSeconds();
100+
private Duration resolveConditionTimeout(Duration timeout) {
101+
return Optional.ofNullable(timeout).orElse(timeoutConfiguration.getCondition());
102102
}
103103

104104
private Duration resolvePollingInterval(Duration pollingInterval) {

0 commit comments

Comments
 (0)