I am experiencing problems with Cucumber and @After annotations. I am using Cucumber and Java. I want to log out at the end of each Scenario and Scenario Outline. I don't want to have log out at each Then step so I have added it in a tearDown() method in StepDefBasePage to cover the log out part, that is extended to my StepDefinitions.
I have it added to @After method in all Step Definition files. But after it logs out the first time and goes to login screen then it is trying to log out again and it doesn't find the element at log in page.
I have the @After annotation in all Step Definitions files and is it possible that because the same feature is using steps from different Step Definitions to try @After method more than once? How can I solve the issue to log out after each Scenario and each Scenario in Scenario Outline?
Thanks for your help