Reputation:
I have a simple create-react-app that runs on https://localhost:3000
locally and I use Cypress e2e testing by running cypress run
and that works as expected. However when I try to do the same in Travis CI it fails:
My spec is simply :
it('Visit the Welcome page', () => { cy.visit('https://localhost:3000') })
My travis does the following :
yarn start
cypress run
The error
:
https://localhost:3000 We attempted to make an http request to this URL but the request failed without a response. We received this error at the network level: > Error: connect ECONNREFUSED 127.0.0.1:3000
Upvotes: 2
Views: 2221
Reputation:
OK I got this going, the main thing is to ensure the server is started and continues to next command by appending an &
before running cypress command, so travis yml:
script:
- yarn start &
- cypress run --record --key <your_cypress_record_key>
Upvotes: 3