Closed lucamjj closed 8 years ago
Could it be that you need to always include this piece of code at the end of any test ? casper.run(function() { test.done(); }); and if casper doesn't find it, can create problem ?
Sounds like this is a core casperjs problem or flakeyness in your tests.
I tried to run the tests only with casperjs and the problem seems not to occur.
It is totally random.
This is not an issue. Read my post here on stackoverflow for more info: http://stackoverflow.com/questions/39571526/mocha-casperjs-sometimes-click-waitforxxx-dont-work-immediately-with-xpath/39622342#39622342
I have been using mocha-casperjs for a while now and I noticed that for some reason, sometimes code like:
casper.click(x("//a[normalize-space(text())='login']")); or
casper.waitForSelector(x("//a[normalize-space(text())='login']") don't work immediately, but it fails saying: xpath selector: //a[normalize-space(text())='login']" still did not exist 5000ms
After some attempts, it just works, but than it doesn't anymore again.
It is not an asynchronous problem, because I use code like:
if(casper.exists(x("//a[normalize-space(text())='login']"))){ console.log('I am here'); } to test its presence and this always returns "I am here".
Any idea ?