bahmutov / cypress-if

Easy conditional if-else logic for your Cypress tests when there is no other way
https://cypress.tips/courses/cypress-plugins
99 stars 12 forks source link

cy.currentSubject is not a function #20

Closed shashank-mhegde closed 2 years ago

shashank-mhegde commented 2 years ago

Getting error cy.currentSubject is not a function Cypress Version: 9.6.0

    cy.get('div[role="dialog"]')
            .if('visible')
            .then(() => {
                cy.log('closing the dialog');
                cy.contains('button', 'Close').click();
            })
            .else()
            .then(() => {
                cy.log('Already closed');
            });

cypress if