## TL;DR

I ended up adding RAILS_ENV=test bundle exec rails server -p 3000 -d so it runs in the background, then kill -9 $(cat tmp/pids/server.pid) for the after job command (once rspec/cypress are done running)

## Fix

1. I ended up adding RAILS_ENV=test bundle exec rails server -p 3000 -d so it runs in the background, then kill -9 $(cat tmp/pids/server.pid) for the after job command (once rspec/cypress are done running)
   Expected: You get the expected result; the problem is gone.

## When to use

- You are dealing with this situation.
- The symptom matches: Starting a rails test server with Cypress on CI.

## When NOT to use

- Unrelated issues with a different cause.
- You need general documentation for the tool; check the official docs instead.

## Compatibility

Reported per the linked source. Source: https://stackoverflow.com/questions/51661617/starting-a-rails-test-server-with-cypress-on-ci.

## Variant phrasings

### Starting a rails test server with Cypress on CI

## Why it happens

I can run cypress locally if I start a rails server using RAILS_ENV=test rails server , and then running the cypress run but I am lost on how to do this on CI. I'm using SemaphoreCI which allows me to have setup commands before I run rspec: $ bundle install $ npm install $ bundle exec rake db:create db:migrate db:test:prepare --trace Followed by the actual jobs: $ bundle exec rspec According to cypress , I can't use cy.exec() to start a rails server and I can't run rails serv

## Edge cases

- If your error message differs even slightly, this is probably a different issue; search the exact text.
- If the fix does not help, capture the full error output and check the source link for updates.

## Source

https://stackoverflow.com/questions/51661617/starting-a-rails-test-server-with-cypress-on-ci