Poltergeist accepts a blacklist
and whitelist
while configuring it as a driver for Capybara. The documentation states:
Poltergeist supports URL blacklisting, which allows you to prevent scripts from running on designated domains.
While this is great, it doesn't help my issue where I would like to block certain assets from being requested/loaded as it is causing issues in my Travis-CI where those assets are returning as 500 Server Errors and causing my tests to fail even though they should be green.
URIs should be blocked as:
['/stylesheet/*', 'some-image-name.jpg']
Is this possible to do with Poltergeist? Or is there a way to have a Capybara cucumber test not fail just because an asset returned a 500 server error?
Capybara.register_driver :poltergeist do |app|
poltergeist_opts = {
window_size: [1280, 1024],
url_blacklist: ['/stylesheets/select_box_arrow.gif', '/stylesheets/ui-icons_ffffff_256x240.png']
}
Capybara::Poltergeist::Driver.new(app, poltergeist_opts)
end