Capybara + RSpec test with turbo stream passes locally but fails on Github actions

104 views Asked by At

I have a Rails7 application with Hotwire and Stimulus components. I run the tests using RSpec and Capybara with the selenium_chrome_headless driver. One of the actions is turbo stream. The tests are passing locally but they fail on Github actions.

From what I can see in Actions, Capybara starts Puma...

Capybara starting Puma
* Version 6.4.0 , codename: The Eagle of Durango
* Min threads: 0, max threads: 4
* Listening on http://127.0.0.1:36901

... then the tests run. Unfortunately, the tests related to turbo stream action fail. There is ActionController::UnknownFormat in the response page content.

I tried changing the Selenium driver or explicitly specifying the JavaScript driver for the failing context.

Has anyone had a similar situation? Am I missing something regarding Github Actions?

UPDATE

I managed to fix it.

Before, I was using the bin/rake script to run the tests on Github Actions. Then I changed it to bundle exec rspec. Actions showed missing assets so I added bundle exec rails assets:precompile just before the rspec execution. It helped!

It seems some of the JavaScript assets were missing before.

0

There are 0 answers