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

feat(jans-auth): update htmlunit driver to htmlunit3 #8373

Merged
merged 2 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 1 addition & 11 deletions jans-auth-server/client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -250,29 +250,19 @@
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
<artifactId>htmlunit3-driver</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.jans</groupId>
<artifactId>jans-auth-test-model</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>jakarta.servlet</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ public void startSelenium() {
//driver = new InternetExplorerDriver();

driver = new HtmlUnitDriver(true);
driver.getWebClient().getOptions().setThrowExceptionOnScriptError(false);
}

public void stopSelenium() {
Expand Down Expand Up @@ -812,7 +813,7 @@ public AuthorizationResponse authorizationRequestAndDenyAccess(

final String previousURL = driver.getCurrentUrl();
doNotAllowButton.click();
WebDriverWait wait = new WebDriverWait(driver, 1);
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(1));
wait.until((WebDriver d) -> (d.getCurrentUrl() != previousURL));

String authorizationResponseStr = driver.getCurrentUrl();
Expand Down Expand Up @@ -871,7 +872,7 @@ public AuthorizationResponse authenticateResourceOwner(

navigateToAuhorizationUrl(driver, driver.getCurrentUrl());

new WebDriverWait(driver, PageConfig.WAIT_OPERATION_TIMEOUT)
new WebDriverWait(driver, Duration.ofSeconds(PageConfig.WAIT_OPERATION_TIMEOUT))
.until(webDriver -> !webDriver.getCurrentUrl().contains("/authorize"));
}

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

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.time.Duration;
import java.util.Set;

import static org.testng.Assert.fail;
Expand All @@ -35,7 +36,7 @@ public AbstractPage(PageConfig config) {

public static String waitForPageSwitch(WebDriver currentDriver, String previousURL) {
Holder<String> currentUrl = new Holder<>();
WebDriverWait wait = new WebDriverWait(currentDriver, PageConfig.WAIT_OPERATION_TIMEOUT);
WebDriverWait wait = new WebDriverWait(currentDriver, Duration.ofSeconds(PageConfig.WAIT_OPERATION_TIMEOUT));
wait.until((WebDriver d) -> {
currentUrl.setT(d.getCurrentUrl());
return !currentUrl.getT().equals(previousURL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.time.Duration;
import java.util.List;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -58,7 +59,7 @@ public LoginPage clickOnLoginAsAnotherUser() {

navigate(driver.getCurrentUrl());
if (BaseTest.ENABLE_REDIRECT_TO_LOGIN_PAGE) {
new WebDriverWait(driver, PageConfig.WAIT_OPERATION_TIMEOUT)
new WebDriverWait(driver, Duration.ofSeconds(PageConfig.WAIT_OPERATION_TIMEOUT))
.until((WebDriver d) -> !d.getCurrentUrl().contains("/authorize"));
}
return new LoginPage(config);
Expand Down
6 changes: 6 additions & 0 deletions jans-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,12 @@
<artifactId>sac</artifactId>
<version>1.3</version>
</dependency>

<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit3-driver</artifactId>
<version>4.17.0</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down