Cannot read properties of null (reading 'append') - @cypress/vue
See original GitHub issueCurrent behavior
I’ve been unable to run any cypress tests that leverage @cypress/vue package. It always fails with Cannot read properties of null (reading 'append')
Related code in node_modules/@cypress/vue/dist/cypress-vue.esm-bundler.js
var document = cy.state('document');
var el = document.getElementById(ROOT_ID);
var componentNode = document.createElement('div');
el.append(componentNode);
Via: yarn cypress open
Via: yarn cypress run
1) HelloWorld
renders a message:
TypeError: Cannot read properties of null (reading 'append')
at Context.eval (http://localhost:58195/__cypress/tests?p=cypress/integration/hello-world.spec.js:382:8)
I’ve been banging my head against this error message for days. Am I missing something obvious? Any help is greatly appreciated.
Sample repo provided
Desired behavior
Be able to successfully run the Hellow World cypress test
Test code to reproduce
https://github.com/mmaietta/cypress-test-tiny
yarn install
yarn cypress open
Cypress Version
9.5.2
Other
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Uncaught TypeError: Cannot read property 'appendChild' of null
The "Cannot read property 'appendChild' of null" error occurs for 2 reasons: Calling the appendChild() method on a DOM element that doesn't ...
Read more >TypeError: Cannot read property 'appendChild' of Null in JS
The "Cannot read property 'appendChild' of null" error occurs when trying to call the appendChild method on a DOM element that doesn't exist....
Read more >Uncaught TypeError: Cannot read property of null - iDiallo
This error occurs when you read a property or call a method on a null object . That's because the DOM API returns...
Read more >cannot read properties of null (reading 'current') - You.com
I've been unable to run any cypress tests that leverage @cypress/vue package. It always fails with Cannot read properties of null (reading 'append')...
Read more >Cannot read properties of undefined' - JavaScript Debugging
How To Fix 'Uncaught TypeError: Cannot read properties of ... "Uncaught Typerror: Cannot set properties of null ( reading 'innerHTML')".
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Confirmed this is fixed by modifying the auto-generated
component-index..html
, line 10 from:<div data-cy-root></div>
to<div data-cy-root id="__cy_root"></div>
For Vue 2 users: this is solved by using @cypress/vue2