Fix webflux usernamepassword:form tests
This commit is contained in:
@@ -17,7 +17,7 @@ dependencies {
|
|||||||
implementation 'org.springframework.boot:spring-boot-starter-security'
|
implementation 'org.springframework.boot:spring-boot-starter-security'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-webflux'
|
implementation 'org.springframework.boot:spring-boot-starter-webflux'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
|
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.boot:spring-boot-starter-test'
|
||||||
testImplementation 'org.springframework.security:spring-security-test'
|
testImplementation 'org.springframework.security:spring-security-test'
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import org.openqa.selenium.WebDriver;
|
|||||||
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
|
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
|
||||||
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
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.
|
* Integration tests for WebFlux based form log in sample.
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package example.pages;
|
package example.pages;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.WebElement;
|
||||||
import org.openqa.selenium.support.FindBy;
|
import org.openqa.selenium.support.FindBy;
|
||||||
@@ -34,7 +36,7 @@ public class LoginPage {
|
|||||||
private WebDriver driver;
|
private WebDriver driver;
|
||||||
|
|
||||||
@FindBy(css = "div[role=alert]")
|
@FindBy(css = "div[role=alert]")
|
||||||
private WebElement alert;
|
private List<WebElement> alert;
|
||||||
|
|
||||||
private LoginForm loginForm;
|
private LoginForm loginForm;
|
||||||
|
|
||||||
@@ -53,12 +55,12 @@ public class LoginPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public LoginPage assertError() {
|
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;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoginPage assertLogout() {
|
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;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user