[Bug] TypeError: Cannot read property 'shadowRoot' of undefined
pszalanski opened this issue ยท 7 comments
Current behavior:
I am using shadowGet
to find and match the contents of an ion-toast
. If I use something like:
cy.shadowGet('ion-toast')
.shadowFind('div.toast-message')
.shadowContains('Success');
it fails with TypeError: Cannot read property 'shadowRoot' of undefined
.
However, if I insert a .wait(200)
right after the shadowGet
, it works. It seems that the shadowFind
does not wait for the element to be accessible or something.
Desired behavior:
It should work without the wait
workaround.
Versions
Cypress 3.7.0
cypress-shadow-dom 1.2.0
Ionic 4.11.4
Angular 8.1.3
Ubuntu 19.10
Chrome 78
Hi @pszalanski
Have you tried the new API of setting custom delays before it fails? like
cy.shadowGet('ion-toast')
.shadowFind('div.toast-message', { timeout: 3000 })
.shadowContains('Success');
Please let me know whether it works for you.
Sorry, I was out sick and couldn't answer to your suggestion.
So I tried it out and it still gives a Cannot read property 'shadowRoot' of undefined
Do you have anything else I can try?
@pszalanski then I cannot suggest anything without seeing the source code.
Can you please create a sample repo with this setup so we can take a look together?
Thanks!
No problem. I'll create a sample tomorrow.
Okay my minimal example does not produce this error. Give me a couple days to investigate this and I'll get back to you if I find anything useful ๐
@pszalanski - I am using ionic and stencil and just had some PRs merged into this project which should allow shadowFind
, shadowGet
, and shadowContains
to work as expected. The v1.3 release should contain these changes (it was released yesterday). Try upgrading and see if the problem still exists.
Awesome! 1.3.0 fixed the issue. Thank you so much! ๐