cy-retryable-before
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

cy-retryable-before

A before hook alternative for Cypress that gets run when a failing test is retried.

By default cypress before hook isn't run when a test below it fails and is retried. Because we use before() as a place to setup state before running assertions inside it() this means we can't make use of cypress retry functionality to make our suites more reliable.

retryableBefore is a workaround for this issue.

Usage

Install, import and replace the default before hook with retryableBefore in your Cypress test file.

npm i -D cy-retryable-before
yarn add -D cy-retryable-before
pnpm i -D cy-retryable-before
import { retryableBefore } from 'cy-retryable-before'

describe('CRUD movie', () => {
  // just replace `before` with `retryableBefore`
  retryableBefore(() => {
    // ...
  })

  it('should', () => {
    // ...
  })
})

Demo

See demo video.

Package Sidebar

Install

npm i cy-retryable-before

Weekly Downloads

199

Version

1.0.3

License

ISC

Unpacked Size

6.68 kB

Total Files

6

Last publish

Collaborators

  • muratkeremozcan