Using
Serenity 2.0.17
Serenity-Cucumber 1.9.20
Serenity-Screenplay 2.0.17
Appium 1.9.1
Xcode 9.4
The serenity driver is closed after each scenario execution. This occurs when multiple scenarios exist within a Feature/Story. Scenarios doesn't depend each other, but when running tests on Kobiton (a cloud device farm), we faced that after each scenario execution, driver.quit() is called, so the device session ends. What device needs to keep session open, is only to call driver.closeApp(), driver.quit() must be called only when all test suite ends.
StepDefinitions are designed following the next example (driver management is let to serenity): https://github.com/serenity-bdd/journey-planner/blob/master/src/test/java/planner/cucumber/PlanAJourneyStepDefinitions.java
try to use serenity.restart.browser.for.each system property
That works if I don't need to close the app, but I need to restart the app without restarting the driver.
That case isn鈥檛 supported, but you are welcome to play round and propose a PR.
In that case, I will suggest playing with before/after hooks and use appium close and app in background https://discuss.appium.io/t/want-to-restart-android-application-in-a-single-appium-session-without-deleting-uninstalling-it/13561
Thanks Ricardo, I've tried what you proposed me but still getting the same error, I've created custom driver but when a scenario ends, the driver sessionID is set to null so the driver cannot be used again. I don't know if it's maybe a cucumber's issue but driver.quit() is still called.
I think you also have to use serenity.restart.browser.for.each=feature or never.
It works Ricardo, thank you so much for your help!.
Great, @wakaleo I think this can be closed.
Ricardo, do you know a way to close the driver when all cucumber features are executed?
Mmm is not closing? Well I think you can create and after all hook and call quit directly @wakaleo what do u think?
Done!, thank you Ricardo for all your help
So can we close this?
Yes, thanks!