Skip to content

Add support for retries specified in each individual test (as opposed to global config) #311

@svegalopez

Description

@svegalopez

Hi @bahmutov,

I was wondering if this is something that could be useful ? If so I can open a PR.
I noticed the plugin reads the retries configuration when it is first imported (in this line)

Let's say that I have the retries set to 2 in the global cypress.config.js but I want to change that for a specific test.
So I do this :

it('dummy', { retries: 3 }, () => {
  // ... some commands ...
})

I think the retries setting of 3 will not be honoured given the place where the plugin reads it, am I correct ?
If so, I was wondering if this could help instead :

// inside of onFailed function

if (this.currentTest.final) {
    const filepath = writeFailedTestInfo(info)
    debug('saving the log file %s', filepath)
    info.filepath = filepath
  }

If the final property is not available in older versions of cypress (not sure), then maybe the plugin could fallback to reading the Cypress.config('retries') ad-hoc, inside the onFailed function as opposed to once at the beginning ?

Let me know if this is something you would be open to ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions