Skip to content

Commit

Permalink
Merge branch '1.1.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
jgrandja committed Aug 16, 2023
2 parents 0a87e78 + b94ca93 commit 408da8e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ dependencies {
testImplementation "org.junit.jupiter:junit-jupiter"
testImplementation "net.sourceforge.htmlunit:htmlunit"
}

tasks.named("test") {
useJUnitPlatform()
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ dependencies {
testImplementation "org.junit.jupiter:junit-jupiter"
testImplementation "net.sourceforge.htmlunit:htmlunit"
}

tasks.named("test") {
useJUnitPlatform()
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,15 @@ public void setUp() {
}

@Test
public void whenLoginSuccessfulThenDisplayNotFoundError() throws IOException {
public void whenLoginSuccessfulThenDisplayBadRequestError() throws IOException {
HtmlPage page = this.webClient.getPage("/");

assertLoginPage(page);

this.webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
WebResponse signInResponse = signIn(page, "user1", "password").getWebResponse();
assertThat(signInResponse.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND.value()); // there is no "default" index page

assertThat(signInResponse.getStatusCode()).isEqualTo(HttpStatus.BAD_REQUEST.value()); // there is no "default" index page
}

@Test
Expand All @@ -86,7 +87,7 @@ public void whenLoginFailsThenDisplayBadCredentials() throws IOException {

HtmlElement alert = loginErrorPage.querySelector("div[role=\"alert\"]");
assertThat(alert).isNotNull();
assertThat(alert.getTextContent()).isEqualTo("Bad credentials");
assertThat(alert.asNormalizedText()).isEqualTo("Invalid username or password.");
}

@Test
Expand Down

0 comments on commit 408da8e

Please sign in to comment.