2021年5月7日星期五

cypress conditional code logic depending on existence of element

I want to perfomr some action depending on the existence of an element. Something like:

cy.get(A).should('not.exist').then(()=>{ //action 1 })  cy.get(A).should('exist').then(()=>{ //action 2 })  

And I need to perform both checks.

Problem is I am using "should" assertion to perform this check. If the element exists then the entire test case fails and I don't even reach to second check for performing action 2.

Is there anything like a soft assert in cypress which lets me just check if element exists or not and does not fails the test case if it doesn't ??

https://stackoverflow.com/questions/67432677/cypress-conditional-code-logic-depending-on-existence-of-element May 07, 2021 at 05:53PM

没有评论:

发表评论