bahmutov/cypress-if

then() chaining not working with else()

MRavimoF opened this issue ยท 1 comments

function bar() {
      return cy.wrap("testing")
      .if()
      .then(() => cy.wrap("got it"))
      .else()
      .then(() => cy.wrap("else do"))
}

bar().then(it => {
      cy.log(`result: ${it}`)
})

Will print

wrap: testing
wrap: got it

I would have expected to see

wrap: testing
wrap: got it
log: result: got it

I get the expected output if I comment out the else branch

function bar() {
      return cy.wrap("testing")
      .if()
      .then(() => cy.wrap("got it"))
//      .else()
//      .then(() => cy.wrap("else do"))
    }

I am a beginner with Cypress and cypress-if, wondering what's up with this behaviour.

"cypress-if": "^1.10.2",
"cypress": "10.11.0",
"cypress-fail-fast": "^3.4.1",

๐ŸŽ‰ This issue has been resolved in version 1.10.3 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€