How to access shadow DOM in Cypress?

Shadow DOM allows hidden DOM trees to be attached to elements in the regular DOM tree. Shadow DOM is not a new thing by any means — browsers have used it for a long time to encapsulate the inner structure of an element. Use shadow() function to handle shadow dom: