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

Cannot type into field #1528

Closed
hypeofpipe opened this issue Apr 3, 2018 · 7 comments
Closed

Cannot type into field #1528

hypeofpipe opened this issue Apr 3, 2018 · 7 comments

Comments

@hypeofpipe
Copy link

hypeofpipe commented Apr 3, 2018

Operating System: Solus 3.999 shannon
Cypress Version: 2.1.0
Browser Version: Electron 59

Is this a Feature or Bug?
This is a bug.

Current behavior:

I have an input field:

I get the error:

CypressError: cy.type() can only be called on textarea or :text. Your subject is a:

Desired behavior:

This is an input element, so I would expect the input to be entered.

How to reproduce:
Create an input, and try type().

Test code:

    cy.get(selector)
        .click()

    cy.get(selector)
        .type(02011999 + '{enter}')
@jennifer-shehane
Copy link
Member

Can you paste the HTML code of the input you're trying to type into?

@jennifer-shehane jennifer-shehane added the stage: needs information Not enough info to reproduce the issue label Apr 3, 2018
@hypeofpipe
Copy link
Author

hypeofpipe commented Apr 4, 2018

@jennifer-shehane oh yeah, I've completely forgotten it :)

<div class="Checkout__fieldRow___vzW2S">
   <div class="Checkout__labelCol___2Y_f1"><label for="birth_date">Date of birth</label></div>
   <div class="Checkout__fieldCol___1zvrt">
      <div class="FieldGroup__DatePickerGroup___3BZyo form-group"><input name="passengers[0].birth_date" class="FieldGroup__customFieldSm___12eZY" placeholder="DD-MM-YYYY" value=""><label for="passengers[0].birth_date" class="FieldGroup__placeholder___3SZMc">DD-MM-YYYY</label></div>
   </div>
</div>

@jennifer-shehane
Copy link
Member

jennifer-shehane commented Apr 4, 2018

Yeah, so I believe that this error is displaying because you haven't defined a type attribute on your input.

Reading the HTML spec, they suggest that if no type exists, that it should be treated as type='text'. We should just be treating any input without a type as text automatically. - https://html.spec.whatwg.org/multipage/input.html#the-input-element

The missing value default and the invalid value default are the Text state.

Workaround: Add a type attribute to your input.

Permanent Fix: Cypress should treat any input with no type attribute defined as type='text'.

@jennifer-shehane jennifer-shehane added pkg/driver This is due to an issue in the packages/driver directory good first issue Good for newcomers stage: ready for work The issue is reproducible and in scope and removed stage: needs information Not enough info to reproduce the issue labels Apr 4, 2018
@rajdhandus
Copy link

Hello.. can I please work on this issue?

@jennifer-shehane
Copy link
Member

Ok, so I probably should have tested my theory first before rambling off a solution. The missing type attribute does not appear to be the issue here, as I can type into an input without a type attribute fine in Cypress.

@hypeofpipe Could you tell me what selector is it you were using in your original code? I realize that you didn't include everything needed to replicate.

@jennifer-shehane jennifer-shehane added stage: needs information Not enough info to reproduce the issue and removed good first issue Good for newcomers pkg/driver This is due to an issue in the packages/driver directory stage: ready for work The issue is reproducible and in scope labels Apr 9, 2018
@hypeofpipe
Copy link
Author

@jennifer-shehane It is fixed by adding a type to it. Nevertheless, I think Cypress should give the opportunity to type in those fields (with a null type).

@kuceb
Copy link
Contributor

kuceb commented Dec 18, 2018

This should be fixed as of 3.0.3 along with #1241, as we read of the type property instead of the attribute

@kuceb kuceb closed this as completed Dec 18, 2018
@kuceb kuceb removed the stage: needs information Not enough info to reproduce the issue label Dec 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants