-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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 in draftjs-based editors #596
Comments
We'll take a look but we have a ton of |
Can confirm, is a bug, still happens in |
looks like issue still occurs |
I can type in draft.js component, but no events are triggered, so the text is not being persisten by the app. Tried also triggering manually the events, no luck |
This is still happening in cypress 1.4.1. This is the major blocker for us adopting cypress, as our app relies heavily on draft-js |
Same here, it's happening for us as well, and also a major blocker for using Cypress unfortunately. I'd love to be able to help out somehow here, is there anything we can do to help? Open to anything really, we currently just need a way to input simple text and a few key strokes like enter etc. |
Fixing this would likely entail knowing the implementation of draft.js, what events they are expecting, seeing what and when events are triggered natively when typing into draft.js and comparing that to our type implementation to see what events we are not triggering or not triggering correctly. Draft.js code: https://github.com/facebook/draft-js Our Also, native events will be helpful when that is out: #311 |
In case this information is of use to you: webdriver/selenium-based testing frameworks do not have this problem. webdriverio's |
I may not understand the
|
@WickyNilliams No, that code basically means that Cypress does not emit a |
I managed to get typing working by dropping down to using DOM directly. Our export const typeIntoDraftEditor = (selector, text) => {
cy.get(selector).then(input => {
var textarea = input.get(0);
textarea.dispatchEvent(new Event("focus"));
var textEvent = document.createEvent("TextEvent");
textEvent.initTextEvent("textInput", true, true, null, text);
textarea.dispatchEvent(textEvent);
textarea.dispatchEvent(new Event("blur"));
});
}; |
@WickyNilliams thanks for the function! Any chance you could provide an example call please, I'm struggling to determine what selector to use. Thanks! |
@dolyst sure! Draft's So, assuming an editor like: <Editor webDriverTestID="foo" /> Then the following would work with my function above: typeIntoDraftEditor(`[data-testid="foo"]`, "hello world") Hope that helps :) |
@WickyNilliams. Thanks very much! |
@jennifer-shehane any progress? |
No, we are not currently working on this. We welcome pull requests though, even if they are 'work in progress'! |
Having the same issue. Many people are complaining about it. Is there any fix for that? |
This issue will be fixed in upcoming patch release, along with many other cy.type improvements mentioned in #1241 |
Having same issue or at least a similar issue as to others here. |
Changes are in PR #2016 , with added support for cy.visit('https://draftjs.org/')
cy.get('[contenteditable]').click()
cy.contains('.RichEditor-styleButton', 'Monospace').click()
cy.get('[contenteditable]')
.type(`
foo
bar
baz{leftarrow}{leftarrow}{uparrow}11{uparrow}22{downarrow}{downarrow}33`
.replace(/\n/g, '{enter}')
)
.should('have.prop', 'innerText', '\nfoo22\nb11ar\nbaz33\n') |
Hallo! I know this is closed, but I wanted to ask the draft users on this thread if they
|
@brettimus on quirk is that typing {enter} does not trigger in input event. That's getting fixed in #311 |
Current behavior:
Desired behavior:
How to reproduce:
https://github.com/dziamid/cypress-draftjs
Test code:
Ubuntu 16.04
Cypress CLI: 0.13.1
Cypress App: 0.19.4
Chrome 59
Electron 53
The text was updated successfully, but these errors were encountered: