← Back to library
Cypressformsintermediatev10+
Trigger keyboard shortcuts
Use Cypress key sequences like {ctrl+a} and {ctrl+v} to test editor keyboard interactions.
1it('copies text with Ctrl+A and Ctrl+C', () => {
2 cy.visit('/editor');
3
4 cy.get('[data-testid="content-editor"]')
5 .type('Hello World')
6 .type('{ctrl+a}') // select all text in the field
7 .type('{ctrl+c}'); // copy the selection to the clipboard
8
9 cy.get('[data-testid="preview-area"]')
10 .click()
11 .type('{ctrl+v}') // paste from clipboard
12 .should('have.value', 'Hello World');
13});#keyboard#ctrl#shortcut#type#hotkey