Releases: NicholasBoll/cypress-pipe
Releases · NicholasBoll/cypress-pipe
v2.0.0
- 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
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