I'm searching a way to implement an AfterStep(@tag) passing the scenario as an argument. Unfortunately, this isn't working and I couldn't find a way to do it.
I also looked into the Cucumber Hooks documentation, but that didn't help as well.
The way I'm trying to implement:
AfterStep('@screenshot') do |scenario|
# Add screenshot to baseline folder.
@helper = Helper.new
@helper.take_screenshot(scenario.name, 'screenshots/baseline')
end
When I run the tests, I get this error:
undefined method `name' for #<Cucumber::Core::Test::Result::Passed:0x007f2b818e6d50> (NoMethodError)
The objective here is to take a screenshot from the scenarios with the @screenshot tag.
As @Sam pointed out, using After('@screenshot') do |scenario|
did the trick for me.