Current behavior:
When trying to type inside of an iframe where the target element is either the body element with contenteditable=true or a child of the body, then an exception is throw from Cypress and the command fails. This worked successfully in 3.4.1, but is now failing in 3.7.0.
We use the Froala wysiwyg editor library v2.9 which creates the editor as an iframe with the body element set with contenteditable=true. So we can no longer run e2e tests which type text into the editor with Cypress 3.7.0.
Desired behavior:
Cypress successfully types into the specified element.
Steps to reproduce: (app code and test code)
An example of how to reproduce the error is by running the command,
cy.get('iframe').then(($iframe) => {
const $body = $iframe.contents().find('body');
cy.wrap($body).find('p').type('test');
});
With an iframe that contains,
<body contenteditable="true">
...
</body>
This produces the following exception.
TypeError: Cannot read property 'body' of null
at getHostContenteditable (http://localhost:57715/__cypress/runner/cypress_runner.js:107362:29)
at _getSelectionBoundsFromContentEditable (http://localhost:57715/__cypress/runner/cypress_runner.js:107280:29)
at Module.getSelectionBounds (http://localhost:57715/__cypress/runner/cypress_runner.js:107602:14)
at shouldUpdateValue (http://localhost:57715/__cypress/runner/cypress_runner.js:94737:81)
at http://localhost:57715/__cypress/runner/cypress_runner.js:95442:14
at Keyboard.performSimulatedDefault (http://localhost:57715/__cypress/runner/cypress_runner.js:95481:11)
at Keyboard.simulatedKeydown (http://localhost:57715/__cypress/runner/cypress_runner.js:95388:25)
at Keyboard.typeSimulatedKey (http://localhost:57715/__cypress/runner/cypress_runner.js:95411:12)
at http://localhost:57715/__cypress/runner/cypress_runner.js:95159:17
From previous event:
at http://localhost:57715/__cypress/runner/cypress_runner.js:95169:70
From previous event:
at Keyboard.type (http://localhost:57715/__cypress/runner/cypress_runner.js:95168:62)
at type (http://localhost:57715/__cypress/runner/cypress_runner.js:87991:23)
at onReady (http://localhost:57715/__cypress/runner/cypress_runner.js:88133:20)
at runAllChecks (http://localhost:57715/__cypress/runner/cypress_runner.js:85227:14)
at retryActionability (http://localhost:57715/__cypress/runner/cypress_runner.js:85235:16)
at http://localhost:57715/__cypress/runner/cypress_runner.js:85241:7
From previous event:
at Object.verify (http://localhost:57715/__cypress/runner/cypress_runner.js:85178:21)
at handleFocused (http://localhost:57715/__cypress/runner/cypress_runner.js:88124:29)
at Context.type (http://localhost:57715/__cypress/runner/cypress_runner.js:88179:12)
at Context.<anonymous> (http://localhost:57715/__cypress/runner/cypress_runner.js:100860:21)
at http://localhost:57715/__cypress/runner/cypress_runner.js:100381:33
From previous event:
at runCommand (http://localhost:57715/__cypress/runner/cypress_runner.js:100363:14)
at next (http://localhost:57715/__cypress/runner/cypress_runner.js:100498:14)
at http://localhost:57715/__cypress/runner/cypress_runner.js:100521:18
From previous event:
at next (http://localhost:57715/__cypress/runner/cypress_runner.js:100498:34)
From previous event:
at http://localhost:57715/__cypress/runner/cypress_runner.js:100535:37
From previous event:
at run (http://localhost:57715/__cypress/runner/cypress_runner.js:100527:15)
at Object.cy.(anonymous function) [as visit] (http://localhost:57715/__cypress/runner/cypress_runner.js:100894:11)
at Context.runnable.fn (http://localhost:57715/__cypress/runner/cypress_runner.js:101081:20)
at callFn (http://localhost:57715/__cypress/runner/cypress_runner.js:30931:21)
at Test.../driver/node_modules/mocha/lib/runnable.js.Runnable.run (http://localhost:57715/__cypress/runner/cypress_runner.js:30924:7)
at http://localhost:57715/__cypress/runner/cypress_runner.js:104009:28
From previous event:
at Object.onRunnableRun (http://localhost:57715/__cypress/runner/cypress_runner.js:103998:17)
at $Cypress.action (http://localhost:57715/__cypress/runner/cypress_runner.js:97629:30)
at Test.Runnable.run (http://localhost:57715/__cypress/runner/cypress_runner.js:102935:20)
at Runner.../driver/node_modules/mocha/lib/runner.js.Runner.runTest (http://localhost:57715/__cypress/runner/cypress_runner.js:31398:10)
at http://localhost:57715/__cypress/runner/cypress_runner.js:31504:12
at next (http://localhost:57715/__cypress/runner/cypress_runner.js:31318:14)
at http://localhost:57715/__cypress/runner/cypress_runner.js:31328:7
at next (http://localhost:57715/__cypress/runner/cypress_runner.js:31260:14)
at http://localhost:57715/__cypress/runner/cypress_runner.js:31296:5
at timeslice (http://localhost:57715/__cypress/runner/cypress_runner.js:26364:27)
Versions
Cypress 3.7.0, 3.6.0, 3.5.0
Current behavior:
When trying to type inside of an iframe where the target element is either the body element with
contenteditable=trueor a child of the body, then an exception is throw from Cypress and the command fails. This worked successfully in 3.4.1, but is now failing in 3.7.0.We use the Froala wysiwyg editor library v2.9 which creates the editor as an iframe with the body element set with
contenteditable=true. So we can no longer run e2e tests which type text into the editor with Cypress 3.7.0.Desired behavior:
Cypress successfully types into the specified element.
Steps to reproduce: (app code and test code)
An example of how to reproduce the error is by running the command,
With an iframe that contains,
This produces the following exception.
Versions
Cypress 3.7.0, 3.6.0, 3.5.0