Closed
Description
Current behavior:
Querying shadow dom in a cy.within
callback function causes the following error:
root.getRootNode is not a function
Desired behavior:
Querying the shadow dom should work inside the cy.within
callback function.
Test code to reproduce
cypress.json
{
"experimentalShadowDomSupport": true
}
cypress/fixures/shadow-dom.html
<html>
<body>
<div id="outer">
<div id="host"></div>
</div>
<script>
document
.getElementById('host')
.attachShadow({ mode: 'open' })
.innerHTML = '<div class="in-shadow-dom">In Shadow DOM</div>'
</script>
</body>
</html>
spec.js
it('fails querying shadow dom in cy.within', () => {
cy.visit('/cypress/fixures/shadow-dom.html')
cy.get('#outer').within(() => {
cy.get('.in-shadow-dom', { includeShadowDom: true })
})
})
Versions
Cypress 4.8.0+
Metadata
Metadata
Assignees
Labels
No labels
Activity
cypress-bot commentedon Sep 4, 2020
The code for this is done in cypress-io/cypress#8505, but has yet to be released.
We'll update this issue and reference the changelog when it's released.
cypress-bot commentedon Sep 15, 2020
Released in
5.2.0
.This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v5.2.0, please open a new issue.