cypress-test-example-repos
cypress-test-example-repos copied to clipboard
Travis-CI + Cypress Issues connecting to site being served using http-server
I have a quick question regarding running Cypress Tests within a CI/CD Pipeline on Travis-CI. I'm currently not able to run my tests as a result of the following error.
'Error: connect ECONNREFUSED'
I'm trying to serve the simple web page I'm trying to test via http-server (https://www.npmjs.com/package/http-server). I've included my travis yaml file below. I'd greatly appreciate any assistance you can provide.
Inside of my test, I'm trying to navigate to the web page using
cy.visit('http://0.0.0.0:1111') and cy.visit('http://localhost:1111') with no luck :(
.travis.yml
language: node_js
node_js:
- 6
cache:
directories:
- ~/.npm
- node_modules
install:
- yarn
script:
- http-server -p 1111 . > http.log 2>&1 &
- $(npm bin)/cypress run
I have no idea why this would be the case, can you try adding wait-on utility to see if it can check if your server is reachable? Also can you not redirect the logs from http-server - maybe there is an error?