Skip to content

Releases: NicholasBoll/cypress-pipe

v2.0.0

20 Aug 05:00
Compare
Choose a tag to compare
  • feat: Add support for cy.within.

BREAKING CHANGE:

Previously cy.pipe() without a previous chain would fall back to using the body element always. Now, if the cy.pipe is inside a cy.within, the withinSubject will be used instead.

Before:

cy.get('.foobar').within(() => {
  cy.pipe(el => el) // el is the body element
})

After:

cy.get('.foobar').within(() => {
  cy.pipe(el => el) // el is the element with a `foobar` class name
})

feat: Loggable decorator for piped functions

02 May 16:25
Compare
Choose a tag to compare

loggable attaches additional metadata to helper functions for the .pipe Command. This includes ensuring the display name of a function regardless of the function being anonymous and also attaches parameters passed.

Example:

const getProp = loggable('getProp', prop => obj => obj[prop]
cy.wrap({ foo: 'bar'  })
  .pipe(getProp('foo'))
  .should('equal', 'bar')

This will show the following in the the Cypress Command Log:

WRAP      {foo: bar}
- PIPE    getProp("foo")
- ASSERT  expected bar to equal bar

Without using loggable, the PIPE line would not include arguments passed to getProp:

- PIPE   getProp

Fixes #16