Skip to content Skip to sidebar Skip to footer

How To Introduce Delay Between Tests In Protractor

I am exploring protractor tool with cucumber and test is executing super fast.. in order to know if really elements are getting clicked or not, I am using sleep() method but failin

Solution 1:

I'm not sure I understand the question but if you just want to see if your "confirmInstructions" is clicked, you should use a debugger and set a breakpoint before the method

Solution 2:

I understood, the best way to wait for web elements in protractor is to use, wait() rather than sleep. However, I was looking either of the way (by using wait / sleep) to slow down the test execution, as it is useful while implementing test scenarios in order to recognize web elements. Finally, following method for now I am using it.. but still if there is a better way to handle please put your comments..

constsleep = (milliseconds) => {
    returnnewPromise(resolve =>setTimeout(resolve, milliseconds));
}

and calling sleep from my function as: await sleep(2000);

For now, I am able to move forward with writing tests.. I am also sure there is a better way in protractor API, yet to find it's implementation.

Post a Comment for "How To Introduce Delay Between Tests In Protractor"