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

Typing uses different Events to actual human typing #7653

Closed
philjones88 opened this issue Jun 10, 2020 · 2 comments
Closed

Typing uses different Events to actual human typing #7653

philjones88 opened this issue Jun 10, 2020 · 2 comments

Comments

@philjones88
Copy link

philjones88 commented Jun 10, 2020

Current behavior:

Typing in cypress seems to issue different events to a human doing the same key sequences, see below:

image

On the left is Chrome automated, on the right Chrome manual.

I'm trying to replicate, in cypress, a bug a customer hit. Where they type and our web app (Angular) looses characters due to a binding mistake.

The cypress spec always passes but when a human does manual testing the bug becomes very obvious.

In the screenshot cypress typed el and got el in the field but if the human types el they end up with e.

I've tried various options on type such as:

  • Making sure to do .focus() before .type()
  • Typing fast, medium, slow, mixed.
  • Multiple cy.type(), chained .type() for individual characters.
  • Forced

The events Angular says happened for the keyup are different...

image

Event in Cypress versus KeyboardEvent in the human interaction.

The only other difference I can see if the composed field being false for cypress.

Desired behavior:

Should match how a human types.

Test code to reproduce

Commercial application unfortunatly.

  it.only('should work', () => {
    cy.get('#search')
      .focus()
      .clear()
      .type('e', { delay: 350 }).should('have.value', 'e')
      .type('l', { delay: 550 }).should('have.value', 'el')
      .type('l', { delay: 150 }).should('have.value', 'ell')
      .type('a', { delay: 450 }).should('have.value', 'ella')
      .type('.', { delay: 350 }).should('have.value', 'ella.');
  })

Versions

Cypress 4.8.0
MacOS
Chrome 83
Node 12 LTS
Angular 9.1.x

@philjones88
Copy link
Author

Think it might be related to:

#311

and specifically this issue and comment:

#5650 (comment)

This is rather annoying...

@jennifer-shehane
Copy link
Member

@philjones88 Yes, basically as you found, this is related to our not issuing Native Events, but rather simulating events.

Closing as duplicate of #311

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants