Skip to content

Commit 8755160

Browse files
authored
feat: escape key for cy.press (#32545)
* feat: escape key for cy.press * changelog * on-link to cy.press() in changelog
1 parent 17c1ede commit 8755160

File tree

8 files changed

+15
-3
lines changed

8 files changed

+15
-3
lines changed

cli/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
<!-- See the ../guides/writing-the-cypress-changelog.md for details on writing the changelog. -->
2-
## 15.2.1
2+
## 15.3.0
33

44
_Released 9/23/2025 (PENDING)_
55

6+
**Features:**
7+
8+
- Added Escape key support to [`cy.press()`](http://on.cypress.io/api/press). Addresses[#32429](https://github.com/cypress-io/cypress/issues/32429). Addressed in [#32545](https://github.com/cypress-io/cypress/pull/32545).
9+
610
**Bugfixes:**
711

812
- In development mode, Electron `stderr` is piped directly to Cypress' `stderr` to make it clear why Electron failed to start, if it fails to start. Fixes [#32358](https://github.com/cypress-io/cypress/issues/32358). Addressed in [32468](https://github.com/cypress-io/cypress/pull/32468).

cli/types/cypress-automation.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ declare namespace Cypress {
1212
'Tab' |
1313
'Backspace' |
1414
'Delete' |
15-
'Insert'
15+
'Insert' |
16+
'Escape'
1617

1718
type SupportedKey = SupportedNamedKey | string | number
1819
}

cli/types/cypress.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,7 @@ declare namespace Cypress {
698698
SPACE: 'Space',
699699
DELETE: 'Delete',
700700
INSERT: 'Insert',
701+
ESC: 'Escape',
701702
},
702703
}
703704

packages/driver/cypress/e2e/commands/actions/press.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('src/cy/commands/actions/press', () => {
88
cy.visit('/fixtures/input_events.html')
99
})
1010

11-
it('fires the click event on the button when the named key is sent', () => {
11+
it('fires the click event on the button when the named key for Space is sent', () => {
1212
cy.get('#button').focus()
1313
cy.get('#button').should('be.focused')
1414
cy.press(Cypress.Keyboard.Keys.SPACE)

packages/driver/src/cy/keyboard.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,6 +1412,7 @@ const Keys: Record<string, Cypress.SupportedNamedKey> = {
14121412
SPACE: 'Space',
14131413
DELETE: 'Delete',
14141414
INSERT: 'Insert',
1415+
ESC: 'Escape',
14151416
}
14161417

14171418
export default {

packages/server/eslint.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ export default [
55
...baseConfig,
66
{
77
languageOptions: {
8+
parserOptions: {
9+
tsconfigRootDir: __dirname,
10+
},
811
globals: {
912
...globals.node,
1013
globalThis: 'readonly',

packages/server/lib/automation/commands/key_press.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ export const BidiOverrideCodepoints: Record<SupportedNamedKey, string> = {
121121
'Delete': '\uE017',
122122
'Insert': '\uE016',
123123
'Space': '\uE00D',
124+
'Escape': '\uE00C',
124125
}
125126

126127
// any is fine to be used here because the key must be typeguarded before it can be used as a supported key

packages/types/src/automation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export const NamedKeys: SupportedNamedKey[] = [
2727
SpaceKey,
2828
'Delete',
2929
'Insert',
30+
'Escape',
3031
]
3132

3233
// utility type to enable the SupportedKey union type

0 commit comments

Comments
 (0)