cypress: Cypress Doesn't Finish Typing Strings Before Continuing to Next Field

Current behavior:

When typing a long string into an input field, such as an email address to login in our case, Cypress 3.5.0 appears to no longer type the entire string. It bails on typing the complete string after the period in the email and never completely types the string. For example, test@webdomainhere.com would be typed as test@webdomainhere. in our app, failing the login.

I have also seen similar things with usernames using mixed case, such as associateEnabled would be typed as associate, stopping before the capital letter in the string.

Due to this bug we have had to roll back to using Cypress 3.4.1, where this worked fine.

Example screenshot showing a failed login in Cypress 3.5.0 where the email should’ve had ‘com’ typed after the period:

Screen Shot 2019-10-25 at 3 00 45 PM

Desired behavior:

Entire string passed to a cy.type() function should be typed into the input field.

Steps to reproduce: (app code and test code)

Type a long string, such as a long email address into a form field and then move on to a password field with a .click() and see that the end of the first string isn’t entered.

Versions

Cypress v3.5.0 (v3.4.1 works fine, we have had to roll back) Mac OSX 10.14.6 Electron 61 / Chrome 78

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 28
  • Comments: 109 (27 by maintainers)

Commits related to this issue

Most upvoted comments

Unfortunately we have to close this issue as there is not enough information to reproduce the problem. This does not mean that your issue is not happening - it just means that we do not have a path to move forward.

Please comment in this issue with a reproducible example and we will reopen the issue. 🙏

@jennifer-shehane , I am unsure what you’re looking for. Simply use cy.type() on an input field with a string with mixed case and it will reproduce the problem. This happens on various login screens around our app which I cannot share as they are proprietary. Please let me know what you’re expecting for this bug to be investigated

I had a similar issue with this where

cy.contains('label', 'exampleLabel').find('input').focus().type('some text here');

only resulted in typing out the first character s.

I was able to get around this issue by adding { force: true } option to type().

My current cypress version is 3.8.2.

Please provide a way to reproduce

Hey everyone, we know this issue is happening and we really, really do want to fix this. But as of yet no one has provided a completely reproducible example that we can currently run that fails in 3.4.1 and passes in 3.5.0.

Please provide a reproducible example - the entire HTML & test code that we can fully run on our system.

We do not currently have an example to reproduce this bug, so no work has been done on this issue and cannot be fixed until that is provided.

Dear great community, i have had the same error, the problem is that Cypress is typing to fast in it. The default input typing speed is 10ms. I solved my problems since i added an option while typing in an input field. You have just to increase the delay of typing! Like ->

cy.get('.loginInput').type('TestUser', {delay:70} );

delays between 70 and 100 was the perfect range i tried it with 50 ms, but it failed onced. since i updated it to 70 ms, the test now have been run over 600 times! without error.

Sorry for my bad english, i’m not a native english speaker.

Best wishes from germany

From the above stories, and from my own experience trying, it is clearly quite difficult to create such a reproducible example.

I do understand how this benefits you when you are trying to debug an issue.

Nonetheless, is there now not sufficient evidence to suggest that there is an underlying issue that is giving many people problems which therefore warrants further investigation from Cypress?

