diff --git a/src/utils.js b/src/utils.js index 649e11d..ae8a20f 100644 --- a/src/utils.js +++ b/src/utils.js @@ -6,7 +6,10 @@ function getFirstElement(jqueryOrElement) { } function getContainer(container) { - const subject = cy.state('subject') + // Cypress 10 deprecated cy.state('subject') usage and suggest to use new cy.currentSubject. + // https://docs.cypress.io/guides/references/changelog#10-5-0 + // Below change ensures we do not get spam of warnings and are backward compatible with older cypress versions. + const subject = cy.currentSubject ? cy.currentSubject() : cy.state('subject'); const withinContainer = cy.state('withinSubject') if (!subject && withinContainer) {