-
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
cy.type() cannot type text to CkEditor text area #26155
Comments
I am able to reproduce this:
This is an issue from the CKEditor internals, I have no idea why it's occurring. Either way, I found a few fixes. Firstly, I tracked down this issue: ckeditor/ckeditor5#12802 that has lots of useful information. You can take a look there for more discussion around this issue - it seems to be non Cypress specific, but also an issue in other runners, like Selenium, etc. Here is one way to do it, using it('does work', () => {
cy.visit('https://ckeditor.com/ckeditor-5/demo/feature-rich/')
cy.get('.ck-content').contains('Discover')
cy.get('[data-cke-tooltip-text="Select all (⌘A)"]').click().type('{backspace}')
cy.get('.ck-content[contenteditable=true]').then(el => {
// @ts-ignore
const editor = el[0].ckeditorInstance // If you're using TS, this is ReturnType<typeof InlineEditor['create']>
editor.setData('Typing some stuff')
})
cy.get('.ck-content').invoke('text').should('eql', 'Typing some stuff')
}) Alternatively, if you want to type character by character (no it('does work', () => {
cy.visit('https://ckeditor.com/ckeditor-5/demo/feature-rich/')
cy.get('.ck-content').contains('Discover')
cy.get('[data-cke-tooltip-text="Select all (⌘A)"]').click().realType('{backspace}')
cy.get('.ck-content[contenteditable=true]').realType('Typing some stuff')
cy.get('.ck-content').invoke('text').should('eql', 'Typing some stuff')
}) I updated your test to use the Hopefully this helps. Let me know if you need anything else. |
Thanks @lmiller1990 for the quick response. The It would be most ideal if Cypress |
It sure would be nice to make Seems like
What kind of issues do you encounter? If it's related to RAM usage, you could try |
(uncaught exception)CKEditorError: Cannot read properties of null (reading 'root') how can solve this probleam |
works, thank you |
We have a similar thing where we needed to set some data for testing purposes, here's how we did it.
|
For Drupal 10 Ckeditor 5 we can use the below code cy.window().then(win => {
win.Drupal.CKEditor5Instances.forEach(editor => editor.setData('<p>Test</p>'))
}) |
Current behavior
On Zendesk update, cy.type() command fails to type text to a CKEditor text area.
type.mp4
Desired behavior
cy.type() should be able to type text to the text area, otherwise the test will not be able to create a ticket. Typing a text to the text area is required in order to create a new ticket.
Test code to reproduce
I have created a sample test code to replicate the issue on this repository:
https://github.com/jeanabanto/cypress-zendesk
The relevant test for this issue is https://github.com/jeanabanto/cypress-zendesk/blob/main/cypress/tests/ticket.spec.ts.
Cypress Version
12.8.1
Node version
16.15.0
Operating System
macOS 13.2.1 (22D68)
Debug Logs
No response
Other
Trying to type text to the text area produces an uncaught exception
Was advised on discord to turn off uncaught exceptions, but doing that did not solve the issue, i.e., unable to type anything to the text area.
The text was updated successfully, but these errors were encountered: