github-action icon indicating copy to clipboard operation
github-action copied to clipboard

Cypress always times out on Github Actions [Help Request]

Open ml242 opened this issue 3 years ago • 4 comments

My flow was working fine and I have not changed any settings, but now it times out on every PR. I look through the commits and it sure seems like nothing has changed, anyway.

Outside of opening a PR without my cypress.yml, and then putting it back in, is there anything else I can check to see why it wouldn't run? I have tried the various flavors of cypress 9.x.x and that has no impact.

Thanks for any insight.

Here is my YML


on: [pull_request]
env: 
  CYPRESS_REACT_APP_API_URL: https:/xxxxx
  REACT_APP_API_URL: xxxxxxxx
jobs:
  cypress-run:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Setup kernel and increase watchers
        run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
      # Install NPM dependencies, cache them correctly
      # and run all Cypress tests
      - name: Cypress run
        uses: cypress-io/github-action@v2
        with:
          quiet: false
          browser: chrome
          headless: true
          record: false
          start: npm start
          wait-on: http://localhost:3000
          wait-on-timeout: 180
          env: true
        env:
          REACT_APP_RECAPTCHA_SITE_KEY: xxxxxx
          CYPRESS_REACT_APP_API_URL:xxxxx
          REACT_APP_API_URL: xxxxx
          CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

ml242 avatar Apr 08 '22 21:04 ml242

I ran into this issue as well. Setting the node version to 16 worked for me:

- uses: actions/setup-node@v2
  with:
    node-version: '16'

tomfriedhof avatar Apr 10 '22 02:04 tomfriedhof

Unfortunately I am also experiencing this issue. I wanted to run Cypress on Node v18. This also caused a timeout. LTS version 16.15.0 is working.

One of the differences I see in logs (Before there was also a network address.):

App running at:
  - Local:   http://localhost:8081 
  - Network: unavailable

Full error log:

Error: Timed out waiting for: http://localhost:8081
    at {runner path}/node_modules/wait-on/lib/wait-on.js:132:31
    at doInnerSub ({runner path}/node_modules/rxjs/dist/cjs/internal/operators/mergeInternals.js:22:31)
    at outerNext ({runner path}/node_modules/rxjs/dist/cjs/internal/operators/mergeInternals.js:17:70)
    at OperatorSubscriber._this._next ({runner path}/node_modules/rxjs/dist/cjs/internal/operators/OperatorSubscriber.js:33:21)
    at Subscriber.next ({runner path}/node_modules/rxjs/dist/cjs/internal/Subscriber.js:51:18)
    at AsyncAction.work ({runner path}/node_modules/rxjs/dist/cjs/internal/observable/timer.js:28:28)
    at AsyncAction._execute ({runner path}/node_modules/rxjs/dist/cjs/internal/scheduler/AsyncAction.js:76:18)
    at AsyncAction.execute ({runner path}/node_modules/rxjs/dist/cjs/internal/scheduler/AsyncAction.js:64:26)
    at AsyncScheduler.flush ({runner path}/node_modules/rxjs/dist/cjs/internal/scheduler/AsyncScheduler.js:39:33)
    at listOnTimeout (node:internal/timers:564:17)
    at process.processTimers (node:internal/timers:507:7)

Setup package.json: scripts:

...
"serve": "vue-cli-service serve",
"test:e2e": "start-server-and-test serve 8081 test",
"test": "npm-run-all pre-test run-test post-test --continue-on-error",
"pre-test": "rimraf cypress/results/*",
"run-test": "cypress run --reporter mochawesome --reporter-options reportDir=cypress/results,overwrite=false,html=false,json=true",
    "post-test": "npx mochawesome-merge 'cypress/results/*.json' > cypress/report/mochawesome.json && npx marge -o cypress/report -f awa_cypress_report cypress/report/mochawesome.json"

devDependencies:

...
"@vue/cli-service": "^5.0.4",
"cypress": "9.6.0",
"mochawesome": "^7.0.1",
"mochawesome-merge": "^4.2.1",

If you want to know more scripts and package versions, let me know.

TomCodePeople avatar May 03 '22 10:05 TomCodePeople

I also get a time out on my job whenever I try to set the node version to 18. It works fine on 14.

camjackson avatar Jun 05 '22 11:06 camjackson

Same for me, nothing happens on 18 but works fine in 16.16

flerpo avatar Aug 23 '22 07:08 flerpo

Same for me. Solved it by replacing localhost with 127.0.0.1.

From the Cypress changelog:

The default webpack configuration's host value was changed from localhost to 127.0.0.1 to support the Node 17+ changes with how DNS names are resolved. Addressed in #21430.

ninaolo avatar Oct 14 '22 09:10 ninaolo

Did you end up solving this? I have Cypress running fine on local but it times out in the CI. I'm using node 16 for github actions.

ManuC84 avatar Nov 02 '22 18:11 ManuC84

Same for me. Solved it by replacing localhost with 127.0.0.1.

From the Cypress changelog:

The default webpack configuration's host value was changed from localhost to 127.0.0.1 to support the Node 17+ changes with how DNS names are resolved. Addressed in #21430.

This worked for me too.

solita-shamsur avatar Feb 22 '23 17:02 solita-shamsur

  • This is related also to issue https://github.com/cypress-io/github-action/issues/802

MikeMcC399 avatar Feb 22 '23 17:02 MikeMcC399

There are related suggestions now added to the documentation

https://github.com/cypress-io/github-action/blob/master/README.md#wait-on-with-nodejs-18

MikeMcC399 avatar Nov 04 '23 07:11 MikeMcC399