Skip to content

Commit 6b82d2c

Browse files
jennifer-shehanebrian-mannbahmutovchrisbreiding
authored
5.0.0 Release (#430)
* rename 'whitelist' to 'ignore' for cy.server() * Rename uses of 'whitelist' for cookies to 'preserve' * fix onBeforeScreenshot and onAfterScreenshot types * conditionally skip tests * ts-ignore * get the checks right * remove need for semver dep Co-authored-by: Brian Mann <brian.mann86@gmail.com> Co-authored-by: Gleb Bahmutov <gleb.bahmutov@gmail.com> Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com> Co-authored-by: Chris Breiding <chrisbreiding@gmail.com>
1 parent c42cf3b commit 6b82d2c

File tree

5 files changed

+29
-13
lines changed

5 files changed

+29
-13
lines changed

app/commands/network-requests.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ <h4 id="server"><a href="https://on.cypress.io/server">cy.server()</a></h4>
9393
expect(server.enable).to.be.true
9494
// forces requests that don't match your routes to 404
9595
expect(server.force404).to.be.false
96-
// whitelists requests from ever being logged or stubbed
97-
expect(server.whitelist).to.be.a('function')
96+
// ignores requests from ever being logged or stubbed
97+
expect(server.ignore).to.be.a('function')
9898
})
9999

100100
cy.server({

app/cypress-api.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ <h4 id="Cookies.preserveOnce"><a href="https://on.cypress.io/cookies">Cypress.Co
120120
<h4 id="Cookies.default"><a href="https://on.cypress.io/cookies">Cypress.Cookies.default()</a></h4>
121121
<p>To set defaults for all cookies, use <a href="https://on.cypress.io/cookies"><code>Cypress.Cookies.default()</code></a>.</p>
122122
<pre><code class="javascript">Cypress.Cookies.defaults({
123-
whitelist: 'session_id'
123+
preserve: 'session_id'
124124
})</code></pre>
125125
</div>
126126

@@ -132,8 +132,8 @@ <h4 id="Server.default"><a href="https://on.cypress.io/cypress-server">Cypress.S
132132
<pre><code class="javascript">Cypress.Server.defaults({
133133
delay: 0,
134134
force404: true,
135-
whitelist: function(xhr){
136-
// handle custom logic for whitelisting
135+
ignore: function(xhr){
136+
// handle custom logic for ignoring XHRs
137137
}
138138
})</code></pre>
139139
</div>

cypress/integration/examples/cypress_api.spec.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,13 @@ context('Cypress.Cookies', () => {
6565
})
6666

6767
it('.defaults() - set defaults for all cookies', () => {
68+
if (Number(Cypress.version.charAt(0)) < 5) return
69+
6870
// now any cookie with the name 'session_id' will
6971
// not be cleared before each new test runs
7072
Cypress.Cookies.defaults({
71-
whitelist: 'session_id',
73+
// @ts-ignore
74+
preserve: 'session_id',
7275
})
7376
})
7477
})

cypress/integration/examples/network_requests.spec.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,12 @@ context('Network Requests', () => {
2929
expect(server.enable).to.be.true
3030
// forces requests that don't match your routes to 404
3131
expect(server.force404).to.be.false
32-
// whitelists requests from ever being logged or stubbed
33-
expect(server.whitelist).to.be.a('function')
32+
33+
if (Number(Cypress.version.charAt(0)) >= 5) {
34+
// ignores requests from ever being logged or stubbed
35+
// @ts-ignore
36+
expect(server.ignore).to.be.a('function')
37+
}
3438
})
3539

3640
cy.server({

package-lock.json

+14-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)