Skip to content

An npm package for a before hook for Cypress that runs on test retries - unlike the default before hook.

Notifications You must be signed in to change notification settings

muratkeremozcan/cy-retryable-before

Repository files navigation

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.

About

An npm package for a before hook for Cypress that runs on test retries - unlike the default before hook.

Resources

Stars

Watchers

Forks

Packages

No packages published