Selaa lähdekoodia

Fix webflux usernamepassword:form tests

Marcus Da Coregio 2 vuotta sitten
vanhempi
commit
d5c3f98bc6

+ 1 - 1
reactive/webflux/java/authentication/username-password/form/build.gradle

@@ -17,7 +17,7 @@ dependencies {
 	implementation 'org.springframework.boot:spring-boot-starter-security'
 	implementation 'org.springframework.boot:spring-boot-starter-webflux'
 	implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
-	implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5'
+	implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6'
 
 	testImplementation 'org.springframework.boot:spring-boot-starter-test'
 	testImplementation 'org.springframework.security:spring-security-test'

+ 1 - 1
reactive/webflux/java/authentication/username-password/form/src/integTest/java/example/WebfluxFormApplicationITests.java

@@ -24,7 +24,7 @@ import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.htmlunit.HtmlUnitDriver;
 
 import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.boot.test.web.server.LocalServerPort;
 
 /**
  * Integration tests for WebFlux based form log in sample.

+ 5 - 3
reactive/webflux/java/authentication/username-password/form/src/integTest/java/example/pages/LoginPage.java

@@ -16,6 +16,8 @@
 
 package example.pages;
 
+import java.util.List;
+
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.support.FindBy;
@@ -34,7 +36,7 @@ public class LoginPage {
 	private WebDriver driver;
 
 	@FindBy(css = "div[role=alert]")
-	private WebElement alert;
+	private List<WebElement> alert;
 
 	private LoginForm loginForm;
 
@@ -53,12 +55,12 @@ public class LoginPage {
 	}
 
 	public LoginPage assertError() {
-		assertThat(this.alert.getText()).isEqualTo("Invalid username and password.");
+		assertThat(this.alert).extracting(WebElement::getText).contains("Invalid username and password.");
 		return this;
 	}
 
 	public LoginPage assertLogout() {
-		assertThat(this.alert.getText()).isEqualTo("You have been logged out.");
+		assertThat(this.alert).extracting(WebElement::getText).contains("You have been logged out.");
 		return this;
 	}