Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions source/_changelogs/4.12.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 4.12.0

*Released 8/3/2020*

**Features:**

- Now you can control whether screenshots are automatically taken on test failure during `cypress run` by setting {% url `screenshotOnRunFailure` configuration#Screenshots %} in your configuration. Addresses {% issue 5029 %}.
- The `pluginsFile` now has access to a readonly `version` property within the `config` object that returns the current Cypress version being run. This will allow plugins to better target specific Cypress versions. Addresses {% issue 6352 %}.
- During `cypress open`, you can now run a subset of all specs by {% url "entering a text search filter and clicking 'Run n tests'" writing-and-organizing-tests#Run-filtered-specs %}. Addresses {% issue 6581 %}.

**Bugfixes:**

- `position: fixed` elements that have a parent with `pointer-events: none` will now correctly evaluate as visible. Fixes {% issue 6675 %}.
- Applications using custom elements will no longer trigger infinite XHR request loops. Fixes {% issue 1068 %}.
- When snapshotting the DOM, Cypress no longer causes `attributeChangedCallback` to be triggered on custom elements. Fixes {% issue 7187 %}.
- Spec files containing `+` characters now properly run in Cypress. Fixes {% issue 5909 %}.
- When using the `fx` shortcut in {% url "`cy.route()`" route %}, an error is now thrown when the fixture file cannot be found. Fixes {% issue 7818 %}.
- Cypress no longer thrown `Cannot read property '__error' of null` error when passing a file containing `null` content to {% url "`cy.fixture()`" fixture %}. Fixes {% issue 8010 %}.
- Values containing exponential operators passed to `--env` via the command line are now properly read. Fixes {% issue 6891 %}.
- The "Open in IDE" button no longer disappears from hooks when the tests are manually rerun. Fixes {% issue 8094 %}.
- When {% url "`experimentalSourceRewriting`" experiments %} is enabled, AST rewriting will no longer return an output before the body is done being written. This would happen when the response body was too large and the response would be sent while the body was still being modified. Fixes {% issue 8043 %}.
- When using {% url "`.type()`" type %}, Cypress now properly types into an input within an iframe that auto focuses the input. Fixes {% issue 8111 %}.

**Misc:**

- Dependencies for our `cypress` npm package are no longer pinned to a specific version. This allows the use of `npm audit fix` to fix security vulnerabilities without needing a patch release from Cypress. Addresses {% issue 8046 %}.
- We now collect environment variables for AWS CodeBuild when recording to the Dashboard. Addressed {% issue 8101 %}.
- Types inside Module API are now accessible via the `CypressCommandLine` namespace. Addresses {% issue 7309 %}.
- We added more type definitions for the {% url "`.should()`" should %} command. Addresses {% issue 5573 %}.
- Cookie command's `expiry` property type is now a Number instead of a String. Addresses {% issue 8144 %}.
- There are some minor visual improvements to the Test Runner's Command Log when hovering, focusing and clicking on hook titles and pending tests. Addressed in {% PR 8153 %}.

**Dependency Updates:**

- Upgraded `jimp` from `0.13.0` to `0.14.0`. Addressed in {% PR 8102 %}.
- Upgraded `moment` from `2.26.0` to `2.27.0`. Addressed in {% PR 8122 %}.
2 changes: 1 addition & 1 deletion source/api/commands/screenshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ You can get details about any given screenshot and manipulate it after it has be

### Automatic screenshots on test failure

When running through `cypress run` or in {% url 'Continuous Integration' continuous-integration %}, Cypress automatically takes a screenshot when a test fails. You can optionally turn this off by setting `screenshotOnRunFailure` to `false` within {% url 'Cypress.Screenshot.defaults()' screenshot-api %}.
When running through `cypress run` or in {% url 'Continuous Integration' continuous-integration %}, Cypress automatically takes a screenshot when a test fails. You can optionally turn this off by setting `screenshotOnRunFailure` to `false` within your {% url `screenshotOnRunFailure` configuration#Screenshots %} or {% url 'Cypress.Screenshot.defaults()' screenshot-api %}.

## Viewing Screenshots

Expand Down
2 changes: 1 addition & 1 deletion source/api/cypress-api/screenshot-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Option | Default | Description
`capture` | `'fullPage'` | Which parts of the Test Runner to capture. This value is ignored for element screenshot captures. Valid values are `viewport`, `fullPage`, or `runner`. When `viewport`, your application under test is captured in the current viewport. When `fullPage`, your application under test is captured in its entirety from top to bottom. When `runner`, the entire browser viewport, including the Cypress Command Log, is captured. For screenshots automatically taken on test failure, capture is always coerced to `runner`.
`disableTimersAndAnimations` | `true`| When true, prevents JavaScript timers (`setTimeout`, `setInterval`, etc) and CSS animations from running while the screenshot is taken.
`scale` | `false` | Whether to scale the app to fit into the browser viewport. This is always coerced to `true` for `runner` captures.
`screenshotOnRunFailure` | `true` | When true, automatically takes a screenshot when there is a failure in Run mode.
`screenshotOnRunFailure` | `true` | When true, automatically takes a screenshot when there is a failure during `cypress run`.
`onBeforeScreenshot` | `null` | A callback before a (non-failure) screenshot is taken. For an element capture, the argument is the element being captured. For other screenshots, the argument is the `$el`.
`onAfterScreenshot` | `null` | A callback after a (non-failure) screenshot is taken. For an element capture, the first argument is the element being captured. For other screenshots, the first argument is the `$el`. The second argument is properties concerning the screenshot, including the path it was saved to and the dimensions of the saved screenshot.

Expand Down
1 change: 1 addition & 0 deletions source/api/plugins/writing-a-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ The `config` object also includes the following extra values that are not part o

* `configFile`: The absolute path to the config file. By default, this is `<projectRoot>/cypress.json`, but may be a custom path or `false` if using the {% url "`--config-file` flag" command-line#cypress-open-config-file-lt-config-file-gt %}.
* `projectRoot`: The absolute path to the root of the project (e.g. `/Users/me/dev/my-project`)
* `version`: The version number of Cypress. This can be used to handle breaking changes.
{% endnote %}

{% url "Please check out our API docs for modifying configuration here." configuration-api %}
Expand Down
35 changes: 34 additions & 1 deletion source/guides/core-concepts/writing-and-organizing-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ The code above will produce a suite with 4 tests:

## Assertion Styles

Cypress supports both BDD (`expect`/`should`) and TDD (`assert`) style assertions. {% url "Read more about assertions." assertions %}
Cypress supports both BDD (`expect`/`should`) and TDD (`assert`) style plain assertions. {% url "Read more about plain assertions." assertions %}

```javascript
it('can add numbers', () => {
Expand All @@ -403,6 +403,39 @@ it('can subtract numbers', () => {
})
```

The {% url "`.should()`" should %} command and its alias {% url "`.and()`" and %} can also be used to more easily chain assertions off of Cypress commands. {% url "Read more about assertions." introduction-to-cypress#Assertions %}

```js
cy.wrap(add(1, 2)).should('equal', 3)
```

# Running tests

## Run a single spec file

We suggest running test files individually by clicking on the spec filename to ensure the best performance. For example the {% url "Cypress RealWorld App" https://github.com/cypress-io/cypress-example-realworld %} has multiple test files, but below we run a single "new-transaction.spec.ts" test file.

{% imgTag /img/guides/core-concepts/run-single-spec.gif "Running a single spec" %}

## Run all specs

You can run all spec files together by clicking the "Run all specs" button. This mode is equivalent to concatenating all spec files together into a single piece of test code.

{% imgTag /img/guides/core-concepts/run-all-specs.gif "Running all specs" %}

{% note danger %}
{% fa fa-warning %} Be wary of root-level hooks, as they could execute in a surprising order when clicking the "Run all specs" button. Instead place them inside `describe` or `context` suites for isolation. Read {% url "'Be careful when running all specs together'" https://glebbahmutov.com/blog/run-all-specs/ %}.
{% endnote %}

## Run filtered specs

You can also run a subset of all specs by entering a text search filter. Only the specs with relative file paths containing the search filter will remain and be run as if concatenating all spec files together when clicking the "Run N specs" button.

- The search filter is case-insensitive; the filter "ui" will match both "UI-spec.js" and "admin-ui-spec.js" files.
- The search filter is applied to the entire relative spec file path, thus you can use folder names to limit the specs; the filter "ui" will match both "admin-ui.spec.js" and "ui/admin.spec.js" files.

{% imgTag /img/guides/core-concepts/run-selected-specs.gif "Running specs matching the search filter" %}

# Watching tests

When running in using {% url "`cypress open`" command-line#cypress-open %}, Cypress watches the filesystem for changes to your spec files. Soon after adding or updating a test Cypress will reload it and run all of the tests in that spec file.
Expand Down
1 change: 1 addition & 0 deletions source/guides/guides/parallelization.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ Cypress currently uses the following CI environment variables to determine a CI
Provider | Environment Variable
--|--
AppVeyor | `APPVEYOR_BUILD_NUMBER`
AWS CodeBuild | `CODEBUILD_BUILD_ID`
Bamboo | `bamboo_buildNumber`
Circle | `CIRCLE_WORKFLOW_ID`, `CIRCLE_BUILD_NUMBER`
Codeship | `CI_BUILD_NUMBER`
Expand Down
2 changes: 1 addition & 1 deletion source/guides/guides/screenshots-and-videos.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To take a manual screenshot you can use the {% url `cy.screenshot()` screenshot

Additionally, Cypress will automatically capture screenshots when a failure happens during `cypress run`. Screenshots on failure are *not* automatically taken during `cypress open`.

This behavior can be turned off by setting `screenshotOnRunFailure` to `false` in the {% url 'Cypress.Screenshot.defaults()' screenshot-api %}.
Capturing of screenshots when a test fails can be turned off entirely by setting {% url `screenshotOnRunFailure` configuration#Screenshots %} to `false` from within your {% url "configuration" configuration %} or by setting `screenshotOnRunFailure` to `false` in the {% url 'Cypress.Screenshot.defaults()' screenshot-api %}.

Screenshots are stored in the {% url `screenshotsFolder` configuration#Screenshots %} which is set to `cypress/screenshots` by default.

Expand Down
5 changes: 4 additions & 1 deletion source/guides/references/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Option | Default | Description

Option | Default | Description
----- | ---- | ----
`screenshotOnRunFailure` | `true` | Whether Cypress will take a screenshot when a test fails during `cypress run`.
`screenshotsFolder` | `cypress/screenshots` | Path to folder where screenshots will be saved from {% url `cy.screenshot()` screenshot %} command or after a test fails during `cypress run`
`trashAssetsBeforeRuns` | `true` | Whether Cypress will trash assets within the `screenshotsFolder` and `videosFolder` before tests run with `cypress run`.

Expand Down Expand Up @@ -394,7 +395,9 @@ Run GC cleanup before every 3rd test during {% url "`cypress run`" command-line#
IntelliSense is available for Cypress while editing your configuration file. {% url "Learn how to set up Intelligent Code Completion." IDE-integration#Intelligent-Code-Completion %}

{% history %}
{% url "3.5.0" changelog %} | Added support for option `nodeVersion`
{% url "4.1.0" changelog#4-12-0 %} | Added support for `screenshotOnRunFailure` configuration.
{% url "4.0.0" changelog#4-0-0 %} | Added support for `firefoxGcInterval` configuration.
{% url "3.5.0" changelog#3-5-0 %} | Added support for `nodeVersion` configuration.
{% endhistory %}

# See also
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.