cypressshadow-root

Cypress shadow-root inside of shadow-root


How do I find the element that is inside of shadow-root which is inside of other shadow-root? I'm new to this and tried .shadow() function.


Solution

  • If you're using Cypress v10, then the configuration is in the file cypress.config.js and the format for setting global shadow enabling is

    const { defineConfig } = require("cypress");
    
    module.exports = defineConfig({
      e2e: {
        ...
      },
      ...
      includeShadowDom: true
    })
    

    Or use test-specific configuration

    it('tests some shadow dom elements', {includeShadowDom: true}, () => {
      ...
    })