I am updating an older app's Ruby and Rails versions and attempting to get all of the feature tests passing. Most of them were failing due to still relying on capybara-webit
. I have replaced that with webdrivers
and cuprite
and that fixed about half of them. Still, all of the injected react components (using react-rails
) aren't rendered when running tests (screenshots prove this).
I have added the gems and am using this config in my spec_helper.rb
file:
Capybara.register_driver(:cuprite) do |app|
Capybara::Cuprite::Driver.new(
app,
window_size: [1200, 800],
inspector: true
)
end
Capybara.default_driver = Capybara.javascript_driver = :cuprite
I've also tried to get this working with a :headless_chrome
driver, and that worked even less. With that config, the page also didn't render the erb
parent container of the injected react component. I also tried adding in a sleep
where components were rendering, which didn't work. Is there a way to get react components to render in test
with this setup?