Hi, had a quick read and looks like a good guide to get started into Cucumber-jvm and Serenity-bdd frameworks.
Just have a few comments regarding it, and wondering if you agree/disagree and open to your thoughts as I've previously implemented them into a project to test a responsive web-app.
The examples on the serenity-bdd website for using the two frameworks weren't very clear on how to use them together, and it seemed like the cucumber step definition classes did absolutely nothing, but call serenity step library class methods, which also did nothing as they would again delegate to the page object classes.
What I did instead, was have a step definition which was more high level that contained NO test logic/assertion code, instead delegate it to the serenity step library class methods, whereby all the test code would reside. It would directly call a public WebElementFacade member in the Page Object classes. These page objects would ONLY contain the WebElementFacade elements that are determined by the Serenity @FindBy annotation, and would only contain methods in the case of more complex situations, such as returning values from a dynamic table element etc.
So the flow would be
Feature file --> Cucumber Step Definitions (Delegates method to Serenity step library, ONLY logic implemented here would be to determine which serenity step library method to call) --> Serenity step library method (Core test code) --> Page object (Only contains WebElementFacade members).
An more detailed example
Feature file: Update Bank Details
Given I am logged in as a member
When I update the bank details
Then It should be updated
Step Definition Class
BankStepDefs.java
@Steps
BankSerenityLib bankSerenityLib;
@When("^(?i)I update the bank details$")
public void iUpdateTheBankDetails() throws Throwable {
bankSerenityLib.navigateToBankDetails();
bankSerenityLib.editWithValidBankDetails();
bankSerenityLib.validateBankUpdatedSuccessMessage();
}
Serenity Step Library Class
BankSerenityLib.java
NavigationPage navigationPane;
UpdateBankPage updateBankPage;
@Step
public void navigateToBankDetails() {
navigationPane.bankBtn.click();
navigationPane.updateBankBtn.waitUntilClickable().click();
assertThat(updateBankPage.updateBankHeading.isCurrentlyVisible()).isTrue();
}
@Step
public void editWithValidBankDetails() {
updateBankPage.editBankDetails.click();
updateBankPage.bsbField.typeAndTab("82424242");
etcetc.
}
Page Object
UpdateBankPage.java
@FindBy(id = "bsb")
public WebElementFacade bsbField;
@FindBy(id = "acctNo")
public WebElementFacade accountNumField;
I noticed that you didn't use the Serenity WebElementFacade, was there a reason why?
Let me know your thoughts, thanks.