Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency org.seleniumhq.selenium:selenium-java to v4 #3522

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.net.MalformedURLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.util.Date;
import java.util.List;
import java.util.Random;
Expand Down Expand Up @@ -1067,7 +1068,7 @@ private List<WebElement> getDivsByPrefix(String prefix) {
*/
private WebElement getAscMessage() {
By ascMessageXpath = By.xpath("//div[@id='ascMessage']/span");
WebDriverWait wait = new WebDriverWait(context.getDriver(), 30);
WebDriverWait wait = new WebDriverWait(context.getDriver(), Duration.ofSeconds(30));
wait.until(ExpectedConditions.visibilityOfElementLocated(ascMessageXpath));
return context.getDriver().findElement(ascMessageXpath);
}
Expand All @@ -1086,7 +1087,7 @@ private String getDivMessageForId(String id) {

private void ascEditbox(int ctrlNum, String suffix, String text) {
WebElement field = context.getDriver().findElement(By.name("c" + ctrlNum + suffix));
WebDriverWait wait = new WebDriverWait(context.getDriver(), 30);
WebDriverWait wait = new WebDriverWait(context.getDriver(), Duration.ofSeconds(30));
wait.until(ExpectedConditions.visibilityOf(field));
field.clear();
field.sendKeys(text);
Expand All @@ -1099,7 +1100,7 @@ private void ascEditbox(int ctrlNum, String suffix, String text) {
* @param text
*/
private void ascSelectDropdown(String id, String optText) {
WebDriverWait wait = new WebDriverWait(context.getDriver(), 30);
WebDriverWait wait = new WebDriverWait(context.getDriver(), Duration.ofSeconds(30));
wait.until(ExpectedConditions.presenceOfElementLocated(By.id(id)));
Select dropdown = new Select(context.getDriver().findElement(By.id(id)));
dropdown.selectByVisibleText(optText);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.tle.webtests.pageobject.wizard.WizardPageTab;
import com.tle.webtests.test.AbstractCleanupTest;
import java.io.IOException;
import java.time.Duration;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
Expand Down Expand Up @@ -68,7 +69,8 @@ public void notificationsSubsearchTest() throws Exception {
private void waitForIndex() throws IOException {
final String token = requestToken(OAUTH_CLIENT_ID);

WebDriverWait notificationsIndexedWaiter = new WebDriverWait(context.getDriver(), 10);
WebDriverWait notificationsIndexedWaiter =
new WebDriverWait(context.getDriver(), Duration.ofSeconds(10));
notificationsIndexedWaiter.until(
(Function<WebDriver, Boolean>)
driver -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.net.URL;
import java.nio.file.Paths;
import java.text.MessageFormat;
import java.time.Duration;
import java.util.Properties;
import java.util.TimeZone;

Expand Down Expand Up @@ -68,8 +69,8 @@ public static String findInstitutionName(Class<?> clazz) {
return inst;
}

public int getStandardTimeout() {
return getIntProperty("timeout.standard", 30);
public Duration getStandardTimeout() {
return Duration.ofSeconds(getIntProperty("timeout.standard", 30));
}

public String getAdminPassword() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.concurrent.TimeUnit;
import java.time.Duration;
import org.openqa.selenium.By;
import org.openqa.selenium.SearchContext;
import org.openqa.selenium.StaleElementReferenceException;
Expand All @@ -15,8 +15,8 @@
public class RefreshingElementHandler implements InvocationHandler {
private static final FluentWait<Object> waiter =
new FluentWait<Object>(Void.class)
.withTimeout(10, TimeUnit.SECONDS)
.pollingEvery(50, TimeUnit.MILLISECONDS);
.withTimeout(Duration.ofSeconds(10))
.pollingEvery(Duration.ofMillis(50));
private LazyTemplatedElementLocator locator;
private RefreshingElementProxyCreator proxyCreator;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.net.URL;
import java.net.URLEncoder;
import java.nio.file.Paths;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
Expand Down Expand Up @@ -56,23 +57,28 @@ public AbstractPage(
loadedElement = null;
}

public AbstractPage(PageContext context, By loadedBy, int timeOut) {
this(context, context.getDriver(), loadedBy, timeOut);
/** @param timeoutSeconds -1 for default timeout */
public AbstractPage(PageContext context, By loadedBy, int timeoutSeconds) {
this(context, context.getDriver(), loadedBy, timeoutSeconds);
}

public AbstractPage(PageContext context, SearchContext searchContext, By loadedBy) {
this(context, searchContext, loadedBy, -1);
}

public AbstractPage(PageContext context, SearchContext searchContext, By loadedBy, int timeOut) {
/** @param timeoutSeconds -1 for default timeout */
public AbstractPage(
PageContext context, SearchContext searchContext, By loadedBy, int timeoutSeconds) {
this(
context,
searchContext,
loadedBy,
new WebDriverWait(
context.getDriver(),
timeOut == -1 ? context.getTestConfig().getStandardTimeout() : timeOut,
50));
timeoutSeconds == -1
? context.getTestConfig().getStandardTimeout()
: Duration.ofSeconds(timeoutSeconds),
Duration.ofMillis(50)));
}

public AbstractPage(PageContext context, By loadedBy) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.tle.webtests.framework.PageContext;
import com.tle.webtests.pageobject.AbstractPage;
import java.time.Duration;
import java.util.function.Function;
import org.openqa.selenium.*;
import org.openqa.selenium.support.FindBy;
Expand Down Expand Up @@ -30,7 +31,7 @@ public void setReason(String reason) {
(Function<WebDriver, Object>)
webDriver -> {
try {
new WebDriverWait(webDriver, 1)
new WebDriverWait(webDriver, Duration.ofSeconds(1))
.until(ExpectedConditions.stalenessOf(getContinueButton()));
return false;
} catch (TimeoutException toe) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.tle.webtests.pageobject.connectors;

import com.tle.webtests.pageobject.WaitingPageObject;
import java.time.Duration;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
Expand Down Expand Up @@ -47,7 +48,8 @@ public WebDriverWait getWaiter() {

public EditBlackboardConnectorPage(ShowConnectorsPage connectorsPage) {
super(connectorsPage);
this.bbWaiter = new WebDriverWait(context.getDriver(), 60, 50);
this.bbWaiter =
new WebDriverWait(context.getDriver(), Duration.ofMinutes(1), Duration.ofMillis(50));
}

public EditBlackboardConnectorPage setUrl(String url, String user, String password) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.tle.webtests.framework.EBy;
import com.tle.webtests.framework.PageContext;
import com.tle.webtests.pageobject.AbstractPage;
import java.time.Duration;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
Expand All @@ -26,7 +27,7 @@ public DatabaseRow(PageContext context, WebElement rowElement) {
super(context);
this.rowElement = rowElement;
statusElement = rowElement.findElement(By.className("status"));
longWaiter = new WebDriverWait(context.getDriver(), 60);
longWaiter = new WebDriverWait(context.getDriver(), Duration.ofMinutes(1));
}

public void initialise() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Duration;
import java.util.zip.ZipOutputStream;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
Expand Down Expand Up @@ -54,7 +55,7 @@ private WebElement getPasswordConfirmElem() {

public ImportTab(PageContext context) {
super(context, "Import institution", "Import new institution");
waiter = new WebDriverWait(context.getDriver(), 240);
waiter = new WebDriverWait(context.getDriver(), Duration.ofMinutes(4));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.google.common.base.Function;
import com.tle.webtests.framework.PageContext;
import com.tle.webtests.pageobject.AbstractPage;
import java.time.Duration;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
Expand All @@ -20,7 +21,7 @@ public class MigrationProgressDialog extends AbstractPage<MigrationProgressDialo

public MigrationProgressDialog(PageContext context) {
super(context, By.className("progress-curr-migration"));
longWaiter = new WebDriverWait(context.getDriver(), 180);
longWaiter = new WebDriverWait(context.getDriver(), Duration.ofMinutes(3));
}

public void close() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.tle.webtests.framework.PageContext;
import com.tle.webtests.pageobject.AbstractPage;
import com.tle.webtests.pageobject.WaitingPageObject;
import java.time.Duration;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
Expand Down Expand Up @@ -33,7 +34,7 @@ public StatusPage(PageContext context, WaitingPageObject<T> tab) {
}

public StatusPage(PageContext context, WaitingPageObject<T> tab, long timeout) {
super(context, new WebDriverWait(context.getDriver(), timeout));
super(context, new WebDriverWait(context.getDriver(), Duration.ofSeconds(timeout)));
edalex-ian marked this conversation as resolved.
Show resolved Hide resolved
mustBeVisible = false;
this.tab = tab;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.tle.webtests.framework.PageContext;
import com.tle.webtests.pageobject.AbstractPage;
import java.time.Duration;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Point;
Expand Down Expand Up @@ -39,15 +40,17 @@ public MoodleBasePage(PageContext context, SearchContext searchContext, By loade
}

public MoodleBasePage(
PageContext context, SearchContext searchContext, By loadedBy, int timeOut) {
PageContext context, SearchContext searchContext, By loadedBy, int timeoutSeconds) {
this(
context,
searchContext,
loadedBy,
new WebDriverWait(
context.getDriver(),
timeOut == -1 ? context.getTestConfig().getStandardTimeout() : timeOut,
50));
timeoutSeconds == -1
? context.getTestConfig().getStandardTimeout()
: Duration.ofSeconds(timeoutSeconds),
Duration.ofMillis(50)));
}

public MoodleBasePage(PageContext context, By loadedBy) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.tle.webtests.framework.PageContext;
import com.tle.webtests.pageobject.AbstractPage;
import java.time.Duration;
import org.openqa.selenium.By;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.WebDriver;
Expand All @@ -13,7 +14,7 @@ public class UpgradeStepsPage extends AbstractPage<UpgradeStepsPage> {

public UpgradeStepsPage(PageContext context) {
super(context, By.id("mp_confirmBackup"));
waiter = new WebDriverWait(driver, 240);
waiter = new WebDriverWait(driver, Duration.ofMinutes(4));
}

public void upgrade(String password) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.tle.webtests.pageobject.remoterepo.AbstractRemoteRepoSearchPage;
import com.tle.webtests.pageobject.remoterepo.RemoteRepoListPage;
import com.tle.webtests.pageobject.remoterepo.RemoteRepoSearchResult;
import java.time.Duration;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.WebDriverWait;
Expand All @@ -26,7 +27,8 @@ public class RemoteRepoSRUSearchPage

public RemoteRepoSRUSearchPage(PageContext context) {
super(context);
this.waiter = new WebDriverWait(context.getDriver(), 60, 50);
this.waiter =
new WebDriverWait(context.getDriver(), Duration.ofMinutes(1), Duration.ofMillis(50));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.tle.webtests.pageobject.AbstractPage;
import com.tle.webtests.pageobject.AbstractReport;
import com.tle.webtests.pageobject.ExpectWaiter;
import java.util.concurrent.TimeUnit;
import java.time.Duration;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
Expand Down Expand Up @@ -39,7 +39,7 @@ public void close() {
}

public R getReport() {
report.getWaiter().withTimeout(5, TimeUnit.MINUTES);
report.getWaiter().withTimeout(Duration.ofMinutes(5));
return ExpectWaiter.waiter(
ExpectedConditions.frameToBeAvailableAndSwitchToIt("reportFrame"), report)
.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.tle.common.Check;
import com.tle.webtests.pageobject.AbstractPage;
import com.tle.webtests.pageobject.ExpectedConditions2;
import java.time.Duration;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
Expand Down Expand Up @@ -33,7 +34,9 @@ public AutoCompleteOptions(AbstractQuerySection<?> qs) {
super(qs.getContext(), LIST_BY);
setMustBeVisible(true);
this.qs = qs;
acWaiter = new WebDriverWait(driver, context.getTestConfig().getStandardTimeout(), 600);
acWaiter =
new WebDriverWait(
driver, context.getTestConfig().getStandardTimeout(), Duration.ofMillis(600));
}

public String getPromptText() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.tle.webtests.pageobject.ExpectedConditions2;
import com.tle.webtests.pageobject.PageObject;
import com.tle.webtests.pageobject.WaitingPageObject;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import org.openqa.selenium.By;
Expand All @@ -29,7 +30,7 @@ public <T extends PageObject> boolean waitAndFinish(WaitingPageObject<T> targetP
}

public BulkResultsPage waitForAll() {
WebDriverWait waiter = new WebDriverWait(driver, 120);
WebDriverWait waiter = new WebDriverWait(driver, Duration.ofMinutes(2));
waiter.until(ExpectedConditions2.presenceOfElement(finishedMessage));
return get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.tle.webtests.framework.PageContext;
import com.tle.webtests.pageobject.AbstractPage;
import java.time.Duration;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
Expand Down Expand Up @@ -96,7 +97,8 @@ public MailSettingsPage save() {
public String getEmailStatus() {
By xpath = By.xpath("//div[@id='emailstatus']/div[text()]");
// Wait a bit longer than normal
WebDriverWait waiter = new WebDriverWait(context.getDriver(), 60, 50);
WebDriverWait waiter =
new WebDriverWait(context.getDriver(), Duration.ofMinutes(1), Duration.ofMillis(50));
waiter.until(ExpectedConditions.visibilityOfElementLocated(xpath));
return driver.findElement(xpath).getText();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.tle.webtests.pageobject.generic.component.StringSelectedStuff;
import com.tle.webtests.pageobject.wizard.AbstractWizardControlPage;
import com.tle.webtests.pageobject.wizard.WizardPageTab;
import java.time.Duration;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Keys;
Expand Down Expand Up @@ -42,7 +43,9 @@ private WebElement getSelectionsTable() {
public AutoCompleteTermControl(
PageContext context, int ctrlnum, AbstractWizardControlPage<?> page) {
super(context, ctrlnum, page);
acWaiter = new WebDriverWait(driver, context.getTestConfig().getStandardTimeout(), 600);
acWaiter =
new WebDriverWait(
driver, context.getTestConfig().getStandardTimeout(), Duration.ofMillis(600));
}

@Override
Expand Down
Loading