Skip to content

Instantly share code, notes, and snippets.

@NicholasBoll
Last active March 28, 2018 06:03
Show Gist options
  • Save NicholasBoll/ddf988f9296114ef93057a435666be17 to your computer and use it in GitHub Desktop.
Save NicholasBoll/ddf988f9296114ef93057a435666be17 to your computer and use it in GitHub Desktop.
const getFoo = cy.wrap('foo').createAlias()
const getBar = cy.wrap('bar').createAlias()
const getOne = cy.wrap(1).createAlias()
// get one alias
getFoo().then(subject => {
subject // string
console.log(subject) // logs 'foo'
})
// get many aliases - API is similar to Promise.all
cy.getAliases([getFoo, getBar, getOne]).then(([foo, bar, one]) => {
foo // string
bar // string
one // number
console.log(foo, bar, one) // logs 'foo', 'bar', 1
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment