MCPcopy Create free account
hub / github.com/cypress-io/github-action / waitOnUrl

Function waitOnUrl

index.js:395–418  ·  view source on GitHub ↗
(waitOn, waitOnTimeout = 60)

Source from the content-addressed store, hash-verified

393 * @param {Number?} waitOnTimeout in seconds
394 */
395const waitOnUrl = (waitOn, waitOnTimeout = 60) => {
396 console.log(
397 'waiting on "%s" with timeout of %s seconds',
398 waitOn,
399 waitOnTimeout
400 )
401
402 const waitTimeoutMs = waitOnTimeout * 1000
403
404 const waitUrls = waitOn
405 .split(',')
406 .map((s) => s.trim())
407 .filter(Boolean)
408 debug(`Waiting for urls ${waitUrls.join(', ')}`)
409
410 // run every wait promise after the previous has finished
411 // to avoid "noise" of debug messages
412 return waitUrls.reduce((prevPromise, url) => {
413 return prevPromise.then(() => {
414 debug(`Waiting for url ${url}`)
415 return ping(url, waitTimeoutMs)
416 })
417 }, Promise.resolve())
418}
419
420const waitOnMaybe = () => {
421 const waitOn = core.getInput('wait-on')

Callers 1

waitOnMaybeFunction · 0.85

Calls 1

pingFunction · 0.85

Tested by

no test coverage detected