Files
cypress/docs/source/api/cypress-api/server.md
T
Jennifer Shehane 1cc47441ec docs: Lots of api links converted to url tags
- Sadly, had to pull out half of the changelog due to a Max call stack
being reached when entire changelog with all url tags are built. :(
2017-06-12 15:56:37 -04:00

1.3 KiB

title, comments
title comments
Cypress.Server true

Permanently change the default options for all {% url cy.server() server %} instances

{% note info New to Cypress? %} Any configuration you pass to {% url cy.server() server %} will only persist until the end of the test. {% endnote %}

Syntax

Cypress.Server.defaults(options)

Usage

Server.defaults() requires being chained off Cypress.

{% fa fa-check-circle green %} Valid Usage

Cypress.Server.defaults({}) // Set server defaults

{% fa fa-exclamation-triangle red %} Invalid Usage

cy.Server.defaults({})  // Errors, cannot be chained off 'cy'

Arguments

{% fa fa-angle-right %} options (Object)

Pass in an options object to change the default behavior of .filter().

Examples

Options

These options will be the new defaults.

// pass anything here you'd normally pass to cy.server().
Cypress.Server.defaults({
  delay: 500,
  force404: false,
  whitelist: function(xhr){
    // handle custom logic for whitelisting
  }
})

Notes

Where to put server configuration

A great place to put this configuration is in your cypress/support/defaults.js file, since it is loaded before any test files are evaluated.

See also

  • {% url cy.server() server %}