1
votes

I need suggestion on cypress framework I am creating cypress automation for web application , this application has multiple modules/components , mostly dependent to each other. Preparing, overall E2E test scenario , where customs commands are called in workflow based on dependencies. But I also have plan to component wise tests, which should be standalone & run successfully without any dependencies. Q. I have 2 components C1 and C2. Custom command for C2 uses element in C1 as assertion ; which works fine for E2E. Cypress.Commands.add(‘add’, {(arg1,arg2)} Need an idea how can I use same command for C2 as standalone. I was think of command overloading , may be like adding new parameter in command

Cypress.Commands.add(‘add’, {(arg1,arg2,arg3)}
If(arg3)
{
//donot use component 1 assertion #use something else without dependency
}
else
{
Use original command 
}

Will this work , is this similar to Parent.Child command? If yes can you provide me good example of how to use parent/child commands

Q2. Is there way to have parameters in test spec file, so tat I can pass argument to command

1

1 Answers