This repository has been archived by the owner on Jan 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
You can check the condition against a browser name or an environment yourself. ```js import {isOn} from '@cypress/skip-test' it('loads users', () => { // when running on Windows locally, the backend is not running // thus we need to stub XHR requests if (isOn('windows') && isOn('localhost')) { cy.server() cy.route('/users', 'fixture:users') } cy.visit('/') cy.get('.user').should('have.length', 10) }) ```
- Loading branch information
Showing
4 changed files
with
70 additions
and
33 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
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,17 @@ | ||
/// <reference types="cypress" /> | ||
import { isOn } from '../..' | ||
|
||
it('returns true for current browser', () => { | ||
expect(isOn(Cypress.browser.name)).to.be.true | ||
}) | ||
|
||
it('returns true for current platform', () => { | ||
expect(isOn(Cypress.platform)).to.be.true | ||
}) | ||
|
||
it('returns true for current url', () => { | ||
const url = Cypress.config('baseUrl') | ||
expect(url).to.be.a('string') | ||
expect(isOn(url)).to.be.true | ||
expect(isOn('foo.com')).to.be.false | ||
}) |
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