hook | R Documentation |
Hooks are functions that are run before or after a scenario.
before(hook)
after(hook)
hook |
A function that will be run. The function first argument is context and the scenario name is the second argument. |
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.
## Not run:
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()
}
})
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.