Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wait-on times out, even tough app is ready #41

Closed
rbuetzer opened this issue Nov 22, 2019 · 3 comments · Fixed by #43
Closed

wait-on times out, even tough app is ready #41

rbuetzer opened this issue Nov 22, 2019 · 3 comments · Fixed by #43
Labels

Comments

@rbuetzer
Copy link

rbuetzer commented Nov 22, 2019

First of all: It's awesome to see how much effort the Cypress team invests into creating examples and bindings for all kinds of tools and services. Thank you.

Now for the issue: I have an app with the following configuration:

cypress-run:
  runs-on: ubuntu-latest
  steps:
    - name: Checkout
      uses: actions/checkout@v1
    - name: Cypress run
      uses: cypress-io/github-action@v1
      with:
        start: yarn run parcel src/index.html
        wait-on: http://localhost:1234

Full configuration: https://github.com/rbuetzer/kinder/blob/4e3ce07bf651ab5f8f9edcdeda0666d7c93c67da/.github/workflows/run-tests.yml

Observed behaviour:

wait-on times out after 60 seconds, even tough the app is ready after <30 seconds.

starting server with command "yarn run parcel src/index.html"
current working directory "/home/runner/work/kinder/kinder"
/usr/bin/yarn run parcel src/index.html
waiting on "http://localhost:1234" with timeout of 60 seconds
/usr/local/bin/npx wait-on --timeout 60000 "http://localhost:1234"
yarn run v1.19.1
$ /home/runner/work/kinder/kinder/node_modules/.bin/parcel src/index.html
Server running at http://localhost:1234 
✨  Built in 22.57s.
Error: Timeout
    at Timeout._onTimeout (/home/runner/.npm/_npx/2839/lib/node_modules/wait-on/lib/wait-on.js:113:10)
    at listOnTimeout (internal/timers.js:531:17)
    at processTimers (internal/timers.js:475:7)

Full log: https://github.com/rbuetzer/kinder/runs/316750720

Expected behaviour

wait-on does not time out.

Analysis

Edit: Ignore the analysis below. Turns out the & variant does not work on GH pages. See #41 (comment)

If I use wait-on with a background process instead of using the configuration, the test runs successfully.

start: yarn run parcel src/index.html & npx wait-on http://localhost:1234

Full configuration: https://github.com/rbuetzer/kinder/blob/13e239b1f055fd1e7b222f0697343d0510679085/.github/workflows/run-tests.yml

Successful run: https://github.com/rbuetzer/kinder/runs/316749597

App version which has the issue:
https://github.com/rbuetzer/kinder/tree/4e3ce07bf651ab5f8f9edcdeda0666d7c93c67da

App version which does not have the issue:
https://github.com/rbuetzer/kinder/tree/13e239b1f055fd1e7b222f0697343d0510679085

Diff between the two:
https://github.com/rbuetzer/kinder/compare/4e3ce07bf651ab5f8f9edcdeda0666d7c93c67da..13e239b1f055fd1e7b222f0697343d0510679085

@JoshAntBrown
Copy link

I'm running into the same issue too. I tried the alternative @rbuetzer shared but it didn't work for me as it behaved no differently than without it.

It looks like their server might start up super quickly so they might not actually need the wait-on to be executed?

start: yarn run parcel src/index.html & npx wait-on http://localhost:1234

The above doesn't seem to behave any different than the below.

start: yarn run parcel src/index.html

@rbuetzer
Copy link
Author

You are right @JoshAntBrown, the test succeeded because the app was ready before Cypress. Leaving away wait-on alltogether worked (https://github.com/rbuetzer/kinder/runs/318844295).

Also, after another experiment, it seems, the &-variant does not do anything in GH actions (worked on my machine though).

So to update the bug description:

wait-on times out here, even if localhost:1234 is available:
https://github.com/rbuetzer/kinder/runs/316750720
https://github.com/rbuetzer/kinder/tree/4e3ce07bf651ab5f8f9edcdeda0666d7c93c67da

However, if I leave away wait-on, the tests run successfully:
https://github.com/rbuetzer/kinder/runs/318844295
https://github.com/rbuetzer/kinder/tree/4c2f70703bdba371043c25ff10e7d20264ca25c2

I know http://localhost:1234 is available, because otherwise the latter Cypress-test would fail.

@github-actions
Copy link

🎉 This issue has been resolved in version 1.16.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants