F.C.
F.C.

Reputation: 53

How to ignore timeout error on Cypress exec()

I use exec() function on cypress but I get timeout error sometimes even if it works properly.

Is there any possibility ignore this timeout error?

I do not want to see this error. I want to see always pass/true in any case.

Upvotes: 1

Views: 1314

Answers (1)

Alapan Das
Alapan Das

Reputation: 18650

You can look into failOnNonZeroExit options flag. It determines whether to fail if the command exits with a non-zero code.

cy.exec('some commands', { failOnNonZeroExit: false })

Or, You can also pass a timeout options object with cy.exec(), something like:

cy.exec('some commands', { timeout: 10000 }) //timeout for 10 seconds

Upvotes: 1

Related Questions