kuceb / cypress-plugin-retries

A Cypress plugin to retry failed tests.
MIT License
237 stars 20 forks source link

Environment variable for x seconds delay before retries #73

Closed tamaker closed 4 years ago

tamaker commented 4 years ago

Awesome work on this. Thanks for your hard work. Is there support for or plans to allow for the setting of an integer variable in ENVIRONMENT vars that can be used as a global wait time between retries? I saw a previous question that touched on the issue and seemed to include / prescribe using 'test:before:run:async'(?)... just wondering if it ever dawned on you to make the delay time between retries an env var like currently exists for number of retries.

kuceb commented 4 years ago

here's an example:

const { Promise } = Cypress

Cypress.on('test:before:run:async', (attrs, test) => {
  if (test.currentRetry()) {
    return Promise.delay(3000)
  }
})

it('fooo', { retries: 2 }, () => {
  throw new Error('sdf')
})