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

Document log event changes #1404

Merged
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
4 changes: 2 additions & 2 deletions source/_data/sidebar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ api:
internal-commandenqueue-event: internal-commandenqueue-event.html
internal-commandretry-event: internal-commandretry-event.html
internal-commandstart-event: internal-commandstart-event.html
log-added-event: log-added-event.html
log-changed-event: log-changed-event.html
internal-log-event: internal-log-event.html
internal-logchange-event: internal-logchange-event.html
page-alert-event: page-alert-event.html
page-confirm-event: page-confirm-event.html
page-end-event: page-end-event.html
Expand Down
4 changes: 2 additions & 2 deletions source/api/events/all-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ Event | Description
{% url `internal:commandEnqueue` internal-commandenqueue-event %} | Fires after a command is first invoked and enqueued to be run later, with the details about the command.
{% url `internal:commandRetry` internal-commandretry-event %} | Fires before a command begins its retrying routines, with details about the retry.
{% url `internal:commandStart` internal-commandstart-event %} | Fires before a command executes, with the command that will be run.
{% url `log:added` log-added-event %} | Fires before a command is displayed in the Command Log, with details about the log.
{% url `log:changed` log-changed-event %} | Fires after a command's attributes changes, with the log details and whether Cypress is in interactive mode.
{% url `internal:log` internal-log-event %} | Fires before a command is displayed in the Command Log, with details about the log.
{% url `internal:logChange` internal-logchange-event %} | Fires after a command's attributes changes, with the log details and whether Cypress is in interactive mode.
{% url `page:alert` page-alert-event %} | Fires when the page calls the global `window.alert()` method, with the alert text.
{% url `page:confirm` page-confirm-event %} | Fires when your app calls the global `window.confirm()` method, with the confirm text.
{% url `page:end` page-end-event %} | Fires when the page has unloaded and is navigating away.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: log:added
title: internal:log
---

The `log:added` event fires whenever a command emits this event so it can be displayed in the Command Log. Useful to see how internal cypress commands utilize the {% url 'Cypress.log()' cypress-log %} API.
The `internal:log` event fires whenever a command emits this event so it can be displayed in the Command Log. Useful to see how internal cypress commands utilize the {% url 'Cypress.log()' cypress-log %} API.

# Environment

Expand All @@ -12,7 +12,7 @@ Some events run in the {% url "browser" all-events#Browser-Events %}, some in th

Event | Browser | Background Process
--- | --- | ---
`log:added` | {% fa fa-check-circle green %} | {% fa fa-times-circle grey %}
`internal:log` | {% fa fa-check-circle green %} | {% fa fa-times-circle grey %}

{% wrap_end %}

Expand All @@ -26,10 +26,10 @@ The log attributes.

## In the browser

In a spec file or support file you can tap into the `log:added` event.
In a spec file or support file you can tap into the `internal:log` event.

```javascript
Cypress.on('log:added', (log) => {
Cypress.on('internal:log', (log) => {
// log looks something like this:
// {
// name: 'get',
Expand All @@ -46,4 +46,4 @@ Cypress.on('log:added', (log) => {

- {% url `cy.log()` log %}
- {% url `Cypress.log` cypress-log %}
- {% url `log:changed` log-changed-event %}
- {% url `internal:logChange` internal-logchange-event %}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: log:changed
title: internal:logChange
---

The `log:changed` event fires whenever a command's attributes changes. This event is debounced to prevent it from firing too quickly and too often. Useful to see how internal cypress commands utilize the {% url 'Cypress.log()' cypress-log %} API.
The `internal:logChange` event fires whenever a command's attributes changes. This event is debounced to prevent it from firing too quickly and too often. Useful to see how internal cypress commands utilize the {% url 'Cypress.log()' cypress-log %} API.

# Environment

Expand All @@ -12,7 +12,7 @@ Some events run in the {% url "browser" all-events#Browser-Events %}, some in th

Event | Browser | Background Process
--- | --- | ---
`log:changed` | {% fa fa-check-circle green %} | {% fa fa-times-circle grey %}
`internal:logChange` | {% fa fa-check-circle green %} | {% fa fa-times-circle grey %}

{% wrap_end %}

Expand All @@ -30,10 +30,10 @@ Whether Cypress is in interactive mode.

## In the browser

In a spec file or support file you can tap into the `log:changed` event.
In a spec file or support file you can tap into the `internal:logChange` event.

```javascript
Cypress.on('log:changed', (log, interactiveMode) => {
Cypress.on('internal:logChange', (log, interactiveMode) => {
// log looks something like this:
// {
// name: 'get',
Expand All @@ -50,4 +50,4 @@ Cypress.on('log:changed', (log, interactiveMode) => {

- {% url `cy.log()` log %}
- {% url `Cypress.log` cypress-log %}
- {% url `log:added` log-added-event %}
- {% url `internal:log` internal-log-event %}
20 changes: 11 additions & 9 deletions source/guides/references/migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,21 @@ Various events have been renamed to maintain a more consistent format.

If you listen for any of the following events in your test code, you'll need to rename them.

- Rename `command:end` to `internal:commandEnd`
- Rename `command:enqueued` to `internal:commandEnqueue`
- Rename `command:retry` to `internal:commandRetry`
- Rename `command:start` to `internal:commandStart`
- Rename `fail` to `test:fail`
- Rename `log:added` to `internal:log`
- Rename `log:changed` to `internal:logChange`
- Rename `test:before:run` to `test:start`
- Rename `test:after:run` to `test:end`
- Rename `fail` to `test:fail`
- Rename `url:changed` to `page:urlChange`
- Rename `viewport:changed` to `viewport:change`
- Rename `window:alert` to `page:alert`
- Rename `window:confirm` to `page:confirm`
- Rename `window:before:load` to `page:start`
- Rename `url:changed` to `page:urlChange`
- Rename `viewport:changed` to `viewport:change`
- Rename `window:before:unload` to `before:window:unload`
- Rename `command:end` to `internal:commandEnd`
- Rename `command:enqueued` to `internal:commandEnqueue`
- Rename `command:retry` to `internal:commandRetry`
- Rename `command:start` to `internal:commandStart`

For example, in your test code...

Expand Down Expand Up @@ -113,9 +115,9 @@ cy.on('page:start', () => {

If you listen for any of the following events in your `backgroundFile`, you'll need to rename them.

- Rename `file:preprocessor` to `browser:filePreprocessor`
- Rename `before:browser:launch` to `browser:launch`
- Rename `after:screenshot` to `screenshot`
- Rename `before:browser:launch` to `browser:launch`
- Rename `file:preprocessor` to `browser:filePreprocessor`

For example, in your `backgroundFile`...

Expand Down
4 changes: 2 additions & 2 deletions themes/cypress/languages/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ sidebar:
configuration-event: configuration
test-fail-event: test:fail
browser-filepreprocessor-event: browser:filePreprocessor
log-added-event: log:added
log-changed-event: log:changed
internal-log-event: internal:log
internal-logchange-event: internal:logChange
scrolled-event: scrolled
task-event: task
uncaught-exception-event: uncaught:exception
Expand Down