Skip to content

Commit 53a3aee

Browse files
authored
Merge pull request #2810 from cypress-io/develop
develop to master auto PR
2 parents 5406954 + d08d0bd commit 53a3aee

27 files changed

+152
-14
lines changed

source/_changelogs/4.2.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
**Bugfixes:**
1111

12-
- We fixed a regression in {% url "3.8.3" changelog-3-8-3 %} where HTTPS requests could experience slowdown. Fixes {% issue 6659 %}.
12+
- We fixed a regression in {% url "3.8.3" changelog-3-8-3 %} where HTTPS requests could experience slowdown. Fixes {% issue 6659 %}.
1313
- We now detect some installations of Firefox that were previously undetected. Fixes {% issue 6669 %}.
1414
- We fixed a race condition where an asynchronous error could fail to be caught when running the plugins file process. Fixes {% issue 6570 %}.
1515
- We now more thoroughly ensure the parent of an element exists when recursively calling actionability checks in order to prevent some maximum call stack errors. Fixes {% issue 6707 %}.

source/_changelogs/4.6.0.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# 4.6.0
2+
3+
*Released 5/20/2020*
4+
5+
**Features:**
6+
7+
- {% url "Errors" debugging#Errors %} in the Test Runner now display a code frame to preview where the failure occurred with the relevant file, line number, and column number highlighted. Clicking on the file link will open the file in your {% url "preferred file opener" IDE-integration#File-Opener-Preference %} and highlight the line and column in editors that support it. Addresses {% issue 3762 %}.
8+
- Cypress now utilizes {% url "source maps" debugging#Source-maps %} to enhance the error experience. Stack traces are translated so that your source files are shown instead of the generated file that is loaded by the browser. Cypress will include an inline source map in your spec file. If you {% url "modify the preprocessor" preprocessors-api %}, ensure that inline source maps are enabled to get the same experience. Users of `@cypress/webpack-preprocessor` should upgrade to v5.4.1 or later of the package which will correctly inline source maps. Addresses {% issue 881 %}, {% issue 1761 %} and {% issue 3966 %}.
9+
- Cypress now enables AST-based JS/HTML rewriting when setting the {% url "`experimentalSourceRewriting`" experiments %} configuration option to `true`. Addresses {% issue 5273 %}.
10+
- Number arguments passed to `have.text`, `have.id`, `have.data`, `have.value`, and `have.attr` {% url "assertions chainers" assertions#Chai-jQuery %} are now automatically cast to strings for comparison. Addresses {% issue 7314 %}.
11+
12+
**Bugfixes:**
13+
14+
- Default {% url "TypeScript" typescript-support %} options are now set to `module: commonJS` which Node.js and the browser expect. This fixes a situation where setting a different module in a `tsconfig.json` would cause errors to throw if you had `export`, `import` or `async` keywords in your code. Fixes {% issue 7005 %}, {% issue 7011 %}, {% issue 7043 %}, and {% issue 7151 %}.
15+
- When {% url "`experimentalSourceRewriting`" experiments %} is enabled, setting `location` or `location.href` to a relative href, or using `location.replace` or `location.assign` with a relative href will no longer navigate the AUT to the wrong URL. Fixes {% issue 3975 %} and {% issue 3994 %}.
16+
- When {% url "`experimentalSourceRewriting`" experiments %} is enabled, the use of `window.top` and `window.parent` will no longer cause the AUT to break out of the Cypress iframe. Fixes {% issue 5271 %} and {% issue 1467 %}.
17+
- When {% url "`experimentalSourceRewriting`" experiments %} is enabled, calls to `window.frames`, `window.parent.frames`, and other `frames` will no longer point to the wrong reference after being proxied through Cypress. Fixes {% issue 2664 %}.
18+
- When {% url "`experimentalSourceRewriting`" experiments %} is enabled, scripts using the `integrity` attribute for sub-resource integrity (SRI) will now load after being proxied through Cypress. Fixes {% issue 2393 %}.
19+
- When {% url "`experimentalSourceRewriting`" experiments %} is enabled, the use of `document.location` to set the URL will no longer navigate the AUT to the wrong URL. Fixes {% issue 7402 %}.
20+
- Type definitions will no longer conflict when running Cypress in a project with Jest. Fixes {% issue 3536 %}.
21+
- We increased the timeout for launching Firefox from 2.5 seconds to 50 seconds. Previously, users hitting this limit would encounter a "cannot open socket" error; now, the error will be wrapped. Fixes {% issue 7159 %}.
22+
- {% url "`.click`" click %} will now click in the correct coordinates when either x or y coordinate options are zero. Fixes {% issue 7319 %}.
23+
- Cypress no longer displays `onError is not a function` when a browser can't connect. Fixes {% issue 7217 %}.
24+
- You can now pass the `force: true` option to {% url "`.select()`" select %} to select options within a disabled `<select>`. Addresses {% issue 107 %}.
25+
- We now throw an error when attempting to {% url "`.select()`" select %} an `<option>` within a disabled `<optgroup>`. Fixes {% issue 7226 %}.
26+
- We fixed a regression in {% url "4.3.0" changelog-4-3-0 %} where the message output during errors were not formatted correctly. Fixes {% issue 6924 %}.
27+
- Using {% url "`Cypress._.capitalize`" _ %} now correctly behaves the same as Lodash's capitalize method. Fixes {% issue 7222 %}.
28+
- When {% url "`experimentalComponentTesting`" experiments#Component-Testing %} is enabled, clicking on a component spec now watches the correct file without assuming it is an integration file. Fixes {% issue 7244 %}.
29+
- Firefox video recording no longer crashes Cypress when running very short spec files. Fixes {% issue 6408 %}.
30+
- Applications containing a DOM element with an id attribute containing 'jquery' will no longer throw an error during {% url "`cy.visit()`" visit %}. Fixes {% issue 6193 %}.
31+
- Long errors generated when compiling or bundling the test file are now horizontally scrollable. Fixes {% issue 6898 %}.
32+
33+
**Misc:**
34+
35+
- Cypress no longer requires write access to the root of the project, it instead will display a warning when no write access is given. Addresses {% issue 1281 %}.
36+
- We increased the timeout for launching Chrome from 20 seconds to 50 seconds. Addressed in {% PR 7372 %}.
37+
- We increased the timeout for macOS or Linux to exit from a `--version` command when looking for available browsers from 5 seconds to 30 seconds. Addressed in {% PR 7366 %}.
38+
- We improved error handling when Cypress launches Chromium-family browsers. Addresses {% issue 6518 %}.
39+
- We now export `Cypress.ConfigOptions` types as a partial of the full options interface. Addresses {% issue 7238 %}.
40+
- We're continuing to make progress in converting our codebase from CoffeeScript to JavaScript. Addresses {% issue 2690 %} in {% PR 7162 %}, {% PR 7216 %}, {% PR 7227 %}, {% PR 7320 %}, {% PR 7232 %}, and {% PR 7345 %}.
41+
42+
**Dependency Updates:**
43+
44+
- Upgraded `@cypress/browserify-preprocessor` from `2.2.2` to `2.2.3`. Addressed in {% PR 7291 %}.
45+
- Upgraded `cookie-parser` from `1.4.4` to `1.4.5`. Addressed in {% PR 7389 %}.
46+
- Upgraded `cypress-multi-reporters` from `1.2.4` to `1.4.0`. Addressed in {% PR 7431 %}.
47+
- Upgraded `electron` from `8.2.3` to `8.3.0`. Addressed in {% PR 7236 %} and {% PR 7387 %}.
48+
- Upgraded `image-size` from `0.7.4` to `0.8.3`. Addressed in {% PR 7236 %}.
49+
- Upgraded `jimp` from `0.9.3` to `0.12.0`. Addressed in {% PR 7408 %}.
50+
- Upgraded `return-deep-diff` from `0.3.0` to `0.4.0`. Addressed in {% PR 7292 %}.

source/_partial/errors_anatomy.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
1. **Error name**: This is the type of the error (e.g. AssertionError, CypressError)
2-
2. **Error message**: This generally tells you what went wrong. It can vary in length. Some are short like in the example, while some are long, and may tell you exactly how to fix the error.
3-
3. **Learn more**: Some error messages contain a **Learn more** link that will take you to relevant Cypress documentation.
4-
4. **View stack trace**: Clicking this toggles the visibility of the stack trace. Stack traces vary in length.
5-
5. **Print to console button**: Click this to print the full error to your DevTools console. This will usually allow you to click on lines in the stack trace and open files in your DevTools.
2+
2. **Error message**: This generally tells you what went wrong. It can vary in length. Some are short like in the example, while some are long, and may tell you exactly how to fix the error. Some also contain a **Learn more** link that will take you to relevant Cypress documentation.
3+
3. **Learn more:** Some error messages contain a Learn more link that will take you to relevant Cypress documentation.
4+
4. **View stack trace**: Clicking this toggles the visibility of the stack trace. Stack traces vary in length. Clicking on a blue file path will open the file in your [preferred file opener](https://on.cypress.io/IDE-integration#File-Opener-Preference).
5+
5. **Code frame file**: This is usually the top line of the stack trace and it shows the file, line number, and column number that is highlighted in the code frame below. Clicking on this link will open the file in your [preferred file opener](https://on.cypress.io/IDE-integration#File-Opener-Preference) and highlight the line and column in editors that support it.
6+
6. **Code frame**: This shows a snippet of code where the failure occurred, with the relevant line and column highlighted.
7+
7. **Print to console button**: Click this to print the full error to your DevTools console. This will usually allow you to click on lines in the stack trace and open files in your DevTools.
68

7-
{% imgTag /img/guides/command-failure-error.png "example command failure error" width-600 %}
9+
{% imgTag /img/guides/command-failure-error.png "example command failure error" %}

source/api/commands/select.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,53 @@ cy.get('select')
124124
.should('deep.equal', ['456', '457'])
125125
```
126126

127+
## Force select
128+
129+
### Force select a hidden `<select>`
130+
131+
```html
132+
<select style="display: none;">
133+
<optgroup label="Fruits">
134+
<option value="banana">Banana</option>
135+
<option value="apple">Apple</option>
136+
<optgroup>
137+
</select>
138+
```
139+
140+
```javascript
141+
cy.get('select')
142+
.select('banana', { force: true })
143+
.invoke('val')
144+
.should('eq', 'banana')
145+
```
146+
147+
### Force select a disabled `<select>`
148+
149+
Passing `{ force: true }` to `.select()` will override the actionability checks for selecting a disabled `<select>`. However, it will not override the actionability checks for selecting a disabled `<option>` or an option within a disabled `<optgroup>`. See {% issue 107 "this issue" %} for more detail.
150+
151+
```html
152+
<select disabled>
153+
<optgroup label="Veggies">
154+
<option value="okra">Okra</option>
155+
<option value="zucchini">Zucchini</option>
156+
<optgroup>
157+
</select>
158+
```
159+
160+
```javascript
161+
cy.get('select')
162+
.select('okra', { force: true })
163+
.invoke('val')
164+
.should('eq', 'okra')
165+
```
166+
127167
# Notes
128168

129169
## Actionability
130170

131171
`.select()` is an action command that follows the rules {% url 'defined here' interacting-with-elements %}.
132172

133-
However, passing `{ force: true }` to `.select()` will not override the actionability checks for selecting a disabled `<select>`, a disabled `<option>`, or an option within a disabled `<optgroup>`. See {% issue 107 "this issue" %} for more detail.
173+
However, passing `{ force: true }` to `.select()` will not override the actionability checks for selecting a disabled `<option>` or an option within a disabled `<optgroup>`. See {% issue 107 "this issue" %} for more detail.
134174

135175
# Rules
136176

source/faq/questions/using-cypress-faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ A *Record Key* is a GUID that's generated automatically by Cypress once you've {
374374

375375
You can find your project's record key inside of the *Settings* tab in the Test Runner.
376376

377-
{% imgTag /img/dashboard/record-key-shown-in-desktop-gui-configuration.png "Record Key in Configuration Tab" %}
377+
{% imgTag /img/dashboard/record-key-shown-in-desktop-gui-configuration.jpg "Record Key in Configuration Tab" %}
378378

379379
For further detail see the {% url Identification projects#Identification %} section of the {% url "Dashboard Service" dashboard-introduction%} docs.
380380

source/guides/core-concepts/interacting-with-elements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,5 +220,5 @@ We will NOT perform these:
220220
In summary, `{ force: true }` skips the checks, and it will always fire the event at the desired element.
221221

222222
{% note warning "force `.select()` disabled options" %}
223-
Passing `{ force: true }` to {% url "`.select()`" select %} will not override the actionability checks for selecting a disabled `<select>`, a disabled `<option>`, or an option within a disabled `<optgroup>`. See {% issue 107 "this issue" %} for more detail.
223+
Passing `{ force: true }` to {% url "`.select()`" select %} will not override the actionability checks for selecting a disabled `<option>` or an option within a disabled `<optgroup>`. See {% issue 107 "this issue" %} for more detail.
224224
{% endnote %}

source/guides/dashboard/projects.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ You can create multiple Record Keys for a project, or delete existing ones from
107107

108108
You can also find your Record Key inside of the *Settings* tab in the Test Runner.
109109

110-
{% imgTag /img/dashboard/record-key-shown-in-desktop-gui-configuration.png "Record Key in Configuration Tab" %}
110+
{% imgTag /img/dashboard/record-key-shown-in-desktop-gui-configuration.jpg "Record Key in Configuration Tab" %}
111111

112112
# Record keys
113113

source/guides/getting-started/writing-your-first-test.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ describe('My First Test', () => {
8686

8787
Once you save again, you'll see Cypress display the failing test in red since `true` does not equal `false`.
8888

89-
Cypress also displays the stack trace where the assertion failed (when available). To read more about the error's display, read about {% url "Debugging Errors" debugging#Errors %}.
89+
Cypress also displays the stack trace and the code frame where the assertion failed (when available). You can click on the blue file link to open the file where the error occurred in {% url "your preferred file opener" IDE-integration#File-Opener-Preference %}. To read more about the error's display, read about {% url "Debugging Errors" debugging#Errors %}.
9090

9191
<!--
9292
To reproduce the following screenshot:

source/guides/guides/debugging.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,22 @@ Sometimes tests fail. Sometimes we want them to fail, just so we know they're te
115115
Let's take a look at the anatomy of an error and how it is displayed in Cypress, by way of a failing test.
116116

117117
```js
118-
it('failure', () => {
119-
// the center of the clicked element is hidden
118+
it('reroutes on users page', () => {
120119
cy.contains('Users').click()
120+
cy.url().should('include', 'users')
121121
})
122122
```
123123

124124
The center of the `<li>Users</li>` element is hidden from view in our application under test, so the test above will fail. Within Cypress, an error will show on failure that includes the following pieces of information:
125125

126126
{% partial errors_anatomy %}
127127

128+
## Source maps
129+
130+
Cypress utilizes source maps to enhance the error experience. Stack traces are translated so that your source files are shown instead of the generated file that is loaded by the browser. This also enables displaying code frames. Without inline source maps, you will not see code frames.
131+
132+
By default, Cypress will include an inline source map in your spec file, so you will get the most out of the error experience. If you {% url "modify the preprocessor" preprocessors-api %}, ensure that inline source maps are enabled to get the same experience. With webpack and the {% url "webpack preprocessor" https://github.com/cypress-io/cypress-webpack-preprocessor %}, for example, set {% url "the `devtool` option" https://webpack.js.org/configuration/devtool/ %} to `inline-source-map`.
133+
128134
# Log Cypress events
129135

130136
Cypress emits multiple events you can listen to as shown below. {% url 'Read more about logging events in the browser here' catalog-of-events#Logging-All-Events %}.

source/guides/references/error-messages.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,24 @@ describe('detachment example', () => {
113113
})
114114
-->
115115

116+
<!--
117+
To reproduce the following screenshot:
118+
describe('detachment example', () => {
119+
beforeEach(() => {
120+
cy.get('body').then(($body) => {
121+
const $outer = Cypress.$('<div />').appendTo($body)
122+
Cypress.$('<button />').on('click', () => { $outer[0].remove() }).appendTo($outer)
123+
})
124+
})
125+
it('detaches from dom', () => {
126+
cy.get('button')
127+
.click()
128+
.parent()
129+
.should('have.text', 'Clicked')
130+
})
131+
})
132+
-->
133+
116134
{% imgTag /img/guides/cy-method-failed-element-is-detached.png "cy.method() failed because element is detached" %}
117135

118136
Cypress errors because it can't interact with "dead" elements - much like a real user could not do this either. Understanding how this happens is very important - and it is often preventable.

0 commit comments

Comments
 (0)