I'm using cucumber + capybara for some web automation testing. I'd love to be able to wire up my own tag (something like @all_browsers before the scenario) and have it run against a list of web drivers I set (celerity, selenium on firefox, ie and chrome). I don't want to have to write the scenario 4 different times with 4 different tags out front. I've looked into trying to do this with a new driver I register via:
Capybara.register_driver :all_browsers do |app| # What would even work in here? I don't think anything will. end
And then following it up with:
Before('@all_browsers') do # Same problem here. end
But I'm not quite sure what to put in that Before method that might actually work.
I've tried using cucumber hooks, specifically:
Around('@all_browsers') do |scenario, block| Capybara.current_driver = :selenium_firefox block.call Capybara.current_driver = :selenium_chrome block.call # etc end
But this doesn't behave as I had hoped. It uses the same driver and runs the scenario twice with it.
Following along the hook lines, there's this from the cucumber documentation:
You may also provide an AfterConfiguration hook that will be run after Cucumber has been configured. This hook will run only once; after support has been loaded but before features are loaded. You can use this hook to extend Cucumber, for example you could affect how features are loaded...
This may be a potential path to go down for this, but I've not managed to come up with anything that works here either.
I've looked into custom formatters, but they really only look like they do exactly that - format the output, not so much designate how the features are actually run.
I've looked into overriding cucumber's feature runner, but that doesn't look easy or friendly to do.
Help please? Anyone?