@Test public final void existingUserWithWrongPasswordCantLogIn() { User user = TestData.newValidUser().withPassword("wrong").build(); LoginPage page = openLoginPage().loginExpectingError(user); assertThat(page.errorMessage()).isVisible(); assertThat(page.errorMessage()).hasVisibleText("Wrong Credentials!"); }
@Test public final void nonExistingUserCantLogIn() { User user = TestData.newValidUser().withUsername("unknown").build(); LoginPage page = openLoginPage().loginExpectingError(user); assertThat(page.errorMessage()).isVisible(); assertThat(page.errorMessage()).hasVisibleText("Wrong Credentials!"); }
@Test public final void existingUserWithCorrectPasswordCanLogIn() { User user = TestData.newValidUser().build(); WelcomePage page = openLoginPage().login(user); assertThat(page.headline()).hasVisibleText("Hello World!"); }