Skip to content

Commit

Permalink
Merge 63f3dd2 into c42cf3b
Browse files Browse the repository at this point in the history
  • Loading branch information
jennifer-shehane committed Aug 18, 2020
2 parents c42cf3b + 63f3dd2 commit 6c5da89
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 13 deletions.
4 changes: 2 additions & 2 deletions app/commands/network-requests.html
Expand Up @@ -93,8 +93,8 @@ <h4 id="server"><a href="https://on.cypress.io/server">cy.server()</a></h4>
expect(server.enable).to.be.true
// forces requests that don't match your routes to 404
expect(server.force404).to.be.false
// whitelists requests from ever being logged or stubbed
expect(server.whitelist).to.be.a('function')
// ignores requests from ever being logged or stubbed
expect(server.ignore).to.be.a('function')
})

cy.server({
Expand Down
6 changes: 3 additions & 3 deletions app/cypress-api.html
Expand Up @@ -120,7 +120,7 @@ <h4 id="Cookies.preserveOnce"><a href="https://on.cypress.io/cookies">Cypress.Co
<h4 id="Cookies.default"><a href="https://on.cypress.io/cookies">Cypress.Cookies.default()</a></h4>
<p>To set defaults for all cookies, use <a href="https://on.cypress.io/cookies"><code>Cypress.Cookies.default()</code></a>.</p>
<pre><code class="javascript">Cypress.Cookies.defaults({
whitelist: 'session_id'
preserve: 'session_id'
})</code></pre>
</div>

Expand All @@ -132,8 +132,8 @@ <h4 id="Server.default"><a href="https://on.cypress.io/cypress-server">Cypress.S
<pre><code class="javascript">Cypress.Server.defaults({
delay: 0,
force404: true,
whitelist: function(xhr){
// handle custom logic for whitelisting
ignore: function(xhr){
// handle custom logic for ignoring XHRs
}
})</code></pre>
</div>
Expand Down
5 changes: 4 additions & 1 deletion cypress/integration/examples/cypress_api.spec.js
Expand Up @@ -65,10 +65,13 @@ context('Cypress.Cookies', () => {
})

it('.defaults() - set defaults for all cookies', () => {
if (Number(Cypress.version.charAt(0)) < 5) return

// now any cookie with the name 'session_id' will
// not be cleared before each new test runs
Cypress.Cookies.defaults({
whitelist: 'session_id',
// @ts-ignore
preserve: 'session_id',
})
})
})
Expand Down
8 changes: 6 additions & 2 deletions cypress/integration/examples/network_requests.spec.js
Expand Up @@ -29,8 +29,12 @@ context('Network Requests', () => {
expect(server.enable).to.be.true
// forces requests that don't match your routes to 404
expect(server.force404).to.be.false
// whitelists requests from ever being logged or stubbed
expect(server.whitelist).to.be.a('function')

if (Number(Cypress.version.charAt(0)) >= 5) {
// ignores requests from ever being logged or stubbed
// @ts-ignore
expect(server.ignore).to.be.a('function')
}
})

cy.server({
Expand Down
19 changes: 14 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6c5da89

Please sign in to comment.