opitzconsulting / uitest.js

uitest.js is able to load a webpage into a frame, instrument that page and the javascript in that page (e.g. add additional scripts at the end of the document, ...) and execute actions on that page.
MIT License
67 stars 8 forks source link

Create general proxy for testing cross domain and without the <script>parent.uitest.instrument</script> #6

Open tbosch opened 11 years ago

tbosch commented 11 years ago

Here is a first working version: https://github.com/tigbro/uitest-proxy

Needs tests, project build using grunt, standalone start command as well as library export to use it as a connect middleware.

jperl commented 11 years ago

@tigbro I am trying to test a chrome extension, so changing it's url may not work with this method. That is why I have started to put a chrome extension together to do this. Can you tell me why the iframe must be on the same domain?

jperl commented 11 years ago

Answer to my question: you cannot access the parent window.variables across domains. Looks like #22 might remove that constraint?

tbosch commented 11 years ago

No, sorry, #22 won't allow to test cross origin. This is the so called "same origin policy", see here: http://en.wikipedia.org/wiki/Same_origin_policy

However, for building chrome extensions, your browser will be chrome, so you can use the following feature of chrome during testing: start it with the flag --disable-web-security and the same origin policy is deactivated.

And yes, you are right: #22 will remove the need of parent.uitest.instrument.

Tobias