Sent via Superhuman iOS ( https://sprh.mn/?vip=williamgdjones@gmail.com )

On Wed, Sep 9 2020 at 8:24 pm, Gleb Bahmutov < notifications@github.com > wrote:

Please provide a small reproduction we can run to see it

Sent from my iPhone

On Sep 9, 2020, at 14:59, Stuart Holme notifications@github.com wrote:

Also having terrible issues w/ Cypress sometimes typing the entire string into some fields, but sometimes not typing the entire string, totally wreaking havoc. It is a Vue app.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub ( https://github.com/cypress-io/cypress/issues/5480#issuecomment-689767214 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/AAND4KABHXGUO2BMC4O5MSLSE7I5JANCNFSM4JFJRB7Q ).

I am experiencing this on 4.6.0. Can’t provide example but in my case this won’t happen at the very first time cypress types, for instance, my test first authenticates typing successfully but after navigating through the application and typing again it truncates the strings. What is solving the issue for me every time is to use clear method just as

cy.get('input[name="input.lastName"]').clear().type(lastName).should('have.value', lastName);

Please provide a way to reproduce

Hey everyone, we know this issue is happening and we really, really do want to fix this regression. But as of yet no one has provided a completely reproducible example that we can currently run that fails in 3.4.1 and passes in 3.5.0.

Please provide a reproducible example - the entire HTML & test code that we can fully run on our system.

We do not currently have an example to reproduce this bug, so this is no work has been done on this issue and cannot be fixed until that is provided.

@TheWanderingWalnut as a workaround, you may want to just set the values with cy.get(...).invoke('val', 'email@example.com'). If you can get us a reproducible I’ll be happy to look more into this. Thanks!

@bahmutov Think I’ve finally got a solid repro for this!

Check out https://github.com/dacort/cypress_type_repro

It’ll require you to run the Metabase Docker image, but the test takes care of setting it up and shows both a failing and successful type test case. There is a drop list that pops up that could be causing the issue?

Let me know how else I can help! /cc @nemanjaglumac as he helped put together the repro.

I am experiencing this on 4.6.0. Can’t provide example but in my case this won’t happen at the very first time cypress types, for instance, my test first authenticates typing successfully but after navigating through the application and typing again it truncates the strings. What is solving the issue for me every time is to use clear method just as

cy.get('input[name="input.lastName"]').clear().type(lastName).should('have.value', lastName);

This helped me as well!

4.8.0 - bug is still there.

Hola comunidad, a mi me está ocurriendo el mismo problema que no terminar escribir una cadena de texto en la versión 4.5. Me está ocurriendo en este mismo momento. Al parecer no hay una solución, pero al menos aquí dejaré el caso. Un saludo.

Captura de Pantalla 2020-05-07 a la(s) 7 19 20 p  m

I too am seeing this issue after upgrading from v3.4.1 -> v3.8.2. Using it as such:

cy.get(this.numberField).type(searchCriteria).type('{enter}');

The searchCriteria we pass in could be 123456 and typically it will type {enter} after 12345, but missing the 6.

We are testing an Angular 8 project with Cypress.

I can confirm this reproduces the issue. It seems to take a few tries but for me, after 3-5 successful attempts it only types the first 2 or 3 letters. It seems to fail a lot more after that happens. Hitting Stop from the TR and rerunning it almost always succeeds the first couple of runs.

I was able to comment out everything reducing to just:

cy.get('#cf_id').type('partnerActive')

And still reproduce it. @jennifer-shehane can we reopen this?

Using cypress 4.1.0 and had to instrument this workaround:

const type = (input, value) => {
  [...value].forEach((c) => {
    input().click();
    input().type(c, { delay: 0 });
  });
};

input must be a function that returns a cypress getter, i.e.

const input() => cy.get('input[name="email"])

We have a react app that uses controlled inputs. We respond to the onInput event and that is why the component is rerendered on each character that is typed. This work around types VERY slowly, so use it sparingly.

After one day trying this, I’ve just found the error. Our app is written in React and eveytime we change the location it fires a setTimout to fire a redux action to clean alerts after x seconds. This leads to weirds re-renders in the middle of the tests that, even if they don’t update the component at all, it prevents Cypress to keep typing. Also, we had other issues with elements being apparently unmounted. But again, this was all related to firing this redux action with the timer to clear notifications.

Thanks!

We just encountered this in 4.0.2 . Our’s was a very simple

cy.get('[data-schema-key="amount"]')
  .clear()
  .type("5000");

It would only type 5 in 4.0.0 and in 4.0.2 sometimes gets 50 or 500. We have many other uses of type around our tests but only this one was failing.

I repeated the same command after it and second time it types the full 5000.

We added the {force: true} and it’s fine now.

It happens running just this test in isolation, not sure how I could try reproduce it but if there’s anything we can do to try help find the cause let me know.