Nightwatch multiple mockNetworkResponse methods are not working as expected

27 Views Asked by At

In nightwatch I am using browser. mocknetworkresponse command but it is not intercepting multiple network responses.

For example I have an endpoint http://localhost:3000/user/{userid}

So when testing for one user ID say 0000001 I set up mocknetworkresponse for this call http://localhost:3000/user/0000001 and return a mock response and it works as well in an it block

But the moment when I setup another mocknetworkresponse for the user 0000002 in another it() block, the mocknetworkresponse doesn't seem to respect this mock and tends to call the original API instead which I don't want.

Is it a real issue in nightwatch or am i missing anything ?

I am using nightwatch latest package

I tried making the mockNetworkResponse call on before Each and before methods but it didn't work at all.

0

There are 0 best solutions below