'Cypress get element that a child contains

I'm trying to find in a table my row that cy.contains() a specific text.

I cannot do:

cy.get("tr").contains("specific text")

That will return my span element containing the text

I cannot do

cy.get("tr").contains("specific text").parent()

beacause the parent of the span my not be my

I cannot do

cy.get("tr").contains("specific text").parentUnitl("tr")

That will not return the element

I probably could do

cy.get("tr").contains("specific text").parentUnitl("tr").parent()

But I think that's becoming really complex for such a simple thing.

Am I missing something?

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source