Reputation: 65183
I have this hook here: After do |scenario| if scenario.try(:status) == :failed @fail_count = @fail_count.to_i + 1 save_and_open_page if @fail_count <= 5 end
but I don't want it to always open failed scenarios.
Is there a way I can set up my cucumber such that when I do cucumber vars ... enable_open_page
the above hook enables?
Upvotes: 1
Views: 164
Reputation: 13593
After do |scenario|
if scenario.try(:status) == :failed
@fail_count = @fail_count.to_i + 1
save_and_open_page if ENV["ENABLE_OPEN_PAGE"].present? and @fail_count <= 5
end
end
And call cucumber with the environment variable:
ENABLE_OPEN_PAGE=true cucumber
Upvotes: 2