From d5c3f98bc6c7c436e1376ca2edb45f0c19ecca59 Mon Sep 17 00:00:00 2001 From: Marcus Da Coregio Date: Wed, 21 Jun 2023 16:20:20 -0300 Subject: [PATCH] Fix webflux usernamepassword:form tests --- .../authentication/username-password/form/build.gradle | 2 +- .../java/example/WebfluxFormApplicationITests.java | 2 +- .../form/src/integTest/java/example/pages/LoginPage.java | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/reactive/webflux/java/authentication/username-password/form/build.gradle b/reactive/webflux/java/authentication/username-password/form/build.gradle index 5fa785f..c57a100 100644 --- a/reactive/webflux/java/authentication/username-password/form/build.gradle +++ b/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' diff --git a/reactive/webflux/java/authentication/username-password/form/src/integTest/java/example/WebfluxFormApplicationITests.java b/reactive/webflux/java/authentication/username-password/form/src/integTest/java/example/WebfluxFormApplicationITests.java index 47a00d3..3623ed9 100644 --- a/reactive/webflux/java/authentication/username-password/form/src/integTest/java/example/WebfluxFormApplicationITests.java +++ b/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. diff --git a/reactive/webflux/java/authentication/username-password/form/src/integTest/java/example/pages/LoginPage.java b/reactive/webflux/java/authentication/username-password/form/src/integTest/java/example/pages/LoginPage.java index 298092d..13e7b7b 100644 --- a/reactive/webflux/java/authentication/username-password/form/src/integTest/java/example/pages/LoginPage.java +++ b/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 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; }