cypress: Missing letters when using type
Current behavior:
I just upgraded to Cypress 3.2.0 and noticed this strange behavior with type

For some reason the first letter gets cut out, this test used to run fine in 3.1.5.
Desired behavior:
That the typed text does not get cut short
Steps to reproduce: (app code and test code)
The test
it('Successful login', () => {
cy.visit('/')
cy.get('head title')
.should('contain', 'Log in')
cy.get('#email')
.type('Admin{enter}', {force: true, delay: 700})
cy.get('#password')
.type('superSafePassword{enter}')
cy.get('.primary').click()
cy.get('#title')
.should('contain', 'Dashboard')
});
});
The form
<div class='right'>
<p class='greeting'>Log in to your account</p>
<ListErrors {errors}/>
<form on:submit='submit(event)' autocomplete='off'>
<fieldset class='login'>
<img alt='user' src='img/user.svg' class='login-icon' />
<input type='text' placeholder='Email' id='email' autocomplete='off' bind:value=email>
</fieldset>
<fieldset class='login'>
<img alt='password' src='img/password.svg' class='login-icon' />
<input type='password' placeholder='Password' id='password' autocomplete='new-password' bind:value=password>
</fieldset>
<Button kind='primary block' type='submit' disabled='{!email || !password}'>Log in</Button>
</form>
</div>
Versions
Windows 10 Cypress 3.2.0 Chrome 73.0.3683.86 (Official Build) (64-bit)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 5
- Comments: 61 (9 by maintainers)
Commits related to this issue
- Use a 20ms delay when typing in `writeIntoStringField` Some weird race condition is happening here. For more details see: https://github.com/cypress-io/cypress/issues/3817 https://github.com/metasf... — committed to metasfresh/metasfresh by TheBestPessimist 4 years ago
- Use a 20ms delay when typing in `writeIntoStringField` Some weird race condition is happening here. For more details see: https://github.com/cypress-io/cypress/issues/3817 https://github.com/metasf... — committed to metasfresh/metasfresh by TheBestPessimist 4 years ago
I’m hitting this bug for the 4th time in 12 months of various fresh installations.
wait()) that I use is simply to duplicate the very first inputtype()command. Something like the following:Really hope this can help because persistent bugs like this for what should be simple example really trip me up when trying to evangelise about the joys & ease of testing with awesome tools like Cypress.
Hope this can help any other googlers or at least help me converge towards this workaround much quicker next time 😅
The issue is still exists
This issue needs to be reopened as it still exists
@sra1rdy If you can provide a reproducible example that we can run to see the issue, we’d be happy to reopen.
Facing same issue.
Interesting solution with 0 ms. Ill try that out
The issue still exists v.7.3.0 It’s only happening on one input, i couldn’t find the reason but adding .wait(500) solve the problem for me
cy.get('input[name="customer-search-string"]').first().wait(500).clear().type(TEST.CUSTOMER.PHONE);@akwasin If you have a reproducible example that we can run completely and see the error, you can email it so support@cypress.io
I added
cy.wait(500);in the beginning of the test and now it passes. Seems like Cy runs just a bit too fast 😃 What is the recommended action when dealing with issues like this? I dont really want to add wait to all of my test casesDon’t you think that is the issue with you application?
@shirshendu30 Please provide code - HTML, CSS, and JS and the Cypress tests that fail with it. Open a new issue.
I had an issue with password not matching. Here’s what i tried and this worked for me.
cy.get("#password").find("[type='password']").wait(500).clear().type('password',{delay: 700}) cy.get("#repeat-password").find("[type='password']").type('password')I’m also facing this issue(( @jennifer-shehane
Or the hell with cypress
.type()and use.text()which never failed me. If in need to type {enter} {esc} etc then.text('sometext').type('{enter}')@KittyGarrison luckily there’s a good amount of suggestions on how to fix this. Here’s a suggestion from Ben @bschley https://github.com/cypress-io/cypress/issues/3817#issuecomment-864113597
Depends on how long it takes to type your warm up text I guess. My worry with
waitis that I just don’t like how it smells. If the app takes longer than thewaitduration to boot for some reason then we’re back where we started. I feel like typing and clearing is at least interaction with the app so maybe cypress will pick up a different error somehow. Probably not though, this is just conjecture. I just don’t like using lots of waits.edit: Oh I get you you mean my typing speed. I actually duplicate the whole line twice and change the middle one to a
clear()so it’s pretty fast I guess. I’m not that fast a typer.Here is another workaround which worked for me. I have used tab along with focus and clear to move between input fields.
look for cypress-plugin-tab here
This is not flaky cypress 4.11.0 has the same issue
type('AID')
type('First name')
type('Last name')
etc and the first letters are skipping
@Mattinn this is a common question and a problem. See my two blog posts about it