cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.73k stars 3.16k forks source link

cy.type is not typing the text quickly. #20570

Closed kanchanj2000 closed 2 years ago

kanchanj2000 commented 2 years ago

Current behavior

cy.get('#searchTextBox').click().type('92014').should('have.value','92014');

image image

Desired behavior

Cypress should quickly type the text provided

Test code to reproduce

cy.get('#searchTextBox').click().type('92014').should('have.value','92014');

Cypress Version

9.5.1

Other

No response

IvoLeist commented 2 years ago

Had the same issue you have to decrease the delay (default=10): https://docs.cypress.io/api/commands/type#Arguments

cy.url().type('www.cypress.io', { delay: 0 })

emilyrohrbough commented 2 years ago

@kanchanj2000 Have you tried updated the delay value like @IvoLeist suggested?

IvoLeist commented 2 years ago

@emilyrohrbough @kanchanj2000

actually I now have the same issue and it seems to be related with search boxes (connected directly to an API) in normal text fields Cypress is basically copy pasting when using {delay: 0} however when wanting to type in the item_id "1234" in a filterable selection box below is happening

data_query :>> {item_id: ''} data_query :>> {Item_id: '1'} data_query :>> {item_id: '12'} data_query :>> {item_id: '123'} data_query :>> {item_id: '1234'}

each line is a console.log of the fetch function to our API

expected would be to have only one query to our API

data_query :>> {item_id: '1234'}

kanchanj2000 commented 2 years ago

@emilyrohrbough @IvoLeist Tried with {delay: 0} and it worked for me.

emilyrohrbough commented 2 years ago

@kanchanj2000 Glad to hear this is working as expected!

@IvoLeist For what you described, I would be curious how your callback function is binge used with this search box input. Is this unexpected behavior triggering the change event callback or on the input event callback? If this issue persists, can you open a new issue and include a minimal reproducible example?

IvoLeist commented 2 years ago

@emilyrohrbough maybe the library I am using is causing the issue: https://github.com/vtaits/react-select-async-paginate

Ok I will open a new issue