mardi 18 février 2020

In Cypress, how do I check if a button has an attribute or not?

I want to put an if condition if an attribute exist on a button or else do some other things. How can I do it in Cypress? I have done this till now but not working... '''

if(cy.get('button[type="button"]').should('have.attr','disabled')==true){
       doTaskA() 
   }else{
        doTaskB()
    } 

''' This fails the whole test and not just the condition.

Aucun commentaire:

Enregistrer un commentaire