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 qsays/grafana#1
Assignees
Labels
topic: cy.type ⌨️ type: regression A bug that didn't appear until a specific Cy version release v3.5.0 🐛 Issue present since 3.5.0

Comments

@mpetrovich
Copy link

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
Copy link
Member

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

@jennifer-shehane jennifer-shehane added type: regression A bug that didn't appear until a specific Cy version release topic: cy.type ⌨️ labels Dec 3, 2019
@cypress-bot cypress-bot bot added the stage: needs investigating Someone from Cypress needs to look at this label Dec 3, 2019
@cypress-bot cypress-bot bot added stage: work in progress stage: needs review The PR code is done & tested, needs review and removed stage: needs investigating Someone from Cypress needs to look at this stage: work in progress labels Dec 3, 2019
@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Dec 4, 2019
@cypress-bot
Copy link
Contributor

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
Copy link
Author

Thanks for the quick turnaround!

@jennifer-shehane jennifer-shehane added the v3.5.0 🐛 Issue present since 3.5.0 label Dec 10, 2019
@cypress-bot
Copy link
Contributor

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.
Labels
topic: cy.type ⌨️ type: regression A bug that didn't appear until a specific Cy version release v3.5.0 🐛 Issue present since 3.5.0
Projects
None yet
3 participants