Open workflow opened 8 years ago
The way I intended to do was to create a browser proxy, using node-http-proxy and then set the Webdriver remote capabilities to use the proxy.
With access to both the request/response on the server, you can chose to either let the request go through, or you can intercept it and redirect it to to a stub of your choice.
Neat eh?
I would love a PR that implements this ;)
The other alternative is to use the host
file on your OS and take over the domain you want to test. It's a bit more clunky but it's a useful technique if you have control over a dedicated e2e test environment
Neat! I set up a proxy and it seems to be running fine with a couple of limitations (lurking below).
chimp
, right? How do we best wire the two together?https://
calls directly in the DOM. Have a better idea or more experience setting up a proxy? :)sanjo:long-running-child-process
? It seems to work fine without, but maybe I'm missing some edge cases or other benefits.
What is a good general way to stub client side external API calls?
Example:
Client side image upload to a service like Cloudinary or Filepicker.io Using jquery on the client to POST to an external API like
https://api.cloudinary.com/v1_1/FakeKeyToPreventConsoleWarning/auto/upload
How would you stub that? Try to intercept the call (like
http-interceptor
does on the server side) by overloading jQuery.ajax and other potential sources of external api calls? Or prevent the call being made in the first place via some logic in the main app code (problem: cluttering). Or maybe something entirely more ingenious?Thx in advance, would love to have your thoughts on this.