Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a built-in paste method to speed up the typing process for longer strings #28861

Open
ssoydabas opened this issue Feb 3, 2024 · 2 comments
Labels
type: enhancement Requested enhancement of existing feature

Comments

@ssoydabas
Copy link

ssoydabas commented Feb 3, 2024

What would you like?

I'd like to have a built-in method to copy and paste strings without losing React State. Right now, it is possible to paste a string into an input element using Cypress's type method, nevertheless, it doesn't update React State, therefore, when the pasting action ends, it erases itself immediately.

Why is this needed?

I would like to type an SSH key into an input element, though, it takes much time to do so. It would be so much easier if there is a built-in mechanism to paste string into an input element as well as manage React State accordingly.

Other

It works to paste an email into an email using plain HTML as follows:

it('pastes text to textarea', () => {
  const textToPaste = 'this is not a valid email'
  cy.visit('index.html')
  cy.get("[type='email']").invoke('val', textToPaste)
})

However, it loses the content when unfocused in a React App, therefore, input sends a request with an empty email field, which makes things difficult to manage.

@jennifer-shehane
Copy link
Member

@ssoydabas Would setting the delay option of cy.type to 0 satisfy this? It should instantly type in and still trigger all of the same events like keyup, etc.

@jennifer-shehane jennifer-shehane added the stage: awaiting response Potential fix was proposed; awaiting response label Feb 9, 2024
@ssoydabas
Copy link
Author

Hi @jennifer-shehane , I have actually made use of delay option, nevertheless, it is not instantanous, instead, it speeds up the process a little. Having to write a long text still takes a lot of time.

@jennifer-shehane jennifer-shehane added type: enhancement Requested enhancement of existing feature and removed stage: awaiting response Potential fix was proposed; awaiting response labels Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Requested enhancement of existing feature
Projects
None yet
Development

No branches or pull requests

2 participants