Skip to content

Typings for cy.contains do not support includeShadowDom #17066

Closed
FuhuXia/inventory-app
#3
@ashblox

Description

@ashblox

Current behavior

I'm using Cypress with Typescript and while I can pass options to cy.get() with includeShadowDom: true, I cannot do so with cy.contains(). It appears the typings differ, where cy.get() allows a Partial<Cypress.Shadow> and cy.contains() does not. I have tried this using both Cypress v 6.8.0 and v 7.3.0.

Screenshot 1 (Works with cy.get()):

cy-get works

Screenshot 2 (Doesn't work with cy.contains()):

cy-contain doesnt work

Desired behavior

I should be able to pass the includeShadowDom argument to cy.contains(). My current workaround is to enable includeShadowDom in the cypress.json but of course that enables it globally.

Test code to reproduce

Example repo: https://github.com/ashblox/cypress-issue

This is the file with the issue.

Versions

Confirmed this does not work with 7.5.0 either.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions