Upgrade to Selenium HtmlUnit 3.64.0 and Selenium 4.4.0

Closes gh-32372
Closes gh-32373
pull/32405/head
Andy Wilkinson 2 years ago
parent aa67f2422a
commit 0476b5da5d

@ -1329,7 +1329,7 @@ bom {
] ]
} }
} }
library("Selenium", "4.2.2") { library("Selenium", "4.4.0") {
group("org.seleniumhq.selenium") { group("org.seleniumhq.selenium") {
modules = [ modules = [
"selenium-api", "selenium-api",
@ -1345,7 +1345,7 @@ bom {
] ]
} }
} }
library("Selenium HtmlUnit", "3.62.0") { library("Selenium HtmlUnit", "3.64.0") {
group("org.seleniumhq.selenium") { group("org.seleniumhq.selenium") {
modules = [ modules = [
"htmlunit-driver" "htmlunit-driver"

@ -20,7 +20,7 @@ import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.TestMethodOrder;
import org.openqa.selenium.By; import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchSessionException; import org.openqa.selenium.NoSuchWindowException;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;
@ -59,7 +59,7 @@ class WebMvcTestWebDriverIntegrationTests {
this.webDriver.get("/html"); this.webDriver.get("/html");
WebElement element = this.webDriver.findElement(By.tagName("body")); WebElement element = this.webDriver.findElement(By.tagName("body"));
assertThat(element.getText()).isEqualTo("Hello"); assertThat(element.getText()).isEqualTo("Hello");
assertThatExceptionOfType(NoSuchSessionException.class).isThrownBy(previousWebDriver::getWindowHandle); assertThatExceptionOfType(NoSuchWindowException.class).isThrownBy(previousWebDriver::getWindowHandle);
assertThat(previousWebDriver).isNotNull().isNotSameAs(this.webDriver); assertThat(previousWebDriver).isNotNull().isNotSameAs(this.webDriver);
} }

@ -19,6 +19,7 @@ package org.springframework.boot.test.web.htmlunit.webdriver;
import java.net.URL; import java.net.URL;
import com.gargoylesoftware.htmlunit.BrowserVersion; import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.TopLevelWindow;
import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.WebClientOptions; import com.gargoylesoftware.htmlunit.WebClientOptions;
import com.gargoylesoftware.htmlunit.WebConsole; import com.gargoylesoftware.htmlunit.WebConsole;
@ -35,8 +36,8 @@ import org.springframework.core.env.Environment;
import org.springframework.mock.env.MockEnvironment; import org.springframework.mock.env.MockEnvironment;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.then; import static org.mockito.BDDMockito.then;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
@ -94,7 +95,8 @@ class LocalHostWebConnectionHtmlUnitDriverTests {
MockEnvironment environment = new MockEnvironment(); MockEnvironment environment = new MockEnvironment();
LocalHostWebConnectionHtmlUnitDriver driver = new TestLocalHostWebConnectionHtmlUnitDriver(environment); LocalHostWebConnectionHtmlUnitDriver driver = new TestLocalHostWebConnectionHtmlUnitDriver(environment);
driver.get("/test"); driver.get("/test");
then(this.webClient).should().getPage(isNull(), requestToUrl(new URL("http://localhost:8080/test"))); then(this.webClient).should().getPage(any(TopLevelWindow.class),
requestToUrl(new URL("http://localhost:8080/test")));
} }
@Test @Test
@ -103,7 +105,8 @@ class LocalHostWebConnectionHtmlUnitDriverTests {
environment.setProperty("local.server.port", "8181"); environment.setProperty("local.server.port", "8181");
LocalHostWebConnectionHtmlUnitDriver driver = new TestLocalHostWebConnectionHtmlUnitDriver(environment); LocalHostWebConnectionHtmlUnitDriver driver = new TestLocalHostWebConnectionHtmlUnitDriver(environment);
driver.get("/test"); driver.get("/test");
then(this.webClient).should().getPage(isNull(), requestToUrl(new URL("http://localhost:8181/test"))); then(this.webClient).should().getPage(any(TopLevelWindow.class),
requestToUrl(new URL("http://localhost:8181/test")));
} }
private WebRequest requestToUrl(URL url) { private WebRequest requestToUrl(URL url) {

Loading…
Cancel
Save