Firefox needs some more RAM to run your Rails system tests

A quick fix for an annoying (and not very descriptive) error Browsing context has been discarded when setting up Ruby on Rails system tests with Firefox headless.

Here is how that might look like:

Alternatively:

This happens especially if you are running this in a constrained environment such as Linux container (with Docker) or a VM (with Vagrant). Simply put there is not enough memory.

If you are running Vagrant as me the actual fix is to increase the memory limit:

And now the tests work!

Leave a comment

Your email address will not be published. Required fields are marked *