mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-04 22:30:00 -06:00
feat: escape key for cy.press (#32545)
* feat: escape key for cy.press * changelog * on-link to cy.press() in changelog
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
<!-- See the ../guides/writing-the-cypress-changelog.md for details on writing the changelog. -->
|
||||
## 15.2.1
|
||||
## 15.3.0
|
||||
|
||||
_Released 9/23/2025 (PENDING)_
|
||||
|
||||
**Features:**
|
||||
|
||||
- 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).
|
||||
|
||||
**Bugfixes:**
|
||||
|
||||
- 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).
|
||||
|
||||
3
cli/types/cypress-automation.d.ts
vendored
3
cli/types/cypress-automation.d.ts
vendored
@@ -12,7 +12,8 @@ declare namespace Cypress {
|
||||
'Tab' |
|
||||
'Backspace' |
|
||||
'Delete' |
|
||||
'Insert'
|
||||
'Insert' |
|
||||
'Escape'
|
||||
|
||||
type SupportedKey = SupportedNamedKey | string | number
|
||||
}
|
||||
|
||||
1
cli/types/cypress.d.ts
vendored
1
cli/types/cypress.d.ts
vendored
@@ -698,6 +698,7 @@ declare namespace Cypress {
|
||||
SPACE: 'Space',
|
||||
DELETE: 'Delete',
|
||||
INSERT: 'Insert',
|
||||
ESC: 'Escape',
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ describe('src/cy/commands/actions/press', () => {
|
||||
cy.visit('/fixtures/input_events.html')
|
||||
})
|
||||
|
||||
it('fires the click event on the button when the named key is sent', () => {
|
||||
it('fires the click event on the button when the named key for Space is sent', () => {
|
||||
cy.get('#button').focus()
|
||||
cy.get('#button').should('be.focused')
|
||||
cy.press(Cypress.Keyboard.Keys.SPACE)
|
||||
|
||||
@@ -1412,6 +1412,7 @@ const Keys: Record<string, Cypress.SupportedNamedKey> = {
|
||||
SPACE: 'Space',
|
||||
DELETE: 'Delete',
|
||||
INSERT: 'Insert',
|
||||
ESC: 'Escape',
|
||||
}
|
||||
|
||||
export default {
|
||||
|
||||
@@ -5,6 +5,9 @@ export default [
|
||||
...baseConfig,
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
tsconfigRootDir: __dirname,
|
||||
},
|
||||
globals: {
|
||||
...globals.node,
|
||||
globalThis: 'readonly',
|
||||
|
||||
@@ -121,6 +121,7 @@ export const BidiOverrideCodepoints: Record<SupportedNamedKey, string> = {
|
||||
'Delete': '\uE017',
|
||||
'Insert': '\uE016',
|
||||
'Space': '\uE00D',
|
||||
'Escape': '\uE00C',
|
||||
}
|
||||
|
||||
// any is fine to be used here because the key must be typeguarded before it can be used as a supported key
|
||||
|
||||
@@ -27,6 +27,7 @@ export const NamedKeys: SupportedNamedKey[] = [
|
||||
SpaceKey,
|
||||
'Delete',
|
||||
'Insert',
|
||||
'Escape',
|
||||
]
|
||||
|
||||
// utility type to enable the SupportedKey union type
|
||||
|
||||
Reference in New Issue
Block a user