Change Request Parameter Lookup

- For this sample, the expression param.error always has a
value upon querying it
- This isn't the case for the other samples, it may be that in reactive
applications, the request is wrapped in something that always
returns a value
This commit is contained in:
Josh Cummings
2024-08-01 12:35:15 -06:00
parent d17784856f
commit f795172611
2 changed files with 4 additions and 4 deletions

View File

@@ -55,12 +55,12 @@ public class LoginPage {
}
public LoginPage assertError() {
assertThat(this.alert).extracting(WebElement::getText).contains("Invalid username and password.");
assertThat(this.alert).extracting(WebElement::getText).containsOnly("Invalid username and password.");
return this;
}
public LoginPage assertLogout() {
assertThat(this.alert).extracting(WebElement::getText).contains("You have been logged out.");
assertThat(this.alert).extracting(WebElement::getText).containsOnly("You have been logged out.");
return this;
}

View File

@@ -13,9 +13,9 @@
<div class="container">
<form class="form-signin" method="post" th:action="@{/login}">
<h2 class="form-signin-heading">Please Log In</h2>
<div th:if="${param.error}" class="alert alert-danger" role="alert">Invalid
<div th:if="${param.keySet().contains('error')}" class="alert alert-danger" role="alert">Invalid
username and password.</div>
<div th:if="${param.logout}" class="alert alert-success" role="alert">You
<div th:if="${param.keySet().contains('logout')}" class="alert alert-success" role="alert">You
have been logged out.</div>
<p>
<label for="username" class="sr-only">Username</label>