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
* docs: updates cy.press() documentation to include expanded named keys, as well as utf-8 characters (#6256)
* docs: updates cy.press() documentation to include expanded named keys, as well as utf-8 characters
* lint
* updates to structure
* lint
---------
Co-authored-by: Jennifer Shehane <[email protected]>
* docs: remove F-keys from cy.press() documentation (#6261)
* docs: remove f keys from cy.press doc
* prettier
* chore: add the 15.1.0 changelog (#6265)
---------
Co-authored-by: Cacie Prins <[email protected]>
Co-authored-by: Jennifer Shehane <[email protected]>
Copy file name to clipboardExpand all lines: docs/api/commands/press.mdx
+66-21Lines changed: 66 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,18 +14,7 @@ Trigger native key events in your application to simulate keyboard interactions.
14
14
15
15
A `keydown`, `press`, and `keyup` event will be dispatched directly to the browser window.
16
16
17
-
Unlike `cy.type()`, which is best for typing character keys, `cy.press()` will dispatch real keyboard events rather than simulated ones. This command is especially useful when testing focus management and keyboard navigation patterns which are critical for [accessibility testing](/app/guides/accessibility-testing) and great keyboard UX.
18
-
19
-
Currently, the only key supported is `Tab`.
20
-
21
-
:::caution
22
-
23
-
<strong>Supported Browsers:</strong>
24
-
This command is supported in chromium browsers and Firefox versions >= v135. WebKit
25
-
is not supported. This command will fail if executed in a browser that does not support
26
-
it.
27
-
28
-
:::
17
+
Unlike `cy.type()`, which is best for typing multiple character keys, `cy.press()` will dispatch real keyboard events rather than simulated ones. This command is especially useful when testing focus management and keyboard navigation patterns which are critical for [accessibility testing](/app/guides/accessibility-testing) and great keyboard UX.
The key to press. The supported values are available on [`Cypress.Keyboard.Keys`](/api/cypress-api/keyboard-api), and may change from time to time. It's recomended that you reference these values from `Cypress.Keyboard.Keys` rather than passing in a string.
72
-
73
-
### Supported Keys
60
+
The key to press. Values for non single character keys are available on [`Cypress.Keyboard.Keys`](/api/cypress-api/keyboard-api), and may change from time to time. It's recommended that you reference these values from `Cypress.Keyboard.Keys` rather than passing in a string when available.
| Special Characters |`"!"`, `"@"`, `"#"`, `'+'`, `"€"`, `"é"`, etc. |
69
+
|`Cypress.Keyboard.Keys.DOWN`|`"ArrowDown"`|
70
+
|`Cypress.Keyboard.Keys.LEFT`|`"ArrowLeft"`|
71
+
|`Cypress.Keyboard.Keys.RIGHT`|`"ArrowRight"`|
72
+
|`Cypress.Keyboard.Keys.UP`|`"ArrowUp"`|
73
+
|`Cypress.Keyboard.Keys.END`|`"End"`|
74
+
|`Cypress.Keyboard.Keys.HOME`|`"Home"`|
75
+
|`Cypress.Keyboard.Keys.PAGEDOWN`|`"PageDown"`|
76
+
|`Cypress.Keyboard.Keys.PAGEUP`|`"PageUp"`|
77
+
|`Cypress.Keyboard.Keys.ENTER`|`"Enter"`|
78
+
|`Cypress.Keyboard.Keys.TAB`|`"Tab"`|
79
+
|`Cypress.Keyboard.Keys.BACKSPACE`|`"Backspace"`|
80
+
|`Cypress.Keyboard.Keys.DELETE`|`"Delete"`|
81
+
|`Cypress.Keyboard.Keys.INSERT`|`"Insert"`|
82
+
|`Cypress.Keyboard.Keys.SPACE`|`"Space"`|
83
+
84
+
:::info
85
+
86
+
F1-F12 keys are not supported. These keys are used for browser shortcuts, and can prevent the test suite from executing properly after they are pressed.
Single character keys are supported, like `a`, `b`, `c`, etc. There is no need to reference `Cypress.Keyboard.Keys` record for these keys, just type them normally as a string:
129
+
130
+
```javascript
131
+
cy.get('input').focus()
132
+
cy.press('a')
133
+
```
134
+
135
+
### Type a multi-codepoint UTF-8 character
136
+
137
+
Multi-codepoint UTF-8 characters are also supported and do not need to be entered as individual codepoints. For example, `é` can be either one single codepoint or two separate codepoints when the accent is pressed as a subsequent modifier key. You do not need to press each codepoint separately; just type the entire character as a string.
138
+
139
+
```javascript
140
+
// works
141
+
cy.get('input').focus()
142
+
cy.press('é') // \u00e9 (composed é)
143
+
cy.press('é') // \u0065\u0301 (e + combining acute accent)
144
+
145
+
// also fine, but not necessary
146
+
cy.get('input').focus()
147
+
cy.press('e') // \u0065
148
+
cy.press('́') // \u0301 (combining acute accent)
149
+
```
150
+
115
151
## Notes
116
152
153
+
### Strings with multiple characters
154
+
155
+
Strings with multiple characters are not supported. If you need to input longer strings into a text input or similar, use [`cy.type()`](/api/commands/type).
156
+
157
+
```js
158
+
cy.get('input').type('Hello, World') // Type 'Hello, World' into the 'input'
159
+
```
160
+
117
161
### Transient activation
118
162
119
163
By dispatching native keyboard events to the browser, this command will cause the browser to enter [Transient activation](https://developer.mozilla.org/en-US/docs/Glossary/Transient_activation) state.
@@ -122,9 +166,10 @@ If your application prevents the default behavior of the `beforeunload` event, t
Copy file name to clipboardExpand all lines: docs/app/references/changelog.mdx
+27Lines changed: 27 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,33 @@ sidebar_label: Changelog
8
8
9
9
# Changelog
10
10
11
+
## 15.1.0
12
+
13
+
_Released 09/02/2025_
14
+
15
+
**Features:**
16
+
17
+
- Expanded `cy.press()` to support more key types. Addresses [#31051](https://github.com/cypress-io/cypress/issues/31051) and [#31488](https://github.com/cypress-io/cypress/issues/31488). Addressed in [#31496](https://github.com/cypress-io/cypress/pull/31496).
18
+
19
+
**Bugfixes:**
20
+
21
+
- Fixed an issue where OS distributions and releases were sometimes not properly populated for Module API results and Cloud recordings. Fixes [#30533](https://github.com/cypress-io/cypress/issues/30533). Addressed in [#32283](https://github.com/cypress-io/cypress/pull/32283).
22
+
- Fixed an issue where Cypress would fail to run on GNOME if GTK 4 and GTK 2/3 were detected in the Electron process. Addresses [#32361](https://github.com/cypress-io/cypress/issues/32361).
23
+
- Fixed an issue where the open Studio button would incorrectly show for component tests. Addressed in [#32315](https://github.com/cypress-io/cypress/pull/32315).
24
+
- Fixed an issue where the TypeScript compiler wasn't being resolved correctly when `@cypress/webpack-batteries-included-preprocessor` was used as a standalone package. Fixes [#32338](https://github.com/cypress-io/cypress/issues/32338).
25
+
- Fixed an issue where `tsx` was not being loaded correctly into the Cypress configuration process due to spaces being present in the path. Fixes [#32398](https://github.com/cypress-io/cypress/issues/32398).
26
+
27
+
**Misc:**
28
+
29
+
- Updated the Cypress Studio panel to have a darker gray background. Addressed in [#32333](https://github.com/cypress-io/cypress/pull/32333).
30
+
31
+
**Dependency Updates:**
32
+
33
+
- Upgraded `esbuild` from `0.15.3` to `0.25.2`. Addressed in [#32231](https://github.com/cypress-io/cypress/pull/32231).
34
+
- Upgraded `image-size` from `1.1.1` to `1.2.1`. Addressed in [#32232](https://github.com/cypress-io/cypress/pull/32232).
35
+
- Upgraded `tar` from `6.1.5` to `6.2.1`. Addressed in [#32229](https://github.com/cypress-io/cypress/pull/32229).
36
+
- Upgraded `axios` from `1.8.3` to `1.11.0`. Addresses [#32347](https://github.com/cypress-io/cypress/issues/32347).
0 commit comments