I started playing around with Serenity BDD and the screenplay pattern in Java. While I get the basic idea I have some trouble with applying the key concepts. Here is what I'd like to do...
My first attempt is to automate the login of a user into the application. This consists of the following:
- Open a specific URL.
- Enter user credentials and hit the submit button.
- Check that the user is on the "Welcome page".
I successfully implemented items 1 and 2 but I'm struggling with the check at 3.
The JUnit Test
@Test
public void shouldBeAbleToLogin() {
user.whoCan(BrowseTheWeb.with(browser));
user.wasAbleTo(OpenTheApplication.onTheLoginPage());
user.attemptsTo(SubmitUserCredentials.withValues("test", "test"));
user.should(???);
}
After having submitted the credentials the user gets redirected to the welcome page. The ???
shall indicate that I don't have a solid idea how to implement this check.
- Check that the new URL matches that of the welcome page.
- Check that a certain text is visible on the welcome page.
- Check that a certain element is visible on the welcome page.
I know that I would need to implement some class of Question
but that's it. Could you provide me with some hint how you would do that?