I don't want to test that it has the class like ...should('have.class', "some-class")
I just want know if it does, and if doesn't then perform some action that gives it that class.
Basically, I want to see if the element has Mui-checked
and if it doesn't them programmatically check it.
You can use the hasClass() jquery method for this:
cy.get('selector').then(($ele) => {
if ($ele.hasClass('foo')) {
//Do something when you have the class
} else {
//Do something when you don't have the class
}
})