Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update run events pages with interactive mode details #3791

Merged
merged 7 commits into from
Apr 12, 2021
2 changes: 1 addition & 1 deletion content/_changelogs/3.8.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ _Released 12/26/2019_
- We fixed an issue where, on some systems with IPv4 and IPv6 enabled, Cypress would fail to connect to the Chrome DevTools Protocol while launching Chrome, leading to test failures. Fixes [#5912](https://github.com/cypress-io/cypress/issues/5912).
- The strict cookie validation added in [3.5.0](#3-5-0) for [cy.setCookie()](/api/commands/setcookie), [cy.clearCookie()](/api/commands/clearcookie), and [cy.getCookie()](/api/commands/getcookie) has been removed. Fixes [#5642](https://github.com/cypress-io/cypress/issues/5642).
- We fixed a regression in [3.8.0](#3-8-0) where using [.type()](/api/commands/type) on number inputs to type non-number characters or the `{enter}` special character would not type the correct value. Fixes [#5968](https://github.com/cypress-io/cypress/issues/5968) and [#5997](https://github.com/cypress-io/cypress/issues/5997).
- Configuration values set from the plugin file now display with the correct background color in the Configuration panel in the Test Runner Settings. Fixes [#6024](https://github.com/cypress-io/cypress/issues/6024).
- Configuration values set from the plugins file now display with the correct background color in the Configuration panel in the Test Runner Settings. Fixes [#6024](https://github.com/cypress-io/cypress/issues/6024).
- We removed the 'Me' and 'An Organization' selections in the Test Runner when setting up a project to more closely match the Dashboard UI. This also fixes an edge case where a user with no default organizations could potentially be unable to set up a project. Fixes [#5954](https://github.com/cypress-io/cypress/issues/5954).

**Misc:**
Expand Down
2 changes: 1 addition & 1 deletion content/_changelogs/6.7.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ _Released 3/15/2021_

- We updated the UI when connecting a project to the Dashboard. Addressed in [#14877](https://github.com/cypress-io/cypress/issues/14877).
- "Test recordings" recorded to the Cypress Dashboard are now referred to as recorded "test results." Addresses [#15376](https://github.com/cypress-io/cypress/issues/15376).
- Errors shown from plugins files now display top-aligned. Addressed in [#15347](https://github.com/cypress-io/cypress/issues/15347).
- Errors shown from the plugins file now display top-aligned. Addressed in [#15347](https://github.com/cypress-io/cypress/issues/15347).

**Dependency Updates:**

Expand Down
16 changes: 12 additions & 4 deletions content/api/plugins/after-run-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@
title: After Run API
---

The `after:run` event fires after a run is finished. The event only fires when running via `cypress run`.
The `after:run` event fires after a run is finished. When running cypress via `cypress open`, the event will fire when closing a project.

The event will fire each time `cypress run` executes. As a result, if running your specs in [parallel](/guides/guides/parallelization), the event will fire once for each machine on which `cypress run` is called.
When running via `cypress run`, the event will fire each time `cypress run` executes. As a result, if running your specs in [parallel](/guides/guides/parallelization), the event will fire once for each machine on which `cypress run` is called.

## Syntax

<Alert type="warning">

⚠️ This code is part of the [plugin file](/guides/core-concepts/writing-and-organizing-tests.html#Plugin-files) and thus executes in the Node environment. You cannot call `Cypress` or `cy` commands in this file, but you do have the direct access to the file system and the rest of the operating system.
⚠️ This code is part of the [plugins file](/guides/core-concepts/writing-and-organizing-tests.html#Plugin-files) and thus executes in the Node environment. You cannot call `Cypress` or `cy` commands in this file, but you do have the direct access to the file system and the rest of the operating system.

</Alert>

<Alert type="warning">

⚠️ When running via `cypress open`, the `after:run` event only fires if the [experimentalInteractiveRunEvents flag](/guides/references/configuration#Experiments) is enabled.

</Alert>

Expand All @@ -24,6 +30,8 @@ on('after:run', (results) => {

Results of the run, including the total number of passes/failures/etc, the project config, and details about the browser and system. It is the same as the results object resolved by the [Module API](/guides/guides/module-api#Results).

Results are only provided when running via `cypress run`. When running via `cypress open`, the results will be undefined.

## Usage

You can return a promise from the `after:run` event handler and it will be awaited before Cypress proceeds running your specs.
Expand All @@ -33,7 +41,7 @@ You can return a promise from the `after:run` event handler and it will be await
```javascript
module.exports = (on, config) => {
on('after:run', (results) => {
// results will look something like this:
// results will look something like this when run via `cypress run`:
// {
// totalDuration: 81,
// totalSuites: 0,
Expand Down
2 changes: 1 addition & 1 deletion content/api/plugins/after-screenshot-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This allows you to record those details, manipulate the image as needed, and ret

<Alert type="warning">

⚠️ This code is part of the [plugin file](/guides/core-concepts/writing-and-organizing-tests.html#Plugin-files) and thus executes in the Node environment. You cannot call `Cypress` or `cy` commands in this file, but you do have the direct access to the file system and the rest of the operating system.
⚠️ This code is part of the [plugins file](/guides/core-concepts/writing-and-organizing-tests.html#Plugin-files) and thus executes in the Node environment. You cannot call `Cypress` or `cy` commands in this file, but you do have the direct access to the file system and the rest of the operating system.

</Alert>

Expand Down
12 changes: 10 additions & 2 deletions content/api/plugins/after-spec-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
title: After Spec API
---

The `after:spec` event fires after a spec file is run. The event only fires when running via `cypress run`.
The `after:spec` event fires after a spec file is run. When running cypress via `cypress open`, the event will fire when the browser closes.

## Syntax

<Alert type="warning">

⚠️ This code is part of the [plugin file](/guides/core-concepts/writing-and-organizing-tests.html#Plugin-files) and thus executes in the Node environment. You cannot call `Cypress` or `cy` commands in this file, but you do have the direct access to the file system and the rest of the operating system.
⚠️ This code is part of the [plugins file](/guides/core-concepts/writing-and-organizing-tests.html#Plugin-files) and thus executes in the Node environment. You cannot call `Cypress` or `cy` commands in this file, but you do have the direct access to the file system and the rest of the operating system.

</Alert>

<Alert type="warning">

⚠️ When running via `cypress open`, the `after:spec` event only fires if the [experimentalInteractiveRunEvents flag](/guides/references/configuration#Experiments) is enabled.

</Alert>

Expand All @@ -32,6 +38,8 @@ Details of the spec file, including the following properties:

Details of the spec file's results, including numbers of passes/failures/etc and details on the tests themselves.

Results are only provided when running via `cypress run`. When running via `cypress open`, the results will be undefined.

## Usage

You can return a promise from the `after:spec` event handler and it will be awaited before Cypress proceeds with processing the spec's video or moving on to further specs if there are any.
Expand Down
33 changes: 27 additions & 6 deletions content/api/plugins/before-run-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@
title: Before Run API
---

The `before:run` event fires before a run starts. The event only fires when running via `cypress run`.
The `before:run` event fires before a run starts. When running cypress via `cypress open`, the event will fire when opening a project.

The event will fire each time `cypress run` executes. As a result, if running your specs in [parallel](/guides/guides/parallelization), the event will fire once for each machine on which the tests are run.

## Syntax

<Alert type="warning">

⚠️ This code is part of the [plugin file](/guides/core-concepts/writing-and-organizing-tests.html#Plugin-files) and thus executes in the Node environment. You cannot call `Cypress` or `cy` commands in this file, but you do have the direct access to the file system and the rest of the operating system.
⚠️ This code is part of the [plugins file](/guides/core-concepts/writing-and-organizing-tests.html#Plugin-files) and thus executes in the Node environment. You cannot call `Cypress` or `cy` commands in this file, but you do have the direct access to the file system and the rest of the operating system.

</Alert>

<Alert type="warning">

⚠️ When running via `cypress open`, the `before:run` event only fires if the [experimentalInteractiveRunEvents flag](/guides/references/configuration#Experiments) is enabled.

</Alert>

Expand All @@ -22,7 +28,7 @@ on('before:run', (details) => {

**<Icon name="angle-right"></Icon> details** **_(Object)_**

Details of the run, including the project config, details about the browser and system, and the specs that will be run.
Details of the run, including the project config, system information, and the version of Cypress. More details are included when running via `cypress run`.

## Usage

Expand All @@ -33,7 +39,7 @@ You can return a promise from the `before:run` event handler and it will be awai
```javascript
module.exports = (on, config) => {
on('before:run', (details) => {
// details will look something like this:
// details will look something like this when run via `cypress run`:
// {
// config: {
// projectId: '12345',
Expand All @@ -47,8 +53,7 @@ module.exports = (on, config) => {
// version: '59.0.3071.115',
// // ...more properties...
// },
// system:
// {
// system: {
// osName: 'darwin',
// osVersion: '16.7.0',
// }
Expand All @@ -69,6 +74,22 @@ module.exports = (on, config) => {
// tag: 'tag-1'
// }

// details will look something like this when run via `cypress open`:
// {
// config: {
// projectId: '12345',
// baseUrl: 'http://example.com/',
// viewportWidth: 1000,
// viewportHeight: 660,
// // ...more properties...
// },
// system: {
// osName: 'darwin',
// osVersion: '16.7.0',
// }
// cypressVersion: '7.0.0'
// }

console.log(
'Running',
details.specs.length,
Expand Down
10 changes: 8 additions & 2 deletions content/api/plugins/before-spec-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
title: Before Spec API
---

The `before:spec` event fires before a spec file is run. The event only fires when running via `cypress run`.
The `before:spec` event fires before a spec file is run. When running cypress via `cypress open`, the event will fire when the browser launches.

## Syntax

<Alert type="warning">

⚠️ This code is part of the [plugin file](/guides/core-concepts/writing-and-organizing-tests.html#Plugin-files) and thus executes in the Node environment. You cannot call `Cypress` or `cy` commands in this file, but you do have the direct access to the file system and the rest of the operating system.
⚠️ This code is part of the [plugins file](/guides/core-concepts/writing-and-organizing-tests.html#Plugin-files) and thus executes in the Node environment. You cannot call `Cypress` or `cy` commands in this file, but you do have the direct access to the file system and the rest of the operating system.

</Alert>

<Alert type="warning">

⚠️ When running via `cypress open`, the `before:spec` event only fires if the [experimentalInteractiveRunEvents flag](/guides/references/configuration#Experiments) is enabled.

</Alert>

Expand Down
4 changes: 2 additions & 2 deletions content/api/plugins/browser-launch-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ Before Cypress launches a browser, it gives you the opportunity to modify the br

<Alert type="warning">

⚠️ This code is part of the [plugin file](/guides/core-concepts/writing-and-organizing-tests.html#Plugin-files) and thus executes in the Node environment. You cannot call `Cypress` or `cy` commands in this file, but you do have the direct access to the file system and the rest of the operating system.
⚠️ This code is part of the [plugins file](/guides/core-concepts/writing-and-organizing-tests.html#Plugin-files) and thus executes in the Node environment. You cannot call `Cypress` or `cy` commands in this file, but you do have the direct access to the file system and the rest of the operating system.

</Alert>

<Alert type="warning">

⚠️ This code is part of the [plugin file](/guides/core-concepts/writing-and-organizing-tests.html#Plugin-files) and thus executes in the Node environment. You cannot call `Cypress` or `cy` commands in this file, but you do have the direct access to the file system and the rest of the operating system.
⚠️ This code is part of the [plugins file](/guides/core-concepts/writing-and-organizing-tests.html#Plugin-files) and thus executes in the Node environment. You cannot call `Cypress` or `cy` commands in this file, but you do have the direct access to the file system and the rest of the operating system.

</Alert>

Expand Down
6 changes: 3 additions & 3 deletions content/api/plugins/configuration-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
title: Configuration API
---

Cypress enables you to dynamically modify configuration values and environment variables from your plugin file.
Cypress enables you to dynamically modify configuration values and environment variables from your plugins file.

## Usage

<Alert type="warning">

⚠️ This code is part of the [plugin file](/guides/core-concepts/writing-and-organizing-tests.html#Plugin-files) and thus executes in the Node environment. You cannot call `Cypress` or `cy` commands in this file, but you do have the direct access to the file system and the rest of the operating system.
⚠️ This code is part of the [plugins file](/guides/core-concepts/writing-and-organizing-tests.html#Plugin-files) and thus executes in the Node environment. You cannot call `Cypress` or `cy` commands in this file, but you do have the direct access to the file system and the rest of the operating system.

</Alert>

<Alert type="warning">

⚠️ This code is part of the [plugin file](/guides/core-concepts/writing-and-organizing-tests.html#Plugin-files) and thus executes in the Node environment. You cannot call `Cypress` or `cy` commands in this file, but you do have the direct access to the file system and the rest of the operating system.
⚠️ This code is part of the [plugins file](/guides/core-concepts/writing-and-organizing-tests.html#Plugin-files) and thus executes in the Node environment. You cannot call `Cypress` or `cy` commands in this file, but you do have the direct access to the file system and the rest of the operating system.

</Alert>

Expand Down
2 changes: 1 addition & 1 deletion content/api/plugins/preprocessors-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ If you don't use webpack in your project or would like to keep the majority of t

<Alert type="warning">

⚠️ This code is part of the [plugin file](/guides/core-concepts/writing-and-organizing-tests.html#Plugin-files) and thus executes in the Node environment. You cannot call `Cypress` or `cy` commands in this file, but you do have the direct access to the file system and the rest of the operating system.
⚠️ This code is part of the [plugins file](/guides/core-concepts/writing-and-organizing-tests.html#Plugin-files) and thus executes in the Node environment. You cannot call `Cypress` or `cy` commands in this file, but you do have the direct access to the file system and the rest of the operating system.

</Alert>

Expand Down
2 changes: 1 addition & 1 deletion content/api/plugins/writing-a-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = (on, config) => {

<Alert type="warning">

⚠️ This code is part of the [plugin file](/guides/core-concepts/writing-and-organizing-tests.html#Plugin-files) and thus executes in the Node environment. You cannot call `Cypress` or `cy` commands in this file, but you do have the direct access to the file system and the rest of the operating system.
⚠️ This code is part of the [plugins file](/guides/core-concepts/writing-and-organizing-tests.html#Plugin-files) and thus executes in the Node environment. You cannot call `Cypress` or `cy` commands in this file, but you do have the direct access to the file system and the rest of the operating system.

</Alert>

Expand Down
6 changes: 3 additions & 3 deletions content/guides/core-concepts/writing-and-organizing-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ Any videos recorded of the run are stored in the [`videosFolder`](/guides/refere

To learn more about videos and settings available, see [Screenshots and Videos](/guides/guides/screenshots-and-videos#Screenshots)

### Plugin files
### Plugins file

The plugin file is a special file that executes in Node before the project is loaded, before the browser launches, and during your test execution. While the Cypress tests execute in the browser, the plugin file runs in the background Node process, giving your tests the ability to access the file system and the rest of the operating system by calling the [cy.task()](/api/commands/task) command.
The plugins file is a special file that executes in Node before the project is loaded, before the browser launches, and during your test execution. While the Cypress tests execute in the browser, the plugins file runs in the background Node process, giving your tests the ability to access the file system and the rest of the operating system by calling the [cy.task()](/api/commands/task) command.

The plugin file is a good place to define how you want to bundle the spec files via the [preprocessors](/api/plugins/preprocessors-api), how to find and launch the browsers via the [browser launch API](/api/plugins/browser-launch-api), and other cool things. Read our [plugins guide](/guides/tooling/plugins-guide) for more details and examples.
The plugins file is a good place to define how you want to bundle the spec files via the [preprocessors](/api/plugins/preprocessors-api), how to find and launch the browsers via the [browser launch API](/api/plugins/browser-launch-api), and other cool things. Read our [plugins guide](/guides/tooling/plugins-guide) for more details and examples.

The initial imported plugins file can be [configured to another file](/guides/references/configuration#Folders-Files).

Expand Down
2 changes: 1 addition & 1 deletion content/guides/references/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ When you open a Cypress project, clicking on the **Settings** tab will display t
- The [Cypress environment file](/guides/guides/environment-variables#Option-2-cypress-env-json)
- System [environment variables](/guides/guides/environment-variables#Option-3-CYPRESS)
- [Command Line arguments](/guides/guides/command-line)
- [Plugin file](/api/plugins/configuration-api)
- [Plugins file](/api/plugins/configuration-api)

<DocsImage src="/img/guides/configuration/see-resolved-configuration.jpg" alt="See resolved configuration" ></DocsImage>

Expand Down
Loading