2021年5月7日星期五

Validating the state of the slide toggle using Cypress

I'm just new to Cypress and I want to validate if the slide toggle button is ON or OFF. I have this piece of code that checks whether it is ON or OFF but I have no idea how to put it in an If-Else condition.

cy.get('#slide-toggle-1')     .find('input')     .filter('#slide-toggle-1')     .should('have.attr', 'aria-checked', 'true')    
//What I want to do  If(<the code above is true>) {   cy.get('#dropdown').select('value1')  }  else {   cy.get('#button').click()  }  

All comments and suggestions are well appreciated. Thank you.

https://stackoverflow.com/questions/67439349/validating-the-state-of-the-slide-toggle-using-cypress May 08, 2021 at 01:28AM

没有评论:

发表评论