Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
155 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules/ | ||
cypress/videos/ | ||
cypress/screenshots/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/// <reference types="cypress" /> | ||
|
||
import '../../src' | ||
|
||
describe('else branch', () => { | ||
it('takes the if branch', () => { | ||
cy.wrap(42).if('equal', 42).log('if branch').else().log('else branch') | ||
}) | ||
|
||
it('takes the else branch', () => { | ||
cy.wrap(42).if('equal', 1).log('if branch').else().log('else branch') | ||
}) | ||
|
||
context('with checks', () => { | ||
it('calls actions in the if branch', () => { | ||
cy.wrap(42) | ||
.if('equal', 42) | ||
.then(cy.spy().as('if')) | ||
.else() | ||
.then(cy.spy().as('else')) | ||
cy.get('@if').should('have.been.calledOnce') | ||
cy.get('@else').should('not.be.called') | ||
}) | ||
|
||
it('calls actions in the else branch', () => { | ||
cy.wrap(42) | ||
.if('equal', 1) | ||
.then(cy.spy().as('if')) | ||
.else() | ||
.then(cy.spy().as('else')) | ||
cy.get('@else').should('have.been.calledOnce') | ||
cy.get('@if').should('not.be.called') | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters