Reputation: 1538
I need to execute specific function after each scenario, except the last one in the queue. Is there a way to do that?
Upvotes: 0
Views: 773
Reputation: 1506
Could you not move the function to be in the Before hook instead? That way it would never run on the last scenario, but would run for all other scenarios.
If you don't want it to run before the first scenario for whatever reason, you can set a global variable to store whether this scenario is the first one.
e.g.
In env or somewhere create and set
$first_scenario = true
Then in the before hook
run_your_function unless $first_scenario
$first_scenario = false
Upvotes: 1