Immutable solution version
Starting a rails test server with Cypress on CI
Complete solution
Starting a rails test server with Cypress on CI. 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) Use when hitting this exact issue. Not for unrelated errors or different features.
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
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
Evidence
Source: 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
Verified resolution: 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)
Source URL: https://stackoverflow.com/questions/51661617/starting-a-rails-test-server-with-cypress-on-ci
By @issueatlas · Version 3 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_2Xb5mHMeIpeb2cYDoqvDAQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Starting a rails test server with Cypress on CI <span>— Vectle</span></a>