Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using qunit with web app in iframe

I'm attempting to use qUnit to perform some unit testing that requires the screens generated by my web app to run. My idea is to put my application into an iframe embedded in my qUnit test page. However this does not seem to work (in chrome) I don't seem to be able to access the web app's iframe. If I do this in chrome's console I get undefined:

frames['myApp'].document

I think this is to do with some kind of cross domain scripting security but, both my web app and my test page are being served from localhost so I don't see why this is occurring, also I have started Chrome with the --disable-web-security parameter but this has not fixed.

Is there a better way to do unit testing that requires output from my application?

like image 809
Jack Allan Avatar asked Nov 14 '22 03:11

Jack Allan


1 Answers

You can try publish these tests on localhost by any simple http server, for example if you have a node you can use https://github.com/nodeapps/http-server.

I have a similar situation tests are running in iframe and this work without problems.

like image 130
Maciek Urbanski Avatar answered Dec 15 '22 06:12

Maciek Urbanski