Hooks are functions that are run before or after a scenario.
Details
You can define them alongside steps definitions.
If you want to run a hook only before or after a specific scenario, use it's name to execute hook only for this scenario.
Examples
if (FALSE) { # \dontrun{
before(function(context, scenario_name) {
context$session <- selenider::selenider_session()
})
after(function(context, scenario_name) {
selenider::close_session(context$session)
})
after(function(context, scenario_name) {
if (scenario_name == "Playing one round of the game") {
context$game$close()
}
})
} # }