What I am trying to do:
I have a custom command, inside which i am declaring few variables(boolean). I am setting the values for the variables as per my code. I wanna use the variables to assert in another part of the test. Example. Custom Command:
Cypress.Commands.add('XYZ', () => {
var a,b,c,d
a=b=c=d=false
if(some condition){
//some cy commands
a=c=true
}
return a,b,c,d
})
Spec file:
it("A test", function () {
cy.XYZ()
if(a){
//do something
}
else if(b){
//do something
}
...
})
Cypress suggests to wrap variables and assign an alias to re use it in the test. But that looks good for a single variable. I wanna work with more than 10 variables in the custom command, and then use the variables in the test later down.
Is there any other solution to return multiple variables from a custom command and use them in the test?