Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
efabb5a
feat: extend Cypress.Keyboard.Keys and cy.press to support all keyboa…
jennifer-shehane Apr 11, 2025
88b8f76
Update cli/types/cypress.d.ts
jennifer-shehane Apr 11, 2025
c4af6b6
reference urls for codepoints
cacieprins Apr 25, 2025
70ecad0
type defs for expanded keys; tests
cacieprins Aug 6, 2025
4a84ff3
Merge branch 'develop' into feat-all-keys
cacieprins Aug 6, 2025
2485043
changelog
cacieprins Aug 6, 2025
935d766
rm modifier keys temporarily - see WIP @ feat/key-press-modifier-keys
cacieprins Aug 6, 2025
6df79a8
Add pr link to changelog
cacieprins Aug 6, 2025
bb031ba
reduce repetition with key codes; remove unsupported capslock keycode
cacieprins Aug 6, 2025
e9abde8
only "key" special function keys in Cypress.Keyboard.Keys - otherwise…
cacieprins Aug 6, 2025
bde74b4
do not refocus on f6 - f6 behavior keyup is indeterminate, so do not …
cacieprins Aug 7, 2025
eddde62
Merge branch 'develop' into feat-all-keys
cacieprins Aug 20, 2025
6109992
clean up keyboard key types, clean up duplicate def from merge
cacieprins Aug 20, 2025
385ecc9
various cleanup - wip - need multi-codepoint fix
cacieprins Aug 20, 2025
54f4f26
support multi-codepoint characters
cacieprins Aug 20, 2025
16a44f2
Merge branch 'develop' into feat-all-keys
cacieprins Aug 20, 2025
bad947c
properly dispatch each part of a multipart utf-8 character
cacieprins Aug 20, 2025
9656b4c
fix import
cacieprins Aug 21, 2025
f5fb925
fix dtslint
cacieprins Aug 21, 2025
8bf80af
tscheck
cacieprins Aug 21, 2025
32cc334
fix spacing
cacieprins Aug 21, 2025
df6ef92
Merge branch 'develop' into feat-all-keys
cacieprins Aug 21, 2025
aa9a386
Apply suggestions from code review
cacieprins Aug 21, 2025
88d776c
Merge branch 'develop' into feat-all-keys
cacieprins Aug 22, 2025
0944c46
changelog
cacieprins Aug 22, 2025
485e7d6
changelog
cacieprins Aug 22, 2025
af4c50c
ensure input actions are released in bidi; add test for keypress and …
cacieprins Aug 25, 2025
166e305
fix keypress & input events in chrome
cacieprins Aug 25, 2025
707adf0
consistent debug
cacieprins Aug 25, 2025
869912a
rm debug logging from input fixture
cacieprins Aug 25, 2025
f63b212
Merge branch 'develop' into feat-all-keys
cacieprins Aug 25, 2025
cb9d042
some typos, changelog version
cacieprins Aug 26, 2025
d43600b
fix toSupportedKey guard fn to properly reject non-strings
cacieprins Aug 26, 2025
d9085ff
add Space as named key, remove warnings re legacy firefox
cacieprins Aug 26, 2025
47ed81f
fix space
cacieprins Aug 26, 2025
311dc66
support single-digit number keys
cacieprins Aug 26, 2025
03a840e
remove support for F-keys
cacieprins Aug 27, 2025
3878191
add test cmd to types pkg
cacieprins Aug 27, 2025
58d7804
rm failing vitest project config
cacieprins Aug 27, 2025
e413eda
fix changelog
cacieprins Aug 27, 2025
764a438
clean up types a bit for single digit numbers
cacieprins Aug 27, 2025
fd8fd80
more updates
cacieprins Aug 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 145 additions & 2 deletions cli/types/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,150 @@ declare namespace Cypress {
Keyboard: {
defaults(options: Partial<KeyboardDefaultsOptions>): void
Keys: {
TAB: 'Tab',
// Numbers
'0': '0',
'1': '1',
'2': '2',
'3': '3',
'4': '4',
'5': '5',
'6': '6',
'7': '7',
'8': '8',
'9': '9',
// Letters
'a': 'a',
'b': 'b',
'c': 'c',
'd': 'd',
'e': 'e',
'f': 'f',
'g': 'g',
'h': 'h',
'i': 'i',
'j': 'j',
'k': 'k',
'l': 'l',
'm': 'm',
'n': 'n',
'o': 'o',
'p': 'p',
'q': 'q',
'r': 'r',
's': 's',
't': 't',
'u': 'u',
'v': 'v',
'w': 'w',
'x': 'x',
'y': 'y',
'z': 'z',
'A': 'A',
'B': 'B',
'C': 'C',
'D': 'D',
'E': 'E',
'F': 'F',
'G': 'G',
'H': 'H',
'I': 'I',
'J': 'J',
'K': 'K',
'L': 'L',
'M': 'M',
'N': 'N',
'O': 'O',
'P': 'P',
'Q': 'Q',
'R': 'R',
'S': 'S',
'T': 'T',
'U': 'U',
'V': 'V',
'W': 'W',
'X': 'X',
'Y': 'Y',
'Z': 'Z',
// Special characters
'!': '!',
'@': '@',
'#': '#',
'$': '$',
'%': '%',
'^': '^',
'&': '&',
'*': '*',
'(': '(',
')': ')',
'-': '-',
'_': '_',
'=': '=',
'+': '+',
'[': '[',
']': ']',
'{': '{',
'}': '}',
'\\': '\\',
'|': '|',
';': ';',
':': ':',
"'": "'",
'"': '"',
',': ',',
'.': '.',
'<': '<',
'>': '>',
'/': '/',
'?': '?',
'`': '`',
'~': '~',
' ': ' ',
// Control keys
'Enter': 'Enter',
'Tab': 'Tab',
'Backspace': 'Backspace',
'Delete': 'Delete',
'Insert': 'Insert',
'Home': 'Home',
'End': 'End',
'PageUp': 'PageUp',
'PageDown': 'PageDown',
'Escape': 'Escape',
'CapsLock': 'CapsLock',
'Shift': 'Shift',
'Control': 'Control',
'Alt': 'Alt',
'Meta': 'Meta',
// Arrow keys
'ArrowUp': 'ArrowUp',
'ArrowDown': 'ArrowDown',
'ArrowLeft': 'ArrowLeft',
'ArrowRight': 'ArrowRight',
// Function keys
'F1': 'F1',
'F2': 'F2',
'F3': 'F3',
'F4': 'F4',
'F5': 'F5',
'F6': 'F6',
'F7': 'F7',
'F8': 'F8',
'F9': 'F9',
'F10': 'F10',
'F11': 'F11',
'F12': 'F12',
// Media keys
'AudioVolumeMute': 'AudioVolumeMute',
'AudioVolumeDown': 'AudioVolumeDown',
'AudioVolumeUp': 'AudioVolumeUp',
'MediaTrackNext': 'MediaTrackNext',
'MediaTrackPrevious': 'MediaTrackPrevious',
'MediaStop': 'MediaStop',
'MediaPlayPause': 'MediaPlayPause',
// Other keys
'NumLock': 'NumLock',
'ScrollLock': 'ScrollLock',
'Pause': 'Pause',
},
}

Expand Down Expand Up @@ -4242,7 +4385,7 @@ declare namespace Cypress {
*/
(chainer: 'be.NaN'): Chainable<Subject>
/**
* Asserts that the target is a number or a date greater than or equal to the given number or date `start`, and less than or equal to the given number or date `finish` respectively.
* Asserts that the target is a number or a date greater than or equal to the given number `start`, and less than or equal to the given number or date `finish` respectively.
* However, it's often best to assert that the target is equal to its expected value.
* @example
* cy.wrap(6).should('be.within', 5, 10)
Expand Down
63 changes: 50 additions & 13 deletions packages/driver/cypress/e2e/commands/actions/press.cy.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,58 @@
import type { KeyPressSupportedKeys } from '@packages/types'

describe('src/cy/commands/actions/press', () => {
it('dispatches the tab keypress to the AUT', () => {
// Non-BiDi firefox is not supported
if (Cypress.browser.family === 'firefox' && Cypress.browserMajorVersion() < 135) {
return
}
// Non-BiDi firefox is not supported
if (Cypress.browser.family === 'firefox' && Cypress.browserMajorVersion() < 135) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think now that we are on 15 Cypress fails before this because we support bidi only? Likely don't need this check

return
}

// TODO: Webkit is not supported. https://github.com/cypress-io/cypress/issues/31054
if (Cypress.isBrowser('webkit')) {
return
}
// TODO: Webkit is not supported. https://github.com/cypress-io/cypress/issues/31054
if (Cypress.isBrowser('webkit')) {
return
}

beforeEach(() => {
cy.visit('/fixtures/input_events.html')
})

cy.press(Cypress.Keyboard.Keys.TAB)
const testKeyPress = (key: KeyPressSupportedKeys) => {
it(`dispatches ${key} keypress to the AUT`, () => {
cy.press(key)
cy.get('#keydown').should('have.value', key)
cy.get('#keyup').should('have.value', key)
})
}

cy.get('#keydown').should('have.value', 'Tab')
// Numbers
;['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'].forEach(testKeyPress)

cy.get('#keyup').should('have.value', 'Tab')
})
// Letters
;['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'].forEach(testKeyPress)

// Special characters
;['!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '-', '_', '=',
'+', '[', ']', '{', '}', '\\', '|', ';', ':', '\'', '"', ',', '.',
'<', '>', '/', '?', '`', '~', ' '].forEach(testKeyPress)

// Control keys
;['Enter', 'Tab', 'Backspace', 'Delete', 'Insert', 'Home', 'End',
'PageUp', 'PageDown', 'Escape', 'CapsLock', 'Shift', 'Control',
'Alt', 'Meta'].forEach(testKeyPress)

// Arrow keys
;['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].forEach(testKeyPress)

// Function keys
;['F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9', 'F10', 'F11', 'F12'].forEach(testKeyPress)

// Media keys
;['AudioVolumeMute', 'AudioVolumeDown', 'AudioVolumeUp',
'MediaTrackNext', 'MediaTrackPrevious', 'MediaStop',
'MediaPlayPause'].forEach(testKeyPress)

// Other keys
;['NumLock', 'ScrollLock', 'Pause'].forEach(testKeyPress)
})
Loading
Loading