Skip to content

Commit 2a4dcc9

Browse files
chrisbreidingtbiethmanxumepadismalemilyrohrboughcowboy
authored andcommitted
9.2.0 Release (cypress-io#4270)
* Adding readFile/writeFile doc around new timeout features (cypress-io#4244) * docs: Add documentation for using child/dual commands in TS (cypress-io#4263) Co-authored-by: Chris Breiding <chrisbreiding@gmail.com> * 9.2.0 changelog. * add changelog for #18290 * chore: clarify cy.intercept fixture encoding behavior (cypress-io#4278) Co-authored-by: Ben Alman <cowboy@rj3.net> * types in interept command docs * add chagnelog for #19363 * add changelogs for #19377 & #18549 * typo. Thanks Shawn * Adding info for CYPRESS_VERIFY_TIMEOUT (cypress-io#4271) * Adding info for CYPRESS_VERIFY_TIMEOUT * Updating docs with other PR content and additional clarification around verify usage * Update List of Valid Test Configuration Config Values (cypress-io#4252) Co-authored-by: Jennifer Shehane <jennifer@cypress.io> Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> Co-authored-by: Emily Rohrbough <emilyrohrbough@yahoo.com> Co-authored-by: Tyler Biethman <tbiethman@users.noreply.github.com> Co-authored-by: Den Klimovsky <xumepadismal@users.noreply.github.com> Co-authored-by: Emily Rohrbough <emilyrohrbough@yahoo.com> Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> Co-authored-by: Ben Alman <cowboy@rj3.net> Co-authored-by: David Munechika <david@cypress.io> Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
1 parent 457002c commit 2a4dcc9

File tree

10 files changed

+265
-87
lines changed

10 files changed

+265
-87
lines changed

content/_changelogs/9.0.0.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ _Released 11/10/2021_
3131
could change the behavior of code within the `pluginsFile` when using the
3232
bundled Node.js version of Cypress. Addressed in
3333
[#18317](https://github.com/cypress-io/cypress/pull/18317).
34+
- The default read behavior of a fixture provided as a static response in
35+
`cy.intercept()` changed from being read as a Buffer to using `utf8` encoding.
36+
This aligns the default read behavior of `cy.intercept()` to `cy.readFile()`
37+
and `cy.fixture()`. Addresses
38+
[#18534](https://github.com/cypress-io/cypress/issues/18534).
3439

3540
**Deprecations:**
3641

content/_changelogs/9.2.0.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
## 9.2.0
2+
3+
_Released 12/20/2021_
4+
5+
**Features:**
6+
7+
- Cypress will throw an error when a user attempts to update a configuration
8+
value at run-time using either the Test Configuration or using
9+
`Cypress.config()` that is a
10+
[readonly option](https://docs.cypress.io/guides/references/configuration#Test-Configuration).
11+
Addresses [#6407](https://github.com/cypress-io/cypress/issues/6407) and
12+
[#19001](https://github.com/cypress-io/cypress/issues/19001).
13+
- A `timeout` option has been added to the `cy.writeFile()` command, with a
14+
default value of `defaultCommandTimeout`. Addresses
15+
[#3350](https://github.com/cypress-io/cypress/issues/3350).
16+
- The default `maxHttpBufferSize` for the internal socket server has been
17+
increased to
18+
[Node's maximum Buffer size](https://nodejs.org/api/buffer.html#bufferconstantsmax_length)
19+
(size varies by OS) to allow large file writes with `cy.writeFile()`.
20+
Addresses [#19140](https://github.com/cypress-io/cypress/issues/19140).
21+
- Add `CYPRESS_VERIFY_TIMEOUT` environment variable to override the timeout
22+
duration of the `verify` command. Addresses
23+
[#18290](https://github.com/cypress-io/cypress/issues/18290).
24+
25+
**Bugfixes:**
26+
27+
- Prevent unnecessary snapshotting when running default assertions that would
28+
unnecessarily increase CPU use in `cypress open` mode which lead to out of
29+
memory crashes on certain browsers. Fixes
30+
[#18549](https://github.com/cypress-io/cypress/issues/18549).
31+
- Removed automatic retries for failed HTTP requests through the proxy. This
32+
fixes an issue where failed requests could be re-sent too many times in some
33+
conditions. This change could increase the number of failed requests that your
34+
app sees. Fixes [#19043](https://github.com/cypress-io/cypress/issues/19043).
35+
- Reduced the occurrence of an issue where logs for `fetch` and `xhr` requests
36+
could be associated with the wrong request. Fixes
37+
[#19043](https://github.com/cypress-io/cypress/issues/19043).
38+
- Tests that are skipped within `then` blocks will no longer throw errors
39+
causing the test to fail. Tests that are skipped outside of `then` blocks will
40+
no longer trigger the fail event. This will prevent screenshots from happening
41+
from errors thrown by the fail event.Fixes
42+
[#14867](https://github.com/cypress-io/cypress/issues/14867) and
43+
[#17660](https://github.com/cypress-io/cypress/issues/17660).
44+
- Fixed a regression in [9.0.0](/guides/references/changelog#9-0-0) where a
45+
fixture provided in a static response to `cy.intercept()` did not support
46+
passing `null` to encoding to read the fixture as a Buffer. This identified an
47+
undocumented 9.0.0 Breaking Change where the default read behavior of a
48+
fixture changed from a Buffer to being read with `utf8` encoding. Fixes
49+
[#19344](https://github.com/cypress-io/cypress/issues/19344).
50+
- Fixed a regression in [9.0.0](/guides/references/changelog#9-0-0) where
51+
`cy.contains()` attempted to ignore `<script>` and `<style>` elements found
52+
within `<body>`. by deleting them from the dom. This behavior was corrected to
53+
ignore the elements without deleting them. Fixes
54+
[#19377](https://github.com/cypress-io/cypress/issues/19377).
55+
- Cypress will no longer crash when proxying an ill formed request. For example,
56+
if the application under test has a resource of `"http: //localhost/asset.js"`
57+
(notice the extraneous space), Cypress will now log a debug message and the
58+
asset will fail to load. Fixes
59+
[#9220](https://github.com/cypress-io/cypress/issues/9220).
60+
- Correct `Cypress.Command.add()` and `Cypress.Command.override()` TypeScript
61+
types. Fixes [#18879](https://github.com/cypress-io/cypress/issues/18879),
62+
[#19095](https://github.com/cypress-io/cypress/issues/19095) and
63+
[#18940](https://github.com/cypress-io/cypress/issues/18940).
64+
- Custom command implementations typings take into account `prevSubject`
65+
variants.
66+
- Custom command implementations now allows to NOT return a value.
67+
- Custom command overwrites typings take into account `originalFn` function.
68+
- Add types for `Cypress.session.clearAllSavedSessions()`. Fixes
69+
[#19363](https://github.com/cypress-io/cypress/issues/19363).
70+
71+
**Dependencies:**
72+
73+
- Upgraded `ssri` from `6.0.1` to `6.0.2` to mitigate
74+
[ssri vulnerability](snyk.io/vuln/npm:ssri@6.0.1). Addressed in
75+
[#19351](https://github.com/cypress-io/cypress/issues/19351).

content/api/commands/intercept.md

Lines changed: 33 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -140,33 +140,14 @@ See [examples](#With-RouteMatcher) below.
140140
#### <Icon name="angle-right"></Icon> staticResponse (<code>[StaticResponse][staticresponse]</code>)
141141

142142
By passing in a `StaticResponse` as the last argument, you can
143-
[statically define (stub) a response](#Stubbing-a-response) for matched requests
144-
including the body of the response, as well as the headers and HTTP status code:
145-
146-
| Option | Description |
147-
| ---------- | ---------------------------------------------------------------- |
148-
| statusCode | HTTP response status code |
149-
| headers | HTTP response headers |
150-
| body | Serve a static response body (`object`, `string`, `ArrayBuffer`) |
151-
| fixture | Serve a fixture as the HTTP response body |
152-
153-
`StaticResponse` also provides options for simulating a degraded or broken
154-
network connection:
155-
156-
| Option | Description |
157-
| ----------------- | --------------------------------------------------------------------------- |
158-
| forceNetworkError | Force an error by destroying the browser connection |
159-
| delay | Minimum network latency or delay to add to the response time (milliseconds) |
160-
| throttleKbps | Maximum data transfer rate of the response (kilobits/second) |
161-
162-
**Note:** All properties are optional.
143+
[statically define (stub) a response](#Stubbing-a-response) for matched
144+
requests. See [`StaticResponse` object](#StaticResponse-objects) for the list of
145+
properties.
163146

164147
See
165148
[Stubbing a response with a `StaticResponse` object](#With-a-StaticResponse-object)
166149
for an example.
167150

168-
See also [`StaticResponse` objects](#StaticResponse-objects).
169-
170151
#### <Icon name="angle-right"></Icon> routeHandler (<code>Function</code>)
171152

172153
The `routeHandler` function is called whenever a request is matched, with the
@@ -457,7 +438,15 @@ cy.intercept('/not-found', {
457438
})
458439
```
459440

460-
See also [`StaticResponse` objects][staticresponse].
441+
Stub response with a fixture that is read as a Buffer:
442+
443+
```js
444+
cy.intercept('/not-found', {
445+
fixture: 'media/gif.mp4,null',
446+
})
447+
```
448+
449+
See also [`StaticResponse` object][staticresponse].
461450

462451
### Using the **`routeHandler`** function
463452

@@ -1326,30 +1315,33 @@ from propagating to the next matching response handler in line. See
13261315

13271316
## `StaticResponse` objects
13281317

1329-
A `StaticResponse` represents a stubbed response to an HTTP request. You can
1330-
supply a `StaticResponse` to Cypress in 3 ways:
1318+
A `StaticResponse` represents a
1319+
[statically defined response (stub)](#Stubbing-a-response).
1320+
1321+
The following properties are available on `StaticResponse`.
1322+
1323+
| Option | Description |
1324+
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1325+
| statusCode | HTTP response status code |
1326+
| headers | HTTP response headers |
1327+
| body | Serve a static response body (`object`, `string`, `ArrayBuffer`) (when `fixture` is omitted). |
1328+
| fixture | Serve a fixture as the HTTP response body (allowed when `body` is omitted). Read the contents with an encoding other than the [default for the file type](/api/commands/fixture#Encoding), pass the fixture like `path,encoding`. |
1329+
| forceNetworkError | Force an error by destroying the browser connection |
1330+
| delay | Minimum network latency or delay to add to the response time (milliseconds) |
1331+
| throttleKbps | Maximum data transfer rate of the response (kilobits/second) |
13311332

1332-
- Directly to `cy.intercept()` as
1333-
[`staticResponse`](#staticResponse-lt-code-gtStaticResponselt-code-gt), to
1334-
stub a response to a route: `cy.intercept('/url', staticResponse)`
1333+
**Note:** All properties are optional.
1334+
1335+
You can supply a `StaticResponse` to Cypress in 3 ways:
1336+
1337+
- To `cy.intercept()` as
1338+
[`an argument`](#staticResponse-lt-code-gtStaticResponselt-code-gt), to stub a
1339+
response to a route: `cy.intercept('/url', staticResponse)`
13351340
- To [`req.reply()`][req-reply], to stub a response from a request handler:
13361341
`req.reply(staticResponse)`
13371342
- To [`res.send()`][res-send], to stub a response from a response handler:
13381343
`res.send(staticResponse)`
13391344

1340-
The following properties are available on `StaticResponse`. All properties are
1341-
optional:
1342-
1343-
| Option | Description |
1344-
| ----------------- | --------------------------------------------------------------------------- |
1345-
| fixture | Serve a fixture as the HTTP response body |
1346-
| body | Serve a static response body (`object`, `string`, `ArrayBuffer`) |
1347-
| headers | HTTP response headers |
1348-
| statusCode | HTTP response status code |
1349-
| forceNetworkError | Force an error by destroying the browser connection |
1350-
| delay | Minimum network latency or delay to add to the response time (milliseconds) |
1351-
| throttleKbps | Maximum data transfer rate of the response (kilobits/second) |
1352-
13531345
See
13541346
["Stubbing a response with a `StaticResponse` object"](#With-a-StaticResponse-object)
13551347
for examples of stubbing with `cy.intercept()`.

content/api/commands/readfile.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Pass in an options object to change the default behavior of `cy.readFile()`.
6060

6161
### Yields [<Icon name="question-circle"/>](/guides/core-concepts/introduction-to-cypress#Subject-Management)
6262

63-
<List><li>`cy.readFile()` yields the contents of the file.</li></List>
63+
- `cy.readFile()` yields the contents of the file.
6464

6565
## Examples
6666

@@ -196,21 +196,21 @@ cy.readFile('some/nested/path/story.txt').should('eq', 'Once upon a time...')
196196

197197
### Requirements [<Icon name="question-circle"/>](/guides/core-concepts/introduction-to-cypress#Chains-of-Commands)
198198

199-
<List><li>`cy.readFile()` requires being chained off of
200-
`cy`.</li><li>`cy.readFile()` requires the file must
201-
exist.</li><li>`cy.readFile()` requires the file be successfully read from
202-
disk.</li></List>
199+
- `cy.readFile()` requires being chained off of `cy`.
200+
- `cy.readFile()` requires the file must exist.
201+
- `cy.readFile()` requires the file be successfully read from disk.
203202

204203
### Assertions [<Icon name="question-circle"/>](/guides/core-concepts/introduction-to-cypress#Assertions)
205204

206-
<List><li>`cy.readFile()` will automatically
207-
[retry](/guides/core-concepts/retry-ability) until all chained assertions have
208-
passed</li></List>
205+
- `cy.readFile()` will automatically
206+
[retry](/guides/core-concepts/retry-ability) until all chained assertions have
207+
passed.
209208

210209
### Timeouts [<Icon name="question-circle"/>](/guides/core-concepts/introduction-to-cypress#Timeouts)
211210

212-
<List><li>`cy.readFile()` can time out waiting for assertions you've added to
213-
pass.</li></List>
211+
- `cy.readFile()` can time out waiting for assertions you've added to pass.
212+
- `cy.readFile()` can time out when the content being read takes a significant
213+
amount of time to encode.
214214

215215
## Command Log
216216

@@ -229,6 +229,14 @@ outputs the following:
229229

230230
<DocsImage src="/img/api/readfile/console-log-shows-content-from-file-formatted-as-javascript.png" alt="Console Log readFile" ></DocsImage>
231231

232+
## History
233+
234+
| Version | Changes |
235+
| --------------------------------------------- | ----------------------------------------- |
236+
| [9.0.0](/guides/references/changelog#9-0-0) | Changed `null` encoding to read as Buffer |
237+
| [0.17.2](/guides/references/changelog#0-17-2) | Improved error messaging |
238+
| [0.17.1](/guides/references/changelog#0-17-1) | `cy.readFile()` command added |
239+
232240
## See also
233241

234242
- [`cy.exec()`](/api/commands/exec)

content/api/commands/writefile.md

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,12 @@ first encoding it as a string.
5858

5959
Pass in an options object to change the default behavior of `cy.writeFile()`.
6060

61-
| Option | Default | Description |
62-
| ---------- | ------- | --------------------------------------------------------------------------------------------------- |
63-
| `log` | `true` | Displays the command in the [Command log](/guides/core-concepts/test-runner#Command-Log) |
64-
| `flag` | `w` | File system flag as used with [`fs.writeFile`](https://nodejs.org/api/fs.html#fs_file_system_flags) |
65-
| `encoding` | `utf8` | The encoding to be used when writing to the file |
61+
| Option | Default | Description |
62+
| ---------- | -------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
63+
| `log` | `true` | Displays the command in the [Command log](/guides/core-concepts/test-runner#Command-Log) |
64+
| `flag` | `w` | File system flag as used with [`fs.writeFile`](https://nodejs.org/api/fs.html#fs_file_system_flags) |
65+
| `encoding` | `utf8` | The encoding to be used when writing to the file |
66+
| `timeout` | [`defaultCommandTimeout`](/guides/references/configuration#Timeouts) | Time to wait for `.writeFile()` to resolve before [timing out](#Timeouts) |
6667

6768
<Alert type="info">
6869

@@ -74,8 +75,7 @@ parameter and include encoding there. This is the same behavior as
7475

7576
### Yields [<Icon name="question-circle"/>](/guides/core-concepts/introduction-to-cypress#Subject-Management)
7677

77-
<List><li>`cy.writeFile()` yields the value of the <code>contents</code>
78-
argument.</li></List>
78+
- `cy.writeFile()` yields `null`.
7979

8080
## Examples
8181

@@ -209,7 +209,6 @@ cy.readFile(filename, null).then((obj) => {
209209
### Requirements [<Icon name="question-circle"/>](/guides/core-concepts/introduction-to-cypress#Chains-of-Commands)
210210

211211
- `cy.writeFile()` requires being chained off of `cy`.
212-
213212
- `cy.writeFile()` requires the file be successfully written to disk. Anything
214213
preventing this such as OS permission issues will cause it to fail.
215214

@@ -220,15 +219,8 @@ cy.readFile(filename, null).then((obj) => {
220219

221220
### Timeouts [<Icon name="question-circle"/>](/guides/core-concepts/introduction-to-cypress#Timeouts)
222221

223-
- `cy.writeFile()` should never time out.
224-
225-
<Alert type="warning">
226-
227-
Because `cy.writeFile()` is asynchronous it is technically possible for there to
228-
be a timeout while talking to the internal Cypress automation APIs. But for
229-
practical purposes it should never happen.
230-
231-
</Alert>
222+
- `cy.writeFile()` can time out when the content being written takes a
223+
significant amount of time to encode.
232224

233225
## Command Log
234226

@@ -251,6 +243,7 @@ outputs the following:
251243

252244
| Version | Changes |
253245
| ------------------------------------------- | -------------------------------------------------------- |
246+
| [9.2.0](/guides/references/changelog#9-2-0) | Added `timeout` option |
254247
| [4.0.0](/guides/references/changelog#4-0-0) | `cy.writeFile()` now yields `null` instead of `contents` |
255248
| [3.1.1](/guides/references/changelog#3-1-1) | Added `flag` option and appending with `a+` |
256249
| [1.0.0](/guides/references/changelog#1.0.0) | `cy.writeFile()` command added |

content/api/cypress-api/config.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,10 @@ Cypress.config() // => {defaultCommandTimeout: 10000, viewportHeight: 900, ...}
140140

141141
### Not all config values can be changed at all times
142142

143-
Some configuration values are readonly and cannot be changed while running a
144-
test. Anything that's not directly under Cypress's control - like timeouts,
145-
`userAgent`, or environment variables - will be ignored at run-time. Be sure to
146-
review the list of
143+
Some configuration values are readonly and cannot be changed during running a
144+
test. Anything that is not listed in the
145+
[test configuration options](/guides/references/configuration#Test-Configuration)
146+
cannot be updated at runtime. Be sure to review the list of
147147
[test configuration options](/guides/references/configuration##Test-Configuration).
148148

149149
### Test Configuration vs `Cypress.config()`

0 commit comments

Comments
 (0)