I am writing some accessibility tests for my rails app using axe-core which requires the use of a javascript_driver.
I have created a separate profile to run my accessibility tests which uses the @accessibility tag and I want this tag to act in the same way as adding the @javascript tag.
I have created a hook, shown below, which I have taken from the Capybara gem.
Before('@accessibility') do
Capybara.current_driver = Capybara.javascript_driver
end
When I then run the tests it does run using the javascript_driver as expected, however method stubs I have added, in this case to allow logging in, no longer work. If I just use the @javascript in addition to my own @accessibility tag then this does not happen.
I am running these test in the rails test environment. If there is any other information I could add that would be helpful, please let me know.