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

3.5.0-3.6.1 regression - cy.type() may skip a character on a autofocussing textbox #5703

Closed
lukeapage opened this issue Nov 14, 2019 · 4 comments · Fixed by #5809 or #5854 · May be fixed by ngChile/ngx-devkit-cypress-builder#20 or neo355/grafana#2

Comments

@lukeapage
Copy link

@lukeapage lukeapage commented Nov 14, 2019

Current behavior:

When typing '10' into a textbox with text selected and that text is '1', the textbox doesn't lose the selection upon typing the first '1' so when the '0' is typed the textbox ends up with '0' but if a user types it, we get '10'

Steps to reproduce: (app code and test code)

cypress-io/cypress-test-tiny#54

Versions

3.6.1, windows

@Bkucera I guess this is a regression from your type() changes.

@jennifer-shehane

This comment has been minimized.

Copy link
Member

@jennifer-shehane jennifer-shehane commented Nov 27, 2019

I have verified this fails in an unexpected ways in both 3.5.0 and 3.6.1 (in different ways). I also verified this is not fixed in 3.7.0 pre-release.

index.html

<html>
<body>
  <input type="text" value="1" />
</body>
<script>
  const el = document.getElementsByTagName('input')[0];
  el.addEventListener('focus', (ev) => ev.target.select());
</script>
</html>

spec.js

it('works', () => {
  cy.visit(`index.html`);
  cy.get('input').type('10');
  cy.get('input').should('have.value', '10');
})

3.4.1

Types in 10 as expected

3.5.0

Types in 110

3.6.1

Types in 1 which is then replaced with 0.

@jennifer-shehane

This comment has been minimized.

Copy link
Member

@jennifer-shehane jennifer-shehane commented Dec 3, 2019

There is a PR open to fix this here: #5854 Our initial attempt at a fix broke some other behavior, so this is the latest.

@cypress-bot

This comment has been minimized.

Copy link

@cypress-bot cypress-bot bot commented Dec 3, 2019

The code for this is done in cypress-io/cypress#5854, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot

This comment has been minimized.

Copy link

@cypress-bot cypress-bot bot commented Dec 12, 2019

Released in 3.8.0.

@cypress-io cypress-io locked as resolved and limited conversation to collaborators Dec 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants
You can’t perform that action at this time.