I am getting very random behaviour after running cucumber steps..I need to add a condition such that i will move to next step of cucumber only if previous steps was a success..Moreover can i set a tolerance level in my env.rb so that Out of 50 files,even if 10 files fails,still its a success…
for now im using
After('@javascript, @selenium') do
page.has_content? ''
end
…to verify between Every scenario…NOT every step.
The best way to make sure the step has passed is to use rspec matches to either pass or fail your test. If you wanted the feature to fail if the content “foo bar” was not on the page you would do it like this:
If you’re setting a tolerance level you can use variables to keep track of the number of successes or failures. Lets say your running a feature that checks for “foo” and you’re checking 50 times. In one of your steps create the variable to track the number of successes and you can use capybara to tell you if the page has what you’re looking for without failing the feature if the page is missing the content:
Then in your last scenario, check to see if a is greater than the minimum threshold