Using Serenity BDD +selenium+Junit for automation.i am new to serenity BDD but have experience in cucumber BDD where we can easily share steps.i want to achieve the same in serenity. For simplicity let's say we have a Login page and a subsequent page say Name Check Page. I have created individual POM for these two pages and then corresponding step definitions(@steps) and wanted to use @steps defined in these two step definition classes in single script. Can this be done?
1)I have tried using this but browser closes as soon the step in particular step class finishes so other steps do not get executed and gives exception
public class AA_NameCheck{
@Managed(driver="edge",clearCookies=ClearCookiesPolicy.BeforeEachTest)
WebDriver driver;
@Steps
StepsLoginPage stepL;
StepsNameCheckPage stepN;
@Test
public void NameCheck_ValidUser() throws InterruptedException{
stepL.Launch();
stepL.Login_ValidCredential();
stepN.Enter_NameDetails();
}
After stepL.Login_validCredentials() finishes browser gets close and thus exception occur on methods on Name_EnterDetails()
2)i have tried instead of creating separate step definition keeping the @steps in POM ,it worked but the steps are then not visible in serenity report.
Just wanted to know any other approach is possible for sharing steps?
@Steps
StepsLoginPage stepL;
@Steps
StepsNameCheckPage stepN;