wait-on won't allow && sleep after wait command
cypress-io/github-action@v2 example:
# Run Tests
- name: Run Cypress Tests
uses: cypress-io/github-action@v2
continue-on-error: true
with:
config: video=true
browser: ${{ matrix.browser }}
headless: true
tag: 'UI-${{ matrix.browser }}'
record: true
parallel: true
command-prefix: npx
working-directory: apps/[myapp]
start: yarn start:[myapp]
wait-on: 'npx wait-on https:/[myapp]:4200/ && sleep 15'
wait-on-timeout: 615
install: false
env:
...
Instead of doing the npx wait-on and then sleeping for 15 seconds, I instead see this error:
Run cypress-io/github-action@v2
Skipping install because install parameter is false
start server "yarn start:[myapp] command "yarn start:[myapp]"
current working directory "/home/runner/work/[myapp]"
Waiting using command "npx wait-on https://[myapp]:4200/ && sleep 15"
executing command "npx wait-on https://[myapp]:4200/ && sleep 15"
current working directory "/home/runner/work/[myapp]"
/usr/local/bin/yarn start:[myapp]
/usr/local/bin/npx wait-on https://[myapp]:4200/ && sleep 15
yarn run v1.22.17
warning package.json: "dependencies" has dependency "tslib" with range "^2.0.0" that collides with a dependency in "devDependencies" of the same name with version "2.1.0"
$ yarn prepare:[myapp] && nx serve [myapp] --configuration=[localMyApp]
ValidationError: "resources[3]" must be a string
Error: The process '/usr/local/bin/npx' failed with exit code 1
The line that stands out is ValidationError: "resources[3]" must be a string, which doesn't occur when I take out && sleep 15 from the wait-on command.
WHen I run npx wait-on https://[myapp]:4200/ && sleep 15 it works fine locally on my Mac.
Is there a recommended way to make things sleep for just a little longer after the wait-on completes? We're seeing an issue where we need a slight wait because even though the wait-on completes apparently the app isn't completely ready.
Another thing I've tried is wait-on a specific location at the end npx wait-on https://[myApp]:4200/log-in/ but that hangs indefinitely.
Thanks!
Any chance someone has some feedback on this use case? I'm hopeful a short sleep after a wait-on will fix some slow spin-up issues with our locally tested app in GH Actions.
@jdborneman-terminus I think I understand your issue, but I am not sure why wait-on-timeout: 615 does not provide enough time? 615 secs is a very long time.
Also per the docs, have you tried this wait-on: 'npx wait-on --timeout 15000 https:/[myapp]:4200/'
You can also wait on several URLs which may be useful like so: wait-on: 'http://localhost:3050, http://localhost:3060, http://localhost:3070'
Let me know if any of these help.
Thanks @robertguss I'll give this a try later today! I'm not suyre why 615 isn't enough time either. It is almost all the time but we have intermittent issues where it seems like our landing/login page isn't available yet when we start up our tests 🤷
I'm kinda taking a stab in the dark at things at this point 😬
@jdborneman-terminus when you are running your app in CI, do you first build it? Meaning are you running your application like you would locally in CI, ie: npm run dev or whatever your command would be? If you are, you definitely want to first build the application, like you would for production and then run the production build.
I hope that makes sense. Also what kind of app is this? What framework or stack are you using?
Closing due to inactivity.