Im using
.waitForResource('/auth')
.then( .... )
.waitForResource('/auth')
.then( .... )
To wait for an ajax call to /auth
to complete before then validating the UI response.
However, the subsequent call to /auth
appear to continue immediately as it has already loaded that resource.
Is there some way to tell casperJS to wait again, or clear that resource so it doesn't think it has loaded for the second request?
Yes, that's exactly what you can do. You can tell CasperJS to clear all the resources that it has previously seen by re-initializing the resources array:
If you don't want to be that destructive, you can mimic the how the
casper.resourceExists()
function finds resources and remove only those:And you would use it like this: