diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index bdd1b773ed6..e2fda914da9 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -1,8 +1,12 @@ -## 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). diff --git a/cli/types/cypress-automation.d.ts b/cli/types/cypress-automation.d.ts index e636551de50..7fbbb4c730a 100644 --- a/cli/types/cypress-automation.d.ts +++ b/cli/types/cypress-automation.d.ts @@ -12,7 +12,8 @@ declare namespace Cypress { 'Tab' | 'Backspace' | 'Delete' | - 'Insert' + 'Insert' | + 'Escape' type SupportedKey = SupportedNamedKey | string | number } diff --git a/cli/types/cypress.d.ts b/cli/types/cypress.d.ts index 11133b937fd..68c09274f1e 100644 --- a/cli/types/cypress.d.ts +++ b/cli/types/cypress.d.ts @@ -698,6 +698,7 @@ declare namespace Cypress { SPACE: 'Space', DELETE: 'Delete', INSERT: 'Insert', + ESC: 'Escape', }, } diff --git a/packages/driver/cypress/e2e/commands/actions/press.cy.ts b/packages/driver/cypress/e2e/commands/actions/press.cy.ts index e9131b33e00..283f97e02fa 100644 --- a/packages/driver/cypress/e2e/commands/actions/press.cy.ts +++ b/packages/driver/cypress/e2e/commands/actions/press.cy.ts @@ -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) diff --git a/packages/driver/src/cy/keyboard.ts b/packages/driver/src/cy/keyboard.ts index 29532e048e8..43c571f6dd6 100644 --- a/packages/driver/src/cy/keyboard.ts +++ b/packages/driver/src/cy/keyboard.ts @@ -1412,6 +1412,7 @@ const Keys: Record = { SPACE: 'Space', DELETE: 'Delete', INSERT: 'Insert', + ESC: 'Escape', } export default { diff --git a/packages/server/eslint.config.ts b/packages/server/eslint.config.ts index ab51e833e09..5e83386dc5e 100644 --- a/packages/server/eslint.config.ts +++ b/packages/server/eslint.config.ts @@ -5,6 +5,9 @@ export default [ ...baseConfig, { languageOptions: { + parserOptions: { + tsconfigRootDir: __dirname, + }, globals: { ...globals.node, globalThis: 'readonly', diff --git a/packages/server/lib/automation/commands/key_press.ts b/packages/server/lib/automation/commands/key_press.ts index 6b749acc5e0..9e784c2939e 100644 --- a/packages/server/lib/automation/commands/key_press.ts +++ b/packages/server/lib/automation/commands/key_press.ts @@ -121,6 +121,7 @@ export const BidiOverrideCodepoints: Record = { '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 diff --git a/packages/types/src/automation.ts b/packages/types/src/automation.ts index 2def55be531..137a06da21c 100644 --- a/packages/types/src/automation.ts +++ b/packages/types/src/automation.ts @@ -27,6 +27,7 @@ export const NamedKeys: SupportedNamedKey[] = [ SpaceKey, 'Delete', 'Insert', + 'Escape', ] // utility type to enable the SupportedKey union type