I have a test that puts my app into a state that a customer would never see. It’s the last test in a suite, and I restart the driver to clear data. The way I do it is to tag my scenario with an @restart and then in my hooks.rb I add the following:
After('@restart') do
restart_driver
end
restart_driver looks like this:
def restart_driver
driver.reset
end
Read more about tagged hooks here: