'Cypress: copy paste shortcuts not working

I am testing a simple <input type="text" /> element with Cypress.

When I run the following test:

it("should copy and paste", () => {
  cy.get("input")
    .type("hello {ctrl+a}{ctrl+c}{movetoend}{ctrl+v}{ctrl+v}")
    .should("have.value", "hello hello hello ");
});

I get the following assertion error:

expected '<input>' to have value 'hello hello hello ', but the value was 'hello '



Solution 1:[1]

It seems to me that {ctrl+c} is not copying the desired value to the clipboard.

For that you should look at this link: Handling Copy and Paste in Cypress

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jaime Roman