diff --git a/source/_changelogs/4.2.0.md b/source/_changelogs/4.2.0.md index 7795cee236..3b9ca873d5 100644 --- a/source/_changelogs/4.2.0.md +++ b/source/_changelogs/4.2.0.md @@ -9,7 +9,7 @@ **Bugfixes:** -- We fixed a regression in {% url "3.8.3" changelog-3-8-3 %} where HTTPS requests could experience slowdown. Fixes {% issue 6659 %}. +- We fixed a regression in {% url "3.8.3" changelog-3-8-3 %} where HTTPS requests could experience slowdown. Fixes {% issue 6659 %}. - We now detect some installations of Firefox that were previously undetected. Fixes {% issue 6669 %}. - We fixed a race condition where an asynchronous error could fail to be caught when running the plugins file process. Fixes {% issue 6570 %}. - 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 %}. diff --git a/source/_changelogs/4.6.0.md b/source/_changelogs/4.6.0.md new file mode 100644 index 0000000000..dafeb5116b --- /dev/null +++ b/source/_changelogs/4.6.0.md @@ -0,0 +1,50 @@ +# 4.6.0 + +*Released 5/20/2020* + +**Features:** + +- {% 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 %}. +- 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 %}. +- Cypress now enables AST-based JS/HTML rewriting when setting the {% url "`experimentalSourceRewriting`" experiments %} configuration option to `true`. Addresses {% issue 5273 %}. +- 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 %}. + +**Bugfixes:** + +- 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 %}. +- 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 %}. +- 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 %}. +- 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 %}. +- 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 %}. +- 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 %}. +- Type definitions will no longer conflict when running Cypress in a project with Jest. Fixes {% issue 3536 %}. +- 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 %}. +- {% url "`.click`" click %} will now click in the correct coordinates when either x or y coordinate options are zero. Fixes {% issue 7319 %}. +- Cypress no longer displays `onError is not a function` when a browser can't connect. Fixes {% issue 7217 %}. +- You can now pass the `force: true` option to {% url "`.select()`" select %} to select options within a disabled `` + +```html + +``` + +```javascript +cy.get('select') + .select('banana', { force: true }) + .invoke('val') + .should('eq', 'banana') +``` + +### Force select a disabled ``. However, it will not override the actionability checks for selecting a disabled ``. See {% issue 107 "this issue" %} for more detail. + +```html + +``` + +```javascript +cy.get('select') + .select('okra', { force: true }) + .invoke('val') + .should('eq', 'okra') +``` + # Notes ## Actionability `.select()` is an action command that follows the rules {% url 'defined here' interacting-with-elements %}. -However, passing `{ force: true }` to `.select()` will not override the actionability checks for selecting a disabled ``, a disabled ``. See {% issue 107 "this issue" %} for more detail. +Passing `{ force: true }` to {% url "`.select()`" select %} will not override the actionability checks for selecting a disabled ``. See {% issue 107 "this issue" %} for more detail. {% endnote %} diff --git a/source/guides/dashboard/projects.md b/source/guides/dashboard/projects.md index 56a36dab02..45be36b1fb 100644 --- a/source/guides/dashboard/projects.md +++ b/source/guides/dashboard/projects.md @@ -107,7 +107,7 @@ You can create multiple Record Keys for a project, or delete existing ones from You can also find your Record Key inside of the *Settings* tab in the Test Runner. -{% imgTag /img/dashboard/record-key-shown-in-desktop-gui-configuration.png "Record Key in Configuration Tab" %} +{% imgTag /img/dashboard/record-key-shown-in-desktop-gui-configuration.jpg "Record Key in Configuration Tab" %} # Record keys diff --git a/source/guides/getting-started/writing-your-first-test.md b/source/guides/getting-started/writing-your-first-test.md index 56fe9ce0bd..c033ae7715 100644 --- a/source/guides/getting-started/writing-your-first-test.md +++ b/source/guides/getting-started/writing-your-first-test.md @@ -86,7 +86,7 @@ describe('My First Test', () => { Once you save again, you'll see Cypress display the failing test in red since `true` does not equal `false`. -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 %}. +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 %}. + + {% imgTag /img/guides/cy-method-failed-element-is-detached.png "cy.method() failed because element is detached" %} 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. diff --git a/source/guides/references/experiments.md b/source/guides/references/experiments.md index 719afea973..edd470b562 100644 --- a/source/guides/references/experiments.md +++ b/source/guides/references/experiments.md @@ -16,6 +16,7 @@ Option | Default | Description ----- | ---- | ---- `experimentalGetCookiesSameSite` | `false` | If `true`, Cypress will add `sameSite` values to the objects yielded from {% url "`cy.setCookie()`" setcookie %}, {% url "`cy.getCookie()`" getcookie %}, and {% url "`cy.getCookies()`" getcookies %}. This will become the default behavior in Cypress 5.0. `experimentalComponentTesting` | `false` | When set to `true`, Cypress allows you to execute component tests using framework-specific adaptors. By default `cypress/component` is the path for component tests. You can change this setting by setting the `componentFolder` configuration option. For more details see the {% url "cypress-react-unit-test" https://github.com/bahmutov/cypress-react-unit-test %} and {% url "cypress-vue-unit-test" https://github.com/bahmutov/cypress-vue-unit-test %} repos. +`experimentalSourceRewriting` | `false` | Enables AST-based JS/HTML rewriting. This may fix issues caused by the existing regex-based JS/HTML replacement algorithm. See {% issue 5273 %} for details. # Component Testing @@ -57,6 +58,7 @@ Code coverage | ✅ / maybe | ✅ \* Most common libraries: React Testing Library, Enzyme, Vue Testing Library, Vue Test Utils {% history %} +{% url "4.6.0" changelog#4-6-0 %} | Added support for `experimentalSourceRewriting`. {% url "4.5.0" changelog#4-5-0 %} | Added support for `experimentalComponentTesting`. {% url "4.3.0" changelog#4-3-0 %} | Added support for `experimentalGetCookiesSameSite`. {% endhistory %} diff --git a/source/guides/references/proxy-configuration.md b/source/guides/references/proxy-configuration.md index 99b6a3b590..900cc351f7 100644 --- a/source/guides/references/proxy-configuration.md +++ b/source/guides/references/proxy-configuration.md @@ -171,4 +171,4 @@ Your current proxy settings can be viewed from within the Cypress Test Runner. F 2. Click the "Settings" tab. 3. Click the "Proxy Settings" section to expand it and view the proxy settings that Cypress is currently using. -{% imgTag /img/guides/proxy-configuration.png "Proxy configuration in the Desktop app" %} +{% imgTag /img/guides/test-runner-settings-proxy-configuration.jpg "Proxy configuration in the Desktop app" %} diff --git a/source/guides/tooling/IDE-integration.md b/source/guides/tooling/IDE-integration.md index 6908334e51..f1c5c00cf3 100644 --- a/source/guides/tooling/IDE-integration.md +++ b/source/guides/tooling/IDE-integration.md @@ -2,6 +2,26 @@ title: IDE Integration --- +# File Opener Preference + +When clicking on a file path from the {% url "Test Runner" test-runner %} in an {% url "error stack trace or a code frame" debugging#Errors %}, Cypress will attempt to open the file on your system. If the editor supports inline highlighting of the file, the file will open with the cursor located on the line and column of interest. + +{% imgTag /img/guides/file-opener-ide-go-to-line.gif "Open file at line in VS Code" %} + +The first time you click a file path, Cypress will prompt you to select which location you prefer to open the file. You can choose to open it in your: + +- File system (e.g. Finder on MacOS, File Explore on Windows) +- An IDE located on your system +- A specified application path + +{% note warning %} +Cypress attempts to find available file editors on your system and display those as options. If your preferred editor is not list, you can specify the (full) path to it by selecting **Other**. Cypress will make every effort to open the file, *but it is not guaranteed to work with every application*. +{% endnote %} + +After setting your file opener preference, any files will automatically open in your selected application without prompting you to choose. If you want to change your selection, you can do so in the **Settings** tab of the Cypress Test Runner by clicking under **File Opener Preference**. + +{% imgTag /img/guides/file-opener-preference-settings-tab.png "screenshot of Test Runner settings tab with file opener preference panel" %} + # Extensions & Plugins There are many third-party IDE extensions and plugins to help integrate your IDE with Cypress. diff --git a/themes/cypress/source/img/dashboard/record-key-shown-in-desktop-gui-configuration.jpg b/themes/cypress/source/img/dashboard/record-key-shown-in-desktop-gui-configuration.jpg new file mode 100644 index 0000000000..245340a51b Binary files /dev/null and b/themes/cypress/source/img/dashboard/record-key-shown-in-desktop-gui-configuration.jpg differ diff --git a/themes/cypress/source/img/dashboard/record-key-shown-in-desktop-gui-configuration.png b/themes/cypress/source/img/dashboard/record-key-shown-in-desktop-gui-configuration.png deleted file mode 100644 index 94c8eb7455..0000000000 Binary files a/themes/cypress/source/img/dashboard/record-key-shown-in-desktop-gui-configuration.png and /dev/null differ diff --git a/themes/cypress/source/img/guides/clear-source-of-failure.png b/themes/cypress/source/img/guides/clear-source-of-failure.png index 64c1dcd647..9cbfe82b7e 100644 Binary files a/themes/cypress/source/img/guides/clear-source-of-failure.png and b/themes/cypress/source/img/guides/clear-source-of-failure.png differ diff --git a/themes/cypress/source/img/guides/command-failure-error.png b/themes/cypress/source/img/guides/command-failure-error.png index 421d92ccc7..7f15ddc5f3 100644 Binary files a/themes/cypress/source/img/guides/command-failure-error.png and b/themes/cypress/source/img/guides/command-failure-error.png differ diff --git a/themes/cypress/source/img/guides/configuration/see-resolved-configuration.jpg b/themes/cypress/source/img/guides/configuration/see-resolved-configuration.jpg index d7cad6f780..0804874acc 100644 Binary files a/themes/cypress/source/img/guides/configuration/see-resolved-configuration.jpg and b/themes/cypress/source/img/guides/configuration/see-resolved-configuration.jpg differ diff --git a/themes/cypress/source/img/guides/cy-method-failed-element-is-animating.png b/themes/cypress/source/img/guides/cy-method-failed-element-is-animating.png index 7fa4e1d335..92a3daf4ae 100644 Binary files a/themes/cypress/source/img/guides/cy-method-failed-element-is-animating.png and b/themes/cypress/source/img/guides/cy-method-failed-element-is-animating.png differ diff --git a/themes/cypress/source/img/guides/cy-method-failed-element-is-detached.png b/themes/cypress/source/img/guides/cy-method-failed-element-is-detached.png index 98c3b841ad..955d85023a 100644 Binary files a/themes/cypress/source/img/guides/cy-method-failed-element-is-detached.png and b/themes/cypress/source/img/guides/cy-method-failed-element-is-detached.png differ diff --git a/themes/cypress/source/img/guides/failing-test.png b/themes/cypress/source/img/guides/failing-test.png index 864bc9bde9..eaa4bb72aa 100644 Binary files a/themes/cypress/source/img/guides/failing-test.png and b/themes/cypress/source/img/guides/failing-test.png differ diff --git a/themes/cypress/source/img/guides/file-opener-ide-go-to-line.gif b/themes/cypress/source/img/guides/file-opener-ide-go-to-line.gif new file mode 100644 index 0000000000..47b93b50e3 Binary files /dev/null and b/themes/cypress/source/img/guides/file-opener-ide-go-to-line.gif differ diff --git a/themes/cypress/source/img/guides/file-opener-preference-settings-tab.png b/themes/cypress/source/img/guides/file-opener-preference-settings-tab.png new file mode 100644 index 0000000000..95ec3714c3 Binary files /dev/null and b/themes/cypress/source/img/guides/file-opener-preference-settings-tab.png differ diff --git a/themes/cypress/source/img/guides/first-test-failing-contains.png b/themes/cypress/source/img/guides/first-test-failing-contains.png index 2f8b0c91c0..d64649267b 100644 Binary files a/themes/cypress/source/img/guides/first-test-failing-contains.png and b/themes/cypress/source/img/guides/first-test-failing-contains.png differ diff --git a/themes/cypress/source/img/guides/proxy-configuration.png b/themes/cypress/source/img/guides/proxy-configuration.png deleted file mode 100644 index a3b1650d1d..0000000000 Binary files a/themes/cypress/source/img/guides/proxy-configuration.png and /dev/null differ diff --git a/themes/cypress/source/img/guides/test-runner-settings-proxy-configuration.jpg b/themes/cypress/source/img/guides/test-runner-settings-proxy-configuration.jpg new file mode 100644 index 0000000000..5c01b5213f Binary files /dev/null and b/themes/cypress/source/img/guides/test-runner-settings-proxy-configuration.jpg differ diff --git a/themes/cypress/source/img/guides/testing-your-app-visit-fail.png b/themes/cypress/source/img/guides/testing-your-app-visit-fail.png index 6750a768c3..015737c54a 100644 Binary files a/themes/cypress/source/img/guides/testing-your-app-visit-fail.png and b/themes/cypress/source/img/guides/testing-your-app-visit-fail.png differ