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

cy.clear({ force: true }) only deletes first character of hidden input in 3.5.0 #5835

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

Comments

@mpetrovich
Copy link

@mpetrovich mpetrovich commented Nov 30, 2019

Current behavior:

.clear({ force: true }) only deletes the first character of a hidden input's initial value.

Desired behavior:

.clear({ force: true }) should delete all characters of a hidden input's initial value.

Steps to reproduce: (app code and test code)

https://github.com/mpetrovich/cypress-test-tiny (compare)

Given:

<input type="text" value="initial value" style="visibility: hidden">

This assertion fails:

cy.get('input').clear({ force: true }).should('have.value', '')

With error:

CypressError: Timed out retrying: expected '<input>' to have value '', but the value was 'nitial value'

Note: Issue persists when input is hidden with style="display: none" as well.

Versions

These versions have been confirmed to be affected:
v3.7.0
v3.6.1
v3.6.0
v3.5.0

These versions have been confirmed to NOT be affected:
v3.4.1
v3.4.0
v3.3.2

@mpetrovich mpetrovich changed the title .clear({ force: true }) only deletes first character of hidden input cy.clear({ force: true }) only deletes first character of hidden input Nov 30, 2019
@jennifer-shehane jennifer-shehane changed the title cy.clear({ force: true }) only deletes first character of hidden input cy.clear({ force: true }) only deletes first character of hidden input in 3.5.0 Dec 3, 2019
@jennifer-shehane

This comment has been minimized.

Copy link
Member

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

I've confirmed this is an issue introduced in 3.5.0. @Bkucera

index.html

<!DOCTYPE html>
<html>
<body>
  <input type="text" value="initial value" style="visibility: hidden">
</body>
</html>

spec.js

it('clear value of hidden input', () => {
  cy.visit('index.html')
  cy.get('input').clear({ force: true }).should('have.value', '')
})

3.4.1

Screen Shot 2019-12-03 at 2 55 25 PM

3.5.0

Screen Shot 2019-12-03 at 2 53 49 PM

@cypress-bot

This comment has been minimized.

Copy link

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

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

@mpetrovich

This comment has been minimized.

Copy link
Author

@mpetrovich mpetrovich commented Dec 4, 2019

Thanks for the quick turnaround!

@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
3 participants
You can’t perform that action at this time.