Skip to content

Commit

Permalink
Revert "Merge pull request #3522 from openequella/renovate/org.seleni…
Browse files Browse the repository at this point in the history
…umhq.selenium-selenium-java-4.x"

This reverts commit a72cb85, reversing
changes made to 4221008.
  • Loading branch information
edalex-ian committed Nov 8, 2024
1 parent d2bd757 commit eca283e
Show file tree
Hide file tree
Showing 28 changed files with 45 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
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 @@ -1068,7 +1067,7 @@ private List<WebElement> getDivsByPrefix(String prefix) {
*/
private WebElement getAscMessage() {
By ascMessageXpath = By.xpath("//div[@id='ascMessage']/span");
WebDriverWait wait = new WebDriverWait(context.getDriver(), Duration.ofSeconds(30));
WebDriverWait wait = new WebDriverWait(context.getDriver(), 30);
wait.until(ExpectedConditions.visibilityOfElementLocated(ascMessageXpath));
return context.getDriver().findElement(ascMessageXpath);
}
Expand All @@ -1087,7 +1086,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(), Duration.ofSeconds(30));
WebDriverWait wait = new WebDriverWait(context.getDriver(), 30);
wait.until(ExpectedConditions.visibilityOf(field));
field.clear();
field.sendKeys(text);
Expand All @@ -1100,7 +1099,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(), Duration.ofSeconds(30));
WebDriverWait wait = new WebDriverWait(context.getDriver(), 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,7 +19,6 @@
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 @@ -69,8 +68,7 @@ public void notificationsSubsearchTest() throws Exception {
private void waitForIndex() throws IOException {
final String token = requestToken(OAUTH_CLIENT_ID);

WebDriverWait notificationsIndexedWaiter =
new WebDriverWait(context.getDriver(), Duration.ofSeconds(10));
WebDriverWait notificationsIndexedWaiter = new WebDriverWait(context.getDriver(), 10);
notificationsIndexedWaiter.until(
(Function<WebDriver, Boolean>)
driver -> {
Expand Down
2 changes: 1 addition & 1 deletion autotest/Tests/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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" % "4.26.0",
"org.seleniumhq.selenium" % "selenium-java" % "3.141.59",
"org.easytesting" % "fest-util" % "1.2.5",
"org.easytesting" % "fest-swing" % "1.2.1",
"xalan" % "xalan" % "2.7.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
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;
Expand Down Expand Up @@ -140,6 +142,7 @@ 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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
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 @@ -69,8 +68,8 @@ public static String findInstitutionName(Class<?> clazz) {
return inst;
}

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

public String getAdminPassword() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.time.Duration;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.SearchContext;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.WrapsElement;
import org.openqa.selenium.internal.WrapsElement;
import org.openqa.selenium.support.ui.FluentWait;

public class RefreshingElementHandler implements InvocationHandler {
private static final FluentWait<Object> waiter =
new FluentWait<Object>(Void.class)
.withTimeout(Duration.ofSeconds(10))
.pollingEvery(Duration.ofMillis(50));
.withTimeout(10, TimeUnit.SECONDS)
.pollingEvery(50, TimeUnit.MILLISECONDS);
private LazyTemplatedElementLocator locator;
private RefreshingElementProxyCreator proxyCreator;

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.Proxy;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.WrapsElement;
import org.openqa.selenium.internal.WrapsElement;
import org.openqa.selenium.support.pagefactory.DefaultFieldDecorator;
import org.openqa.selenium.support.pagefactory.ElementLocator;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
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;
Expand Down Expand Up @@ -173,6 +175,7 @@ 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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
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 @@ -57,28 +56,23 @@ public AbstractPage(
loadedElement = null;
}

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

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

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

public AbstractPage(PageContext context, By loadedBy) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.WrapsElement;
import org.openqa.selenium.internal.WrapsElement;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

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 @@ -31,7 +30,7 @@ public void setReason(String reason) {
(Function<WebDriver, Object>)
webDriver -> {
try {
new WebDriverWait(webDriver, Duration.ofSeconds(1))
new WebDriverWait(webDriver, 1)
.until(ExpectedConditions.stalenessOf(getContinueButton()));
return false;
} catch (TimeoutException toe) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
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 @@ -48,8 +47,7 @@ public WebDriverWait getWaiter() {

public EditBlackboardConnectorPage(ShowConnectorsPage connectorsPage) {
super(connectorsPage);
this.bbWaiter =
new WebDriverWait(context.getDriver(), Duration.ofMinutes(1), Duration.ofMillis(50));
this.bbWaiter = new WebDriverWait(context.getDriver(), 60, 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,7 +5,6 @@
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 @@ -27,7 +26,7 @@ public DatabaseRow(PageContext context, WebElement rowElement) {
super(context);
this.rowElement = rowElement;
statusElement = rowElement.findElement(By.className("status"));
longWaiter = new WebDriverWait(context.getDriver(), Duration.ofMinutes(1));
longWaiter = new WebDriverWait(context.getDriver(), 60);
}

public void initialise() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
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 @@ -55,7 +54,7 @@ private WebElement getPasswordConfirmElem() {

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

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
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 @@ -21,7 +20,7 @@ public class MigrationProgressDialog extends AbstractPage<MigrationProgressDialo

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

public void close() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
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 @@ -34,7 +33,7 @@ public StatusPage(PageContext context, WaitingPageObject<T> tab) {
}

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

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 @@ -40,17 +39,15 @@ public MoodleBasePage(PageContext context, SearchContext searchContext, By loade
}

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

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

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 @@ -14,7 +13,7 @@ public class UpgradeStepsPage extends AbstractPage<UpgradeStepsPage> {

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

public void upgrade(String password) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
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 @@ -27,8 +26,7 @@ public class RemoteRepoSRUSearchPage

public RemoteRepoSRUSearchPage(PageContext context) {
super(context);
this.waiter =
new WebDriverWait(context.getDriver(), Duration.ofMinutes(1), Duration.ofMillis(50));
this.waiter = new WebDriverWait(context.getDriver(), 60, 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.time.Duration;
import java.util.concurrent.TimeUnit;
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(Duration.ofMinutes(5));
report.getWaiter().withTimeout(5, TimeUnit.MINUTES);
return ExpectWaiter.waiter(
ExpectedConditions.frameToBeAvailableAndSwitchToIt("reportFrame"), report)
.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.openqa.selenium.SearchContext;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.WrapsElement;
import org.openqa.selenium.internal.WrapsElement;
import org.openqa.selenium.support.ui.ExpectedConditions;

public abstract class AbstractResultList<
Expand Down
Loading

0 comments on commit eca283e

Please sign in to comment.