how to pass an assertion in if condition using cypress without halting the execution in case of assertion failure

I am trying to pass an assertion to if condition and execute a logic when the condition is met and another logic when condition is failed.

Since the test is failing on failure of assertion i am not able to achieve the desired result.

I tried the following...

if(cy.get("div").length\>0)

{

cy.log("print this")

}

else

{

cy.log("print this")

}

or

if(cy.get("div").should('have.length.greaterThan',0)

{

cy.log("print this")

}

else

{

cy.log("print this")

}


Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation