I need a way to skip a test block in Cypress based on the evaluation of IF/ELSE condition. Below is the code that I have
it("Website testing",function(){
cy.request({
method: 'GET',
url: "http://127.0.0.1:5000/isIPv6",
timeout:300000
}).then(network_result => {
cy.log(network_result.body)
if(network_result.body.isIPv6 == false)
{
statements
}
else
{
cy.log("IPv6 device, stopping the test")
this.skip()
}
})
})
the above code snippet dosent work because this.skip()
is a synchronous statement, and cypress gives error for it.
I have also tried it.skip()
, throw()
but its not useful in this case.
I need a method wherein I could skip the test execution/block when execution control comes to else block, and send the test to skipped/pending state.