0

I would like to end-to-end test my Meteor/React app in multiple browsers.

Karma is great for automating tests in multiple browsers, but I don't see any config options to make it load the page to test from my own server, only the option to specify which JS files contain tests and support code.

This is obviously because Karma injects its own test harness HTML and JS. But to end-to-end test my page, I would need it to load the page from Meteor instead of Karma's own embedded server, since Meteor injects a lot of its own JS dependencies into the page.

Bundling the tests into the code served up by Meteor is easy. The problem is how to tell Karma to load a specific URL, and to be able to put script tags or whatever to load and run the Karma test harness into my own HTML code.

I believe it may have been possible with the Velocity test runner for Meteor, but I found it horribly slow and wanted to implement end-to-end testing without it.

Does anyone know if this is possible with Karma or another framework?

Andy
  • 7,885
  • 5
  • 55
  • 61
  • If nothing else, I suppose I can create an iframe to load my page in my Karma test script... – Andy Nov 29 '15 at 22:54
  • 1
    You could use some selenium/webdriver framework to script the browser(s) to browser your application from your server and test it (injecting your test JS into the page). HEre's some frameworks: [1] : http://webdriver.io/ [2]: http://admc.io/wd/ [3]: http://nightwatchjs.org/ [4]: https://theintern.github.io/ – MarcoL Nov 30 '15 at 10:54
  • That's a thought; with that would I have access to my application's own internal state though? (rather than only being able to test by reading what shows in the DOM?) – Andy Nov 30 '15 at 15:15
  • 1
    With some of those tools you can interact with the app state. I have a direct experience only with `The Intern` and `Nightwatch`: with the former you have a more fine grained control but both let you inject JS scripts in the page (as you're typing in the JS console of the browser) to perform some action/test that can return a value you can use in your expectation code. – MarcoL Nov 30 '15 at 15:22
  • @MarcoL cool, I'll look into them! – Andy Nov 30 '15 at 17:09

0 Answers0