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

Question about Reloaded function & Plunk fix #24

Open ndegroot opened 11 years ago

ndegroot commented 11 years ago

I tried the plunk example from the readme, but couldn't get it to work in Chrome. It refused to load the uitest.js from the raw.github location, because of a missing MIME extention. This is easy to fix, for now I just made uittest a Plunk-local file using cut and paste. Maybe the uitest.js can be hosted elsewhere and the location reported to Plunk as an external library?

But now my question: I can't figure out what the pattern is how to test following a form submit or link to a new page.

In the Plunk http://plnkr.co/edit/2a7gnhINPyzTy16evmYL?p=preview
I created a button with a onClick event in app.html. While running the test the appuiSpec.js code clicks the button and page2 gets shown. So far so good. The code now expects a 'reloaded' function which I provided. But I think I'm missing something, I get

Error: The test page has not yet loaded. Please call ready first

I tried to insert uit.ready() at various levels, but that's not it. Can you point me in the right direction? If you want I can document this in your Wiki, when I got it working.

Thanks in advance!

tbosch commented 11 years ago

Hi, yes, this now a bug due to chrome changing is't security standards. The solution is to use the host rawgithub instead of raw.github. This will serve the js files with the correct mime type.

About the actual issue: This should work just like you did it. I will look into it...

Thanks! Tobias