parent
017d3dc402
commit
a2bed160f0
|
|
@ -1549,7 +1549,7 @@ bom {
|
|||
]
|
||||
}
|
||||
}
|
||||
library("Selenium", "3.141.59") {
|
||||
library("Selenium", "4.1.1") {
|
||||
group("org.seleniumhq.selenium") {
|
||||
modules = [
|
||||
"selenium-api",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -20,7 +20,7 @@ import org.junit.jupiter.api.MethodOrderer;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestMethodOrder;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.NoSuchWindowException;
|
||||
import org.openqa.selenium.NoSuchSessionException;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ class WebMvcTestWebDriverIntegrationTests {
|
|||
this.webDriver.get("/html");
|
||||
WebElement element = this.webDriver.findElement(By.tagName("body"));
|
||||
assertThat(element.getText()).isEqualTo("Hello");
|
||||
assertThatExceptionOfType(NoSuchWindowException.class).isThrownBy(previousWebDriver::getWindowHandle);
|
||||
assertThatExceptionOfType(NoSuchSessionException.class).isThrownBy(previousWebDriver::getWindowHandle);
|
||||
assertThat(previousWebDriver).isNotNull().isNotSameAs(this.webDriver);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ dependencies {
|
|||
testImplementation("io.mockk:mockk")
|
||||
testImplementation("jakarta.json:jakarta.json-api")
|
||||
testImplementation("ch.qos.logback:logback-classic")
|
||||
testImplementation("com.squareup.okhttp3:okhttp")
|
||||
testImplementation("org.apache.tomcat.embed:tomcat-embed-core")
|
||||
testImplementation("org.codehaus.groovy:groovy")
|
||||
testImplementation("org.codehaus.groovy:groovy-xml")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -35,8 +35,8 @@ import org.springframework.core.env.Environment;
|
|||
import org.springframework.mock.env.MockEnvironment;
|
||||
|
||||
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.isNull;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
|
@ -55,6 +55,9 @@ class LocalHostWebConnectionHtmlUnitDriverTests {
|
|||
this.webClient = webClient;
|
||||
given(this.webClient.getOptions()).willReturn(new WebClientOptions());
|
||||
given(this.webClient.getWebConsole()).willReturn(new WebConsole());
|
||||
WebWindow currentWindow = mock(WebWindow.class);
|
||||
given(currentWindow.isClosed()).willReturn(false);
|
||||
given(this.webClient.getCurrentWindow()).willReturn(currentWindow);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -80,7 +83,7 @@ class LocalHostWebConnectionHtmlUnitDriverTests {
|
|||
void createWithCapabilitiesWhenEnvironmentIsNullWillThrowException() {
|
||||
Capabilities capabilities = mock(Capabilities.class);
|
||||
given(capabilities.getBrowserName()).willReturn("htmlunit");
|
||||
given(capabilities.getVersion()).willReturn("chrome");
|
||||
given(capabilities.getBrowserVersion()).willReturn("chrome");
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> new LocalHostWebConnectionHtmlUnitDriver(null, capabilities))
|
||||
.withMessageContaining("Environment must not be null");
|
||||
|
|
@ -91,7 +94,7 @@ class LocalHostWebConnectionHtmlUnitDriverTests {
|
|||
MockEnvironment environment = new MockEnvironment();
|
||||
LocalHostWebConnectionHtmlUnitDriver driver = new TestLocalHostWebConnectionHtmlUnitDriver(environment);
|
||||
driver.get("/test");
|
||||
verify(this.webClient).getPage(any(WebWindow.class), requestToUrl(new URL("http://localhost:8080/test")));
|
||||
verify(this.webClient).getPage(isNull(), requestToUrl(new URL("http://localhost:8080/test")));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -100,7 +103,7 @@ class LocalHostWebConnectionHtmlUnitDriverTests {
|
|||
environment.setProperty("local.server.port", "8181");
|
||||
LocalHostWebConnectionHtmlUnitDriver driver = new TestLocalHostWebConnectionHtmlUnitDriver(environment);
|
||||
driver.get("/test");
|
||||
verify(this.webClient).getPage(any(WebWindow.class), requestToUrl(new URL("http://localhost:8181/test")));
|
||||
verify(this.webClient).getPage(isNull(), requestToUrl(new URL("http://localhost:8181/test")));
|
||||
}
|
||||
|
||||
private WebRequest requestToUrl(URL url) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue