From 86199da1d882401be7dfc93594c5623ff0e8e71c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 30 Oct 2024 13:49:14 +0000 Subject: [PATCH 1/4] chore(deps): update dependency org.seleniumhq.selenium:selenium-java to v4 --- autotest/Tests/build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autotest/Tests/build.sbt b/autotest/Tests/build.sbt index 75514afd6e..6b0fa7668a 100644 --- a/autotest/Tests/build.sbt +++ b/autotest/Tests/build.sbt @@ -23,7 +23,7 @@ libraryDependencies ++= Seq( "org.scala-lang" % "scala-reflect" % scalaVersion.value, "javax.jws" % "javax.jws-api" % "1.1", "org.apache.commons" % "commons-lang3" % "3.14.0", - "org.seleniumhq.selenium" % "selenium-java" % "3.141.59", + "org.seleniumhq.selenium" % "selenium-java" % "4.26.0", "org.easytesting" % "fest-util" % "1.2.5", "org.easytesting" % "fest-swing" % "1.2.1", "xalan" % "xalan" % "2.7.3", From 5b492a5ec4af8043445733e4238dde8d0a92398e Mon Sep 17 00:00:00 2001 From: Ian Stevenson Date: Tue, 5 Nov 2024 15:07:56 +1100 Subject: [PATCH 2/4] test(Selenium): update WrapsElement import WrapsElement moved out of 'internal' as per https://github.com/SeleniumHQ/selenium/issues/6881 --- .../webtests/framework/factory/RefreshingElementHandler.java | 2 +- .../webtests/framework/factory/RefreshingFieldDecorator.java | 2 +- .../java/com/tle/webtests/pageobject/ExpectedConditions2.java | 2 +- .../tle/webtests/pageobject/searching/AbstractResultList.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/autotest/Tests/src/main/java/com/tle/webtests/framework/factory/RefreshingElementHandler.java b/autotest/Tests/src/main/java/com/tle/webtests/framework/factory/RefreshingElementHandler.java index b3342a7f58..1c19d86f7b 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/framework/factory/RefreshingElementHandler.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/framework/factory/RefreshingElementHandler.java @@ -9,7 +9,7 @@ import org.openqa.selenium.SearchContext; import org.openqa.selenium.StaleElementReferenceException; import org.openqa.selenium.WebElement; -import org.openqa.selenium.internal.WrapsElement; +import org.openqa.selenium.WrapsElement; import org.openqa.selenium.support.ui.FluentWait; public class RefreshingElementHandler implements InvocationHandler { diff --git a/autotest/Tests/src/main/java/com/tle/webtests/framework/factory/RefreshingFieldDecorator.java b/autotest/Tests/src/main/java/com/tle/webtests/framework/factory/RefreshingFieldDecorator.java index e6b2b49877..f68cb50607 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/framework/factory/RefreshingFieldDecorator.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/framework/factory/RefreshingFieldDecorator.java @@ -4,7 +4,7 @@ import java.lang.reflect.InvocationHandler; import java.lang.reflect.Proxy; import org.openqa.selenium.WebElement; -import org.openqa.selenium.internal.WrapsElement; +import org.openqa.selenium.WrapsElement; import org.openqa.selenium.support.pagefactory.DefaultFieldDecorator; import org.openqa.selenium.support.pagefactory.ElementLocator; diff --git a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/ExpectedConditions2.java b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/ExpectedConditions2.java index 7d7567f8e3..01c5c74b02 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/ExpectedConditions2.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/ExpectedConditions2.java @@ -14,7 +14,7 @@ import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriverException; import org.openqa.selenium.WebElement; -import org.openqa.selenium.internal.WrapsElement; +import org.openqa.selenium.WrapsElement; import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.support.ui.ExpectedConditions; diff --git a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/searching/AbstractResultList.java b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/searching/AbstractResultList.java index 473e5dea22..4042b872da 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/searching/AbstractResultList.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/searching/AbstractResultList.java @@ -12,7 +12,7 @@ import org.openqa.selenium.SearchContext; import org.openqa.selenium.TimeoutException; import org.openqa.selenium.WebElement; -import org.openqa.selenium.internal.WrapsElement; +import org.openqa.selenium.WrapsElement; import org.openqa.selenium.support.ui.ExpectedConditions; public abstract class AbstractResultList< From eaeac175f400c7606017fe58e5121916a3e5523d Mon Sep 17 00:00:00 2001 From: Ian Stevenson Date: Tue, 5 Nov 2024 15:31:06 +1100 Subject: [PATCH 3/4] test(Selenium): move to using Duration Newer Selenium uses Duration rather than int (seconds) for waits and timeouts. --- .../controls/asc/AdvancedScriptControlTests.java | 7 ++++--- .../webservices/rest/NotificationsApiTest.java | 4 +++- .../com/tle/webtests/framework/TestConfig.java | 5 +++-- .../factory/RefreshingElementHandler.java | 6 +++--- .../tle/webtests/pageobject/AbstractPage.java | 16 +++++++++++----- .../webtests/pageobject/cal/CALOverridePage.java | 3 ++- .../connectors/EditBlackboardConnectorPage.java | 4 +++- .../pageobject/institution/DatabaseRow.java | 3 ++- .../pageobject/institution/ImportTab.java | 3 ++- .../institution/MigrationProgressDialog.java | 3 ++- .../pageobject/institution/StatusPage.java | 3 ++- .../integration/moodle/MoodleBasePage.java | 9 ++++++--- .../pageobject/migration/UpgradeStepsPage.java | 3 ++- .../remoterepo/sru/RemoteRepoSRUSearchPage.java | 4 +++- .../reporting/AbstractReportWindow.java | 4 ++-- .../searching/AutoCompleteOptions.java | 5 ++++- .../pageobject/searching/BulkResultsPage.java | 3 ++- .../pageobject/settings/MailSettingsPage.java | 4 +++- .../wizard/controls/AutoCompleteTermControl.java | 5 ++++- .../universal/KalturaUniversalControlType.java | 3 ++- .../universal/iTunesUniversalControlType.java | 3 ++- .../equellatests/browserpage/BrowserPage.scala | 3 ++- 22 files changed, 69 insertions(+), 34 deletions(-) diff --git a/autotest/OldTests/src/test/java/com/tle/webtests/test/contribute/controls/asc/AdvancedScriptControlTests.java b/autotest/OldTests/src/test/java/com/tle/webtests/test/contribute/controls/asc/AdvancedScriptControlTests.java index d5eddb398c..304e9e1f90 100644 --- a/autotest/OldTests/src/test/java/com/tle/webtests/test/contribute/controls/asc/AdvancedScriptControlTests.java +++ b/autotest/OldTests/src/test/java/com/tle/webtests/test/contribute/controls/asc/AdvancedScriptControlTests.java @@ -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; @@ -1067,7 +1068,7 @@ private List 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); } @@ -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); @@ -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); diff --git a/autotest/OldTests/src/test/java/com/tle/webtests/test/webservices/rest/NotificationsApiTest.java b/autotest/OldTests/src/test/java/com/tle/webtests/test/webservices/rest/NotificationsApiTest.java index a488e8d415..b5ef1a0e79 100644 --- a/autotest/OldTests/src/test/java/com/tle/webtests/test/webservices/rest/NotificationsApiTest.java +++ b/autotest/OldTests/src/test/java/com/tle/webtests/test/webservices/rest/NotificationsApiTest.java @@ -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; @@ -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) driver -> { diff --git a/autotest/Tests/src/main/java/com/tle/webtests/framework/TestConfig.java b/autotest/Tests/src/main/java/com/tle/webtests/framework/TestConfig.java index 933c9be8f8..78d656ddb8 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/framework/TestConfig.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/framework/TestConfig.java @@ -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; @@ -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() { diff --git a/autotest/Tests/src/main/java/com/tle/webtests/framework/factory/RefreshingElementHandler.java b/autotest/Tests/src/main/java/com/tle/webtests/framework/factory/RefreshingElementHandler.java index 1c19d86f7b..fc688ff248 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/framework/factory/RefreshingElementHandler.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/framework/factory/RefreshingElementHandler.java @@ -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; @@ -15,8 +15,8 @@ public class RefreshingElementHandler implements InvocationHandler { private static final FluentWait waiter = new FluentWait(Void.class) - .withTimeout(10, TimeUnit.SECONDS) - .pollingEvery(50, TimeUnit.MILLISECONDS); + .withTimeout(Duration.ofSeconds(10)) + .pollingEvery(Duration.ofMillis(50)); private LazyTemplatedElementLocator locator; private RefreshingElementProxyCreator proxyCreator; diff --git a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/AbstractPage.java b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/AbstractPage.java index 2220423ed5..bf7fcd76a2 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/AbstractPage.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/AbstractPage.java @@ -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; @@ -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) { diff --git a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/cal/CALOverridePage.java b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/cal/CALOverridePage.java index ef4efb15c0..03fb48b699 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/cal/CALOverridePage.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/cal/CALOverridePage.java @@ -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; @@ -30,7 +31,7 @@ public void setReason(String reason) { (Function) webDriver -> { try { - new WebDriverWait(webDriver, 1) + new WebDriverWait(webDriver, Duration.ofSeconds(1)) .until(ExpectedConditions.stalenessOf(getContinueButton())); return false; } catch (TimeoutException toe) { diff --git a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/connectors/EditBlackboardConnectorPage.java b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/connectors/EditBlackboardConnectorPage.java index 0fa028c8ed..353602aea1 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/connectors/EditBlackboardConnectorPage.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/connectors/EditBlackboardConnectorPage.java @@ -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; @@ -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) { diff --git a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/institution/DatabaseRow.java b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/institution/DatabaseRow.java index 174f8b713e..a658306218 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/institution/DatabaseRow.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/institution/DatabaseRow.java @@ -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; @@ -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() { diff --git a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/institution/ImportTab.java b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/institution/ImportTab.java index dd596ad3dd..fc86ee001b 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/institution/ImportTab.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/institution/ImportTab.java @@ -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; @@ -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 diff --git a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/institution/MigrationProgressDialog.java b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/institution/MigrationProgressDialog.java index a040a54e42..bf47195f01 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/institution/MigrationProgressDialog.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/institution/MigrationProgressDialog.java @@ -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; @@ -20,7 +21,7 @@ public class MigrationProgressDialog extends AbstractPage tab) { } public StatusPage(PageContext context, WaitingPageObject tab, long timeout) { - super(context, new WebDriverWait(context.getDriver(), timeout)); + super(context, new WebDriverWait(context.getDriver(), Duration.ofSeconds(timeout))); mustBeVisible = false; this.tab = tab; } diff --git a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/integration/moodle/MoodleBasePage.java b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/integration/moodle/MoodleBasePage.java index da4ba8ba59..e21d8a2659 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/integration/moodle/MoodleBasePage.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/integration/moodle/MoodleBasePage.java @@ -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; @@ -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) { diff --git a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/migration/UpgradeStepsPage.java b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/migration/UpgradeStepsPage.java index 702c2c34d9..9f594757d2 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/migration/UpgradeStepsPage.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/migration/UpgradeStepsPage.java @@ -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; @@ -13,7 +14,7 @@ public class UpgradeStepsPage extends AbstractPage { 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) { diff --git a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/remoterepo/sru/RemoteRepoSRUSearchPage.java b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/remoterepo/sru/RemoteRepoSRUSearchPage.java index 6648ce1287..e506e5972e 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/remoterepo/sru/RemoteRepoSRUSearchPage.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/remoterepo/sru/RemoteRepoSRUSearchPage.java @@ -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; @@ -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 diff --git a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/reporting/AbstractReportWindow.java b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/reporting/AbstractReportWindow.java index 0f91bd26d3..db8069eb38 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/reporting/AbstractReportWindow.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/reporting/AbstractReportWindow.java @@ -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; @@ -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(); diff --git a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/searching/AutoCompleteOptions.java b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/searching/AutoCompleteOptions.java index 058ba7d53d..9e52b309a2 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/searching/AutoCompleteOptions.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/searching/AutoCompleteOptions.java @@ -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; @@ -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() { diff --git a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/searching/BulkResultsPage.java b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/searching/BulkResultsPage.java index 93fa27befd..64dc968b4e 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/searching/BulkResultsPage.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/searching/BulkResultsPage.java @@ -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; @@ -29,7 +30,7 @@ public boolean waitAndFinish(WaitingPageObject 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(); } diff --git a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/settings/MailSettingsPage.java b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/settings/MailSettingsPage.java index 6031f78782..52a115c69a 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/settings/MailSettingsPage.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/settings/MailSettingsPage.java @@ -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; @@ -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(); } diff --git a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/wizard/controls/AutoCompleteTermControl.java b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/wizard/controls/AutoCompleteTermControl.java index 90769b628a..0ee01609b3 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/wizard/controls/AutoCompleteTermControl.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/wizard/controls/AutoCompleteTermControl.java @@ -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; @@ -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 diff --git a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/wizard/controls/universal/KalturaUniversalControlType.java b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/wizard/controls/universal/KalturaUniversalControlType.java index 154a8c6cdc..36021db22f 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/wizard/controls/universal/KalturaUniversalControlType.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/wizard/controls/universal/KalturaUniversalControlType.java @@ -4,6 +4,7 @@ import com.tle.webtests.pageobject.PageObject; import com.tle.webtests.pageobject.WaitingPageObject; import com.tle.webtests.pageobject.wizard.controls.UniversalControl; +import java.time.Duration; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebElement; @@ -46,7 +47,7 @@ public enum KalturaOption { public KalturaUniversalControlType(UniversalControl control) { super(control); - this.waiter = new WebDriverWait(driver, 60, 50); + this.waiter = new WebDriverWait(driver, Duration.ofMinutes(1), Duration.ofMillis(50)); } public KalturaUniversalControlType search(String query) { diff --git a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/wizard/controls/universal/iTunesUniversalControlType.java b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/wizard/controls/universal/iTunesUniversalControlType.java index 5956b5c1ad..4bf1872cde 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/wizard/controls/universal/iTunesUniversalControlType.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/wizard/controls/universal/iTunesUniversalControlType.java @@ -3,6 +3,7 @@ import com.tle.webtests.pageobject.AbstractPage; import com.tle.webtests.pageobject.WaitingPageObject; import com.tle.webtests.pageobject.wizard.controls.UniversalControl; +import java.time.Duration; import org.openqa.selenium.By; import org.openqa.selenium.SearchContext; import org.openqa.selenium.WebElement; @@ -25,7 +26,7 @@ private WebElement getTree() { public iTunesUniversalControlType(UniversalControl control) { super(control); - waiter = new WebDriverWait(context.getDriver(), 120); + waiter = new WebDriverWait(context.getDriver(), Duration.ofMinutes(2)); } @Override diff --git a/autotest/Tests/src/test/scala/equellatests/browserpage/BrowserPage.scala b/autotest/Tests/src/test/scala/equellatests/browserpage/BrowserPage.scala index 253ac12a1d..c0da41775b 100644 --- a/autotest/Tests/src/test/scala/equellatests/browserpage/BrowserPage.scala +++ b/autotest/Tests/src/test/scala/equellatests/browserpage/BrowserPage.scala @@ -4,6 +4,7 @@ import com.tle.webtests.framework.PageContext import org.openqa.selenium.support.ui.{ExpectedCondition, ExpectedConditions, WebDriverWait} import org.openqa.selenium.{By, WebDriver, WebElement} +import java.time.Duration import scala.util.Try object BrowserPage { @@ -22,7 +23,7 @@ trait BrowserPage { def findElement(by: By): WebElement = driver.findElement(by) def findElementById(id: String): WebElement = findElement(By.id(id)) def findElementO(by: By): Option[WebElement] = Try(driver.findElement(by)).toOption - val waiter = new WebDriverWait(driver, 10, 50L) + val waiter = new WebDriverWait(driver, Duration.ofSeconds(10), Duration.ofMillis(50)) def waitFor[A](c: ExpectedCondition[A]): A = waiter.until(c) def updatedBy(by: By): ExpectedCondition[_] = From 792b61ccef11a06b256ad89882b7b6c5bf39ae54 Mon Sep 17 00:00:00 2001 From: Ian Stevenson Date: Tue, 5 Nov 2024 15:58:35 +1100 Subject: [PATCH 4/4] test(Selenium): remove calls to FirefoxBinary::setTimeout This function has been removed. Indeed, FirefoxBinary has been deprecated and we're meant to move to FirefoxOptions. --- .../java/com/tle/webtests/framework/StandardDriverFactory.java | 3 --- .../com/tle/webtests/framework/setup/SyncToLocalServer.java | 3 --- 2 files changed, 6 deletions(-) diff --git a/autotest/Tests/src/main/java/com/tle/webtests/framework/StandardDriverFactory.java b/autotest/Tests/src/main/java/com/tle/webtests/framework/StandardDriverFactory.java index 5456ec26bf..3a6fa4d2c1 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/framework/StandardDriverFactory.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/framework/StandardDriverFactory.java @@ -1,7 +1,5 @@ package com.tle.webtests.framework; -import static java.util.concurrent.TimeUnit.SECONDS; - import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.Maps; import com.tle.common.Check; @@ -142,7 +140,6 @@ public WebDriver getDriver(Class clazz) throws IOException { } else { binary = new FirefoxBinary(); } - binary.setTimeout(SECONDS.toMillis(120)); FirefoxProfile profile = new FirefoxProfile(); profile.addExtension(getClass(), "firebug-1.10.2-fx.xpi"); profile.addExtension(getClass(), "firepath-0.9.7-fx.xpi"); diff --git a/autotest/Tests/src/main/java/com/tle/webtests/framework/setup/SyncToLocalServer.java b/autotest/Tests/src/main/java/com/tle/webtests/framework/setup/SyncToLocalServer.java index 690f062969..fee6c870b5 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/framework/setup/SyncToLocalServer.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/framework/setup/SyncToLocalServer.java @@ -1,7 +1,5 @@ package com.tle.webtests.framework.setup; -import static java.util.concurrent.TimeUnit.SECONDS; - import com.tle.webtests.framework.Assert; import com.tle.webtests.framework.PageContext; import com.tle.webtests.framework.TestConfig; @@ -175,7 +173,6 @@ private FirefoxDriver getDriver() { } else { binary = new FirefoxBinary(); } - binary.setTimeout(SECONDS.toMillis(120)); FirefoxProfile profile = new FirefoxProfile(); // profile.addExtension(getClass(), "firebug-1.7.3-fx.xpi"); profile.setPreference("extensions.firebug.currentVersion", "999");