> For the complete documentation index, see [llms.txt](https://ofn-user-guide.gitbook.io/ofn-testing-handbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ofn-user-guide.gitbook.io/ofn-testing-handbook/automated-testing-handbook/system-specs.md).

# System Specs

**Background**

"System tests" are the new replacement for "feature specs" in modern Rails apps. Also, the new driver Ferrum-Cuprite driver does a similar job to Selenium, but it's radically faster and the tests are way more stable (less flaky specs). See also [relevant thread on Slack](https://openfoodnetwork.slack.com/archives/C02TZ6X00/p1626093858077600?thread_ts=1626075838.077100\&cid=C02TZ6X00).

**Migration from Feature specs into System specs**

&#x20;This is a task which is in progress [here](https://github.com/openfoodfoundation/openfoodnetwork/issues/8029). The process involves these steps [(mentioned on this page) ](https://everydayrails.com/2018/01/08/rspec-3.7-system-tests.html):<br>

* move spec files from spec/features to into spec/system
* replace `require "spec_helper"`with `require "system_helper"`
* Use `RSpec.describe` to define system specs, instead of `RSpec.feature`
* Replace the `scenario` alias in previous feature specs with the standard `it` syntax (this appears to be optional)

Additionally, other changes may be required. For example:

* some helper methods were created considered Selenium; these won't work now and need to be adapted to [Ferrum](https://github.com/rubycdp/ferrum)
* some syntax might not work under system specs, for example `background do` blocks need to be replaced with `before do` �.
* the syntax for manipulating cookies with Ferrum is found [here](https://ofn-user-guide.gitbook.io/ofn-testing-handbook/automated-testing-handbook/system-specs); see also [this commit](https://github.com/openfoodfoundation/openfoodnetwork/pull/8317/commits/a376c0b079f45c2aac6faa76444959fd8919873c).&#x20;
* other issues will certainly come up and will be added here

**References**

{% embed url="<https://guides.rubyonrails.org/testing.html#system-testing>" %}

{% embed url="<https://evilmartians.com/chronicles/system-of-a-test-setting-up-end-to-end-rails-testing#modern-system-tests-with-cuprite>" %}

{% embed url="<https://everydayrails.com/2018/01/08/rspec-3.7-system-tests.html>" %}

�
