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.type() on a DIV #1686

Closed
gcjbr opened this issue May 8, 2018 · 2 comments · Fixed by #2016
Closed

cy.type() on a DIV #1686

gcjbr opened this issue May 8, 2018 · 2 comments · Fixed by #2016
Assignees
Milestone

Comments

@gcjbr
Copy link

gcjbr commented May 8, 2018

I have an app which is a text editor and the DOM is formatted using regular elements (h1, div, span) and they become actionable when clicked and the user can type as in a regular textarea or input . Cypress won't let me type on it, though.

I tried using force, with no success.

Is there any way to make it work or I'm stuck with Dusk? :(

EDIT:

I tried the following solution but it only types the first character on the desired field and the rest switches to another one.

Here's my DOM and how it should work
https://imgur.com/fCjZLRK

Here's how it's happening with Cypress
https://imgur.com/Oynzlrd

And here's my current code

cy.get('.editor-title').find('[contenteditable]').click().type('An unexpected party', {
      force: true,
    });
@jennifer-shehane
Copy link
Member

Cypress allows typing into elements with a contenteditable attribute - as outlined here and it does look like it is typing at least one character without erroring.

I suspect that the library you are using is listening to or triggering events that Cypress is not handling correctly. Could you provide a reproducible example?

Also, as workarounds, try playing with the delay option of the type or using trigger to set the value directly in the div.

@jennifer-shehane jennifer-shehane added the stage: needs information Not enough info to reproduce the issue label May 8, 2018
@kuceb kuceb added this to the 3.0.3 milestone Jul 16, 2018
@kuceb kuceb removed the stage: needs information Not enough info to reproduce the issue label Jul 16, 2018
@kuceb
Copy link
Contributor

kuceb commented Jul 16, 2018

This should be fixed after PR #2016 is merged

@kuceb kuceb self-assigned this Jul 16, 2018
brian-mann pushed a commit that referenced this issue Jul 23, 2018
this grew to a large PR fixing many cy.type issues.

fix #365
fix #420
fix #586 
fix #593 
fix #596 
fix #610 
fix #651
fix #940
fix #1002 
fix #1108
fix #1171
fix #1209 
fix #1234 
fix #1366
fix #1381 
fix #1684 
fix #1686
fix #1926 
fix #2056
fix #2096 
fix #2110 
fix #2173
fix #2187
@jennifer-shehane jennifer-shehane added stage: pending release and removed stage: needs review The PR code is done & tested, needs review stage: needs investigating Someone from Cypress needs to look at this stage: in progress labels Jul 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants