You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/api/commands/screenshot.md
+3-4Lines changed: 3 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,5 @@
1
1
---
2
2
title: screenshot
3
-
4
3
---
5
4
6
5
Take a screenshot of the application under test and, optionally, the {% url "Cypress Command Log" test-runner#Command-Log %}.
@@ -42,15 +41,15 @@ Pass in an options object to change the default behavior of `.screenshot()`.
42
41
43
42
Option |Default | Description
44
43
--- | --- | ---
45
-
`log` | `true` | {% usage_options log %}
46
44
`blackout` | `[]` | Array of string selectors used to match elements that should be blacked out when the screenshot is taken. Does not apply to `runner` captures.
47
45
`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`, the application under test is captured in the current viewport. When `fullPage`, the 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`.
48
46
`clip` | `null` | Position and dimensions (in pixels) used to crop the final screenshot image. Should have the following shape: `{ x: 0, y: 0, width: 100, height: 100 }`
49
47
`disableTimersAndAnimations` | `true`| When true, prevents JavaScript timers (`setTimeout`, `setInterval`, etc) and CSS animations from running while the screenshot is taken.
50
-
`scale` | `false` | Whether to scale the app to fit into the browser viewport. This is always coerced to `true` when `capture` is `runner`.
`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`.
53
50
`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.
51
+
`scale` | `false` | Whether to scale the app to fit into the browser viewport. This is always coerced to `true` when `capture` is `runner`.
For more details on these options and to set some as defaults across all uses of `.screenshot()`, see the {% url 'Cypress.Screenshot API doc' screenshot-api %}.
Copy file name to clipboardExpand all lines: source/api/events/file-preprocessor-event.md
+9-11Lines changed: 9 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: file:preprocessor Event
3
3
---
4
4
5
-
The `file:preprocessor` event allows you to modify how your spec files and support file are preprocessed for the browser.
5
+
The `file:preprocessor` event allows you to modify how your spec files and support files are preprocessed for the browser.
6
6
7
7
A preprocessor is the plugin responsible for preparing a {% url "support file" writing-and-organizing-tests#Support-file %} or a {% url "test file" writing-and-organizing-tests#Test-files %} for the browser.
8
8
@@ -16,7 +16,7 @@ Occurs only in the {% url "background process" background-process %}.
16
16
17
17
# Examples
18
18
19
-
We've created three preprocessors as examples for you to look at. These are fully functioning preprocessors.
19
+
We've have three preprocessors as examples. These are fully functioning preprocessors.
20
20
21
21
The code contains comments that explain how it utilizes the preprocessor API.
22
22
@@ -26,7 +26,7 @@ The code contains comments that explain how it utilizes the preprocessor API.
26
26
27
27
# Recipes
28
28
29
-
We've also added some recipes showing how to utilize these preprocessors.
29
+
We've also have some recipes showing how to utilize these preprocessors.
30
30
31
31
Here are two recipes using both webpack and browserify to write your tests in TypeScript.
32
32
@@ -46,9 +46,7 @@ The Browserify Preprocessor handles:
46
46
47
47
The exact default configuration options {% url 'can be found here' https://github.com/cypress-io/cypress-browserify-preprocessor#browserifyoptions %}.
48
48
49
-
{% note info %}
50
-
Are you looking to change the **default options** for Browserify?
51
-
{% endnote %}
49
+
{% note info "Are you looking to change the default options for Browserify?" %}
52
50
53
51
Changing the Browserify options lets you:
54
52
@@ -57,10 +55,11 @@ Changing the Browserify options lets you:
57
55
- Add support for CoffeeScript `2.x.x`
58
56
59
57
Please read this link in the {% url 'browserify preprocessor' https://github.com/cypress-io/cypress-browserify-preprocessor#modifying-default-options %} repo for instructions on modifying these.
58
+
{% endnote %}
60
59
61
60
# Usage
62
61
63
-
To use a preprocessor, you should bind to the `file:preprocessor` event in your {% url "`backgroundFile`" configuration#Folders-Files %}:
62
+
To use a preprocessor, you should bind to the `file:preprocessor` event in your {% url "`backgroundFile`" configuration#Folders-Files %}.
> \*\* The built file is the file that is created by the preprocessor that will eventually be served to the browser.
84
83
85
-
> If, for example, the source file is `spec.coffee`, the preprocessor should:
84
+
If, for example, the source file is `spec.coffee`, the preprocessor should:
85
+
86
86
1. Compile the CoffeeScript into JavaScript `spec.js`
87
87
2. Write that JavaScript file to disk (example: `/Users/foo/tmp/spec.js`)
88
88
3. Resolve with the absolute path to that file: `/Users/foo/tmp/spec.js`
@@ -114,7 +114,6 @@ The `file` object passed to the callback function is an {% url "Event Emitter" h
114
114
When the running spec, the project, or the browser is closed while running tests, the `close` event will be emitted. The preprocessor should do any necessary cleanup in this function, like closing the watcher when watching.
115
115
116
116
```javascript
117
-
// example
118
117
constwatcher=fs.watch(filePath, /* ... */)
119
118
120
119
file.on('close', () => {
@@ -127,7 +126,6 @@ file.on('close', () => {
127
126
If watching for file changes, emit `rerun` after a file has finished being processed to let Cypress know to rerun the tests.
128
127
129
128
```javascript
130
-
// example
131
129
fs.watch(filePath, () => {
132
130
file.emit('rerun')
133
131
})
@@ -147,4 +145,4 @@ Use the following npm keywords:
147
145
]
148
146
```
149
147
150
-
Feel free to submit your published plugins to our {% url "list of plugins" plugins %}.
148
+
Feel free to submit your published plugin to our {% url "list of plugins" plugins %}.
Copy file name to clipboardExpand all lines: source/guides/core-concepts/writing-and-organizing-tests.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,7 +93,7 @@ To start writing tests for your app, simply create a new file like `app_spec.js`
93
93
94
94
## Background file
95
95
96
-
Cypress runs a background Node.js process that you can utilize via the the background file (`cypress/background/index.js` by default).
96
+
Cypress runs a background Node.js process that you can utilize via the the {% url "background file" configuration#Folders-Files %} (`cypress/background/index.js` by default).
97
97
98
98
{% url "Read more about using the background process to extend Cypress behavior." background-process %}
Copy file name to clipboardExpand all lines: source/guides/references/configuration.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ Option | Default | Description
50
50
`fileServerFolder` | root project folder |Path to folder where application files will attempt to be served from
51
51
`fixturesFolder` | `cypress/fixtures` | Path to folder containing fixture files (Pass `false` to disable)
52
52
`integrationFolder` | `cypress/integration` | Path to folder containing integration test files
53
-
`backgroundFile` | `cypress/background/index.js` | Path to background file. (Pass `false` to disable)
53
+
`backgroundFile` | `cypress/background/index.js` | Path to {% url "background file" background-process %}. (Pass `false` to disable)
54
54
`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`
55
55
`supportFile` | `cypress/support/index.js` | Path to file to load before test files load. This file is compiled and bundled. (Pass `false` to disable)
56
56
`videosFolder` | `cypress/videos` | Path to folder where videos will be saved during `cypress run`
@@ -123,9 +123,9 @@ cypress run --record --config viewportWidth=1280,viewportHeight=720
123
123
124
124
## Background Process
125
125
126
-
As of {% url `1.2.0`changelog#1-2-0 %} you can programmatically modify configuration values using Node.js code via the {% url "background process" background-process %}. This enables you to do things like use `fs`and read off configuration values and dynamically change them.
126
+
As of {% url `1.2.0`changelog#1-2-0 %} you can programmatically modify configuration values using Node.js code via the {% url "background process" background-process %}. This enables you to do things like use `fs`or read and dynamically change configuration values.
127
127
128
-
While this may take a bit more work than other options - it yields you the most amount of flexibility and the ability to manage configuration however you'd like.
128
+
While this may take a bit more work than other options - it yields you the most amount of flexibility to manage configuration however you'd like.
129
129
130
130
{% url "We've fully documented how to do this here." configuration-event %}
Copy file name to clipboardExpand all lines: source/guides/references/error-messages.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -526,4 +526,4 @@ This error likely appeared because:
526
526
527
527
WIP. We'll be adding more here soon.
528
528
529
-
For now, please view the {% url 'details on the `uncaught-exception` event' uncaught-exception-event %} for examples how to turn off catching uncaught exceptions.
529
+
For now, please view the {% url 'details on the `uncaught-exception` event' uncaught-exception-event %} for examples on how to turn off catching uncaught exceptions.
Copy file name to clipboardExpand all lines: source/guides/references/migration-guide.md
+12-10Lines changed: 12 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,15 +6,15 @@ title: Migration Guide
6
6
7
7
## pluginsFile renamed to backgroundFile
8
8
9
-
The `pluginsFile` configuration property has been renamed to `backgroundFile`.
9
+
The `pluginsFile` configuration property has been renamed to {% url "`backgroundFile`" configuration#Folders-Files %}. In your `cypress.json` file...
10
10
11
11
```json
12
12
{
13
13
"pluginsFile": "path/to/file.js"
14
14
}
15
15
```
16
16
17
-
should become:
17
+
...should be changed to:
18
18
19
19
```json
20
20
{
@@ -24,7 +24,7 @@ should become:
24
24
25
25
## Default background file path changed
26
26
27
-
The default path of the {% url 'background file' background-process %} (previously known as the plugins file) has been changed from `cypress/plugins/index.js` to `cypress/background/index.js`. If you don't explicitly set the `backgroundFile` to a custom path, you'll need to move your background file to the new default path.
27
+
The default path of the {% url 'background file' background-process %} (previously known as the plugins file) has been changed from `cypress/plugins/index.js` to `cypress/background/index.js`. If you don't explicitly set the `backgroundFile` to a custom path, you'll need to move your background file to the new default path. In your `cypress` folder...
28
28
29
29
```text
30
30
/cypress
@@ -35,7 +35,7 @@ The default path of the {% url 'background file' background-process %} (previous
35
35
- index.js
36
36
```
37
37
38
-
should become:
38
+
...should be changed to:
39
39
40
40
```text
41
41
/cypress
@@ -48,12 +48,14 @@ should become:
48
48
49
49
## Events renamed
50
50
51
-
Various events have been renamed to a more consistent format. If you listen for any of the following events in your test code, you'll need to rename them.
51
+
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.
52
52
53
-
-`test:before:run` renamed to `before:test:run`
54
-
-`test:after:run` renamed to `after:test:run`
55
-
-`window:before:load` renamed to `before:window:load`
56
-
-`window:before:unload` renamed to `before:window:unload`
53
+
- Rename `test:before:run` to `before:test:run`
54
+
- Rename `test:after:run` to `after:test:run`
55
+
- Rename `window:before:load` to `before:window:load`
56
+
- Rename `window:before:unload` to `before:window:unload`
Copy file name to clipboardExpand all lines: source/guides/references/trade-offs.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,7 @@ In case you missed it before - Cypress tests run inside of the browser! This mea
53
53
54
54
But what this also means is that your test code **is being evaluated inside the browser**. Test code is not evaluated in Node.js, or any other server side language. The **only** language we will ever support is the language of the web: JavaScript.
55
55
56
-
This trade-off means it makes it a little bit harder to communicate with the backend - like your server or database. You will not be able to connect or import those server-side libraries or modules directly. Although you can of course require `node_modules` which can be used in the browser. Additionally, you have the ability to use Node.js to import or talk directly to your backend scripts using {% url "`cy.task()`" task %} in {% url "the background process" background-process %}.
56
+
This trade-off means it makes it a little bit harder to communicate with the backend - like your server or database. You will not be able to connect or import those server-side libraries or modules directly. Although you can require `node_modules` which can be used in the browser. Additionally, you have the ability to use Node.js to import or talk directly to your backend scripts using {% url "`cy.task()`" task %} in the {% url "background process" background-process %}.
57
57
58
58
To talk to your database or server you need to use the {% url `cy.exec()` exec %}, {% url `cy.task()` task %}, or {% url `cy.request()` request %} commands. That means you will need to expose a way to seed and setup your database. This really is not that hard, but it might take a bit more elbow grease than other testing tools written in your backend language.
0 commit comments