Cypress.testingType returns the current testing type, determined by the Test Runner chosen to run. The Cypress.testingType returns e2e for Cypress Test Runner integration tests, or component for experimental Component Testing.
Cypress.testingType // returns 'e2e' or 'component'
it('is running experimental component testing mode', () => {
expect(Cypress.testingType).to.equal('component')
})
it('does something differently', () => {
if (Cypress.testingType === 'e2e') {
cy.exec('something')
} else {
cy.exec('something else')
}
})
| Version | Changes |
|---|---|
| 7.0.0 | Added Cypress.testingType
|
© 2017 Cypress.io
Licensed under the MIT License.
https://docs.cypress.io/api/cypress-api/testing-type